Potential Vulnerability: Regular expression Denial of Service - ReDoS #302
ganpatgutte
started this conversation in
General
Replies: 3 comments 3 replies
|
Thank you @ganpatgutte for the report. Or do you see cases where some injected text could cause this vulnerability? |
3 replies
|
@ganpatgutte Sorry, I just reread your message and realized I previously misunderstood your report. The problem lies in the built-in detector. Do you know which kind of expression might cause this issue? |
0 replies
|
@madsuhrenholt can you please add a full reproduction? I've executed the following code: var target = new Interpreter();
var code = "IF(MARGINAL_REFERENCE_PRICE>MARGINAL_PRICE,IF(REFERENCE_PRICE_WITH_PRICESTATE!=null, REFERENCE_PRICE_WITH_PRICESTATE, REFERENCE_PRICE_WITH_PRICESTATE_1),MARGINAL_COMPENSATION_PRICE)";
var detectedIdentifiers = target.DetectIdentifiers(code);
Assert.That(detectedIdentifiers.UnknownIdentifiers, Is.EqualTo(new[] { "IF", "MARGINAL_REFERENCE_PRICE", "MARGINAL_PRICE", "REFERENCE_PRICE_WITH_PRICESTATE", "REFERENCE_PRICE_WITH_PRICESTATE_1", "MARGINAL_COMPENSATION_PRICE" }));and it finishes relatively quickly (about 500ms on .NET framework 4.6.2 and about 153ms on .NET9). |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hello,
I came across a potential denial of service vulnerability, if a malicious expression is used the regular expression could run indefinite and may result in denial of service error.
Solution: Restricting or adding some timeout while declaring regex would help avoid the denial of service issue.
your thoughts please!
All reactions