by userbinator · 10y ago · 0 comments
C3
A Hello World is roughly 20 bytes, the bulk of it being the string itself: 95 BA 07 01 CD 21 C3 48 65 6C 6C 6F 20 77 6F 72 6C 64 21 24
The ELF in the article, which is 130 by my count, could be reduced to 45 with some tricks:http://www.muppetlabs.com/~breadbox/software/tiny/teensy.htm...
Also worth looking at is what the demoscene has done with binaries of 128 bytes or less:
http://www.pouet.net/prodlist.php?type%5B%5D=32b&type%5B%5D=...
Then I showed it to a security researcher I knew and he immediately replied "oh, this is so cool! also, you can replace the last four bytes with C3". Oh man, that hurt :-)
I'm pretty sure this was actually used in some Unix/Linux version, and they got bug reports due to the poor performance (executing a shell to do nothing), which makes for a lot of bugs per line of code. Unfortunately I can't find a reference. Instead I found that AT&T Unix implemented "true" as an empty file... with a copyright notice! See http://trillian.mit.edu/~jc/humor/ATT_Copyright_true.html
joey@darkstar:~>touch true
joey@darkstar:~>chmod +x true
joey@darkstar:~>ls -l true
-rwxr-xr-x 1 joey joey 0 Nov 18 10:53 true*
joey@darkstar:~>if ./true; then echo yay; fi
yay
Just saying. # which true
/usr/bin/which: no true in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin)
# true; echo $?
0the smallest prod on pouet is a zero byte com file. of course it errors. With C3 you have skewed the definition of a program, already, anyhow. Edit: Queue the story of the empty dos program that was nevertheless useful to prompt the OS's program loader to do some memory management with useful side effects