EDUCATE.
TRANSFORM.
PROTECT.

Delivering expert cyber security solutions to small and medium-sized businesses

Learn More

Understanding API Attacks and How to Prevent Them

What is an API and how do API attacks work?

The application programming interface (API) is a tool within software that facilitates application connections. The API facilitates easy communication between applications using a variety of tools, routines and different protocols for data exchange and extraction. The web API enables the app to communicate with other services and platforms. Unfortunately, like all other software, APIs are hackable and proving increasingly prone to attacks.

How do hackers launch an API attack?

Hackers try to break into APIs by assessing their security vulnerabilities. They try to access the information regarding their implementation methods and structure. API security vulnerabilities can range from lack of encryption to poor authentication methods, vulnerability to DDOS attacks and many others. Since API attacks change form constantly, they can be difficult to identify. Below we list out the most common API attack types.

6 most common types of API attacks

Man-in-the-middle attacks (MITM)

MITM attacks are quite literal, in the sense that a hacker can quietly relay, modify, and intercept communications, messages, and requests between two endpoints of a communication channel to illicitly gain sensitive information. For instance, the attacker can intercept a session token issuing API to an HTTP header and a user to gain access to the victim’s account leading to data compromise and theft.

DDoS Attacks

Distributed Denial of Service (DDoS, or D-doss) attacks are used so often that they have become a staple even in popular culture. Hackers gain control of multiple systems to send spurious requests to the targeted server and flood its bandwidth. A DDoS attack on a web APIis similar. In this type of attack, the attempt is geared towards overwhelming the API’s memory by requesting several thousand connections simultaneously. Hackers could also try to overload by sending large amounts of information with each request. This generally leads to all available resources being clogged up, resulting in an inevitable crash.

API Injection Attack

Applications with poorly developed code are prone to API Injection Attacks. This attack is fairly straightforward as the hacker simply injects malicious code in software, like SQLi (SQL injection) and XSS (cross-site scripting). The aim is to gain access to your software.

Insecure API Key Generation

API security tools, such as API key or JWT (JSON Web Token) can track and protect your API by detecting abnormal API behavior and blocking access to an API key automatically. Hackers circumvent these defenses by generating and using a number of API keys from a huge pool of users.

Incorrect Server Security

Misconfigured SSL certificates and accepting non-HTTPS traffic can lead to data leaks. While there is no reason for modern applications to accept non-HTTPS requests, customers can sometimes mistakenly raise a non HTTP request that leads to the exposure of the API key. Since APIs lack the protection of a browser, redirection to HTTPS is of no consequence here.

Insufficient Logging & Monitoring

Without proper API logging and monitoring, you may be opening yourself up to hackers exploiting the same vulnerabilities again and again over a period of time. They could even use the first vulnerability as a secure foothold to search for additional vulnerabilities. Managed IT Services Houston can help you Scan your system for existing exploits as well as defend yourself against future vulnerabilities.

API Security Checklist to prevent API attacks

Apply Two Factor Authentication

Two Factor Authentication (2FA) refers to an additional layer of security where a user has to enter an additional passcode other than the password itself. This additional passcode is generally randomly generated and sent to a previously trusted device owned by the user. For instance, a lot of banks use 2FA with an SMS push notification that sends a time-sensitive pin to a registered mobile number upon account access. In order to gain access to their account, users must enter their credentials, such as username and password, as well as the time-sensitive PIN shared on the registered mobile number. Since access to physical devices is often challenging for hackers, Two Factor Authentication offers an enhanced level of API security.

Encrypt Your Data

Recent data indicates that as much as 69% of the organizations continue to share their APIs with partners and customers. Given this scenario, encrypting all traffic in transit with a Secure Sockets Layer (SSL) is an effective method to weed out hackers. Even if the hackers manage to breach your defenses and get at the data, it will prove useless to them without decryption methods.

Defend yourself against API Key Pools

A simple but effective measure against API key pools is simply to require a human interaction for every request to sign up to your service and generate API keys. Captcha and 2-Factor Authentication are quite effective at removing bot traffic. You should only enable trusted customers to generate API keys programmatically unless there is a specific reason for not doing so. You should also monitor for any anomalies at the user and account level, apart from each API key.

Ensure Proper SSL

SSL implementation should be regularly tested. For effective API security, block all non-HTTP requests in your load balancer and eliminate any HTTP headers and error messages that may accidentally show implementation details.

Carefully add API logging

API Security logging needs to track the API requests and also users for enhanced user behavior analytics. This data should be stored in your database for at least a year with zero provisions for accidental deletion or early retirement. Since API audit logs are required for security, data regulation frameworks such as GDPR and CCPA provide exceptions for them. You should look for solutions that offer comprehensive API monitoring and analytics for API products.

Fix Authorization

Authenticated users must be authorized to access all resources that are relevant for the API response. This can be easily done by checking the specific user identification credentials or access control lists (ACL) linked to the relevant objects in API Management.

Article Reference Credit:  Scott Young, President at PennComp LLC.

CONTACT US FOR A FREE CONSULTATIONGetting started in security can be challenging. Let us help ease the burden of security and compliance with our small-mid sized business services and solutions.