Lucene search
+L

miniBB 3.7.2 X-Forwarded-For SQL Injection

🗓️ 02 Dec 2026 00:00:00Reported by Khashayar FereidaniType 
packetstorm
 packetstorm
🔗 packetstorm.news👁 3 Views

Unauthenticated SQL injection in miniBB via X-Forwarded-For header in getIP().

Code
# 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/)

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation

02 Dec 2026 00:00Current
6.1Medium risk
Vulners AI Score6.1
3