Description

A stored cross-site scripting vulnerability exists in miniBB, caused by the same getIP() validation weakness described in the X-Forwarded-For SQL Injection report: an X-Forwarded-For value containing an IPv6 substring such as :: is accepted verbatim as the visitor's IP (limited to 45 characters). This forged "IP address" is stored in the database without sanitization in two places:

  • posts.poster_ip, written when any message is posted (bb_func_pthread.php line 100, bb_func_ptopic.php)
  • failedlogin.forced_ip, written on a failed login attempt (bb_functions.php line 881, fixWrongLogin())

Both values are later rendered without HTML encoding in pages that only administrators and moderators can view:

  • bb_func_vthread.php line 271 renders poster_ip inside the IP link shown next to each post
  • bb_func_fla_admin.php lines 62 and 71 render forced_ip in the failed-logins list

Proof of Concept:

curl -H 'X-Forwarded-For: "><img src=x onerror=alert(1)>::' -H "Referer: http://HOSTNAME/" \
  --data "action=pthread&forum=1&topic=1&postText=hello+world+test" \
  http://HOSTNAME/index.php

When an administrator or moderator later opens the affected thread (or, for the forced_ip variant, one failed login followed by opening the failed-login list), the injected onerror handler executes in their browser session. No action by the victim is required beyond viewing the page.

Impact

An unauthenticated attacker can plant a persistent JavaScript payload that executes in the session of an administrator or moderator, enabling session hijacking, CSRF protection bypass, and full administrative takeover of the forum.

CVSS 3.1 base score: 6.1 Medium (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N).

Solution

Fixed in miniBB 3.8. Upgrade to 3.8 or later. To patch an older install by hand, fix the getIP() validation (see the X-Forwarded-For SQL Injection report) so that only genuine IP addresses can be accepted, and HTML-encode the stored IP values at output time.

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 (same root cause as the X-Forwarded-For SQL injection; getIP() now validates addresses with inet_pton()). Fix verified.
  • 2026-11-20: Fixed in miniBB 3.8. Report published.

References