dc2019q - know_your_mem
This was a jeopardy challenge, part of dc2019q. (CTFtime)
Points: 109
Was solved by:
122
teams
You may spawn the server:
On your laptop
- Install docker
docker pull archiveooo/pub:know_your_mem
(docker-saved download)docker run -d --name knowyourmem archiveooo/pub:know_your_mem
- Local IP:
docker inspect knowyourmem -f '{{ .NetworkSettings.Networks.bridge.IPAddress }}'
- Connect to that IP:4669 —
Remember to
docker rm -f
when done.
On your laptop (full source)
- Install docker and
pip install PyYAML coloredlogs
git clone https://github.com/o-o-overflow/dc2019q-know_your_mem
(notice below)cd know_your_mem
./spawner --log-level=INFO
- Connect to the
ip:port
displayed
Hosted by OOO
Right now we're asking players to login first.Description
Find the flag page in memory, 64-bit edition. Timeouts are strict, please test locally first! There's a simplified version to help with that.
This was an introductory, easy challenge.
FYI, the v1 version allows for an easier solution that the one that is suggested. If you wish, v2 is slightly harder.
know_your_mem.c simplified.c simplified_shellcode.so.c shellcode.c Makefile topkt.py README.md
Hints
Hint 1
Start by looking at syscalls. Only a few are allowed by the seccomp filter.Hint 2
Many syscalls can be used "indirectly" to check if memory is allocated at a certain address or not, without using signals or /proc/self/maps. How?Hint 3
Build a simple memory scanner using a syscall. Start on 32-bit. Can you make it faster? Can you distinguish read-write or read-only?Hint 4
Experiment with mmap() -- how does it behave with regards to memory that is already allocated? Try it on the local code.Hint 5
Use mmap() to first scan large chunks of memory. Try a chunk size of 64 KB. Look at the randomization function: not all memory addresses are possible.Hint 6
Once you drill down to find allocated single pages, how can you determine if the flag is there or not? See the source code.If you wish, you can contribute more.