1

I'm reading about buffer overflow and there's this part i didn't understand , it says :

Eliminating Data Segments

That assembly code works completely. However, it is useless. You can compile it with nasm, execute it, and view the binary file in hex form with hexdump, which is itself a shellcode. The problem is that both programs use their own data segments, which means that they cannot execute inside another application. This means in chain that an exploit will not be able to inject the required code into the stack and execute it.

why can't we use a data segment in our shellcode ? thanks !

1 Answer 1

2

You can read from and write to a process's data segment from shellcode (assuming proper page protections).

However, you typically want to supply the data your shellcode is going to use (for example, the data string "http://172.19.3.204/stager.exe"), and not rely what's currently in the exploited process's data segment (for example, the data string "Internet Explorer 4.0").

As such, you'll need to either inject your shellcode's data into the exploited process's data segment, or as is the more common case, inject your shellcode and data together in a single blob and have your shellcode reference your data at an offset relative to your shellcode.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.