1337UP intigriti 2023

Bug report repo

This is the webpage of the challenge where we look at the page dealing in reports:

we keep on typing the number , we can see that the program responds the name and the status of the report

we can also see that no request was made to the back-end for this -> so everything must on the front-end

Though when bug not found says the id not on the display:

It gives a new report id-> 11 not on display {also from ethical hacker}

I got this code from the page's js file -> They were using websockets .. that's why nothing was on burp

explaintation

  1. Document Ready Function:

    • This part ensures that the document is fully loaded before executing the provided functions.

    • open_ws() is called to open a WebSocket connection.

    • An event listener is attached to the keyup event on the HTML element with the ID id. When a key is released, the bug_search() function is called.

  2. bug_search() Function:

    • Retrieves the value from the HTML element with the ID id.

    • If bug_id is not empty, it constructs a JSON message (msg) and sends it via the WebSocket (ws.send(msg)).

    • It then manipulates the style of table rows based on whether they match the bug_id.

  3. open_ws() Function:

    • Constructs a WebSocket (ws) using the current page's origin with the protocol changed to WebSocket (ws).

    • Sets up event handlers for onopen, onmessage, onerror, and onclose events.

    • Calls ping function at regular intervals (42 seconds).

  4. ping() and pong() Functions:

    • ping sends a __ping__ message through the WebSocket and sets a timeout.

    • pong clears the timeout, acting as a response to the ping.

exploit begins

what if we use the injection here? -> basic sqli

GUESS WE ARE RIGHT

we can use sqlmap to automate our finding -> sqlmap over websockets !! yes how to do so:

  1. Article-1 explaining everything.

  2. Article-2 shared by official writeup -> here

so using article-1 I made sure to understand the code and used it , also the code was made for the in-network server but we needed to connect to remote hosts over websockets so we used wss instead of ws in the protocol.

we also need to make sure that the negative id are not being transmitted as it's running sqlite3

so to do that we just imply a simple condition the code : if payload.startswith('-'): content="NOT sending due to -ve value"

code:

now this is our middle ware -> we'll send the request to him via sqlmap and this will forward it over websocket:

middle ware proxy getting sqlmap payloads

Last updated