Automating API Security: SAST, DAST, and XDR Posted inSecurity Gilad David Maayan February 21, 2023 API security applies security best practices to secure web APIs, which are widely used in modern applications. API security includes access control, data privacy protection, and the detection and prevention of attacks on APIs through common vulnerabilities and exploits. The most important vulnerabilities are listed in the OWASP API Security Top 10.Whether the application is for consumers, employees, or partners, the client side of the application typically interacts with the server side of the application through application programming interfaces (APIs). APIs are also at the basis of microservices architectures. These APIs are usually well-documented, easy to reverse-engineer, and typically available over a public network. Additionally, APIs are highly sensitive to Denial of Service (DDoS) attacks.Attacks on APIs can bypass client applications, interfere with the functionality of other user applications, or expose personal information. Therefore, API security is focused on protecting the application layer and addressing issues that arise when a malicious hacker directly manipulates the API.Why Is API Security Important?Businesses often use APIs to connect services and transfer sensitive data. A compromised, exposed, or hacked API could expose personal data, financial information, or other sensitive data. Therefore, security is important when designing and developing RESTful and other APIs.If an API is not properly coded and secured, it can also be exploited through malicious requests. But APIs are also vulnerable to security vulnerabilities in backend systems. If an attacker compromises the host server of the API endpoint, all API data and functionality can be compromised.For example, a denial of service (DoS) attack can bring an API endpoint offline or severely degrade performance. Attackers can abuse APIs by scraping data or exceeding usage limits. More sophisticated attackers can inject malicious code to perform unauthorized actions or entirely compromise the backend.API Security Automation ToolsWith the proliferation of microservices and serverless architectures, nearly all enterprise applications rely on APIs for basic functionality. This makes API security an integral part of modern information security. To help ensure API security, there are many testing options to choose from. Below, we’ll review a handful of application testing strategies, including Static Application Security Testing (SAST), Dynamic Application Security Testing (DAST), Interactive Application Security Testing (IAST), fuzz testing, and eXtended Detection and Response (XDR).Static Application Security Testing (SAST)Static Application Security Testing (SAST) is a white-box testing method for examining the underlying framework and implementation of applications and APIs. SAST tools can generate up to 100% code coverage, scanning the source code without executing it. This method can detect software vulnerabilities such as SQL injection and other OWASP Top 10 weaknesses.Because SAST tools do not test code at runtime, it is prone to false positives. It can be difficult to manually resolve these false positives to find the real bugs. Some SAST tools, especially older ones, are not designed to identify API endpoints, so it is more efficient to use specialized tools that can examine API structure.Dynamic Application Security Testing (DAST)Dynamic Application Security Testing (DAST) is often implemented as a black box testing methodology. This means it doesn’t need access to the source code. By providing arbitrary or predefined inputs to the system, DAST tools can identify weaknesses attackers can exploit.Unlike SAST, DAST works from the outside in. There are very few false positives in DAST tools because the code is executed during testing. Therefore, DAST tools are very effective at finding edge cases and testing APIs from an attacker’s point of view.DAST tools are typically deployed late in the development process because they require a running application. Because DAST tools test software based on random or predefined inputs, manual fine-tuning can significantly improve your ability to reach relevant parts of the system under test.Interactive Application Security Testing (IAST)Interactive Application Security Testing (IAST) is a type of software testing that combines elements of both static and dynamic testing to identify vulnerabilities and security flaws in applications. IAST involves analyzing an application’s source code and runtime behavior to identify security issues.IAST tools work by instrumenting the application, which means they insert code into the application that allows the IAST tool to monitor its behavior while running. This allows the IAST tool to detect issues such as input validation flaws, insecure coding practices, and other security weaknesses.One advantage of IAST is that it can provide a more comprehensive view of an application’s security posture than either static or dynamic testing alone. IAST can also provide more accurate and actionable results than either static or dynamic testing alone, as it combines the strengths of both approaches.Feedback-Based FuzzingFeedback-based fuzzing or feedback-based application security testing (FAST) is a dynamic testing method. It uses advanced white-box techniques to detect functional bugs and security issues in software. Fuzzing tools analyze code structure and provide feedback during testing— this feedback allows the fuzzer to automatically generate test cases that maximize code coverage across most APIs in the system.Feedback-based fuzzing contributes to API security stability. It is compatible with most CI/CD environments and can be automated to allow developers to perform continuous security testing of their own code.eXtended Detection and Response (XDR)Endpoint protection tools help protect endpoints such as desktops, mobile devices, and laptops. You can use it to secure servers hosting APIs and API endpoints. Endpoint protection solutions protect against known malware, zero-day malware, ransomware, and other threats, and prevent attackers from exploiting endpoints to perform malicious actions. Endpoint security solutions are available on-premises and in the cloud.XDR is a new innovation that enhances security in three main ways:Combines the detection and response signals of endpoint security and other security silos, such as email security and network security, into one model.Uses technologies such as cloud computing, machine learning, and behavioral analytics to monitor large amounts of data over long periods of time. This provides more complete and meaningful security insights and establishes baseline behaviors to identify anomalies.Provides a human-readable, timeline-based view of security events, avoiding alert fatigue and allowing security teams to take decisive action quickly.What to Look for in API Security Testing ToolsThere are many API security tools on the market, all offering slightly different types of services. As such, there are many important aspects to consider when evaluating API security testing vendors.Deployment: Does the Tool Integrate With CI/CD?You can deploy API security tests in various ways, but ideally, you should look for a tool that automates testing in CI/CD and runs locally for testing and debugging. It can help you quickly learn if a new vulnerability was introduced and remediate it while you are still writing the code.Configuration: Explicit API Routes vs. Crawling for DiscoveryLegacy tools rely on the application’s HTML spider to surface API routes. It can work in some cases but often leads to missed API routes. It also does not work with one-page applications. Modern tools are configured directly for API scanning, using newer technologies like the GraphQL introspection endpoint or the OpenAPI Specification to fully test the API for security vulnerabilities.Performance: Data-Driven NodesPerformance is critical when running API security tests. Unfortunately, traditional API security testing tools can add hours to the build pipeline. For example, performance is often impacted by the underlying API route compared to each iteration of this route, a functionality called data-driven nodes.Traditional tools typically test each variation, adding significant time to scans. Modern tools understand data-driven nodes, testing only the underlying route and, as a result, adding only seconds or minutes to the build pipeline.Scan Quality: Technology-Specific ScanningSome tools might run the same tests regardless of the tested API. However, you might want a tool that can perform specific scanning. For example, REST APIs should only receive JSON-based requests. This tool sends suitable requests to an API, resulting in fast and accurate scans.Accuracy: Minimize False PositivesAccuracy is an important concern for security testing tools because false positives often create unnecessary work for teams and can erode trust in the test. A security testing tool should be built for API security testing and modern application architecture.Developer Experience: Aim for Developer-First API SecurityThe modern software development lifecycle (SDLC) has shifted security left, adopting methodologies like DevSecOps to promote a culture of security. Today’s CI/CD pipeline incorporates protection at all phases, bringing all teams into the process.Engineering teams can run security tests in CI/CD and alert the developers working on the code when they have inadvertently introduced a security vulnerability. A developer-first security tool provides features suitable for the modern CI/CD, such as simple CI/CD automation, running tests locally, integrations with existing engineering workflows, and Configuration-as-Code (CaC).ConclusionIn conclusion, automating API security is essential for ensuring the security and reliability of modern software systems. There are several different tools and technologies available for automating API security, including Static Application Security Testing (SAST), Dynamic Application Security Testing (DAST), and eXtended Detection and Response (XDR).SAST is a type of software testing that is used to identify vulnerabilities and security flaws in applications during the development process. DAST involves running the application in a test environment and simulating various types of attacks to identify vulnerabilities. XDR is a security technology that combines multiple security tools and processes to provide a more comprehensive view of an organization’s security posture.By automating API security, organizations can improve the security of their APIs, reduce the risk of security breaches, and ensure the reliability of their software systems. It is important to carefully evaluate the various tools and technologies available and choose those that best fit the needs and workflow of your organization.