Skip to content

Commit ccde508

Browse files
authored
Merge pull request #2018 from HackTricks-wiki/update_TaszkSecLabs_xiaomi-c400-pwn__PoC_exploit_and_jail_20260317_131134
TaszkSecLabs/xiaomi-c400-pwn PoC exploit and jailbreak for X...
2 parents b1e97c4 + aef7ced commit ccde508

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

  • src/binary-exploitation/rop-return-oriented-programing

src/binary-exploitation/rop-return-oriented-programing/README.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,21 @@ G3:
287287
ret
288288
```
289289

290+
## Shellcode via /proc/self/mem (Embedded Linux)
291+
292+
If you already have a ROP chain but **no RWX mappings**, an alternative is to **write shellcode into the current process using** `/proc/self/mem` and then jump to it. This is common on embedded Linux targets where `/proc/self/mem` can ignore write protections on executable segments in default configurations.
293+
294+
Typical chain idea:
295+
296+
```c
297+
fd = open("/proc/self/mem", O_RDWR);
298+
lseek(fd, target_addr, SEEK_SET); // e.g., a known RX mapping or code cave
299+
write(fd, shellcode, shellcode_len);
300+
((void(*)())target_addr)(); // ARM Thumb: jump to target_addr | 1
301+
```
302+
303+
If preserving `fd` is hard, calling `open()` multiple times can make it feasible to **guess the descriptor** used for `/proc/self/mem`. On ARM Thumb targets, remember to **set the low bit** when branching (`addr | 1`).
304+
290305
291306
## Protections Against ROP and JOP
292307
@@ -328,6 +343,10 @@ rop-syscall-execv/
328343
- arm64, no ASLR, ROP gadget to make stack executable and jump to shellcode in stack
329344
- [https://googleprojectzero.blogspot.com/2019/08/in-wild-ios-exploit-chain-4.html](https://googleprojectzero.blogspot.com/2019/08/in-wild-ios-exploit-chain-4.html)
330345
331-
{{#include ../../banners/hacktricks-training.md}}
346+
## References
332347
348+
- [Now You See mi: Now You're Pwned](https://labs.taszk.io/articles/post/nowyouseemi/)
349+
- [TaszkSecLabs/xiaomi-c400-pwn](https://github.com/TaszkSecLabs/xiaomi-c400-pwn)
350+
351+
{{#include ../../banners/hacktricks-training.md}}
333352

0 commit comments

Comments
 (0)