hacktricks/binary-exploitation/stack-overflow/pointer-redirecting.md
2024-07-18 22:49:07 +02:00

4.1 KiB

Pointer Redirecting

{% hint style="success" %} Learn & practice AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE)
Learn & practice GCP Hacking: HackTricks Training GCP Red Team Expert (GRTE)

Support HackTricks
{% endhint %}

String pointers

If a function call is going to use an address of a string that is located in the stack, it's possible to abuse the buffer overflow to overwrite this address and put an address to a different string inside the binary.

If for example a system function call is going to use the address of a string to execute a command, an attacker could place the address of a different string in the stack, export PATH=.:$PATH and create in the current directory an script with the name of the first letter of the new string as this will be executed by the binary.

You can find an example of this in:

Function pointers

Same as string pointer but applying to functions, if the stack contains the address of a function that will be called, it's possible to change it (e.g. to call system).

You can find an example in:

References

{% hint style="success" %} Learn & practice AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE)
Learn & practice GCP Hacking: HackTricks Training GCP Red Team Expert (GRTE)

Support HackTricks
{% endhint %}