CVE-2023-24622 in safeurl-pythoninfo

Summary

by MITRE • 01/30/2023

isInList in the safeurl-python package before 1.2 for Python has an insufficiently restrictive regular expression for external domains, leading to SSRF.

VulDB is the best source for vulnerability data and more expert information about this specific topic.

Analysis

by VulDB Data Team • 07/02/2025

The vulnerability identified as CVE-2023-24622 resides within the safeurl-python package, a widely used library for validating and sanitizing URLs in Python applications. This particular flaw affects versions prior to 1.2 and stems from an inadequately crafted regular expression implementation within the isInList function. The security implications are significant as the vulnerable code fails to properly restrict external domain validation, creating a potential pathway for server-side request forgery attacks. The issue demonstrates a classic example of insufficient input validation where the regular expression pattern does not adequately filter out malicious URL schemes or domain patterns that could be exploited by attackers to bypass security controls.

The technical flaw manifests in the insufficiently restrictive regular expression used to validate external domains within the safeurl-python library. When applications utilize this library to validate URLs, the isInList function processes incoming URLs to determine whether they belong to approved domains. However, the flawed regular expression pattern fails to properly account for various URL schemes and encoding methods that could allow attackers to craft malicious URLs that appear to be from trusted domains while actually pointing to internal resources. This vulnerability specifically affects the validation logic that should prevent requests to internal network addresses or restricted domains, but due to the weak regular expression, it permits bypasses that could lead to unauthorized access to internal systems.

The operational impact of CVE-2023-24622 is substantial for organizations relying on the safeurl-python package for URL validation in their web applications and APIs. Attackers could exploit this vulnerability to perform server-side request forgery attacks by crafting URLs that bypass the intended domain restrictions. This could enable unauthorized access to internal services, databases, or network resources that are typically protected by network segmentation. The vulnerability aligns with CWE-917, which addresses "Improper Limitation of a Control Flow Identifier," as the flawed regular expression creates an improper control flow that allows malicious requests to proceed undetected. Additionally, this issue maps to ATT&CK technique T1071.004 for Application Layer Protocol: DNS, since the vulnerability could be leveraged to manipulate DNS resolution and access internal systems through DNS-based attacks.

Organizations utilizing vulnerable versions of the safeurl-python package should immediately upgrade to version 1.2 or later, which contains the fixed regular expression implementation. The mitigation strategy should include comprehensive code review to identify any other instances where the vulnerable library might be used within applications, particularly in API gateways, web applications, and services that process external user input. Security teams should also implement network-level controls such as firewalls and access control lists to restrict outbound connections from servers that process user-supplied URLs. The fix in version 1.2 addresses the root cause by implementing a more robust regular expression that properly validates domain names and prevents bypass attempts. Organizations should conduct vulnerability assessments to ensure no other similar patterns exist in their codebase, as this type of vulnerability often indicates broader issues with input validation and regular expression usage in security-critical components. The vulnerability demonstrates the importance of proper regular expression design in security libraries and the potential consequences of inadequate pattern validation in URL parsing and validation functions.

Reservation

01/30/2023

Disclosure

01/30/2023

Moderation

accepted

CPE

ready

EPSS

0.00563

KEV

no

Activities

very low

Sources

Want to stay up to date on a daily basis?

Enable the mail alert feature now!