Got Overwrite
The report explains a GOT overwrite technique where the address of the puts function in the Global Offset Table is replaced with the address of system, so that when puts is called with a buffer containing /bin/sh, a shell is spawned. The attacker can achieve remote code execution if they can write to the GOT.
Published on infosecwriteups.com
It is responsible for calling the dynamic linker during and after the program runtime to resolve the addresses of the requested functions
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
The program allows writing to the Global Offset Table (GOT) without protection, enabling an attacker to redirect a function call to another function.
Impact
This could lead to remote code execution, allowing an attacker to spawn a shell.
What the attacker needed
Ability to write to the GOT; Knowledge of addresses (PLT, GOT, system)
How it was found
- Compile the provided source code.
- Disassemble the program using GDB-PEDA to find the PLT address of puts.
- From the PLT entry, find the GOT address of puts.
- Find the address of system.
- Overwrite the GOT entry of puts with the address of system.
- Pass /bin/sh as input to the buffer using gets, so that when puts is called, system executes with /bin/sh.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
Programs use a table to find the addresses of functions like puts. If an attacker can change the entry for puts to point to system instead, then calling puts will run system. This lets the attacker run commands on the computer.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.