Torna agli aggiornamenti
New releaseSep 13, 2026

sj v2.8.2

Uno strumento per auditare gli endpoint definiti in file di definizione esposti (Swagger/OpenAPI).

Condividi

sj (Swagger Jacker)

sj è uno strumento da riga di comando progettato per assistere nell'audit dei file di definizione Swagger/OpenAPI esposti, verificando gli endpoint API associati alla ricerca di autenticazione debole. Fornisce inoltre modelli di comandi per il test manuale delle vulnerabilità.

Lo fa analizzando il file di definizione per percorsi, parametri e metodi accettati, per poi utilizzare i risultati con uno dei cinque sottocomandi:

  • automate - Genera una serie di richieste e analizza il codice di stato della risposta.
  • prepare - Genera un elenco di comandi da utilizzare per il test manuale.
  • endpoints - Genera un elenco di route API grezze. I valori dei percorsi non verranno sostituiti con dati di test.
  • brute - Invia una serie di richieste a un target per trovare definizioni di operazioni basate su percorsi di file comunemente utilizzati.
  • convert - Converte un file di definizione dalla v2 alla v3.

Build

Per compilare dal sorgente, assicurati di avere installato Go versione >= 1.22.5 ed esegui go build all'interno del repository:

$ git clone https://github.com/BishopFox/sj.git
$ cd sj/
$ go build .

Install

Per installare l'ultima versione dello strumento, esegui:

$ go install github.com/BishopFox/sj@latest

# Note: you may also need to place the path to your Go binaries within your PATH environment variable:
$ export PATH=$PATH:~/go/bin

Usage

Usa il comando automate per inviare una serie di richieste a ciascun endpoint definito e analizzare il codice di stato di ogni risposta.

$ sj automate -u https://petstore.swagger.io/v2/swagger.json -qi -p http://127.0.0.1:8080               

Gathering API details.
⚠  POST     500  /v2/pet
⚠  PUT      500  /v2/pet
✓  GET      200  /v2/pet/findByStatus
✓  GET      200  /v2/pet/findByTags
✓  GET      200  /v2/pet/1
✓  POST     200  /v2/pet/1
⚠  POST     N/A  /v2/pet/1/uploadImage
✓  GET      200  /v2/store/inventory
⚠  POST     N/A  /v2/store/order
⚠  GET      N/A  /v2/store/order/1
✓  POST     200  /v2/user
⚠  POST     N/A  /v2/user/createWithArray
⚠  POST     N/A  /v2/user/createWithList
✓  GET      200  /v2/user/login
✓  GET      200  /v2/user/logout
✓  GET      200  /v2/user/bishopfox
✓  PUT      200  /v2/user/bishopfox

Puoi usare il flag --replay-proxy per riprodurre le richieste corrispondenti attraverso un proxy separato (ad esempio, Burp Suite). Questo ti consente di instradare tutto il traffico attraverso un proxy (o direttamente) inviando solo i risultati interessanti al tuo proxy di intercettazione:

$ sj automate -u https://petstore.swagger.io/v2/swagger.json -qi --replay-proxy http://127.0.0.1:8080

Puoi anche combinarlo con --proxy per instradare il traffico di scansione attraverso un proxy diverso mentre riproduci le corrispondenze verso Burp:

$ sj automate -u https://petstore.swagger.io/v2/swagger.json -qi -p http://proxy:9090 --replay-proxy http://127.0.0.1:8080

Puoi anche richiedere un output dettagliato per vedere la risposta parziale (o completa):

$ sj automate -u https://petstore.swagger.io/v2/swagger.json -qi -p http://127.0.0.1:8080 -v           

Gathering API details.
⚠  POST     500  /v2/pet
   {"code":500,"type":"unknown","message":"something 
⚠  PUT      500  /v2/pet
   {"code":500,"type":"unknown","message":"something 
✓  GET      200  /v2/pet/findByStatus
   []
✓  GET      200  /v2/pet/findByTags
   []
✓  GET      200  /v2/pet/1
   {"id":1,"category":{"id":1,"name":"cat"},"name":"d
✓  POST     200  /v2/pet/1
   {"code":200,"type":"unknown","message":"1"}
⚠  POST     N/A  /v2/pet/1/uploadImage
✓  GET      200  /v2/store/inventory
   {"sold":115,"bishopfox":1,"SOLD":1,"string":224,"d
⚠  POST     N/A  /v2/store/order
⚠  GET      N/A  /v2/store/order/1
✓  POST     200  /v2/user
   {"code":200,"type":"unknown","message":"1"}
⚠  POST     N/A  /v2/user/createWithArray
⚠  POST     N/A  /v2/user/createWithList
✓  GET      200  /v2/user/login
   {"code":200,"type":"unknown","message":"logged in 
✓  GET      200  /v2/user/logout
   {"code":200,"type":"unknown","message":"ok"}
✓  GET      200  /v2/user/bishopfox
   {"id":1,"username":"bishopfox","firstName":"bishop
✓  PUT      200  /v2/user/bishopfox
   {"code":200,"type":"unknown","message":"1"}

Usa il comando prepare per preparare un elenco di comandi per il test manuale. Attualmente supporta sia curl che sqlmap. Probabilmente dovrai modificarli leggermente.

$ sj prepare -u https://petstore.swagger.io/v2/swagger.json -qi -p http://127.0.0.1:8080

$ curl -X POST "https://petstore.swagger.io/v2/pet" -H 'Content-Type: application/json' -d '{"category":{"id":1,"name":"bishopfox"},"id":1,"name":"doggie","photoUrls":"https://bishopfox.com","status":"available","tags":[{"id":1,"name":"bishopfox"}]}'
$ curl -X PUT "https://petstore.swagger.io/v2/pet" -H 'Content-Type: application/json' -d '{"category":{"id":1,"name":"bishopfox"},"id":1,"name":"doggie","photoUrls":"https://bishopfox.com","status":"available","tags":[{"id":1,"name":"bishopfox"}]}'
$ curl -X GET "https://petstore.swagger.io/v2/pet/findByStatus?status=1"
$ curl -X GET "https://petstore.swagger.io/v2/pet/findByTags?tags=1"
$ curl -X GET "https://petstore.swagger.io/v2/pet/1"
$ curl -X POST "https://petstore.swagger.io/v2/pet/1" -H 'Content-Type: application/x-www-form-urlencoded' -d 'name=bishopfox&status=bishopfox'
$ curl -X POST "https://petstore.swagger.io/v2/pet/1/uploadImage" -H 'Content-Type: application/x-www-form-urlencoded' -d 'additionalMetadata=bishopfox&file=1'
$ curl -X GET "https://petstore.swagger.io/v2/store/inventory"
$ curl -X POST "https://petstore.swagger.io/v2/store/order" -H 'Content-Type: application/json' -d '{"complete":true,"id":1,"petId":1,"quantity":1,"shipDate":"1990-01-01","status":"placed"}'
$ curl -X GET "https://petstore.swagger.io/v2/store/order/1"
$ curl -X POST "https://petstore.swagger.io/v2/user" -H 'Content-Type: application/json' -d '{"email":"[email protected]","firstName":"bishopfox","id":1,"lastName":"bishopfox","password":"bishopfox","phone":"bishopfox","userStatus":1,"username":"bishopfox"}'
$ curl -X POST "https://petstore.swagger.io/v2/user/createWithArray" -H 'Content-Type: application/json' -d '[{"email":"[email protected]","firstName":"bishopfox","id":1,"lastName":"bishopfox","password":"bishopfox","phone":"bishopfox","userStatus":1,"username":"bishopfox"}]'
$ curl -X POST "https://petstore.swagger.io/v2/user/createWithList" -H 'Content-Type: application/json' -d '[{"email":"[email protected]","firstName":"bishopfox","id":1,"lastName":"bishopfox","password":"bishopfox","phone":"bishopfox","userStatus":1,"username":"bishopfox"}]'
$ curl -X GET "https://petstore.swagger.io/v2/user/login?username=bishopfox&password=bishopfox"
$ curl -X GET "https://petstore.swagger.io/v2/user/logout"
$ curl -X GET "https://petstore.swagger.io/v2/user/bishopfox"
$ curl -X PUT "https://petstore.swagger.io/v2/user/bishopfox" -H 'Content-Type: application/json' -d '{"email":"[email protected]","firstName":"bishopfox","id":1,"lastName":"bishopfox","password":"bishopfox","phone":"bishopfox","userStatus":1,"username":"bishopfox"}'

Più content type per il corpo della richiesta

Spesso un'operazione dichiara lo stesso corpo sotto diversi content type. Per impostazione predefinita sj invia quello con maggiori probabilità di essere accettato, preferendo application/json, poi application/x-www-form-urlencoded, poi multipart/form-data, poi XML. La scelta è deterministica, quindi esecuzioni ripetute producono comandi identici.

Poiché un parser JSON e un parser XML rappresentano superfici di attacco diverse, --all-content-types invia ogni tipo dichiarato invece di solo quello preferito:

Categorie