OWASP API security – 7: Security misconfiguration

Introduction

1: Broken object level authorisation

2: Broken user authentication

3: Excessive data exposure

4: Lack of resources & rate limiting

5: Broken function level Authorization

6: Mass assignment

7: Security misconfiguration

8: Injection

9: Improper assets management

10: Insufficient logging & monitoring


 

The Security Misconfiguration vulnerabilities cover a range of common security mistakes made when exposing services over the internet.  One important part to note is that a service’s default configuration can be a Security Misconfiguration.  Any information on or insight into a service may give an attacker valuable information that can be used to exploit the service.  HTTP servers may present version numbers in default response headers or bodies.  Intentionally calling the service with bad request data may return a stack trace that might give valuable information regarding libraries used by the application or file names and paths.

To prevent Security Misconfiguration exploits service owners must carefully examine the data returned by the service in all scenarios, success to failure, and ensure that all exposed services and their dependencies are up to date with the latest security fixes.

OWASP summary

Threat agents/Attack vectors Security Weakness Impacts
API Specific : Exploitability 3 Prevalence 3 : Detectability 3 Technical 2 : Business Specific
Attackers will often attempt to find unpatched flaws, common endpoints, or unprotected files and directories to gain unauthorized access or knowledge of the system. Security misconfiguration can happen at any level of the API stack, from the network level to the application level. Automated tools are available to detect and exploit misconfigurations such as unnecessary services or legacy options. Security misconfigurations can not only expose sensitive user data, but also system details that may lead to full server compromise.

Source: OWASP Security Misconfiguration

APIM context

One of the values of an APIM is to help protect the API from Security Misconfiguration exploits.  The APIM, when also configured correctly, will limit the types of calls that can be made to the service, remove and modify headers, modify the response body, ensure connections are secured, and replace responses based on status code.

Tyk approach

Limiting the scope of information returned by an API can be achieved with various Tyk features:

  1. Response Header manipulation to remove or modify API response headers that reveal implementation details.
  2. Response Body manipulation to remove or modify parts of the API response body that reveal implementation details.
  3. TLS to help clients make sure they are connecting to the right service and encrypt the traffic.
  4. Mutual TLS with both the clients and API helps ensure that only callers with explicitly whitelisted client certificates can connect to the endpoints.
  5. Error Templates allow serving a different response body based on status code and content type, which can help minimize the implementation details sent to the client.
  6. CORS functionality allows the Tyk Gateway to limit API access to particular browser-based consumers.
  7. Policy Path-Based Permissions and the Whitelist plugin prevent clients from accessing API endpoints using non-authorised HTTP methods. For example, blocking the use of the DELETE method on an endpoint which should only accept GET requests.
  8. Tyk can be configured using Environment Variables, which take precedence over values in local configuration files. The use of environment variables can help standardise configuration across containerised deployments.
  9. For GraphQL APIs:
    1. Schema Introspection ensures that the Tyk Dashboard automatically uses the schema of the upstream GraphQL API, and can keep it synchronised if it changes.
    2. GraphQL Schema Validation prevents invalid schemas from being saved. This catches errors such as duplicate type names and usage of unknown types.
  10. Third-party Secret Storage can be used to centralise configuration of sensitive data such as passwords. This data can then be dynamically referenced by Tyk configuration files, rather than hard coded.
  11. Custom Plugins for more complex cases, users can write custom plugins in a variety of languages, either directly or through gRPC calls, to implement their requirements.

APIM owners should schedule regular Penetration Tests to ensure the security of their published services.  Tyk, through our Professional Services or Partners, can assist in the process.