# What is ReDoS, and how do you fix it?

DevFeed: [What is ReDoS, and how do you fix it?](<https://devfeed.tech/articles/what-is-redos-and-how-do-you-fix-it-68006.md>)

Original publisher: [Read original article](<https://github.blog/security/how-to-fix-a-redos/>)

Author: Kevin Backhouse

Published: 2023-05-09T17:40:33Z

Content type: tutorial

Language: en

Sources: [GitHub Blog](<https://devfeed.tech/sources/github-engineering.md>)

Topics: [vulnerability management](<https://devfeed.tech/topics/vulnerability-management.md>), [Test-driven development](<https://devfeed.tech/topics/tdd.md>), [Fuzzing/Fuzz testing](<https://devfeed.tech/topics/fuzzing.md>), [Python](<https://devfeed.tech/topics/python.md>), [snyk-open-source](<https://devfeed.tech/topics/snyk-open-source.md>), [AI Chat](<https://devfeed.tech/topics/ai-chat.md>)

Tags: [agent](<https://devfeed.tech/tags/agent.md>), [android](<https://devfeed.tech/tags/android.md>), [c](<https://devfeed.tech/tags/c.md>), [c-plus-plus](<https://devfeed.tech/tags/c-plus-plus.md>), [c-sharp](<https://devfeed.tech/tags/c-sharp.md>), [code](<https://devfeed.tech/tags/code.md>), [code-scanning](<https://devfeed.tech/tags/code-scanning.md>), [codeql](<https://devfeed.tech/tags/codeql.md>), [coding](<https://devfeed.tech/tags/coding.md>), [debugging](<https://devfeed.tech/tags/debugging.md>), [denial-of-service](<https://devfeed.tech/tags/denial-of-service.md>), [deterministic-finite-automata](<https://devfeed.tech/tags/deterministic-finite-automata.md>), [dfa](<https://devfeed.tech/tags/dfa.md>), [github-security-lab](<https://devfeed.tech/tags/github-security-lab.md>), [security](<https://devfeed.tech/tags/security.md>), [vulnerabilities](<https://devfeed.tech/tags/vulnerabilities.md>), [vulnerability-research](<https://devfeed.tech/tags/vulnerability-research.md>)

## AI overview

The article explains how to diagnose and fix regular expression denial-of-service (ReDoS) vulnerabilities. It recommends reproducing the issue with a failing input, simplifying the regex while preserving the behavior, removing ambiguous repetition that causes exponential backtracking, and using fuzzing and code scanning to check the fix. Examples use Python and include a URL validation regex; the principles also apply to other languages.

## Source excerpt

Code scanning detects ReDoS vulnerabilities automatically, but fixing them isn't always easy. This blog post describes a 4-step strategy for fixing ReDoS bugs.