Sign inSign up

suezawa/exploit-exercise3

By suezawa

•Updated almost 7 years ago

Image
0

469

suezawa/exploit-exercise3 repository overview

⁠Exercise3: Advanced (ROP)

Try priviledged escalation using Arbitrary code execution vulnerability

⁠Run docker images
docker run --rm --privileged -it suezawa/exploit-exercise3 /bin/bash
⁠Procedure
  • Change user from root to appuser(unprivileged user)
# su appuser --shell=/bin/bash
$ echo "Test" | ./baby_stack
Thank you!
msg : Test
  • Try to cat shadow
$ cat /etc/shadow
cat: /etc/shadow: Permission denied
  • Attack baby_stack
$ ls -l baby_stack
-rwsr-sr-x 1 root root 2051370 Jan 10 04:53 baby_stack
$
$ python exploit_print.py | ./baby_stack
Thank you!
msg :
  • Got shell
id
#[return] uid=1000(appuser) gid=37(appuser) euid=0(root) egid=0(root) groups=0(root),37(appuser)
cat /etc/shadow
#[return] root:*:18179:0:99999:7:::
⁠GDB (Autoexecution until ret)
# on root
gdb baby_stack -x gdb-autocommand
  • See memory in .bss segment
gdb-peda$ hexdump 0x564200 48
⁠(Ref) Get ROP Gadget
rp-lin-x64 -f baby_stack -r 1 --unique
⁠(Ref) Get .bss segment address
readelf -W -e baby_stack
⁠(Ref) How the binary was created
go build -o baby_stack -ldflags "-w"
⁠References

Tag summary

Content type

Image

Digest

Size

208.3 MB

Last updated

almost 7 years ago

docker pull suezawa/exploit-exercise3