Skip to main content
5 min read Intermediate API

Rest API

REST API Pentesting Resources

An application programming interface (API) is a way for two or more computer programs or components to communicate with each other.

Tools and Wordlist

ToolsURLWord ListURL
Burp Suite ProDownloadAssetnoteWordlist
PostmanDownloadSecListsGitHub
KiterunnerGitHub
DirbKali Tools
GobusterKali Tools

API Pentesting Resources

CreditURL
Medium Articlehttps://medium.com/geekculture/rest-api-testing-github-postman-62ba105e550e
Hacktricks Bookhttps://book.hacktricks.xyz/network-services-pentesting/pentesting-web/web-api-pentesting
Vaadata Bloghttps://www.vaadata.com/blog/api-penetration-testing-objective-methodology-black-box-grey-box-and-white-box-tests/

GitHub Repositories for API Pentesting

CreditURL
arainhohttps://github.com/arainho/awesome-api-security
m14r41https://github.com/m14r41/PentestingEverything/tree/main/API%20Pentesting

API Security Checklists

CreditURL
Shieldfyhttps://github.com/shieldfy/API-Security-Checklist
APISec.ai Bloghttps://www.apisec.ai/blog/api-security-checklist
Astra Bloghttps://www.getastra.com/blog/api-security/api-security-checklist/
Salt Security Bloghttps://salt.security/blog/api-security-checklist
Indusface Bloghttps://www.indusface.com/blog/api-penetration-testing-checklist/

API Course Free

CreditURL
APISec Universityhttps://www.apisecuniversity.com/courses/api-penetration-testing

Vulnerable APIs

CreditURL
OWASPhttps://github.com/OWASP/crAPI
erev0shttps://github.com/erev0s/VAmPI
roottuskhttps://github.com/roottusk/vapi

API Pentesting Checklist

AspectRESTful APISOAP APIGraphQL APIWebsocket API
ProtocolHTTP/HTTPSHTTP/HTTPSHTTP/HTTPSWebSocket
Message FormatJSON, XMLXMLJSONCustom binary or text-based
Request MethodsGET, POST, PUT, DELETE, etc.POSTPOSTCustom
Endpoint StructureMultiple endpoints for different resourcesSingle endpointSingle endpointSingle endpoint
Query FlexibilityFixed structure for endpoints and data retrievalFixed structure defined by WSDLFlexible query structure for data retrievalReal-time bidirectional communication
Data FetchingPartial data fetching via endpointsPredefined request/response structureFlexible data fetching with custom queriesReal-time data updates
AuthenticationVarious methods (API keys, OAuth, JWT, etc.)Various methods (WS-Security, Basic Auth, etc.)Various methods (API keys, OAuth, JWT, etc.)Custom authentication schemes
Security ProtocolsHTTPS, TLSHTTPS, TLSHTTPS, TLSSSL/TLS
Common VulnerabilitiesInjection attacks (SQLi, XSS, etc.), Broken Authentication, Insecure Direct Object References, etc.XML External Entity (XXE) injection, SOAPAction header injection, etc.Injection attacks, Introspection leaks, Query depth attacks, etc.Message tampering, DoS attacks, Authorization bypass, etc.
Testing ConsiderationsInput validation, Authentication, Authorization, Error handling, Rate limiting, etc.WSDL file disclosures, Message validation, Encryption, etc.Query depth, Introspection, Authorization controls, etc.Message flooding, Message validation, Encryption, etc.

Information Gathering

  • Identify the API's purpose, business logic, and functionality.
  • Enumerate API endpoints and methods (GET, POST, PUT, DELETE, etc.).
  • Gather information about API versioning and changes.
  • Discover hidden or undocumented endpoints using fuzzing and brute force.
  • Obtain API documentation, if available, and review it for insights.

Authentication Testing

  • Test API authentication mechanisms, such as API keys, OAuth, JWT, or basic authentication.
  • Verify if authentication tokens or credentials are securely stored on the client side.
  • Test for missing or weak authentication, including default credentials.
  • Assess multi-factor authentication (MFA) if used.

Authorization Testing

  • Test role-based access control (RBAC) and authorization mechanisms.
  • Check if users can access resources they shouldn't have permissions for.
  • Test for horizontal privilege escalation by manipulating user roles.
  • Verify proper enforcement of access controls, such as admin vs. regular user.

Input Validation

  • Test for input validation and output encoding to prevent injection attacks.
  • Check for SQL injection, Cross-Site Scripting (XSS), and other injection vulnerabilities.
  • Verify if API endpoints properly validate and sanitize user inputs.
  • Assess file upload endpoints for malicious file uploads.

Data Exposure

  • Test for sensitive data exposure through API responses.
  • Verify if the API enforces proper data encryption in transit (HTTPS).
  • Check for information disclosure in error messages.
  • Ensure that data, especially personally identifiable information (PII), is redacted.

Rate Limiting and Resource Exhaustion

  • Test rate limiting and resource exhaustion controls.
  • Check if the API is vulnerable to brute force attacks or denial-of-service (DoS) attacks.
  • Test for API rate limiting bypass techniques.
  • Verify if anti-automation mechanisms are in place.

JWT and OAuth Testing

  • Test JSON Web Tokens (JWT) security, including signature validation.
  • Check for OAuth vulnerabilities, such as authorization code, implicit grant, and client credentials issues.
  • Verify if OAuth tokens are securely managed, rotated, and revoked.
  • Assess OAuth token scope and permissions.

API Rate Limiting

  • Test API rate limiting policies for different user roles.
  • Verify if rate limiting is consistently applied across API endpoints.
  • Check for bypasses or weaknesses in rate limiting controls.
  • Test for API rate limiting abuse and scenarios.

Error Handling

  • Test how the API handles errors and exceptions.
  • Check if error messages reveal sensitive information or internal details.
  • Verify that proper HTTP status codes are returned for different error scenarios.
  • Assess if error messages are consistent and not overly verbose.

Webhooks and Callbacks

  • Test webhooks and callback mechanisms.
  • Check for security vulnerabilities in callback URLs, such as SSRF or unauthorized callbacks.
  • Verify if callbacks are properly authenticated and validated.
  • Test for replay attacks or callback abuse.

image