Skip to main content

Crate solve

Crate solve 

Source
Expand description

SOLVE v0.5 — Scoring Obstacle Levels in Vulnerabilities & Exploits.

Scores how hard a vulnerability-discovery and exploit-development challenge is, before anyone attempts it. Four components are judged independently on 0.0..=10.0 and combined with a soft maximum, so a challenge is hard when any single stage is hard, and several hard stages together add at most one further point.

use solve::{
    Assessment, CodeAnalysis, CodeLength, Cwe, ExpertKnowledge, ExploitDevelopment, Score,
    VulnerabilityDiscovery, anchors::{AttackSurface, Locality, Readability},
};

let assessment = Assessment {
    code_analysis: CodeAnalysis {
        readability: Readability::CompiledLogic.score(),
        complexity: Score::lit(4.0),
        length: CodeLength::Tokens(8_000),
        attack_surface: AttackSurface::MediumMinus.score(),
    },
    vulnerability_discovery: VulnerabilityDiscovery::new(
        [Cwe::USE_AFTER_FREE, Cwe::TYPE_CONFUSION],
        Score::lit(5.0),
        Locality::SameCodebase.score(),
    ),
    exploit_development: ExploitDevelopment::with_technique_count(
        Score::lit(6.0),
        1,
        Score::lit(2.0),
    ),
    expert_knowledge: ExpertKnowledge::none(),
};

let components = assessment.components();
assert_eq!(components.code_analysis, Score::lit(3.4));
assert_eq!(components.vulnerability_discovery, Score::lit(6.6));
assert_eq!(components.exploit_development, Score::lit(7.0));

assert!((assessment.score().get() - 6.7965).abs() < 1e-4);
assert_eq!(assessment.score().level().to_string(), "Medium");

§The arithmetic

Each component total is rounded to one decimal place before aggregation, which the reference calculator does and which changes results.

ComponentTotal
Code analysisround1(readability × (lengthScore + attackSurface) / 20 / 3 + complexity × 2/3)
Vulnerability discoveryround1(min(10, complexity + cweCount) × 4/5 + locality / 5)
Exploit developmentround1(max(min(10, complexity + techniqueCount), harness))
Expert knowledgemax over required domains

Code length scores as round1(clamp(log2(units / 500), 0, 10)), counting cl100k_base tokens for source and disassembly plus .rodata lines for binaries.

Combining, for m = max and s = sum over the four totals:

maxplus = 0 if m == 0 else m + (s - m) / (3 · m)
SOLVE   = maxplus × 10 / 11

§Divergences from the prose specification

Two places where the specification’s text and its own reference calculator disagree. This crate follows the calculator, because the published DownUnderCTF figures were produced by it, and reproduces all sixteen exactly.

  1. Exploit development has no lower bound. The prose clamps complexity + techniques to [1, 10]; the calculator applies only the upper bound, and the published pyny assessment scores zero on this component.
  2. maxplus is not monotonic below 1. The specification states the combined score is monotonic in each component. It is not: raising a component can lower the score when the maximum component is under 1.0. Four components at 0.5 score 1.364, but raising one to 0.6 drops the result to 1.303. The partial derivative in the maximum parameter is 1 - (s - m) / (3m²), negative whenever s - m > 3m², which requires m < 1. Above 1.0 — every published example, and any challenge that is not trivial on all four axes — monotonicity holds.

§Attribution

SOLVE: Scoring Obstacle Levels in Vulnerabilities & Exploits (Version 0.5) © 2025 by Pattern Labs Tech Inc. (now Irregular) is licensed under CC BY-SA 4.0.

This crate is an independent implementation of that specification, and is not affiliated with, sponsored by, or endorsed by Irregular or Pattern Labs Tech Inc. A score produced here is not an assessment by Irregular. Their own benchmarks are not public and are not implemented here. See NOTICE.md.

Re-exports§

pub use aggregate::maxplus;
pub use component::CodeAnalysis;
pub use component::DomainRequirement;
pub use component::ExpertKnowledge;
pub use component::ExploitDevelopment;
pub use component::VulnerabilityDiscovery;
pub use error::SolveError;
pub use length::CodeLength;
pub use score::Level;
pub use score::Score;
pub use taxonomy::Cwe;
pub use taxonomy::Domain;
pub use taxonomy::Technique;

Modules§

aggregate
The maxplus soft-maximum that combines component totals.
anchors
Named points on the specification’s suggested scales.
component
The four primary components, each producing a total in 0.0..=10.0.
error
Error type for SOLVE score construction.
length
Code length measurement and its logarithmic score.
score
The bounded 0.0..=10.0 score that every SOLVE judgment and total uses.
taxonomy
The specification’s appendices: weakness classes, exploit techniques, expertise domains.

Structs§

Assessment
A complete SOLVE assessment of one challenge.
Components
The four component totals that feed the combined score.