쉐도잉 연습: Watch this before you boot up another device - 영상으로 영어 말하기 배우기

로딩 중...
1
Ladies and gentlemen, boys and girls, lend me, lend me, lend me your ears.
2
I want to show you this really neat vulnerability in U-Boot that everyone's talking about.
3
Not everyone, but I am.
4
So if you run the script here, QEMU drive, QMU, bada bing, bada boom, you will see the magical values.
5
The 41414141, the 41414141, and the 4242423E.
6
What the hell is even going on?
7
What are we talking about?
8
Guys, we're talking about a vulnerability in U-Boot,
9
the bootloader that allows you to bypass signature verification by exploiting a vulnerability in the bootloader itself.
10
Bugs like this are really, really neat because they actually invalidate an entire trust chain in the way that weird devices like this, like embedded ones and even ones that you sit in your pocket,
11
validate if they use U-Boot.
12
Obviously, this one does not.
13
This one might.
14
Anyway, I'm going to break down the bug, what went wrong, what you can do about it, and then also what the hell all this stuff means.
15
The finding today was found by a company named Binarly.
16
I've done videos on their stuff before.
17
They do a really good job on finding vulnerabilities in like lower level.
18
That's the name of the channel, by the way.
19
Low level.
20
Low level systems like bootloaders or BMC, board management controllers, stuff like that.
21
Again, not an ad for this company, just they do a lot of good work.
22
So the vulnerability today is a stack buffer underflow, kind of hard to say, in uBoot during the FIT image signature verification,
23
specifically in the FDT find regions functions.
24
A lot of words said there.
25
I'm gonna go into what all that means here in a little bit.
26
Okay, so enter uBoot, right?
27
What is uBoot?
28
Well, uBoot, kind of like the name of this folder that I had, I called it Das Boot.
29
uBoot is a system that allows you to, in an embedded world, boot other OSes, right?
30
So typically, the way these weird devices work is you have to bring them up.
31
You gotta get the board to be alive, you have to bring the CPU to live.
32
And then the first thing that you run on a router like this is this thing called a bootloader.
33
A bootloader is a piece of code that allows you to run other code.
34
The idea being, you don't have to make that piece of code know how to boot against every other CPU.
35
You just bring the CPU up to the bootloader, and the bootloader does the rest of the work, right?
36
You can use that bootloader to run your OS, like Linux or Windows or whatever.
37
So if the job of the bootloader is to run code that we want it to run, why does RCE in a bootloader matter?
38
Why does the vulnerability in U-Boot matter to anybody?
39
Great question.
40
What actually is interesting about U-Boot is its ability to facilitate this thing called verified boot, okay?
41
There's this whole world of boot processes
42
that the entire job is to make sure that code
43
that is not meant to be ran does not run on the device.
44
And we do this thing where we use a bunch of cryptographical algorithms using asymmetric encryption with like RSA keys
45
and public keys and stuff to sign the software image before it tries to get loaded.
46
And then using a public key on the device, we verify if that manufacturer signed image is actually what we want.
47
Is it the proper thing that is allowed to run on this device?
48
because maybe we just don't want anyone to be able to
49
run any software they want on random piece of Chinese router, right?
50
Maybe that's a thing that they don't want.
51
Okay.
52
So the issue that happens here is when you go to boot with a U-boot image in this fit format, this flattened image tree format,
53
it is signed with a signature.
54
It is basically taking a private key that the manufacturer owns.
55
We use that to embed a signature cryptographically that says, yup, it was signed by this manufacturer.
56
And then we use the public key on the device to verify the signature
57
that it was manufactured and it is the proper image.
58
But we can invalidate this entire signature verification process.
59
We can upload and execute a piece of code that is not intended by the manufacturer
60
if we can find and exploit a vulnerability inside of the bootloader.
61
And this is exactly what Binarily did.
62
And I'm sorry if you're worth with Binarily and I'm mispronouncing the company's name.
63
I'm not very good at English.
64
Okay, so stack buffer underflow in uBoot during the FIT image signature verification and FDT find regions.
65
Basically, there's code in the bootloader that is finding different regions of the actual image itself.
66
And the vulnerability is based on the same issue as one above, where we rely on the fact that FTT getName, which is a call that happens above, can fail.
67
But this time we're interested in what it writes to the length argument upon failure.
68
The error code.
69
Very interesting.
70
So there's this function called FTT getName, that if for any reason in this searching of the image during this FTT getName process,
71
where it's getting the name of a leaf of this image format, right?
72
If for some reason it's searching and it finds that one of the leaves does not have a slash, right?
73
So strrcare is a thread-safe version of strcare, which basically looks for a token in a string.
74
If that fails, we set error equal to some value and we go to fail.
75
And then in the fail label, we say if the length pointer exists, we are going to write out that length pointer, which should be the output of the actual length of the name.
76
Instead, we're going to output an error value, and that error value is FTT error bad structure.
77
And then notice that later on in the code we're going to do is we're going to say start copy onto end, the name that we found from that function, oh, and also end plus equals length.
78
Well, the issue here is that length holds a negative value.
79
It is a large negative error code.
80
So instead of actually moving the end of that cursor of parsing forward, the pointer moves backwards.
81
It'll go backwards by the size or the value of error bad structure, which is negative 11th.
82
And then it will increment that and add a slash.
83
As the amount of code generated by AI increases, one thing that scares me is the ability to maintain that volume of code.
84
And that's why today's video is sponsored by CodeRabbit.
85
CodeRabbit is an AI code review tool that helps engineers manage the world of AI generated PRs.
86
For one of my platforms, Lillava Labs, I added a feature to add bookmarks to the site, right? a fairly simple feature, but adding new API endpoints like anything does create potential new security vulnerabilities
87
and someone at the end of the day has to review this code.
88
Now CodeRabbit's new change stack feature makes this really, really easy.
89
If you go to the PR overview page, you get a nice walkthrough of how the code changed, what the major changes are, and also it does some really nice things where it generates diagrams for you
90
that you can easily put into your code's documentation.
91
One of the hardest things about a growing code base is not only tech debt, but knowledge debt, right?
92
Making sure there's documentation that explains exactly how the code works.
93
Now, if you go inside the change stack, you actually see that there's layers here.
94
What CodeRabbit is doing is breaking down the PR into the separate layers that it affects, right?
95
We have the first layer, which is just the bookmark system, right?
96
These single couple of Go files that maintain the bookmarks.
97
But what's even more important is you get a very clean view here of, okay, now how does this system integrate to the overall backend API?
98
This gives you your semantic diff of the code base, showing you what changes and how it changes as a function of the new feature.
99
You know, then we have the last layer here.
100
We have the TypeScript interface
101
that shows you how the new webpage created for the bookmarks is integrated into the rest of the TypeScript system.
102
Breaking down the PR like this, guys, gives you a much better idea of exactly what the PR does.
103
You can go through and review the code, obviously, but knowing systematically how it affects the overall code base is a much cleaner path to a secure development life cycle.
104
And guys, CodeRabbit is used all over the world.
105
You can actually try CodeRabbit for free at this URL below.
106
Go try CodeRabbit out and see if your pull request needs some more work and if CodeRabbit can help you get there.
107
Thank you for sponsoring the video, CodeRabbit.
108
Let's get back to it.
109
So the end result is like actually beautiful, right?
110
So what you have here is a stack frame for the function in question, right?
111
You have the stack frame for this function and you have this end pointer, right?
112
So it's end is this and it's saying end plus equals length.
113
So the pointer for end should go up and up and up the stack grows more positively down.
114
That is important for you to know.
115
If you don't know that, you should know that watching this channel.
116
Damn it.
117
But what's actually happening is we have another stack frame above us, and every time we exploit this vulnerability with these sections that have bad names, that don't have a slash in them,
118
we're actually subtracting the end pointer back and back and back, 11 bytes at a time,
119
until eventually the end pointer points to the return address of the previous stack frame.
120
And I know you're thinking, if you're like a binary exploiter person, and you're like, wait, if this is its own stack frame here, isn't there nothing above it?
121
Well, no, the actual, the contents of this buffer lives in another stack frame below it.
122
So just trust me, this is how it works.
123
So N goes up, up, up.
124
And then using a new malformed section name that does have a slash,
125
we can write arbitrary data we want to the program counter and get it to return to whatever address we want.
126
Again, if this is, you know, 32-bit, like ARM, we're going to have like A, A, A, B, right?
127
And if you're new to the world of exploitation, right, what's happening here, by overriding the program counter value,
128
we now have the ability to arbitrarily run or at least point the CPU to a place to run other code, right?
129
Like we could have put code in like another part of the image
130
and we can like wrap around to like mProtect or whatever, like set the page table entry to make it executable.
131
We do a bunch of evil stuff, right?
132
The end goal here is
133
that we're able to run code in the context of a bootloader that is doing signature verification without a valid signature.
134
We are exploiting the code that is doing signature verification, and this could invalidate an entire secure boot-like process.
135
I want to highlight that this in and of itself is not secure boot.
136
This image would have to be signed by a secure boot key, like the manufacturer key that the actual motherboard has.
137
But that being said, right, it's a really interesting primitive in the world of U-Boot, of bootloader vulnerabilities.
138
Not going to dive super deep into a ton of these, but you have another bunch of vulnerabilities, like, you know, the same kind of bug, denial of service in U-Boot using an FIT image signature because of an unchecked size value.
139
There are other parts of the code that use a name pointer where that name pointer can be null pointer.
140
And because of that, it's going to do a bunch of other stuff.
141
There's a whole bunch of interesting bugs on this write-up.
142
I'll put it in the description below.
143
But it's an interesting case study in the world of U-Boot, of bootloader vulnerabilities.
144
And the question for the class, the question that everyone probably wants to know the answer to, would Rust have fixed this?
145
Sort of.
146
So again, U-Boot, the whole point of this is to have the CPU be brought up, the CPU runs a bootloader, the bootloader then enables the OS, right?
147
We are at the super, super low level, name of the channel, by the way, in the boot process, okay?
148
Now, doing this in Rust is actually like there are these things called peripheral access crates
149
or these things called hardware abstraction layer crates
150
that allow you to write code that is not unsafe for the board in question.
151
That being said, doing things like raw MMIO
152
that maybe there isn't a peripheral extraction crate written for is very hard to do.
153
And it always does depend on unsafe code, even inside of the peripheral abstraction crates or access crates.
154
There is there has to be by the nature of how embedded software works, right?
155
It's global mutability, which is what Rust is designed to get rid of.
156
Inside of even this code, there has to be a piece of unsafe code, unfortunately.
157
But that being said, it's possible, just not easy.
158
And yes, Rust would have fixed bugs like this, right?
159
You would, well, actually, kind of think about it.
160
I don't think you're able to fix this bug
161
because all you're doing here is writing out to a pointer and a value, right?
162
And then from there, it's causing the underflow.
163
So I'm not necessarily sure if that's the case.
164
You can't raw pointers in rust
165
so there you go that's that's the answer actually you know the rust um error
166
and not error the the okay and error type the result type would fix this
167
because what this is actually the classical issue in c where
168
you're using the error code in the error state as the
169
actual value slot right this is like the entire problem
170
that the rust t e or rust result type fixes
171
and before we leave by the way in the code here what we're showing you
172
so what i did here is i i wrote um i compiled uboot the vulnerable version
173
which there is no patch for by the way yet.
174
I compiled UBoot to run in QMU.
175
QMU is like a system emulator, emulates an arm chip.
176
And then I ran UBoot and I tried to signature validate with the FIT image that has the vulnerable structures in it.
177
And then by using this, I was able to take control of the registers that are put on the stack, right?
178
So R10, the frame pointer, and ultimately PC, where PC is the return address that we're going to execute next, right?
179
And by doing that, this proves
180
that I have at least the the ability to point the CPU to other places in the code
181
that I want to run my evil stuff right now.
182
Obviously, the question of like NX and ASLR comes up, but that is a different question for a different video.
183
Anyway, thank you for watching, guys.
184
I appreciate it.
185
If you like this stuff, check out my other stuff, and then give me a little kiss on the cheek.
186
Okay, we'll see you later.
187
Goodbye.

영상의 맥락과 배경

이 영상은 U-Boot라는 부트로더의 취약점에 대해 설명하는 내용입니다. 화자는 "Ladies and gentlemen, boys and girls, lend me your ears"와 같은 생동적인 표현으로 시작해, 기술적인 내용을 쉽게 풀어내고 있습니다. U-Boot가 임베디드 장치에서 OS를 부팅하는 역할을 하며, 이 부트로더의 취약점이 보안에 미치는 영향을 중점적으로 다루고 있습니다. 영상 속 대화는 전문 용어도 많지만, 화자의 설명이 직설적이고 생동하여 이해하기 쉽게 구성되어 있습니다.

일상 대화에 유용한 상위 5개 표현

  • "Lend me your ears": 귀를 기울여 달라는 뜻으로, 주의를 끌 때 자주 사용됩니다. 예: "Hey, lend me your ears! I have something important to say."
  • "Bada bing, bada boom": 간단히 해결되거나 결과가 빠르게 나타날 때 사용하는 구문입니다. 예: "Just press the button, bada bing, bada boom, it's done."
  • "What the hell is even going on?": 상황이 이해되지 않을 때 쓰는 표현으로, "도대체 무슨 일이야?"라는 뜻입니다. 예: "Everyone is running around—what the hell is even going on?"
  • "Break down": 복잡한 것을 쉽게 설명할 때 사용합니다. 예: "Can you break down the steps for me?"
  • "Genuine": 진정한, 진품의 뜻으로, 예: "Is this a genuine product?"와 같이 사용됩니다.

단계별 쉐도잉 가이드 (shadowspeak, shadow speak)

이 영상은 기술 용어가 많아 쉐도잉(영어 쉐도잉)하기 어려울 수 있지만, 다음 단계로 쉽게 접근할 수 있습니다. 1단계: 영상을 0.75배속으로 듣고, 문장의 리듬과 강세를 파악합니다. "What are we talking about? Guys, we're talking about a vulnerability..."와 같은 부분은 강세가 바뀌므로 주의깊게 듣습니다. 2단계: 짧은 구문부터 반복합니다. "Bada bing, bada boom"처럼 짧은 표현을 여러 번 따라말하여 발음을 익힙니다. 3단계: 의미를 이해한 후, 자연스러운 속도로 따라합니다. "The vulnerability today is a stack buffer underflow..."와 같은 긴 문장은 의미를 파악한 후에 쉐도잉하면 더 잘 따라할 수 있습니다. 4단계: shadowing site를 이용해 녹음하고 비교합니다. 자신의 발음과 화자의 발음을 비교하여 차이점을 찾고 개선합니다.

쉐도잉을 연습할 때는 발음뿐만 아니라 억양과 강세도 중요합니다. 이 영상은 화자의 표현이 생동하기 때문에, 그 감정을 따라하기 위해 노력하면 더 자연스러운 영어 발화 능력을 기를 수 있습니다.

쉐도잉이란? 영어 실력을 빠르게 키우는 과학적 방법

쉐도잉(Shadowing)은 원래 전문 통역사 훈련을 위해 개발된 언어 학습 기법으로, 다언어 학자인 Dr. Alexander Arguelles에 의해 대중화된 방법입니다. 핵심 원리는 간단하지만 매우 강력합니다: 원어민의 영어를 들으면서 1~2초의 짧은 지연으로 즉시 소리 내어 따라 말하는 것——마치 '그림자(shadow)'처럼 화자를 따라가는 것입니다. 문법 공부나 수동적인 청취와 달리, 쉐도잉은 뇌와 입 근육이 동시에 실시간으로 영어를 처리하고 재현하도록 훈련합니다. 연구에 따르면 이 방법은 발음 정확도, 억양, 리듬, 연음, 청취력, 말하기 유창성을 크게 향상시킵니다. IELTS 스피킹 준비와 자연스러운 영어 소통을 원하는 분들에게 특히 효과적입니다.