this post was submitted on 27 May 2025
656 points (99.4% liked)
Programmer Humor
23530 readers
1714 users here now
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Rules
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Do you know what a memory stack and assembly are?
If you want code that does assembly operations A, B, and then C, you might be able to accomplish it by scanning loaded memory (or its corresponding binary) for bits that, when translated into assembly, do:
A
D
return
This set of three instructions is a gadget. In practice, it's a location in memory.
And then you find another gadget.
B
C
return
Then, if you don't care about D, or D does something irrelevant that won't screw up what you're trying to do, or won't crash the program, you can replace the stack with the addresses of gadgets one and two. When gadget one returns, the stack is popped and then gadget two executes.
Since the computer did ADBC and D was irrelevant, the system executed your ABC malware and now you win.
Is finding gadgets that execute actual malware hard? Surprisingly not!