Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kernelCTF: Add CVE-2024-27397 mitigation #123

Merged
merged 1 commit into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
522 changes: 522 additions & 0 deletions pocs/linux/kernelctf/CVE-2024-27397_mitigation/docs/exploit.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
- Requirements:
- Capabilites: CAP_NET_ADMIN
- Kernel configuration: CONFIG_NF_TABLES=y
- User namespaces required: Yes
- Introduced by: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit?id=c3e1b005ed1c
- Fixed by: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=7395dfacfff65e9938ac0889dafa1ab01e987d15
- Affected Version: v4.1 - v6.8
- Affected Component: netfilter, nftables
- URL: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-27397
- Cause: Use-After-Free

A use-after-free vulnerability in the Linux kernel's netfilter: nf_tables component can be exploited to achieve local privilege escalation.
NFT sets and their elements can have associated timeouts.
These timeouts are checked against the live system clock to assess expiration (see `nft_set_elem_expired` in `nf_tables.h`).
This causes issues when the elements expire during a transaction, leading to an asymmetric clean-up operation in a potential transaction
rollback, missing f. e. required reference count updates.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

exploit: exploit.c netlink.c
$(CC) -O3 -ggdb -static -Wall -lpthread -o $@ $^

real_exploit: exploit.c netlink.c
$(CC) -O3 -ggdb -static -Wall -lpthread -DKASLR_BYPASS_INTEL=1 -o exploit $^
Binary file not shown.
Loading
Loading