Although software composition analysis (SCA) has been around for over 20 years, it continues to remain a tedious and time-consuming exercise for both developers and AppSec teams. Some of the reasons for this are:
These pain points kept coming up in our conversations with industry leaders/practitioners and customers. In order to solve this challenge and help developers build secure code without being overwhelmed with SCA data, we created the SCA 2.0 framework. You can read about the SCA 2.0 framework in this whitepaper, which presents practical strategies to prioritize SCA findings based on multiple parameters such as runtime usage, runtime reachability, exploit availability, severity, topology, and applicability.
“Reachability” refers to the analysis of determining if a particular vulnerability (vulnerable function/class/dependency) is reachable i.e., that there exists a code path to reach the vulnerability that an attacker can potentially leverage.In this blog, I will go into the details of reachability and the different approaches to determine it. There are two main ways of determining reachability: Static call graph analysis and runtime usage analysis. I will dive deeper into these approaches in the following section.
Static call graph analysis tools generate a graph G=<F,E> where F stands for functions in the code and E refers to an edge or a caller->callee relationship by scanning the static source code. In order to generate this graph, these tools will traverse the codebase and identify the target of each branch (callee function) from within the function’s code. Unfortunately the determination of the callee function is not straightforward or reliable in certain commonly occurring circumstances such as virtual dispatch (the mechanism used by object oriented languages to determine the callee function at runtime), function pointers, and dynamically loaded modules. The static analysis tools try to approximately estimate the callee function in such cases.
Here are some considerations around static call graph analysis:
In this approach, the tool instruments the running application to determine runtime usage of dependencies. Here are some considerations of runtime usage analysis:
When reviewing these two approaches it’s important to understand that reachability should be used as a measure for prioritization and NOT for ignoring vulnerabilities since both static and runtime reachability analysis have blind spots. In other words:
Given that reachability is a prioritization metric, runtime reachability analysis will give developers a much higher degree of prioritization compared to static call graph analysis. It will also provide the list of resources that are definitely used in the normal course of the application rather than all theoretical code paths that may also contain dead code. Static call graphs are marred by the original problems that have existed with traditional SCA tools such as too much noise and lack of visibility into the runtime state or deployment context of the application.
At Deepfactor, we have been laser focused on getting runtime usage analysis right and have solved the hard challenges associated with runtime instrumentation. Highlights of Deepfactor’s innovative approach to runtime usage analysis—‘static + runtime SCA’—include:
This table presents a comprehensive comparison between the different SCA approaches:
Static w/ Call Graph | Runtime Only | Deepfactor’s hybrid approach to reachability (static + runtime) | |
Detection approach | Manifest file or source code or both | Executed code | Manifest file + source code for greater coverage |
Detection coverage | Depending upon on the approach (manifest or source code scan) | Depends upon runtime execution. | Direct, transitive dependencies and OS packages |
Detection time | Early since code/image is scanned in the CI pipeline | Late as the code/image has to be deployed before the tool can analyze | Early since code/image is scanned in the CI pipeline |
Reachability within application dependencies (jar, node modules, pip modules etc) | Yes with exceptions noted below | Yes | Yes |
Reachability analysis blindspots | Dynamically loaded resources such as reflection in Java result in false negatives. Lack of visibility into OSS components whose source is unavailable/not scanned. Lack of visibility into usage of OS packages |
Depends upon the code executed at runtime. | Depends upon the code executed at runtime. Mitigated by running your applications with Deepfactor in multiple environments for long durations for greater coverage. Resources that are still unused should be deprioritized as lower risk. |
Reachability within OS packages for container scans | No | Yes | Yes |
Noise in reachability analysis | High since static call graphs will use all theoretical paths to determine reachability including old or dead code no longer used in your app | Low as runtime analysis will detect the paths that are definitely executed at runtime | Low as runtime analysis will detect the paths that are definitely executed at runtime |
Prioritization using exploit availability/maturity | Possible | Possible | Yes. Deepfactor pulls exploit info from multiple sources, pulls PoC information from GitHub and exploited incidents from CISA |
Prioritization based on internet accessibility | Not possible | Possible | Possible |
Detection of dead/unused code | Partial (theoretically unreachable code only, not unused/dead code) | Yes | Yes. Deepfactor can highlight the dependencies and OS packages in containers that your application hasn’t used at runtime and your developers can consider trimming them down |
Detection of unknown vulnerabilities not in CVE databases | Not possible | Possible | Yes. Deepfactor observes application processes for insecure file/network/memory behaviors and detects 11 categories of malicious behaviors that may not be a known CVE today. |
Scanning of containers that are deployed but not built in the CI pipeline | Not possible | Possible | Yes. In Kubernetes environments, Deepfactor’s scan pod can automatically scan containers as pods are started. |
Search for vulnerabilities in running environments | Not possible | Possible | Yes. Deepfactor allows you to search whether an application running in any of your environments contains vulnerable OSS deps or packages that contain certain vulnerabilities. This helps assess risk posture to a specific CVE/component. |
Admission control (Prevent a container from starting up if it has a certain class of vulnerabilities or licenses) | Not possible | Possible | Possible |
The post Reachability Analysis for Prioritization of SCA Findings appeared first on Deepfactor.
*** This is a Security Bloggers Network syndicated blog from Deepfactor authored by Vikas Wadhvani. Read the original post at: https://www.deepfactor.io/reachability-analysis-for-prioritization-of-sca-findings/