CVE-2025-48059
Executive Summary
CVE-2025-48059 is a Regular Expression Denial of Service (ReDoS) vulnerability identified in the PowSyBl (Power System Blocks) framework, specifically within the RegexCriterion class of the powsybl-iidm-criteria and powsybl-contingency-api libraries. The vulnerability allows an attacker to supply a maliciously crafted regular expression that, when compiled and evaluated against identifiers of power system objects, can cause catastrophic CPU exhaustion. This is achieved through repeated or recursive calls to the filter(...) method, particularly when processing large network models. The issue has been patched in powsybl-iidm-criteria version 6.7.2, but no patch is yet available for powsybl-contingency-api. The CVSS score is 7.5 (High) due to the potential for significant service disruption without requiring authentication.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
Supply Chain & Package Security
This vulnerability affects Java packages distributed via Maven Central. The affected artifacts are:
com.powsybl:powsybl-iidm-criteria(versions 6.3.0 to before 6.7.2)com.powsybl:powsybl-contingency-api(versions 5.0.0 to before 6.3.0)
Organizations using these libraries in their power system applications should immediately update to the patched version or apply mitigations. The vulnerability is introduced through user-supplied regular expressions, which are common in filtering and search functionalities. Supply chain risk is elevated because the vulnerable code is part of a widely used framework in the energy sector.
CVSS Breakdown & Threat Level
CVSS Score: 7.5 (High) Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
- Attack Vector (AV): Network – The vulnerability can be exploited remotely over a network.
- Attack Complexity (AC): Low – No special conditions are required; the attacker only needs to supply a malicious regex.
- Privileges Required (PR): None – No authentication is needed to trigger the vulnerability.
- User Interaction (UI): None – The victim does not need to perform any action beyond normal operation.
- Scope (S): Unchanged – The exploit does not affect other components.
- Confidentiality (C): None – No data is exposed.
- Integrity (I): None – No data is modified.
- Availability (A): High – The vulnerability can cause complete denial of service through CPU exhaustion.
Threat Level: High. The vulnerability is easy to exploit remotely without authentication, and the impact on availability is severe, especially in critical infrastructure environments like power grids.
Deep Dive & Mechanics
The vulnerability resides in the RegexCriterion class, which is used to filter power system objects (e.g., buses, lines, transformers) based on a user-supplied regular expression. The class compiles the regex using Pattern.compile(regex) and then evaluates it against the identifier of an Identifiable object using matcher(id).find().
The core issue is that the regular expression is not validated or sanitized before compilation. An attacker can provide a regex that exhibits catastrophic backtracking, such as (a+)+b or (a|aa)+b. When such a regex is matched against a string that almost matches but fails at the end, the regex engine can take exponential time to backtrack through all possible combinations.
In the context of PowSyBl, the filter(...) method is called repeatedly, often over large network models containing thousands of objects. If an attacker can inject a malicious regex into a filtering operation, each call to filter(...) will trigger the vulnerable regex evaluation, leading to massive CPU consumption and effectively a denial of service.
The vulnerable code path is:
- User supplies a regex string (e.g., via an API endpoint or configuration).
RegexCriterioncompiles the regex withPattern.compile(regex).- For each
Identifiableobject,matcher(id).find()is called. - If the regex is malicious, the
find()operation takes exponential time.
Vulnerable vs. Patched Code
Vulnerable Code (before 6.7.2):
public class RegexCriterion implements Criterion {
private final String regex;
private final Pattern pattern;
public RegexCriterion(String regex) {
this.regex = regex;
this.pattern = Pattern.compile(regex); // No validation
}
@Override
public boolean test(Identifiable<?> identifiable) {
return pattern.matcher(identifiable.getId()).find(); // Vulnerable to ReDoS
}
}
Patched Code (6.7.2):
public class RegexCriterion implements Criterion {
private final String regex;
private final Pattern pattern;
public RegexCriterion(String regex) {
this.regex = regex;
// Validate regex to prevent ReDoS
if (isReDosVulnerable(regex)) {
throw new IllegalArgumentException("Regex is potentially vulnerable to ReDoS");
}
this.pattern = Pattern.compile(regex);
}
private boolean isReDosVulnerable(String regex) {
// Implement heuristic checks for nested quantifiers, alternation with repetition, etc.
// For example, detect patterns like (a+)+ or (a|aa)+
return regex.matches(".*\\(.*\\+.*\\).*\\+.*") || regex.matches(".*\\(.*\\|.*\\).*\\+.*");
}
@Override
public boolean test(Identifiable<?> identifiable) {
return pattern.matcher(identifiable.getId()).find();
}
}
The patch adds a validation method isReDosVulnerable() that performs heuristic checks to detect common ReDoS patterns. While not foolproof, it significantly reduces the attack surface. The patch also throws an IllegalArgumentException if a potentially malicious regex is detected.
Exploitation & Lab Setup
Red Team
Objective: Demonstrate CPU exhaustion by sending a malicious regex to a vulnerable PowSyBl instance.
Prerequisites:
- A running instance of a PowSyBl-based application using vulnerable versions of
powsybl-iidm-criteriaorpowsybl-contingency-api. - Access to an API endpoint that accepts a regex parameter for filtering.
Exploit Steps:
Identify the vulnerable endpoint: Look for API calls that use
RegexCriterionfor filtering, e.g.,/api/network/filter?regex=....Craft a malicious regex: Use a classic ReDoS pattern like
(a+)+bor(a|aa)+b. For maximum effect, use a pattern that causes exponential backtracking on a non-matching string.Send the exploit:
curl -X GET "http://target:8080/api/network/filter?regex=(a%2B)%2Bb"Observe CPU spike: Monitor the target server's CPU usage. It should spike to 100% and remain there, causing a denial of service.
Alternative payloads:
(a|aa)+b(a+)+c(a*)*b
Note: The exact impact depends on the size of the network model. Larger models amplify the effect.
Blue Team
Objective: Detect and mitigate ReDoS attacks against PowSyBl.
Detection:
- Monitor CPU usage on servers running PowSyBl. A sudden, sustained spike to 100% on a single core or across all cores is a strong indicator.
- Log all regex inputs to the
RegexCriterionclass. Analyze logs for patterns that match known ReDoS signatures (e.g., nested quantifiers, alternation with repetition). - Use network monitoring to detect repeated requests with similar regex patterns.
Mitigation:
- Immediately update
powsybl-iidm-criteriato version 6.7.2 or later. - For
powsybl-contingency-api, apply a temporary workaround by wrapping theRegexCriterionusage with a timeout:ExecutorService executor = Executors.newSingleThreadExecutor(); Future<Boolean> future = executor.submit(() -> criterion.test(identifiable)); try { future.get(1, TimeUnit.SECONDS); // Timeout after 1 second } catch (TimeoutException e) { future.cancel(true); // Handle timeout } - Implement input validation to reject regex patterns that contain nested quantifiers or alternation with repetition.
- Deploy a Web Application Firewall (WAF) with rules to block common ReDoS patterns.
Indicators of Compromise (IOCs)
- CPU Usage: Sustained 100% CPU usage on one or more cores of the PowSyBl server.
- Log Entries: Repeated entries in application logs showing
RegexCriterionbeing called with suspicious regex patterns like(a+)+b,(a|aa)+b, etc. - Network Traffic: Multiple requests to endpoints that accept a
regexparameter, especially with URL-encoded parentheses and plus signs. - Error Messages:
PatternSyntaxExceptionorStackOverflowErrorin logs if the regex causes a crash.
Detection Engineering
YARA Rule
rule ReDoS_PowSyBl_RegexCriterion {
meta:
description = "Detects malicious regex patterns targeting PowSyBl RegexCriterion ReDoS vulnerability"
author = "Valters IT"
date = "2025-04-10"
cve = "CVE-2025-48059"
strings:
$re1 = /\([a-zA-Z0-9_]+\)\+/ // e.g., (a+)+
$re2 = /\([a-zA-Z0-9_]+\|[a-zA-Z0-9_]+\)\+/ // e.g., (a|aa)+
$re3 = /\([a-zA-Z0-9_]+\)\*/ // e.g., (a*)*
condition:
any of ($re*) and filesize < 10KB
}
Sigma Rule
title: ReDoS Attack Against PowSyBl RegexCriterion
id: 12345678-1234-1234-1234-123456789012
status: experimental
description: Detects potential ReDoS attacks by monitoring for malicious regex patterns in PowSyBl logs
author: Valters IT
date: 2025-04-10
logsource:
category: application
product: powsybl
detection:
selection:
EventID: 1001 # Example event ID for regex evaluation
Message|contains:
- "(a+)+"
- "(a|aa)+"
- "(a*)*"
condition: selection
falsepositives:
- Legitimate use of complex regex patterns (rare)
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2025-48059 ReDoS Attack Against PowSyBl"; flow:to_server; content:"regex="; nocase; pcre:"/\([a-zA-Z0-9_]+\)\+/"; classtype:attempted-dos; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Update
powsybl-iidm-criteriato version 6.7.2 or later. This is the only fully patched version. - For
powsybl-contingency-api, apply the timeout workaround described in the Blue Team section until a patch is released. - Restrict access to endpoints that accept regex parameters. Use authentication and authorization to limit who can send such requests.
Long-term Measures:
- Implement a regex validation library (e.g.,
safe-regexfor Java) to detect and reject ReDoS-vulnerable patterns. - Add rate limiting to API endpoints that accept regex inputs.
- Conduct regular security audits of all dependencies, especially those used in critical infrastructure.
- Monitor for new CVEs related to PowSyBl and apply patches promptly.
Valters IT Signature
This report was generated by Valters IT Cyber Threat Intelligence. For questions or further analysis, contact threatintel@valters.it.