text stringlengths 0 1.99k |
|---|
``` |
Uh, oh - something went wrong. Let's take a look in GDB to see what |
happened. |
``` |
root@cheribsd-morello-purecap:~/vuln # gdb -q ./heap2 heap2.core |
Reading symbols from ./heap2... |
[New LWP 100064] |
Core was generated by `./heap2'. |
Program terminated with signal SIGPROT, CHERI protection violation. |
Capability tag fault. |
#0 strlen (str=0x40c0f000 [rwRW,0x40c0f000-0x40c0f040] (invalid) "CHERI2") |
at /home/user/cheri/cheribsd/lib/libc/string/strlen.c:143 |
``` |
So what did that `malloc_revoke()` function do? This is a function |
provided by the CHERI SDK that forces a cleanup of the quarantine list in |
the allocator. This means that the capability corresponding to `ptr1` has |
its tag bit cleared. From the CHERI man pages [5], `malloc_revoke()` |
"triggers a full flush of the quarantine and scan of memory to ensure that |
all references to memory previously quarantined by free(3) or realloc(3) |
are revoked upon successful return". Ultimately, we can see that `strlen()` |
was called (presumably by `printf()` due to the `%s` format specifier) with |
an invalid capability. |
## Where next? |
I hope you've enjoyed this figurative toe-dip into CHERI both as a concept, |
and also after getting our hands dirty with some solid examples. |
Personally, I think the platform has some solid design ideas that will |
certainly make classic exploitation techniques harder. I'm hesitant to say |
that any of those existing techniques have been rendered obsolescent |
because, as far as I'm aware, CHERI is yet to be battle tested as a |
security mechanism on a target that's of significant interest to exploit |
developers; like a flagship smartphone or a games console. |
If you'd like to dive deeper into CHERI, then I recommend checking out the |
Morello documentation more closely [2]. There's also the "CHERI Exercises" |
repo on GitHub [6] by the CHERI team at Cambridge University which |
highlights more scenarios where CHERI introduces new complications for |
exploit writers. This article should give you a solid foundation to be able |
to tackle those exercises. |
Remember that CHERI doesn't stop at Morello with Aarch64! CHERI |
specifications also exist for MIPS and RISC-V, with x86_64 in the works too. |
In particular, there is the CherIoT (CHERI Internet-Of-Things) project [7] |
which uses the RISC-V CHERI extension to power an IoT platform. This |
project makes extensive use of the compartmentalisation feature of CHERI |
that I briefly mentioned earlier in the article. This is a method of |
process isolation using sealed capabilities without having to separate |
processes into different memory spaces. |
It's also worth taking a look at the output of `./cheribuild.py |
--list-targets` - there are already build definitions for things like |
Apache, Nginx, KDE Plasma, Wayland, FFmpeg, and even DOOM! |
## Closing Thoughts |
First of all, if you've made it this far - thank you! I hope you found this |
read worth your time and that you learnt something - even if it was just to |
scratch that itch to understand a little better what this CHERI thing is |
all about. That's certainly why I chose to take a look at it. If CHERI |
takes off in the consumer space in the future, I think bug hunters and |
xdevs alike will enjoy the new challenged posed by it. And if it doesn't |
take off, then it will still remain an interesting experiment that we can |
continue to play with in VMs. |
Obligatory shoutouts go to netspooky, dnoiz, hermit, gren, srsns, bane, |
remy, computeruser, zeta, chill, buses, rqu, iximeow, ilya, kyo and The |
Binary Golf Association (you should go play Binary Golf [8]). |
## Links and References |
[1] https://www.arm.com/architecture/cpu/morello |
[2] https://developer.arm.com/documentation/ddi0606/ak |
[3] https://github.com/CTSRD-CHERI/cheribuild |
[4] https://ctsrd-cheri.github.io/cheribsd-getting-started/features/ |
temporal.html |
[5] https://man.cheribsd.org/cgi-bin/man.cgi/dev/malloc_revoke_enabled.3 |
[6] https://github.com/CTSRD-CHERI/cheri-exercises/tree/master |
[7] https://cheriot.org/ |
[8] https://binary.golf/ |
|=-----------------------------------------------------------------------=| |
|=-------------=[ 5 - High-Performance Network Scanning ]=---------------=| |
|=-------------------------=[ With AF_XDP ]=-----------------------------=| |
|=-----------------------------------------------------------------------=| |
|=---------------------------=[ c3l3si4n ]=------------------------------=| |
|=-----------------------------------------------------------------------=| |
-- Table of contents |
0 - Introduction |
1 - The Slow Path: Traditional Scanning Methods |
1.0 - Per-Connection Syscall Overhead |
1.1 - Inefficient Packet Filtering with AF_PACKET |
2 - Kernel Bypass and Fastpath Architectures |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.