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

recursion #15

Closed
ltzehan opened this issue Jun 28, 2021 · 1 comment · Fixed by #29
Closed

recursion #15

ltzehan opened this issue Jun 28, 2021 · 1 comment · Fixed by #29

Comments

@ltzehan
Copy link
Collaborator

ltzehan commented Jun 28, 2021

recursion

Challenge Details

An executable contains a nested executable XOR'd with a 4-byte key. The first program accepts a 32-character string as an argument. Each executable uses the first 4 bytes of this string to decrypt the next executable and calls it with the rest of the string as an argument.

Will probably use memfd_create -> execve chain. Hopefully this doesn't trip players' AV 🤷

Key Concepts

Memory and file descriptor shenanigans. Recognizing certain files have fixed bytes that can be used to reduce the search space.

Solution

Running strace on the first executable should reveal the memfd_create and execve calls before it segfaults. By observing that the user input is used to XOR over a memory region, before executing it through a fd, players should realize this contains an encrypted ELF file.

Each chunk can be recovered by XORing the encrypted executable with the magic bytes expected in an ELF file. Not impossible for the player to brute-force, but they will need to realize how to brute-force 4 bytes at a time or they will experience pain (~60^22 should be hard enough right??).

8 layers of executables should be sufficient to motivate players to write a script instead of doing everything by hand. Should be possible to do the whole challenge statically.

Learning Objectives

Basics of how malware is packed and how fileless malware operate.

Flag

greyhats{p4cK_@ll_th3_th1Ng5!!!}
@ltzehan ltzehan added Category: RE Difficulty: Medium Status: Idea Just idea, haven't starting implementing labels Jun 28, 2021
@ltzehan ltzehan self-assigned this Jun 28, 2021
@ltzehan
Copy link
Collaborator Author

ltzehan commented Jun 28, 2021

Need to leave a note to players that WSL1 bad: microsoft/WSL#3542

@ltzehan ltzehan added Status: Testing Call for testing and removed Status: Idea Just idea, haven't starting implementing labels Jul 2, 2021
@ltzehan ltzehan mentioned this issue Jul 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant