{"id":10400,"date":"2021-10-05T11:34:38","date_gmt":"2021-10-05T10:34:38","guid":{"rendered":"https:\/\/staging-site.42crunch.com\/?p=10400"},"modified":"2022-09-24T14:12:05","modified_gmt":"2022-09-24T13:12:05","slug":"application-security-tools-are-not-up-to-the-job-of-api-security","status":"publish","type":"post","link":"https:\/\/staging2022.42crunch.com\/application-security-tools-are-not-up-to-the-job-of-api-security\/","title":{"rendered":"Application Security Tools Are Not up to the Job of API Security"},"content":{"rendered":"

The last two decades have seen a proliferation of software (according to GitHub there has been a 35% increase in code repositories in 2020 alone) into every aspect of our lives in the form of web or mobile applications. Adversaries have increasingly attacked these applications, and defenders have adopted various testing tools and technologies to protect them.<\/p>\n

Today most enterprises have in place an Application Security (AppSec) program to manage the deployment of these tools and manage associated vulnerabilities. The only constant in the world of software development is change, and never more so than in recent years with the widespread adoption of cloud native technologies (such as containers, orchestration platforms) and the breakdown of the monolith via microservice adoption.\u00a0<\/span><\/p>\n

Unfortunately for AppSec teams, this rapidly evolving landscape has meant that much of the tooling they use is not up to the task of securing their applications.<\/p>\n

Nowhere is this more apparent than with the security of application program interfaces (APIs) which are foundational to all modern applications. APIs present a unique challenge from a security perspective because of their uniqueness from an attack point of view \u2014 a fact recognized by OWASP who produced a dedicated\u00a0Top 10 list for API security vulnerabilities<\/span><\/a>.\u00a0<\/span><\/p>\n

 <\/p>\n

Why Existing AppSec Tools Fare Badly on APIs<\/strong><\/h2>\n

SAST wasn\u2019t designed for API-centric applications<\/h3>\n

The workhorse of any AppSec program is the Static Application Security Testing (SAST) which is a \u201cwhite box\u201d assessment of the vulnerabilities in an application derived by examining the source code and creating a model of the data flow through an application to determine where an application may be vulnerable to external attack by, for example, injection attacks.<\/p>\n

Complex data flow paths or unsupported frameworks reduce the accuracy of a SAST analysis since the model may be incomplete or inaccurate.\u00a0<\/span><\/p>\n

In the case of APIs, this is significantly more complex since most SAST tools are designed to work with web applications constructed as for example Java Servlet PHttpRequest.Bodyages or .Net ASP pages.<\/p>\n

In this case, the SAST tool detects instances of\u00a0HttpRequest.Body<\/code>\u00a0within a codebase, since this is typically how a webpage is constructed. Unfortunately, APIs are significantly more complex since they are constructed differently using a myriad of 3rd party frameworks (such as SpringBoot, Flask, etc), and the detection of the entry points into the application is more complex leading to inaccurate models and higher rates of false negatives.<\/p>\n

<\/h3>\n

DAST Lacks Context of APIs<\/h3>\n

Dynamic Application Security Testing (DAST) is a \u201cblack box\u201d assessment of a running application by exercising the application endpoints in the same way a user \u2014 or attacker \u2014 would. DAST tools are adept at \u201cspidering\u201d a web application to determine the page structure and input fields and then to attack these fields to identify vulnerabilities.\u00a0<\/span><\/p>\n

Unfortunately, for an API the DAST scanner is unable to enumerate the API endpoints making such attacks impossible. Some DAST tools (such as\u00a0OWASP ZAP<\/span><\/a>) can ingest an OpenAPI\/Swagger file to seed the spidering process.<\/p>\n

Even in this case without a deeper understanding of the API endpoints, DAST tools can\u2019t provide an intelligent assessment of API security. For example, a DAST scanner will not be able to identify Broken Object Level Authorization (BOLA<\/span><\/a>) issues unless it has an awareness of the parameter value used to identify the object (in order to fuzz this field) and then to be able to interpret the response to determine whether the attack succeeded, or if any error is returned.<\/p>\n

<\/h3>\n

Shifting Left on API Security<\/h3>\n

Security tools<\/a>\u00a0have shown great advances in the past decade however, the most significant impediment to highly scaled and effective AppSec initiatives is that the security activities are conducted too late in the Software Development Lifecycle (SDLC).<\/p>\n

Testing too late increases the cost of remediation and reduces the likelihood of developer remediation. In the case of typical monolithic applications, there was no alternative but to test late in the cycle since a functional, running instance of the application was required to perform testing, particularly for DAST.<\/p>\n

With the advent of a microservice-based API-centric architecture, it is possible to test each of the individual APIs as they are developed rather than requiring a complete instance of an application \u2014 enabling a \u201cshift left\u201d approach allowing early testing of individual components.\u00a0<\/span><\/p>\n

Because APIs are specified earliest in the SDLC and have a defined contract (via an OpenAPI \/ Swagger specification) they are ideally suited to a preemptive \u201cshift left\u201d security testing approach \u2014 the API specification and underlying implementation can be tested in a developer IDE as a standalone activity.<\/p>\n

Core to this approach is API-specific test tooling as contextual awareness of the API contract is required. The existing SAST\/DAST tools will be largely unsuitable in this application \u2014 in the discussion on DAST testing to detect BOLA we identified the inability of the DAST tool to understand the API behavior.<\/p>\n

By specifying the API behavior with a contract the correct behavior can be enforced and verified enabling a positive security model (desired behavior is whitelisted) as opposed to a black list approach such as DAST.\u00a0<\/span><\/p>\n

The diagram below summarizes key differences between API security native testing versus DAST testing, from\u00a042Crunch<\/a>:<\/p>\n

\n

\"\"<\/p>\n

Source: 42Crunch.<\/p>\n<\/div>\n

The security testing tools I\u2019ve discussed are typically operated by an organization\u2019s security or AppSec teams and often imposed on developers who may find them unsuitable to modern development practices such as continuous integration (CI) and continuous deployment (CD) \u2014\u00a0sometimes leading to developer frustration and lower adoption rates of security tooling.<\/p>\n

In contrast, API security tooling that can add value to the development effort (for instance allowing continuous validation of API specifications) within their environments is more likely to be adopted and actively used.<\/p>\n

Conclusion<\/h3>\n

Do the more traditional security testing tools such as SAST and DAST have a place in your API development environment? The answer is almost certainly yes, particularly if you have an existing investment and process centered on these tools. By leveraging the declarative nature of API specifications, a savvy organization can use API-specific tooling to take a hard \u201cshift left\u201d approach and enforce and test API security using a positive security model. Any resultant APIs produced are then guaranteed secure by design, providing a solid foundation for the high layer application stack (webpages or mobile applications) which can be tested using SAST\/DAST tools.<\/p>\n

Originally published at The New Stack<\/a><\/strong><\/p>\n

<\/div>\n","protected":false},"excerpt":{"rendered":"

The last two decades have seen a proliferation of software (according to GitHub there has been a 35% increase in code repositories in 2020 alone) into every aspect of our lives in the form of web or mobile applications. Adversaries have increasingly attacked these applications, and defenders have adopted various testing tools and technologies to […]<\/p>\n","protected":false},"author":10,"featured_media":11320,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_seopress_robots_primary_cat":"none","_seopress_titles_title":"Why web application security tools are not API Security tools","_seopress_titles_desc":"Why application security tools such as SAST and DAST are not up to the job of API Security.\r\n","_seopress_robots_index":"","site-sidebar-layout":"default","site-content-layout":"default","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"disabled","ast-hfb-above-header-display":"disabled","ast-hfb-below-header-display":"disabled","ast-hfb-mobile-header-display":"disabled","site-post-title":"disabled","ast-breadcrumbs-content":"disabled","ast-featured-img":"disabled","footer-sml-layout":"disabled","theme-transparent-header-meta":"default","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""}},"footnotes":""},"categories":[6],"tags":[14],"_links":{"self":[{"href":"https:\/\/staging2022.42crunch.com\/wp-json\/wp\/v2\/posts\/10400"}],"collection":[{"href":"https:\/\/staging2022.42crunch.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/staging2022.42crunch.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/staging2022.42crunch.com\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/staging2022.42crunch.com\/wp-json\/wp\/v2\/comments?post=10400"}],"version-history":[{"count":0,"href":"https:\/\/staging2022.42crunch.com\/wp-json\/wp\/v2\/posts\/10400\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/staging2022.42crunch.com\/wp-json\/wp\/v2\/media\/11320"}],"wp:attachment":[{"href":"https:\/\/staging2022.42crunch.com\/wp-json\/wp\/v2\/media?parent=10400"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/staging2022.42crunch.com\/wp-json\/wp\/v2\/categories?post=10400"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/staging2022.42crunch.com\/wp-json\/wp\/v2\/tags?post=10400"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}