Inside UnrealIRCd — When Two Bytes Lead to RCE
A trojanized version of UnrealIRCd [redacted] contained a backdoor that checked if the first two bytes of input were 'AB' and then passed the entire input to the system() function. An attacker could send a crafted message starting with 'AB' followed by shell commands to execute arbitrary commands on the server.
Published on medium.com
I transferred the unrealircd binary from /usr/bin/ on Metasploitable 2 to my Kali Linux machine using wget for analysis. One straightforward way to do this is to spin up a temporary HTTP server on the target:
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Context
UnrealIRCd is an open-source IRC (Internet Relay Chat) server used to host and manage IRC networks. In 2009 to 2010, UnrealIRCd [redacted] shipped a nasty surprise: certain download mirrors were distributing a trojanised version of the source archive. The tampered code let a remote attacker execute arbitrary operating system commands with the privileges of the user running the IRC server. The vulnerability was assigned CVE-2010-2075.
An IRC server's job is to relay messages between people. This one had been modified so that, under one specific condition, it also relayed shell commands.
Setup
The analysis was done on a copy of the unrealircd binary taken from /usr/bin/ on Metasploitable 2 and moved to a Kali Linux machine with wget. To make the file available, a temporary HTTP server was started on the target:
sudo python -m SimpleHTTPServer 8000

The binary's protections were checked with checksec. The notable result was PIE (Position Independent Executable): No PIE. Without PIE the main executable is loaded at a fixed virtual address instead of having its base randomised by ASLR, so its code addresses stay the same between runs. That makes it easier to reference specific functions and instructions during static analysis.

Finding it
The dynamic relocations were inspected with objdump, and one entry stood out:
080b6354 R_386_JUMP_SLOT [redacted]
A reference to system@GLIBC means the binary dynamically resolves the C library's system() function, which executes shell commands. On its own that is not proof of a backdoor, but it was a lead worth following: where is system() called, and what input triggers it?

Searching the disassembly for references to system turned up a call instruction at 0x0805a798, confirming that the binary really does invoke system().
Exploitation
Step 1: locate the call site in assembly

805a791: movl $0x80b7ec0,(%esp)
805a798: call 8056b6c <system@plt>
805a79d: jmp 805a23f <read_message+0x71f>
The instruction at 0x0805a791 pushes the address 0x080b7ec0 onto the stack as an argument. The next instruction calls system(), passing 0x080b7ec0 as its argument.
Step 2: decompile the calling function in Ghidra

Decompiling read_message() in Ghidra produced a suspicious block:
1 LAB_0805a21f:
2 bVar14 = iStack_144 == 0;
3 if (!bVar14) {
4 iVar9 = 2;
5 pcVar6 = &readbuf;
6 pcVar13 = "AB";
7
8 do {
9 if (iVar9 == 0) break;
10 iVar9 = iVar9 + -1;
11 bVar14 = *pcVar6 == *pcVar13;
12 pcVar6 = pcVar6 + 1;
13 pcVar13 = pcVar13 + 1;
14 } while (bVar14);
15
16 iVar9 = Hooks._196_4_;
17 if (bVar14) {
18 system(&readbuf);
19 iVar9 = Hooks._196_4_;
20 }
Two things stood out: the hardcoded string "AB" assigned to pcVar13 on line 6, and the call to system() passing &readbuf on line 18. The comparison loop runs at most two iterations, and if the bytes match, the whole receive buffer is passed to system().
Step 3: identify the trigger string in memory

The instructions just before the comparison set up the registers and counter for it:
1. 0805a225 MOV EAX,DAT_080a575c
2. 0805a22a MOV ESI,readbuf
3. 0805a22f CLD
4. 0805a230 MOV ECX,0x2
5. 0805a235 MOV EDI,EAX
- Loads the memory address of
DAT_080a575cintoEAX. - Loads the memory address of
readbufintoESI. - Clears the Direction Flag (DF), so subsequent string operations move forward through memory.
- Sets the
ECXcounter to2, specifying that two bytes will be compared. - Copies the address stored in
EAXintoEDI.
This prepares EDI and ESI for the REPE CMPSB instruction that follows.

Following the reference to DAT_080a575c in Ghidra showed the bytes stored there:
080a575c 41 ; A
080a575d 42 ; B
0x41 and 0x42 are the ASCII characters A and B, so DAT_080a575c holds the hardcoded string "AB", the reference string for the comparison.
Step 4: trace the comparison and the jump

The do block resolves to the instructions at 0x0805a237 and 0x0805a239:
0805a237 CMPSB.REPE ES:EDI, ESI
0805a239 JZ LAB_0805a791
REPE CMPSB compares the bytes at the addresses in EDI and ESI, repeating while they match. With ECX set to 2, it compares the first two bytes of readbuf against "AB". If both match, the Zero Flag is set and the JZ jumps to LAB_0805a791, where the system() call sits.
Step 5: reproduce the logic

With the comparison and the call traced, the backdoor's behaviour is clear: if the first two bytes of the received input are "AB", the entire input is passed to system(). A simplified Python recreation was used to demonstrate the logic:
import os
user_input = input("Enter a string: ")
input_bytes = user_input.encode()
if input_bytes[:2] == b"AB":
os.system(user_input)
else:
print("Executing program normally")
The results show an important detail. Entering id on its own ran normally, because the input did not start with the "AB" prefix. Entering ABid triggered the backdoor, but the shell tried to execute ABid as a command and returned a command-not-found error.
AB;id behaved differently. The comparison only looks at the first two bytes, so the "AB" prefix satisfies the trigger, but the whole input, prefix included, is passed to system(). The semicolon separates commands in shell syntax, so the shell first tries to run AB, which fails, and then runs id, which returns the current user's information.
The semicolon is not needed to trigger the backdoor. It is needed in this example to separate the AB trigger prefix from the command that should actually run.
Root cause
The trojanised source archive added a check in read_message() that compares the first two bytes of the received buffer against the hardcoded string "AB" and, on a match, hands the entire buffer to system(). Because the comparison covers only two bytes and the full input is passed on, a command can be appended after the prefix, separated by a semicolon as demonstrated.
The executable was built without PIE, which made the call site easy to locate statically, and the system@GLIBC relocation pointed to the dangerous dependency before any code was read. The weakness is in the distribution process rather than in UnrealIRCd's own design: the source archive on some mirrors had been modified before users downloaded it.
Impact
A remote attacker can execute arbitrary operating system commands on the IRC server, with the privileges of the user running it. The trigger is input whose first two bytes are AB, followed by whatever command the attacker wants to run. The report does not describe any authentication requirement or network position beyond reaching the server.
Fix
The report does not describe a patch or a code change. The lesson it draws is about supply chain integrity: the biggest vulnerability here was not in the software itself but in the integrity of the software distribution process, The lesson it draws is about supply chain integrity: the biggest vulnerability here was not in the software itself but in the integrity of the software distribution process.
Variants to test
- Other trojanised archives from the same era. Check whether a binary resolves
system,popen,execveor similar through its dynamic relocations, then find the call sites. A positive result is a relocation entry for one of those functions in a program that has no legitimate reason to spawn a shell. - Hardcoded magic prefixes. Look for short constant strings compared against the start of a receive buffer, such as the two-byte
"AB"here. A positive result is a comparison whose length matches the constant and whose success path reaches a command execution function. - Shell metacharacter bypass of a prefix check. When a prefix is required, try appending
;,&&,|or a newline after it. A positive result is the appended command running while the prefix itself fails. - Non-PIE binaries. Check
checksecoutput forNo PIE; fixed addresses make static tracing of call sites much faster. A positive result is a stable address for the suspicious function across runs.
Hunting notes
This kind of bug hides in code paths that handle untrusted input and then reach a shell, and the strongest recon signal is a dynamic relocation for system in a binary that should never need it. From there, searching the disassembly for references to system and reading the surrounding decompilation narrows the trigger condition quickly. The report shows impact by tracing the comparison, the jump and the call, then demonstrating with a minimal recreation that a prefixed command reaches the shell; that chain, from relocation to call site to trigger string to executed command, is what makes the finding convincing.
What started as a suspicious reference to system() led through assembly instructions, Ghidra decompilation, memory references and the backdoor's trigger condition, and ended with a two-byte string opening the door to remote command execution.
What happened, in plain words
Imagine a postal service that is supposed to do one thing: carry letters between people. Now imagine someone secretly modifies the sorting office so that any letter whose first two characters are the letters "AB" is not delivered at all, but instead is read out as an instruction to the staff, who then do whatever it says. That is essentially what happened to a piece of software called UnrealIRCd.
UnrealIRCd is an IRC server. IRC stands for Internet Relay Chat, one of the oldest ways people chat online in groups. An IRC server is the central computer that receives messages from one person and passes them on to everyone else in a chat room. Its whole job is relaying text between people.
In 2009 to 2010, the version UnrealIRCd [redacted] was being handed out from some download sites in a tampered form. The package of source code that people downloaded had been quietly changed before it reached them. The changed code added a hidden feature: if a message arriving at the server began with the two characters AB, the server would stop treating the rest of the message as chat text and instead hand it to the operating system to run as a command. A command is an instruction to the computer, like "list the files" or "show me who is logged in".
Because the server runs as some user account on the machine, any command sent this way runs with that user's powers. A remote attacker can therefore run commands on it with that user's powers. This kind of flaw, where an attacker can run their own commands on someone else's machine, is called remote command execution, often shortened to RCE. The flaw was given the identifier CVE-2010-2075. A CVE is a public catalogue number for a known security flaw, so people around the world can refer to the same bug unambiguously.

The rest of this article walks through how the researcher took the tampered program apart, found the hidden trigger, and proved what it does. Every step is explained from scratch, so you do not need any prior security knowledge.
Setting up the lab environment
To study a program, you first need a copy of it. The researcher used a deliberately vulnerable practice machine called Metasploitable 2, which is a virtual computer built for learning security, and a second machine running Kali Linux, a Linux distribution that comes with many analysis tools preinstalled. A Linux distribution is an operating system built around the Linux kernel, the core of the system; think of it as a brand of the same underlying system.
The program file itself, called the unrealircd binary, lived in the folder /usr/bin/ on the practice machine. A binary is the compiled, ready-to-run form of a program: the file the computer actually executes, as opposed to the human-readable source code. The researcher copied it from /usr/bin/ on Metasploitable 2 to the Kali machine using wget.
wget is a small command-line tool for downloading files over the web. To give wget something to download, the researcher first started a temporary web server on the practice machine. A web server is a program that hands out files when another computer asks for them by address; it is the same kind of software that serves ordinary websites, just used here for one file.
sudo python -m SimpleHTTPServer 8000
Line by line:
sudomeans "run the following command with administrator rights". Starting a server that listens for network connections usually needs those rights.pythonruns the Python programming language interpreter, a program that executes Python code.-m SimpleHTTPServertells Python to run one of its built-in modules, here a tiny web server calledSimpleHTTPServer. A module is a bundle of ready-made code that comes with Python.8000is the port number. A port is like a numbered door on a computer: many programs can run on one machine, and each listens on its own door number so incoming traffic reaches the right one. Port 8000 is a common choice for temporary servers.
So this single line starts a small web server that will hand out files from the current folder to anyone who asks on port 8000. The researcher could then point wget on the Kali machine at that address and pull the binary across.

With the file in hand, the next question was how the program was built, because the way a program is built affects how easy it is to analyse. The researcher ran a tool called checksec. checksec inspects a binary and reports which built-in defences are switched on. One result stood out: PIE (Position Independent Executable): No PIE.
To understand why that matters, you need to know about ASLR, which stands for Address Space Layout Randomisation. Every running program lives in the computer's memory, and every piece of it sits at a numbered address, much like houses on a very long street. ASLR is a defence that shuffles where the program's parts are placed each time it starts, so an attacker cannot rely on a particular function always being at the same address. PIE is the property of a program that allows this shuffling to apply to the main program file itself.
With No PIE, the main executable is loaded at a fixed address every single time, and ASLR cannot move it. That means the addresses of its functions and instructions stay identical between runs. For someone doing static analysis, which means studying a program without running it, this is a gift: a note saying "the interesting code is at address X" remains true forever, and you can jump straight to it.

Finding it
Next the researcher looked at the binary's dynamic relocations using a tool called objdump. This needs a little background.
Most programs do not contain every piece of code they use. They rely on shared libraries, which are collections of common functions stored once on the system and used by many programs. On Linux the main one is the C library, usually called glibc, which provides basic services like reading input and printing text. When a program is built, it does not know exactly where in memory those shared functions will be, so it leaves a note saying "I need function so-and-so from library such-and-such; please connect it when I start". Those notes are the dynamic relocations, and the process of connecting them at startup is called dynamic linking.
objdump is a command-line tool that can display these notes and other internal details of a binary. One entry immediately caught the researcher's attention:
080b6354 R_386_JUMP_SLOT [redacted]
Line by line:
080b6354is the memory address where this relocation entry lives inside the binary.R_386_JUMP_SLOTis the type of relocation. In plain terms it says "this is a slot that will be filled with the address of a function from a shared library, so calls can jump to it".[redacted]names the function being requested:system, from the C library glibc, version 2.0 of its interface.
Why did that matter? Because system() is a C library function whose entire purpose is to take a line of text and run it as a shell command. A shell is the program that reads typed commands and executes them; system() hands its text to that program. Seeing system requested by an IRC server is like finding a megaphone in a library: not automatically a crime, but definitely worth asking about.
The researcher was careful to say this was not proof of a backdoor. Plenty of legitimate programs use system() for harmless reasons. But it was a strong lead, and it raised two questions: where in the program is system() actually called, and what input causes that call to happen?

To answer the first question, the researcher searched the disassembly for references to system. Disassembly is the process of turning a binary back into assembly language, the low-level list of instructions the processor executes, one per line. The search found a call instruction at address 0x0805a798, which confirmed the binary really does invoke system().
The researcher noted the irony: this is an IRC server, whose job is relaying messages between people, yet somewhere it had decided that relaying shell commands was also part of its duties.
Following the trail in assembly

805a791: movl $0x80b7ec0,(%esp)
805a798: call 8056b6c <system@plt>
805a79d: jmp 805a23f <read_message+0x71f>
Line by line:
805a791: movl $0x80b7ec0,(%esp)is an instruction at address805a791.movlmeans "move a 4-byte value".$0x80b7ec0is a fixed number, here a memory address, written in hexadecimal (base 16, a compact way of writing numbers that computers use; the0xprefix marks it as hexadecimal).(%esp)refers to the stack pointer register,esp, which tracks the top of the stack. The stack is a scratch area of memory used to pass arguments to functions. So this line places the address0x80b7ec0onto the stack, ready to be handed to the next function as its argument.805a798: call 8056b6c <system@plt>calls the function at address8056b6c, which the tool has labelledsystem@plt. PLT stands for Procedure Linkage Table, a small set of trampolines that forward calls to functions in shared libraries. So this is the actual call tosystem().805a79d: jmp 805a23f <read_message+0x71f>is an unconditional jump to address805a23f. The label<read_message+0x71f>tells us this address is inside a function calledread_message, at an offset of0x71fbytes from its start. In other words, after running the command, the program goes back to reading messages.
Put together: the program pushes the address 0x80b7ec0 as the argument, calls system(), and then returns to its normal message-reading loop. The argument 0x80b7ec0 is what will be handed to system(). The obvious next question is what is stored at that address.
Firing up Ghidra

Reading raw assembly is slow, so the researcher used Ghidra, a free reverse-engineering tool. Reverse engineering means working backwards from a finished program to understand how it was built and what it does. Ghidra includes a decompiler, a feature that takes assembly and produces approximate C-like code, which is much easier for humans to follow.
Decompiling the read_message() function produced a suspicious block:
1 LAB_0805a21f:
2 bVar14 = iStack_144 == 0;
3 if (!bVar14) {
4 iVar9 = 2;
5 pcVar6 = &readbuf;
6 pcVar13 = "AB";
7
8 do {
9 if (iVar9 == 0) break;
10 iVar9 = iVar9 + -1;
11 bVar14 = *pcVar6 == *pcVar13;
12 pcVar6 = pcVar6 + 1;
13 pcVar13 = pcVar13 + 1;
14 } while (bVar14);
15
16 iVar9 = Hooks._196_4_;
17 if (bVar14) {
18 system(&readbuf);
19 iVar9 = Hooks._196_4_;
20 }
Line by line, in plain words:
- Line 1,
LAB_0805a21f:, is a label: a name for this spot in the code so other parts can jump to it. - Line 2,
bVar14 = iStack_144 == 0;, sets a true/false variable to the answer of "is this local variable equal to zero?". - Line 3,
if (!bVar14) {, means "if that answer is not true", so the block below runs only when the variable was not zero. - Line 4,
iVar9 = 2;, sets a counter to 2. This is the number of bytes that will be compared. - Line 5,
pcVar6 = &readbuf;, points a variable atreadbuf, the buffer where the incoming message is stored. A buffer is simply a reserved chunk of memory for holding data, here the text just received. - Line 6,
pcVar13 = "AB";, points another variable at the hardcoded string"AB". This is the first thing that stood out: why would a chat server compare incoming messages against the letters A and B? - Line 8,
do {, starts a loop that runs at least once. - Line 9,
if (iVar9 == 0) break;, stops the loop once the counter reaches zero. - Line 10,
iVar9 = iVar9 + -1;, subtracts one from the counter each pass. - Line 11,
bVar14 = *pcVar6 == *pcVar13;, compares the byte currently pointed at in the message with the byte currently pointed at in"AB", and records whether they are equal. - Lines 12 and 13,
pcVar6 = pcVar6 + 1;andpcVar13 = pcVar13 + 1;, move both pointers forward by one byte, so the next pass compares the next pair of bytes. - Line 14,
} while (bVar14);, repeats the loop as long as the last comparison was equal. - Line 16,
iVar9 = Hooks._196_4_;, reads some internal bookkeeping value; it is not central to the backdoor. - Line 17,
if (bVar14) {, means "if the last comparison was equal", that is, if the bytes matched. - Line 18,
system(&readbuf);, is the second thing that stood out: it passes the whole receive buffer tosystem(), which runs it as a command. - Line 19 repeats the bookkeeping read.
So the logic is: compare at most two bytes of the incoming message against "AB", and if they match, run the entire message as a shell command. The comparison loop runs at most two iterations, and the whole buffer, not just the two bytes, goes to the shell.
Identifying the backdoor trigger string

The decompiler showed the shape of the check, but to be certain the researcher looked at the actual assembly instructions just before the comparison. These set up the registers and counter the comparison needs. Registers are tiny, very fast storage slots inside the processor; each has a name, and assembly instructions move data between them and memory.
1. 0805a225 MOV EAX,DAT_080a575c
2. 0805a22a MOV ESI,readbuf
3. 0805a22f CLD
4. 0805a230 MOV ECX,0x2
5. 0805a235 MOV EDI,EAX
Line by line:
MOV EAX,DAT_080a575ccopies the memory address labelledDAT_080a575cinto the registerEAX. The labelDAT_...is Ghidra's name for a piece of data it found at that address.MOV ESI,readbufcopies the address of the receive buffer into the registerESI.CLDclears the Direction Flag, a processor setting that controls whether string operations walk forward or backward through memory. Clearing it means they move forward, which is the normal direction for reading a message from its start.MOV ECX,0x2puts the number 2 into theECXregister. In string operations,ECXacts as the counter: it says how many bytes to process. Two means two bytes will be compared.MOV EDI,EAXcopies the address that was inEAXintoEDI, soEDInow points at the same data asDAT_080a575c.
After these five instructions, EDI points at the reference data and ESI points at the incoming message, and ECX says to compare two bytes. That is exactly the setup the next instruction, REPE CMPSB, expects.

To find out what DAT_080a575c actually contains, the researcher followed the reference in Ghidra and looked at the bytes stored there:
080a575c 41 ; A
080a575d 42 ; B
Line by line:
080a575c 41 ; Ameans that at memory address080a575cthe byte value is41in hexadecimal, and the comment notes this is the characterA.080a575d 42 ; Bmeans the next byte, at the next address, is42in hexadecimal, the characterB.
Why do 41 and 42 mean A and B? Because computers store text as numbers using a standard code called ASCII. In ASCII, each character has a number: capital A is 65 in ordinary decimal, which is 41 in hexadecimal, and capital B is 66, which is 42. So the two bytes at DAT_080a575c spell the string "AB". That confirms the hardcoded reference string used by the comparison is exactly "AB".
Tracing the backdoor logic

The researcher then traced the do block from the decompiled code down to the actual assembly instructions at 0x0805a237 and 0x0805a239:
0805a237 CMPSB.REPE ES:EDI, ESI
0805a239 JZ LAB_0805a791
Line by line:
0805a237 CMPSB.REPE ES:EDI, ESIis a string comparison instruction.CMPSBcompares one byte at the address inEDIwith one byte at the address inESI. TheREPEprefix means "repeat while equal", so it keeps comparing byte after byte as long as each pair matches, stopping when they differ or when the counter inECXruns out. SinceECXwas set to 2, it compares the first two bytes of the incoming message against"AB".0805a239 JZ LAB_0805a791is a conditional jump.JZmeans "jump if zero", and the Zero Flag is a processor marker that gets set when a comparison finds the two values equal. So if both bytes matched, the program jumps to the labelLAB_0805a791, which is exactly where thesystem()call sits.
That closes the loop: the first two bytes of the message are compared with "AB", and on a match the program jumps straight to the code that runs the message as a command.
Reconstructing CVE-2010-2075

With the comparison and the call traced, the behaviour is clear: if the first two bytes of the received input are "AB", the entire input is passed to system(). To demonstrate the logic without needing the real server, the researcher wrote a simplified Python recreation:
import os
user_input = input("Enter a string: ")
input_bytes = user_input.encode()
if input_bytes[:2] == b"AB":
os.system(user_input)
else:
print("Executing program normally")
Line by line:
import osloads Python'sosmodule, which provides access to operating system features, including running commands.user_input = input("Enter a string: ")shows a prompt and stores whatever the user types as text inuser_input.input_bytes = user_input.encode()converts that text into bytes, the raw numeric form the computer stores. This matters because the real program compares raw bytes, not text.if input_bytes[:2] == b"AB":checks whether the first two bytes, written[:2]meaning "from the start up to but not including position 2", equal the two bytesb"AB". Thebprefix marks a bytes value rather than ordinary text.os.system(user_input)runs the whole original input as a shell command, exactly as the backdoor does.else:andprint("Executing program normally")handle the case where the prefix does not match, printing a harmless message instead.
The results show an important detail about how the backdoor works.
When the researcher entered id on its own, the program continued normally, because the input did not begin with the required "AB" prefix. (id is a standard Linux command that reports which user you are; it is a common way to show what powers an attacker has gained.)
Entering ABid triggered the backdoor, but the shell tried to execute ABid as a command, and there is no such command, so it returned a command-not-found error. The trigger worked, but the command did not, because the letters AB were stuck to the front of it.
Things became more interesting with AB;id. The comparison only looks at the first two bytes, so the "AB" prefix satisfies the trigger condition. But the entire input, prefix included, is passed to system(). This is where the semicolon (;) comes in. In shell syntax, a semicolon separates commands, so the shell runs the next command regardless of whether the previous one succeeds. The shell first tries to run AB, which fails because no such command exists, and then runs id, which succeeds and returns the current user's information.
In other words, the semicolon is not required to trigger the backdoor. It is required in this example to separate the AB trigger prefix from the actual shell command.
Root cause
The tampered source archive added a check inside read_message() that compares the first two bytes of the received buffer against the hardcoded string "AB" and, on a match, hands the entire buffer to system(). Because the comparison covers only two bytes and the full input is passed on, a command can be appended after the prefix, separated by a semicolon as demonstrated.
It was built without PIE, which made the call site easy to locate statically, and the system@GLIBC relocation pointed to the dangerous dependency before any code was even read. The weakness is in the distribution process rather than in UnrealIRCd's own design: the source archive on some mirrors had been modified before users downloaded it.
Impact
A remote attacker can execute arbitrary operating system commands on the IRC server, with the privileges of the user running it. The trigger is input whose first two bytes are AB, followed by whatever command the attacker wants to run. The report does not describe any authentication requirement or network position beyond being able to reach the server.
Fix
The report does not describe a patch or a code change. The lesson it draws is about supply chain integrity, meaning trust in the chain of steps by which software reaches you: the biggest vulnerability here was not in the software itself but in the integrity of the software distribution process. The lesson it draws is about supply chain integrity: the biggest vulnerability here was not in the software itself but in the integrity of the software distribution process.
Variants to test
- Other trojanised archives from the same era. Check whether a binary resolves
system,popen,execveor similar through its dynamic relocations, then find the call sites. A positive result is a relocation entry for one of those functions in a program that has no legitimate reason to spawn a shell. - Hardcoded magic prefixes. Look for short constant strings compared against the start of a receive buffer, such as the two-byte
"AB"here. A positive result is a comparison whose length matches the constant and whose success path reaches a command execution function. - Shell metacharacter bypass of a prefix check. When a prefix is required, try appending
;,&&,|or a newline after it. A positive result is the appended command running while the prefix itself fails. - Non-PIE binaries. Check
checksecoutput forNo PIE; fixed addresses make static tracing of call sites much faster. A positive result is a stable address for the suspicious function across runs.
Hunting notes
This kind of bug hides in code paths that handle untrusted input and then reach a shell, and the strongest early signal is a dynamic relocation for system in a binary that should never need it. From there, searching the disassembly for references to system and reading the surrounding decompilation narrows the trigger condition quickly. The report shows impact by tracing the comparison, the jump and the call, then demonstrating with a minimal recreation that a prefixed command reaches the shell. That chain, from relocation to call site to trigger string to executed command, is what makes the finding convincing.
What started as a suspicious reference to system() led through assembly instructions, Ghidra decompilation, memory references and the backdoor's trigger condition, and ended with a two-byte string opening the door to remote command execution.
Glossary
- Address: the numbered location of a piece of data or code in a computer's memory, like a house number on a very long street.
- ASCII: a standard way of representing text as numbers, where each character has its own number (capital
Ais 65,Bis 66). - ASLR (Address Space Layout Randomisation): a defence that shuffles where a program's parts sit in memory each time it starts, so attackers cannot rely on fixed addresses.
- Assembly language: the low-level list of instructions a processor executes, one per line, produced by disassembling a binary.
- Backdoor: a hidden feature deliberately added to software that lets someone bypass normal access and take control.
- Binary: the compiled, ready-to-run form of a program, as opposed to its human-readable source code.
- Buffer: a reserved chunk of memory used to hold data, such as an incoming message.
- Byte: a unit of computer data made of eight bits, enough to store one character.
- C library (glibc): the collection of common functions that most Linux programs rely on, including
system(). - checksec: a tool that inspects a binary and reports which built-in security defences are enabled.
- Command: an instruction to the operating system, such as
id, which reports the current user. - CVE: a public catalogue number for a known security flaw, so people worldwide can refer to the same bug unambiguously.
- Decompiler: a tool that turns assembly back into approximate C-like code that humans can read more easily.
- Direction Flag: a processor setting that controls whether string operations walk forward or backward through memory.
- Disassembly: the process of turning a binary back into assembly language.
- Dynamic linking: connecting a program at startup to functions stored in shared libraries.
- Dynamic relocations: the notes inside a binary saying which shared-library functions it needs and where to connect them.
- Ghidra: a free reverse-engineering tool that includes a decompiler.
- Hexadecimal: base-16 number notation, marked with a
0xprefix, used as a compact way to write numbers in computing. - IRC (Internet Relay Chat): an old but still used system for group text chat, where a central server relays messages between people.
- Kali Linux: a Linux distribution that comes with many security analysis tools preinstalled.
- Linux distribution: an operating system built around the Linux kernel, like a brand of the same underlying system.
- Metasploitable 2: a deliberately vulnerable virtual machine built for practising security.
- Module: a bundle of ready-made code that comes with a programming language such as Python.
- PIE (Position Independent Executable): a property of a program that allows its own code to be placed at a randomised address; without it, the program loads at a fixed address.
- PLT (Procedure Linkage Table): a small set of trampolines that forward calls to functions in shared libraries.
- Port: a numbered door on a computer that lets incoming network traffic reach the right program.
- Privileges: the powers a user account has, such as which files it may read or change.
- Register: a tiny, very fast storage slot inside the processor, each with a name such as
EAXorESI. - Remote command execution (RCE): a flaw that lets an attacker run their own commands on someone else's machine over a network.
- Reverse engineering: working backwards from a finished program to understand how it was built and what it does.
- Shell: the program that reads typed commands and executes them.
- Stack: a scratch area of memory used to pass arguments to functions and keep track of where to return.
- Stack pointer: the register that tracks the top of the stack.
- Static analysis: studying a program without running it.
- Supply chain integrity: trust in the chain of steps by which software reaches you, from author to download site.
- Web server: a program that hands out files to other computers that ask for them by address.
- wget: a command-line tool for downloading files over the web.
- Zero Flag: a processor marker set when a comparison finds two values equal, used by conditional jumps such as
JZ.