$ cat writeup.md…
$ cat writeup.md…
hackthebox
Task: Write shellcode to read flag.txt under a 60-byte limit with a 16-byte blacklist filter. Solution: Use open/read/write (ORW) syscall chain instead of blocked execve, XOR-encode the "flag.txt" string with key 0x22 to bypass banned bytes, substitute blocked instructions with push/pop equivalents, and decode the string at runtime with a compact loop.
$ cat /etc/rate-limit
Rate limit reached (20 reads/hour per IP). Showing preview only — full content returns at the next hour roll-over.
Hey, just because I am hungry doesn't mean I'll execute everything
Remote: nc 83.136.253.132 37814
execute — ELF 64-bit LSB PIE executable, x86-64, dynamically linked, not strippedexecute.c — Source codeflag.txt — Fake flag for local testing| Property | Value |
|---|---|
| Arch | x86-64 |
| RELRO | Partial |
| Stack | Executable (-z execstack) |
| NX | Disabled |
| PIE | Yes |
| Canary | No |
The binary reads up to 60 bytes of user input into a stack buffer, checks every byte against a 16-byte blacklist, and if all bytes pass — casts the buffer to a function pointer and calls it. Classic shellcode execution with a twist: a byte-level blacklist filter.
int check(char *a, char *b, int size, int op) { for(int i = 0; i < op; i++) { for(int j = 0; j < size-1; j++) { if(a[i] == b[j]) return 0; } } return 1337; }
The check() function iterates over every blacklist byte (a[i]) and every input byte (b[j]). If any match is found, it returns 0 (fail). Otherwise returns 1337 (pass).
...
$ grep --similar