Perfectly Coded APIs Can Be Susceptible To Attack

An Application Programming Interface (API) is a way for two or more computer programmes to communicate with each other - a type of software that offers a service to other pieces of software. API development has seen an over emphasis on ‘shift left’, whereby security testing, quality and performance are carried out solely in the development process rather than throughout the entire release cycle.  

While this has allowed departments to develop and roll out their own “secure” APIs, it assumes that the developer is happy to ‘mark their own homework’ and fix the code when many hate this aspect of the job. 

But there’s another more serious danger in that it creates a false sense of security. The assumption is that APIs that go live are then bullet proof.

In reality, while shift left efforts are beneficial, no measures will stop a persistent automated attack. If the assets being protected by that API are attractive enough, attackers will persist and will compromise it usually by using its own functionality against it in an attack known as business logic abuse.

Even if the API is coded perfectly correctly, adheres to the API specification it is designed against, and is properly inventoried and has been tested to ensure it is not susceptible to any of the OWASP (Open Web Application Security Project) Top Ten API Threats, it can still be probed and compromised. 

Research conducted during the first half of 2022 reveals that APIs were subjected to automated business logic abuse in numerous ways. Over three billion shopping bots were used to target well-formed APIs with a dense network of highly volumetric and geographically distributed fuzzing payloads. Over 290 million malicious gift card requests used enumeration based on fuzzing the numeric patterns on APIs that support payment and checkout microservices. And there were over 37 million comment spam requests detected against customer relationship management workflows.

Combined Assaults

Perfectly coded and inventoried APIs take more effort to compromise and so attacks will typically use multiple methods from the OWASP Top Ten. For instance, we’ve seen something we call the attack trifecta where attackers used API2 (Broken User Authentication), API3 (Excessive Data Exposure) and API9 (Improper Assets management), to perform detailed reconnaissance and analysis of how each API works, how they interact with each other, and the expected outcome. That information was then used for malicious purposes. 

Another real-world example is the Ulta Beauty case study where a large scale enumeration attack was executed against a third party inventory API. The inventory search API supplier notified the company security team of a traffic surge, requesting help to stop the attack. The investigation mapped the attack to OWASP API4 (Lack of Resources and Rate Limiting) and API5 (Broken Function Level Authorisation). 

Initially, the attackers targeted the web API before moving to the mobile API which provides similar information. The attack targeted the inventory API directly, without hitting any other app or web function (in contrast, normal behaviour would show the user traversing multiple APIs, generating upwards of 40-50 cookies as they browsed the inventory, whereas the attack generated just one). 

Originating from residential proxy IP addresses, the attack rotated through 153,000 unique product and SKU combinations while scraping 61,000 ZIP codes and 33,000 products but Web Application Firewall (WAF) and Content Delivery Network (CDN) mitigation efforts were ineffective. It was only stopped by policies that effectively blocked 85.9 million requests.

The Difficulty Of Detection 

In this particular case the company was alerted by its provider but how can businesses spot attacks against what they consider to be secure APIs? Web Application Firewalls (WAFs) or bot prevention tools are ineffective at preventing an API specific attack for several reasons. 

WAFs use signatures to detect known vulnerabilities as described in the OWASP Web Application Top 10 Threats list so will struggle to find and block attacks that appear legitimate, and they are unable to address the entire API protection lifecycle. Bot tools rely on JavaScript instrumentation to collect the telemetry required to understand and block the attack. As an API is clientless, it cannot be instrumented in this manner. Consequently, those that believe their APIs are secure and rely on traditional web security tools are lulled into a false sense of security.

The first step in any API protection initiative should always be a runtime inventory. This automatically logs all known and unknown endpoints, helping to discover and prioritise APIs by assessing the risk they represent, and applying sensitive data exposure protection and business logic abuse protection. The next step is to protect the APIs from attacks  using Machine Learning to determine the intent of transactions (whether performed by bots or individuals) and then quickly block them or send them down another path. 

With runtime security covered, development teams should look at more API specific testing solutions to complement and strengthen existing shift left efforts. Dynamic Application Security Testing (DAST) solutions that use specifications and documentation to understand how an API works, then looks for vulnerabilities should also be considered. Traditional web-focused testing tools lack the ability to derive the API context needed to test and find gaps and this is where DAST can really add value.  

There also needs to be acceptance that, while shift left is helping organisations deliver more secure APIs, even a perfectly coded API can be attacked. The OWASP Top Ten lists are useful, but should be viewed as a starting point.

Until we face up to the fact that all APIs will fall to a determined attacker, we can’t begin to adequately protect them.   

Andy Mills is VP for EMEA at Cequence Security

You Might Also Read: 

Types Of Security Testing Explained With Examples:

___________________________________________________________________________________________

If you like this website and use the comprehensive 6,500-plus service supplier Directory, you can get unrestricted access, including the exclusive in-depth Directors Report series, by signing up for a Premium Subscription.

  • Individual £5 per month or £50 per year. Sign Up
  • Multi-User, Corporate & Library Accounts Available on Request

Cyber Security Intelligence: Captured Organised & Accessible


 

« Europol Arrest Crypto Currency Fraud Gang
Sexual Abuse & Harassment Of Women »

CyberSecurity Jobsite
Perimeter 81

Directory of Suppliers

Alvacomm

Alvacomm

Alvacomm offers holistic VIP cybersecurity services, providing comprehensive protection against cyber threats. Our solutions include risk assessment, threat detection, incident response.

Resecurity, Inc.

Resecurity, Inc.

Resecurity is a cybersecurity company that delivers a unified platform for endpoint protection, risk management, and cyber threat intelligence.

Syxsense

Syxsense

Syxsense brings together endpoint management and security for greater efficiency and collaboration between IT management and security teams.

Jooble

Jooble

Jooble is a job search aggregator operating in 71 countries worldwide. We simplify the job search process by displaying active job ads from major job boards and career sites across the internet.

ON-DEMAND WEBINAR: What Is A Next-Generation Firewall (and why does it matter)?

ON-DEMAND WEBINAR: What Is A Next-Generation Firewall (and why does it matter)?

Watch this webinar to hear security experts from Amazon Web Services (AWS) and SANS break down the myths and realities of what an NGFW is, how to use one, and what it can do for your security posture.

Irish Reporting & Information Security Service (IRISS)

Irish Reporting & Information Security Service (IRISS)

IRISS-CERT is Ireland's first CSIRT (Computer Security Incident Response Team) to provide services to all users within Ireland.

CIO

CIO

CIO provides technology and business leaders with insight and analysis on information technology trends

Direct Recruiters Inc

Direct Recruiters Inc

Direct Recruiters is a relationship-focused search firm that assists IT Security and Cybersecurity companies with recruiting high-impact talent.

Bricata

Bricata

Bricata offers industry-leading IPS solutions for enterprise-wide threat prevention and unparalleled situational awareness.

Applied Risk

Applied Risk

Applied Risk is an established leader in Industrial Control Systems security, focused on critical infrastructure security and combating security breaches that pose a significant threat.

Exein

Exein

Exein are on a mission to build the world’s first ecosystem for firmware security so that all different types of firmware are secure around the world.

European Healthcare Fraud & Corruption Network (EHFCN)

European Healthcare Fraud & Corruption Network (EHFCN)

EHFCN is the only organisation dedicated to combating fraud, corruption and waste in the healthcare sector across Europe.

Datrix

Datrix

Datrix is a leading Smart Infrastructure and Cyber Security solutions provider. We deliver critical networking, communications and cyber security solutions to public and private sector organisations.

ConnectSecure

ConnectSecure

ConnectSecure (formerly CyberCNS) is a global cybersecurity company that delivers tools to identify and address vulnerabilities and manage compliance requirements.

Computer Services Inc (CSI)

Computer Services Inc (CSI)

CSI is a leading fintech, regtech and cybersecurity solutions partner operating at the intersection of innovation and service.

e5 Lab

e5 Lab

e5 Lab seeks to develop solutions to challenges faced by the shipping industry including digital transformation, autonomous technologies and big data in order to promote safe and efficient operations.

Tenable

Tenable

Organizations around the world rely on Tenable to help them understand and reduce cybersecurity risk across their attack surface—in the cloud or on-premises, from IT to OT and beyond.

CDS

CDS

CDS is a strategic change agency enabling organisations and businesses to create and build better services to meet the evolving needs of customers, employees and citizens.

Cytidel

Cytidel

Cytidel is a vulnerability and risk management platform that utilises threat and business intelligence to help IT Security teams.

BCX

BCX

BCX, a subsidiary within Telkom Group, is one of Africa’s largest systems integrator and digital transformation partners for enterprises and public sector organisations.

Protega

Protega

Protega is a company specialized in Managed Cybersecurity Services (MSS) & SOC 24×7; management, risk & compliance (GRC); implementation of data protection technologies; and Red Team services.