We expect a high standard of professionalism from you at all times while you are taking any of our courses. We expect all students to act in good faith at all times
tldr: don’t be a dick jerk
buffer overflows, format strings, xss, sqli
if 10 people wanted to communicate privately (one-on-one), how many:
How many bits of work will it take to brute-force a 6-character password (consisting of numeric digits, lower-case, and upper-case letters) if every password takes 10 bits of work to check
[v,va,s,sn,f]printf
[v,va,s,sn,f]scanf
setproctitle
, syslog
, and others!%<flags><width><precision><modifier><type>
%d
: print as signed decimal%x
: print as hex%c
: print as a character%p
: print out a value as a pointer%s
: print as a string?%n
: huh?h
: print half%hd
: print bottom 2 bytes%hn
: write two byteshh
: print half half (quarter)%hhd
: print bottom byte%hhn
: write one bytezfill()
in python%10c
pads the argument to 100 bytesprintf("%10c", 5);
> 5
printf("%10c", 10)
> 10
%10$x
prints the 10th argument as hexint a = 1, b = 2, c = 3;
printf("%2x", a, b, c);
> 0x2
char buffer[30] = "the quick brown fox";
printf("The length of '%s' is %d\n", buffer, strlen(buffer));
// The length of 'the quick brown fox' is 19
printf("The length of '%s' is %d\n");
// The length of '????' is ???
char buffer[30] = "The length of '%s' is %d\n");
printf(buffer);
what do these do?
printf(buffer);
.time 2 draw
AAAA BBAAAA
| ---------- | | ---------- |
| 0x41410000 | -> | 0x41414141 |
| 0x00004141 | -> | 0x00004242 |
| ---------- | | ---------- |
10
you’d just need to write 10
chars + %n0x08041234(134484532)
, how do we write 134M chars?addr,addr+1...
ASLR: randomizes the programs location in memory
PIE: program can only use relative jumps (needs ASLR)
RELRO: GOT is Read-Only (partial is trash, full is RIP)
PAC: you can only jump to signed pointers
NX: the stack isn’t executable (no shellcode)
Fortify: %n only allowed if fmtstr in read-only memory
0x565...
: binary base (PIE enabled)0x804...
: binary base (PIE disabled)0xf7f...
: library base0xff....
: stack base