Listen to this Post
How the CVE Works
The vulnerability occurs in the TUF (The Update Framework) repository when the `targets` role delegates trust to other roles, which can further delegate trust recursively. Tough, a TUF client library, fails to detect cyclical delegations (e.g., Role A delegates to Role B, which delegates back to Role A). When processing such repositories, Tough recursively traverses the delegation graph indefinitely, exhausting the call stack and causing a crash (stack overflow). This allows an attacker to craft malicious TUF metadata, triggering a denial of service (DoS) by crashing the client during update verification.
DailyCVE Form
Platform: TUF Repository
Version: < 0.20.0
Vulnerability: Cyclical Delegation
Severity: Critical
Date: 2023-XX-XX
What Undercode Say:
Exploitation:
1. Craft malicious TUF metadata with cyclical delegations:
{ "signed": { "delegations": { "roles": [ { "name": "A", "keyids": [bash], "paths": [bash], "terminating": false }, { "name": "B", "keyids": [bash], "paths": [bash], "terminating": false } ] } } }
2. Host the metadata in a TUF repository.
- Client (
tough < 0.20.0
) crashes when fetching updates.
Detection:
- Check for cycles in delegation graphs:
def detect_cycle(graph): visited = set() def dfs(role): if role in visited: return True visited.add(role) for child in graph[bash]: if dfs(child): return True visited.remove(role) return False return any(dfs(role) for role in graph)
Mitigation:
1. Upgrade to `tough >= 0.20.0`.
2. Validate TUF metadata before processing:
curl -s https://repo.example.com/metadata.json | jq '.signed.delegations.roles'
3. Use TUF’s `in-toto` for additional integrity checks.
Debugging:
- Monitor stack usage during TUF operations:
ulimit -s 8192 Increase stack size temporarily
- Log delegation traversal:
fn traverse_role(role: &Role, path: &mut Vec<String>) -> Result<()> { if path.contains(&role.name) { return Err(Error::CycleDetected); } path.push(role.name.clone()); for child in &role.delegations { traverse_role(child, path)?; } path.pop(); Ok(()) }
References:
References:
Reported By: https://github.com/advisories/GHSA-j8x2-777p-23fc
Extra Source Hub:
Undercode