Skip to content

Add kernelCTF CVE-2024-45016_lts_cos_mitigation#261

Open
hexfoureight wants to merge 15 commits intogoogle:masterfrom
hexfoureight:CVE-2024-45016_lts_cos_mitigation
Open

Add kernelCTF CVE-2024-45016_lts_cos_mitigation#261
hexfoureight wants to merge 15 commits intogoogle:masterfrom
hexfoureight:CVE-2024-45016_lts_cos_mitigation

Conversation

@hexfoureight
Copy link
Copy Markdown
Contributor

No description provided.

@JordyZomer JordyZomer added the kCTF: vuln OK The submission exploits the claims vulnerability (passed manual verification) label Oct 13, 2025
Copy link
Copy Markdown
Collaborator

@koczkatamas koczkatamas left a comment

Choose a reason for hiding this comment

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

Hey! I've left some questions, change requests and also run our AI tool on the source code. Please take a look and make changes if necessary. Thanks!

}

if (off != -1) {
memcpy(buf, msgbuf + off + 56, 8); // latency
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Could you describe what structure's fields you are describing here? Are they dynamically generated fields and they don't have a kernel representation?

Asking because we'd like to understand how to modify these offsets when we'd like to target a different kernel version.

Read more about this violation in the 'Sprayed and leaked structures' section of the style guide.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

There is no underlying struct, the message is constructed in netem_dump() and has to be parsed.


```
y,p: &n2->latency
s: &n1->latency + 32
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

What's at +32 or why do we need this offset?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The node s is placed there so that its child fields overlap with controllable parameters.

Due to the limitation of the rebalancing write mentioned above, the fake qdisc linked to by `n2->hash.next` will be at a misaligned offset, limiting which of its fields we can set. Therefore this qdisc will only be used to link to the fake qdisc that is actually used for the read. Here are the `y`,`p`,`s`,`c` addresses for the rebalancing write:

```
y: &n1->latency + 32
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

What are at offsets +32, +32 and +8 or why do we need this alignment?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

y has to be at the same place as the previous s to stay under the dangling rb_node pointer. A fake Qdisc will placed with its hash.next at p. Its location is chosen so that we can control its hash.next and flags fields. s is again chosen so that its child fields are controllable.

The rebalancing write primitive is used to replace the root FSC `hfsc_class` of the interface's root qdisc:

```
y: &n1->slot + 8
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

What are at offsets +8, -16 and +32 or why do we need this alignment?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

y has to be at the same place as the previous s to stay under the dangling rb_node pointer. The vt_node of a fake hfsc_class will be located at p. It's placed so that its left child field overlaps with the parameters. s is at the same location as in the first write.

I've defined macros for the offsets to indicate which fake structure is placed at them. They are offset by one byte to account for the node being colored black during the write.

@koczkatamas
Copy link
Copy Markdown
Collaborator

Hey!

A few comments left unanswered, are you still planning to make changes before we can review it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kCTF: vuln OK The submission exploits the claims vulnerability (passed manual verification)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants