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-57947_mitigation #162

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mingi
Copy link
Contributor

@mingi mingi commented Feb 10, 2025

No description provided.

@mingi mingi changed the title Add kernelCTF CVE-2024-57947 Add kernelCTF CVE-2024-57947_mitigation Feb 10, 2025
@koczkatamas koczkatamas force-pushed the master branch 3 times, most recently from 933028d to c111d81 Compare March 3, 2025 14:31
@koczkatamas koczkatamas force-pushed the master branch 13 times, most recently from 76d6b57 to bf0d68f Compare March 13, 2025 15:39
Copy link
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,

This is just a quick code quality review. We're planning to review the submissions more deeply (actually understanding what the exploit does) next week.

In general, the code quality looks good, no major concerns. I've left a few smaller comments here and please also apply the changes asked in the other PRs (e.g. #161) here as well.

We also have a draft style guide now. Please take a look and let us know if it's helpful for understanding our code quality expectations: https://google.github.io/security-research/kernelctf/style_guide.

Thanks for the submission and PR!

}

void trigger(char * trig_set_name, char * trig_chain_name){
uint8_t desc_concat[64] = {0,};
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 comment here in more detail what these values mean? See more here: https://google.github.io/security-research/kernelctf/style_guide#name-andor-comment-numeric-constants


unsigned long user_data[0x100] = {0,};

*(unsigned long*) &key_data[0] = 0xb000001010a;
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 comment here in more detail what these values mean and how they are interpreted / user? Would the exploit work in the same way if we would change them or their exact value matters? See more here: https://google.github.io/security-research/kernelctf/style_guide#name-andor-comment-numeric-constants

nftnl_set_set_u32(set, NFTNL_SET_DATA_TYPE, NFT_DATA_VERDICT);
nftnl_set_set_data(set, NFTNL_SET_DESC_CONCAT, desc_concat, 4);

uint8_t key_data[0x200] = {0,};
Copy link
Collaborator

Choose a reason for hiding this comment

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

What are these sizes (0x200, 0x2000, 0x100) influence? Does it matter from the cache point-of-view? Comment this here. See more here: https://google.github.io/security-research/kernelctf/style_guide#name-andor-comment-numeric-constants

*(unsigned long*) &key_end_data[0] = 0x1400ff02010a;
*(unsigned long*) &key_end_data[8] = 17;

struct nftnl_set * set_elem_triggers[0x200];
Copy link
Collaborator

Choose a reason for hiding this comment

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

There seems to be an inconsistency between spraying iteration counts:

The code:

  • allocates an array with 0x200 == 512 slots for the objects
  • actually creates 20 * 20 == 400 objects
  • uses 200 objects in the batch

It’s not clear whether these are typos and bugs in the exploit (hex 0x200 != decimal 200) or it is intentional.

Please make the code consistent or comment here if this was intentional.

Read more here: https://google.github.io/security-research/kernelctf/style_guide#match-iteration-count-for-allocation-creation-and-usage

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.

2 participants