Description (en)
# miniBB 3.7.2 `X-Forwarded-For` SQL Injection Vulnerability(CRITICAL)
**Author:** Khashayar Fereidani
**Disclosure Date:** 2026-11-20
**Advisory:** https://fereidani.com/minibb-372-x-forwarded-for-sql-injection-vulnerability
**Contact:** https://fereidani.com/contact
## Description
An unauthenticated SQL injection vulnerability exists in miniBB
through insufficient validation of the `X-Forwarded-For` HTTP header
in the `getIP()` function (bb_functions.php). The function accepts the
header value if it matches an IPv4 or an IPv6 regular expression. The
IPv4 pattern is anchored with `^` and `$`, but the IPv6 pattern is
not, and PHP's `preg_match()` succeeds when the pattern matches
anywhere inside the subject. The IPv6 pattern contains an alternative
that matches a bare `::`, so any header value containing `::` anywhere
passes validation and becomes the visitor's "IP address".
The resulting value reaches SQL queries unescaped, because the
database helpers (`db_simpleSelect()`, `db_ipCheck()`,
`insertArray()`, `updateArray()`) build their statements by direct
string concatenation. Reachable pre-authentication locations include:
- `bb_func_fla.php` lines 24, 50, 63 and 68 (failed-login handling,
`POST mode=login`)
- `index.php` line 362 (`db_ipCheck()`, any POST request)
- `bb_func_ptopic.php` line 66 (anonymous new topic)
- `bb_func_pthread.php` line 81 (anonymous reply)
**Proof of Concept:**
```bash
curl -H "X-Forwarded-For: 1' or sleep(5)-- ::" -H "Referer: http://HOSTNAME/"; \
--data "mode=login&user_usr=user&user_pwd=wrong" \
http://HOSTNAME/index.php
```
The response is delayed by 5 seconds, confirming injection into `WHERE
forced_ip='...'`. The `Referer` header must contain the forum URL to
pass the built-in POST filter.
## Impact
An unauthenticated remote attacker can execute arbitrary SQL against
the forum database, including time-based or error-based blind
extraction of member records and password hashes, and can forge the
ban-check query to bypass IP bans.
CVSS 3.1 base score: 8.2 High (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:N`).
## Solution
Fixed in miniBB 3.8. Upgrade to 3.8 or later. To patch an older
install by hand, anchor the IPv6 pattern with `^` and `$` exactly like
the IPv4 pattern, or replace both checks with `filter_var($ip,
FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)` / `FILTER_FLAG_IPV6`.
## Timeline
- 2026-09-25: Reported to the miniBB maintainer, together with the
other miniBB 3.7.2 issues.
- 2026-10-01: The maintainer sent a pre-release with the fix
(`getIP()` now validates addresses with `inet_pton()` instead of the
unanchored IPv6 pattern). Fix verified.
- 2026-11-20: Fixed in miniBB 3.8. Report published.
## References
- [miniBB 3.7.2 `poster_ip` Stored Cross-Site
Scripting](https://fereidani.com/minibb-372-posterip-stored-cross-site-scripting-vulnerability)
- [CWE-89: Improper Neutralization of Special Elements used in an SQL
Command ('SQL Injection')](https://cwe.mitre.org/data/definitions/89.html)
- [miniBB - official website](https://www.minibb.com/)
_______________________________________________
Sent through the Full Disclosure mailing list
https://nmap.org/mailman/listinfo/fulldisclosure
Web Archives & RSS: https://seclists.org/fulldisclosure/Raw JSON
{
"containers": {
"cna": {
"affected": [
{
"product": "Minibb",
"vendor": "Minibb",
"versions": [
{
"status": "affected",
"version": "unknown"
}
]
}
],
"credits": [
{
"lang": "en",
"type": "finder",
"value": "Khashayar Fereidani"
}
],
"descriptions": [
{
"lang": "en",
"value": "# miniBB 3.7.2 `X-Forwarded-For` SQL Injection Vulnerability(CRITICAL)\n\n**Author:** Khashayar Fereidani\n**Disclosure Date:** 2026-11-20\n**Advisory:** https://fereidani.com/minibb-372-x-forwarded-for-sql-injection-vulnerability\n**Contact:** https://fereidani.com/contact\n\n## Description\n\nAn unauthenticated SQL injection vulnerability exists in miniBB\nthrough insufficient validation of the `X-Forwarded-For` HTTP header\nin the `getIP()` function (bb_functions.php). The function accepts the\nheader value if it matches an IPv4 or an IPv6 regular expression. The\nIPv4 pattern is anchored with `^` and `$`, but the IPv6 pattern is\nnot, and PHP's `preg_match()` succeeds when the pattern matches\nanywhere inside the subject. The IPv6 pattern contains an alternative\nthat matches a bare `::`, so any header value containing `::` anywhere\npasses validation and becomes the visitor's \"IP address\".\n\nThe resulting value reaches SQL queries unescaped, because the\ndatabase helpers (`db_simpleSelect()`, `db_ipCheck()`,\n`insertArray()`, `updateArray()`) build their statements by direct\nstring concatenation. Reachable pre-authentication locations include:\n\n- `bb_func_fla.php` lines 24, 50, 63 and 68 (failed-login handling,\n`POST mode=login`)\n- `index.php` line 362 (`db_ipCheck()`, any POST request)\n- `bb_func_ptopic.php` line 66 (anonymous new topic)\n- `bb_func_pthread.php` line 81 (anonymous reply)\n\n**Proof of Concept:**\n\n```bash\ncurl -H \"X-Forwarded-For: 1' or sleep(5)-- ::\" -H \"Referer: http://HOSTNAME/\"; \\\n --data \"mode=login&user_usr=user&user_pwd=wrong\" \\\n http://HOSTNAME/index.php\n```\n\nThe response is delayed by 5 seconds, confirming injection into `WHERE\nforced_ip='...'`. The `Referer` header must contain the forum URL to\npass the built-in POST filter.\n\n## Impact\n\nAn unauthenticated remote attacker can execute arbitrary SQL against\nthe forum database, including time-based or error-based blind\nextraction of member records and password hashes, and can forge the\nban-check query to bypass IP bans.\n\nCVSS 3.1 base score: 8.2 High (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:N`).\n\n## Solution\n\nFixed in miniBB 3.8. Upgrade to 3.8 or later. To patch an older\ninstall by hand, anchor the IPv6 pattern with `^` and `$` exactly like\nthe IPv4 pattern, or replace both checks with `filter_var($ip,\nFILTER_VALIDATE_IP, FILTER_FLAG_IPV4)` / `FILTER_FLAG_IPV6`.\n\n## Timeline\n\n- 2026-09-25: Reported to the miniBB maintainer, together with the\nother miniBB 3.7.2 issues.\n- 2026-10-01: The maintainer sent a pre-release with the fix\n(`getIP()` now validates addresses with `inet_pton()` instead of the\nunanchored IPv6 pattern). Fix verified.\n- 2026-11-20: Fixed in miniBB 3.8. Report published.\n\n## References\n\n- [miniBB 3.7.2 `poster_ip` Stored Cross-Site\nScripting](https://fereidani.com/minibb-372-posterip-stored-cross-site-scripting-vulnerability)\n- [CWE-89: Improper Neutralization of Special Elements used in an SQL\nCommand ('SQL Injection')](https://cwe.mitre.org/data/definitions/89.html)\n- [miniBB - official website](https://www.minibb.com/)\n_______________________________________________\nSent through the Full Disclosure mailing list\nhttps://nmap.org/mailman/listinfo/fulldisclosure\nWeb Archives & RSS: https://seclists.org/fulldisclosure/"
}
],
"problemTypes": [
{
"descriptions": [
{
"cweId": "CWE-89",
"description": "CWE-89",
"lang": "en",
"type": "CWE"
}
]
}
],
"providerMetadata": {
"dateUpdated": "2026-12-01T21:29:09Z",
"orgId": "4e2abfbf-4a2a-4b76-a4e0-d77c18ba156c",
"shortName": "VULNARCHIVE"
},
"references": [
{
"tags": [
"technical-description",
"exploit"
],
"url": "https://vuln.freearchive.org/archive/full-disclosure/2026/Dec/8"
},
{
"tags": [
"technical-description"
],
"url": "https://seclists.org/fulldisclosure/2026/Dec/8"
},
{
"url": "http://HOSTNAME/\""
},
{
"url": "http://HOSTNAME/index.php"
},
{
"url": "https://cwe.mitre.org/data/definitions/89.html"
},
{
"url": "https://fereidani.com/contact"
},
{
"url": "https://fereidani.com/minibb-372-posterip-stored-cross-site-scripting-vulnerability"
},
{
"url": "https://fereidani.com/minibb-372-x-forwarded-for-sql-injection-vulnerability"
},
{
"url": "https://nmap.org/mailman/listinfo/fulldisclosure"
},
{
"url": "https://seclists.org/fulldisclosure/"
},
{
"url": "https://www.minibb.com/"
}
],
"source": {
"defect": [
"https://seclists.org/fulldisclosure/2026/Dec/8"
],
"discovery": "EXTERNAL"
},
"title": "miniBB 3.7.2 `X-Forwarded-For` SQL Injection Vulnerability(CRITICAL)",
"x_gcve": [
{
"recordType": "advisory",
"relationships": [],
"vulnId": "GCVE-1988-2026-0584",
"x_vulnarchive": {
"archiveUrl": "https://vuln.freearchive.org/archive/full-disclosure/2026/Dec/8",
"automated": true,
"contentSha256": "8a84ca2f05820cca074818beb595abbd9e4702a4145ed0b097a0fbf4dd1b22f7",
"evidenceScore": 11,
"messageId": "",
"originalUrl": "https://seclists.org/fulldisclosure/2026/Dec/8",
"policy": "vulnarchive-1",
"sourceFormat": "text/html",
"sourcePublishedAt": "2026-11-20T13:22:20Z"
}
}
]
}
},
"cveMetadata": {
"assignerOrgId": "4e2abfbf-4a2a-4b76-a4e0-d77c18ba156c",
"assignerShortName": "VULNARCHIVE",
"datePublished": "2026-12-01T21:29:09Z",
"dateUpdated": "2026-12-01T21:29:09Z",
"state": "PUBLISHED",
"vulnId": "GCVE-1988-2026-0584"
},
"dataType": "CVE_RECORD",
"dataVersion": "5.2"
}