论文研读-Compatible Remediation on Vulnerabilities from Third-Party Libraries for Java Projects
1 Research Problem
- This paper aims to fix vulnerabilities in open-source third-party libraries (TPLs) by adjusting dependency versions while preserving project compatibility.
- Dependency and vulnerability detection is relatively mature and widely implemented in SCA tools. However, there is no broadly accepted approach to remediating vulnerabilities through dependency version adjusments.
2 Motivation & Gap
2.1 Motivation
- Dependabot: Dependabot is able to create PRs to upgrade vulnerable dependencies to clean versions and calculates the successful test rate of the upgrades from other repositories as the confidence score for compatibility.
- Steady: Steady adjusts both direct and transitive dependencies, uses static and dynamic reachability analysis to deprioritize low-risk unreachable vulnerabilities, and prioritizes non-vulnerable versions. It then estimates compatibility using \(p\) : the proportion of project-used classes and methods("touch points") that remain present after an upgrade.
- Com A: Upgrades vulnerable direct dependencies to the closest non-vulnerable versions. It uses WALA-based static reachability analysis to prioritize critical reachable vulnerabilities.
- Com B: Tries candidate versions for each direct dependency, re-resolves the resulting transitive dependencies, and selects the candidate that leaves the fewest vulnerabilities.
2.2 Gap
- Unreliable compatibility assessment: Although Steady and Dependabot provide compatibility scores, these scores do not reliably establish compatibility for the target project. More reliable compatibility assessment is needed to balance security and compatibility during version selection.
- Lack of global optimization: Dependencies in a dependency graph are interconnected, so optimizing each dependency independently may produce a suboptimal overall solution. However, global optimization is challenging because the number of possible version combinations can grow exponentially with the number of dependencies.
- Lack of support of handling \(\text{ripple effects}\): Version adjustments can change both the DG and the underlying CG. Existing tools do not fully account for these changes throughout optimization, so decisions based on outdated graphs may lead to incompatibilities or suboptimal remediation results.
3 Key Insight
Dependency versions should be selected jointly because dependencis are interconnected, and version adjustments can change both dependency and call relationships. CORAL combines graph partitioining, compatibility-constrained optimization, graph updates, and backtracking to balance security, compability and efficiency.

4 Approach
4.1 Problem Formulation
Formulating dependency vulnerability remediation as a constrained optimization problem: reduce vulnerability risk while preserving project compatibility.
-
Objective: minimize total vulnerability risk
\[\text{min } F_{\text{vul}} = \sum_{m=1}^M\sum_{\text{vul}=1}^{\text{Vul}_m}\theta_{\text{vul}}f_{\text{cvss}}(\text{vul}) \]- \(M:\) the number of dependency libraries.
- \(f_{cvss}(vul):\) the vulnerability's CVSS severity score.
- \(\theta_{vul}:\) a weight reflecting vulnerability reachability.
Total risk is the sum of each remaining vulnerability's severity multiplied by its reachability weight. Reachable vulnerabilities receive higher weights. Vulnerabilities with unknow reachability are ranked between reachable and unreachable ones.
-
Constraint: avoid incompatibility
\[\text{s.t. } c_{\text{incom}} = \sum_{m=1}^{M}\sum_{p=1}^{P}\theta_v\cdot\text{incom}(v_p,v_m)=0 \]- s.t. stands for subject to, meaning that the following constraint must be satisfied.
- \(v_p\) is the dependent library, and \(v_m\) is the library it depends on.
- \(\text{incom}(v_p,v_m)\) represents incompatibility between the selected versions of two libraries.
- \(c_{incom}=0\) requires that there be no incompatibility issues.
For example, if library A calls a method in library B and that method is removed after upgrading B, the selected version combination may violate the compatibility constraint.
4.2 Overview
Step1: Constructing the DG and CG
- DG: CORAL extracts the dependency tree by the Maven command and recovers the DGs by completing the absent dependency relationships from a pre-computed dependenct database.
- CG: The CG is constructed statically based on Soot by the Spark algorithm from the class files of the projects. CORAL collects call relationships separately from individual dependency JARs and integrates them into a project-level CG. After version adjustments, the relevant call relationships are updated to account for ripple effects.
Step 2: Partitioning the DG
To reduce the cost of searching version combinations across the entire DG.
- Vertical partitioning: Separating branches that have no dependency connections with one another except through the project root.
- Horizontal partitioning: CORAL jointly optimizes two adjacent dependency levels at a time and moves the optimization window doenward from the project root.
Partitioning improves efficiency but may overlook better version combinations involving relationships across multiple levels.
Step 3: Optimizing Subgraphs
After partitioning the dependency graph, CORAL selects versions for the dependencies in each subgraph. It formulates version selection as a constrained, multi-objective optimization problem and uses the Z3 SMT solver to solve it.
-
Primary Objective : Minimize Vulnerability Risk
Subgraph optimization follows Equation (1):
\[\text{min } F_{\text{vul}} = \sum_{m=1}^M\sum_{\text{vul}=1}^{\text{Vul}_m}\theta_{\text{vul}}f_{\text{cvss}}(\text{vul}) \tag1 \]CORAL considers three reachability categories: reachable, unknown and unreachable. The selection strategy prioritizes reducing reachable and unknown vulnerabilities. When multiple candidates satisfy these requirements and the other constraints, candidates with fewer unreachable vulnerabilities are preferred.
-
Compatibility Constraint : Avoid Syntactic Breaking
Equation (3) constrains syntactic incompatibility:
\[\text{s.t. } c_{\text{synb}} = \sum_{m = 1}^M\sigma \cdot \text{synb}(P(x_m'), x_m') = 0 \]CORAL compares APIs across JAR versions, then consults the CG to determine whether affected APIs are used.
-
Compatibility Constraint : Avoid Dependency Version Conflicts
Equation (4) addresses dependency version conficts:licts:
\[\text{s.t. } c_{\text{dc}} = \sum_{m = 1}^M\text{dc} (P(x_m'), x_m') = 0 \] -
Secondary Objectives : Reduce Semantic Breaking Risk
Equations (3) and (4) mainly deal with problems that can be statically checked, but cannot fully determine semantic breaking.
For example, a method exists before and after the upgrade, with unchanged parameters, but changes in the return result or exception handling method. The project may compile successfully but fail testing.SemVer: MAJOR.MINOR.PATCH
-
Minimize major version changes - Equation (5)
\[\text{min }f_{\text{major}} = \sum_{n=1}^Nf_{\text{major}, x_n}(x_n, x_n') \]Here, \(x_n\) 和 \(x_n'\) are the original and selected versions. Each term is 1 if the adjustment crosses a major version boundary and 0 otherwise.
-
Minimize minor version changes - Euqation (6)
\[\text{min }f_{\text{minor}} = \sum_{n=1}^Nf_{\text{minor}, x_n}(x_n, x_n') \] -
Minimize transitions to development versions - Equation (7)
\[\text{min }f_{\text{dev}} = \sum_{n=1}^Nf_{\text{dev}, x_n}(x_n, x_n') \]This objective discourages selecting development or prerelease versions, such as alpha, beta and SNAPSHOT, particularly when moving from a stable release.
-
Minimize version spans - Equation (8)
\[\text{min }f_{\text{span}} = \sum_{n=1}^N\text{dist}(x_n, x_n') \]\(\text{dist}(x_n, x_n')\) is measured between positions in a sorted version list, rather than by numerically subtracting version identifiers.
-
Selected versions remain revisable. CORAL retains alternative candidates and updates the relevant graphs, allowing later compatibility constranys to overturn earlier selections.
Step 4: Backtracking
- Hard backtracking: Aiming to solve dead ends. When every candidate version of a dependenct violates compatibility constraints, CORAL revisits a parent dependency, temporarily excludes its current selection, and tries alternative versions.
- Soft backtracking: Aiming to slove sub-optimal solutions. When the current combination satisfies compatibility requirements but prevents of the selections of a lower-risk version, CORAL tries alternative parent versions to find a combination with fewer vulnerabilities. Unlike hard backtracking, it does not classfiy the originall selection as incompatible. The original solution can be retained if the alternatives provide no improvement.
5 Evaluation
- RQ1: Security and compatibility
- CORAL was compared with 4 tools on 301 Maven projects. It fixed 87.56% of all CVEs with all reachable removed, achieving a 98.67% compilation success rate and a 92.96% unit test success rate. The results show that CORAL balances vulnerability reduction and compatibility better than the compared tools.
- RQ2: Effectiveness of subgraph partitioning
- CORAL was compared with Baseline C, which does not partition the dependency graph. Partitioning substantially reduced execution time, especially for large graphs, while fixing only 54 fewer vulnerability instances and causing no additional compilation failures. It therefore improves efficiency with a small loss in remediation effectiveness.
- RQ3: Fixable and unfixable vulnerabilities
- In a separate study of 2,000 Maven projects, CORAL fixed 78.45% of vulnerability instances without breaking compilation. Simply upgrading direct dependencied to secure non-major versions fixed only 25.71%. The remaining 21.55% were not fixed by CORAL, they are not necessarily impossible to fix through other approches.
6 Limitations
- Limited comparison scope: The evaluation excludes tools that provide multiple remediation options requiring manual version selection. Therefore, the results do not establish CORAL's superiority over all SCA remediation tools or human-assisted remediation approaches.
- Reliance on static call graphs: CORAL uses static call graphs for efficiency, but these graphs may miss calls made through reflection and other dynamic mechanisms, which can cause reachable vulnerabilities or incompatible API usages to be overlooked.
- Limited detection of semantic breaking changes: CORAL cannot reliably detect behavioral changes introduced by dependency updates, even when API signatures remain unchanged. It uses version-based heuristics, such as minimizing major version changes and version spans, to reduce this risk, but these heuristics cannot guarantee behavioral compatibility.
7 Critical Thinking
- CORAL is designed and evaluated for Maven-based Java projects, so its effectiveness in other ecosystems remains unverified.(CMake-based C++).
- Both images will be updated with version adjustments, but the paper provides a more specific explanation of the CG update mechanism and does not delve into the same implementation details for DG.

浙公网安备 33010602011771号