rootđź’€senseicat:~#

Hack. Eat. Sleep. Repeat!!!


Project maintained by SENSEiXENUS Hosted on GitHub Pages — Theme by mattgraham

API RECONNAISSANCE


Postman Introduction



API Development(Postman)


image


Proxying Postman through Burp SUite


image

image


Techniques



/api
/v1
/v2
/v3
/rest
/swagger
/swagger.json
/docs
/doc
/graphql
/graphiql
/altair
/playground
api.target-name.com
uat.target-name.com
dev.target-name.com
developer.target-name.com
test.target-name.com
{"message": "Missing Authorization token"}

Github Postman Explore APIS guru Public Apis Github Project Rapid API Hub


PASSIVE RECONNAISSANCE


Queries-:

api key
apikeys
api key
authorization: Bearer
access_token
secret
token
API Key exposed

Syntax-: trufflehog git <repo> --results=verified,unknown

hostname:sensei.com 
"content-type: application/json" <-> filter responses with json body
"content-type: application/xml"  <-> filter responses with xml body
"200 OK"  <-> successful requests
"wp-json"  <-> This will search for web applications using the WordPress API.

Active Reconnaissance


image

curl https://raw.githubusercontent.com/OWASP/Amass/master/examples/config.ini >~/.config/amass/config.ini

amass enum -active -d <target> |grep api


Endpoint Analysis


Reverse engineering an api with postman and mitmweb


 pip3 install mitmproxy2swagger
 pip3 install mitmweb

image

image


Creating custom documentation with MITMweb


image

sudo mitmproxy2swagger -i /Downloads/flows -o spec.yml -p http://crapi.apisec.ai -f flow

image

image

image

sudo mitmproxy2swagger -i /Downloads/flows -o spec.yml -p http://crapi.apisec.ai -f flow --examples

image


Excessive Data exposure


image


AUTHENTICATION ATTACKS


image

image

image

image

image


Passwords in requests can also be base64 encoded


image

image

image


Exploiting token flaws with jwt_tool.py


image

image


JWT ATTACKS



Automating jwt attacks with JWT_TOOL


image

image


JWT TOOL


image

python3 jwt_tool.py -t http://crapi.apisec.ai/identity/api/v2/user/dashboard -rh "Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJiaW1iaW16QGdtYWlsLmNvbSIsImlhdCI6MTc0MzUxMDEwNSwiZXhwIjoxNzQzNTk2NTA1fQ.OufYUVmq7Ys8Dn8FSTFNQLMDy3ZKRA3YAzuLzb0J4na0PDea4afHLeQhSbuXOUpethOxue5Z4GqtyDIaQPNTSA" -M pb -np


Broken Authorization


GET /api/resource/1
GET /user/account/find?user_id=15
POST /company/account/Apple/balance
POST /admin/pwreset/account/90

image


Broken Function Level Authorization



Improper Assets Management


api.target.com/v3
/api/v2/accounts
/api/v3/accounts
/v2/accounts
Accept: version=2.0
Accept api-version=3
/api/accounts?ver=2
POST /api/accounts

{
"ver":1.0,
"user":"hapihacker"
}

Mass Assignment


"isadmin": true,
"is_admin":"true",
"admin": 1,
"admin":true

API PATCH Method


[
   { "op": "test", "path": "/a/b/c", "value": "foo" },
   { "op": "remove", "path": "/a/b/c" },
   { "op": "add", "path": "/a/b/c", "value": [ "foo", "bar" ] },
   { "op": "replace", "path": "/a/b/c", "value": 42 },
   { "op": "move", "from": "/a/b/c", "path": "/a/b/d" },
   { "op": "copy", "from": "/a/b/d", "path": "/a/b/e" }
]