Project:ModSecurity false positive affecting Page Forms

From Azeroth Gazetteer
Jump to navigation Jump to search

ModSecurity false positive affecting Page Forms documents a resolved ModSecurity false positive on Azeroth Gazetteer, hosted by DreamHost. Legitimate MediaWiki wikitext entered through the Page Forms extension, particularly citations combined with apostrophe-formatted wiki links, was mistaken for a possible SQL injection attempt. Page Forms previews or saves consequently appeared to fail with an internal server error. An Apache error log subsequently showed that the host's ModSecurity web application firewall (WAF) had rejected the request with HTTP 418.[1]

On 5 November 2026, DreamHost technical support confirmed that security rule 942550 was interfering with the requests and, with the site administrator's approval, removed the offending rule. The previously problematic citations then worked without further changes to MediaWiki, PHP, Page Forms, or Cargo. This before-and-after result, together with the server log, strongly supports the firewall rule as the cause of the observed editing failures. The precise scope of DreamHost's configuration change was not independently established; removing one detection rule should not be confused with disabling the entire WAF.

  • First documented: 5 November 2026
  • Status: Resolved on this installation after DreamHost removed ModSecurity rule 942550
  • Affected operation: Previewing or saving certain template-field content through Page Forms
  • Detection rule: 942550 (“JSON-Based SQL Injection”)
  • Blocking rule: 949110 (“Inbound Anomaly Score Exceeded”)
  • Recorded firewall response: HTTP 418, despite the browser's generic internal-error message
  • Earlier workarounds: {{#tag:ref|...}} and, for one tested pattern, placing italics inside a wiki link's display label

This was not established to be a defect in Page Forms, Cite, Cargo, or PHP. A separate Cargo issue involving stored UNIQ--ref...-QINU placeholders remains distinct from the firewall problem.

Software environment and chronology

The investigation and successful remediation took place on 5 November 2026. The following versions were confirmed locally:

Component Versions tested or installed
MediaWiki 1.45.3, subsequently upgraded to 1.46.2
PHP 8.4.27 initially; subsequently 8.3.36
Page Forms 6.0.11
Cargo 3.9.4
Cite Installed and functional; no numerical version declared in Special:Version

Under PHP 8.4.27, even a simple literal reference in the affected form field produced an apparent internal server error. Changing the host's PHP version to 8.3.36 allowed simple references to work, but more complex markup continued to fail. A controlled series of fifteen tests isolated combinations of references, wiki links, formatting, and ordering (documented below).

MediaWiki was then upgraded from 1.45.3 to 1.46.2, retaining PHP 8.3.36 and the reported Page Forms and Cargo versions. Ordinary source editing and article saving worked after the upgrade. However, the following Page Forms input still failed:

''[[Tides of Darkness]]''<ref>Test citation</ref>

The alternative [[Tides of Darkness|Tides of Darkness]] continued to work in the subsequent test. Updating MediaWiki therefore did not resolve the observed form-submission failure. The problem was subsequently resolved only after DreamHost changed the ModSecurity configuration.

Affected form and reproduction

The clearest case involves Blackened Woods, edited through Form:Location. The Former name(s) field is defined as:

{{{field|fname|input type=textarea|rows=2}}}

It supplies the fname parameter to Template:Locationbox, which both displays the text and stores it in Cargo as Former_name, declared as Wikitext string.

To reproduce the problem in the tested environment:

  1. Open Blackened Woods using Edit with form.
  2. Enter the test markup below into Former name(s).
  3. Select Preview or Save.
''[[Tides of Darkness]]''<ref>Test citation</ref>

Observed result before the firewall change: The request failed, while equivalent markup could be entered through the ordinary source editor. Removing the problematic markup or using one of the tested alternatives allowed the form operation to proceed. After DreamHost removed rule 942550, citation entry through Page Forms was reported to work normally. Not every one of the fifteen historical test combinations was individually retested after the change.

An earlier incident involved the citation for Falstad Wildhammer in the current-ruler information of Wildhammer Clan. The failures were therefore not confined to a single article, although the detailed reproduction tests were conducted using Form:Location.

Apache log evidence

After MediaWiki 1.46.2 had been installed and the failure reproduced, the site's Apache error log was inspected through SSH. Three entries at 12:48:05 on 5 November 2026 (server log time) identify a single blocked request to /mediawiki/index.php.

The relevant information, condensed from the log and with the client's IP address omitted, is:

ModSecurity: Warning
[id "942550"] [msg "JSON-Based SQL Injection"]
[data "Matched Data: host found within ARGS:Locationbox[fname]:
''[[tidesofdarkness]]''<ref>testcitation</ref>"]

ModSecurity: Warning
[id "942550"] [msg "JSON-Based SQL Injection"]
[data "Matched Data: host found within ARGS:pf_free_text: ..."]

ModSecurity: Access denied with code 418 (phase 2)
[id "949110"]
[msg "Inbound Anomaly Score Exceeded (Total Score: 10)"]
[uri "/mediawiki/index.php"]

The rules were loaded from DreamHost's installation of the OWASP Core Rule Set. Rule 942550 matched two parameters in the same request: the location-infobox field (Locationbox[fname]) and the form's free-text field (pf_free_text). The latter contained existing page markup, including links and references. Rule 949110 then rejected the request when the inbound anomaly score reached 10.

The log establishes that the firewall rejected this legitimate editing request as a suspected SQL injection. It does not show a PHP exception or establish that MediaWiki reached the PHP code that would normally process the edit. Consequently, a PHP exception backtrace was not needed to explain this particular blocked request.

DreamHost documents that ModSecurity uses HTTP 418 for blocked requests, and that the resulting page may display the generic message “The server encountered an internal error or misconfiguration”. DreamHost also states that individual ModSecurity rules cannot be modified through .htaccess on its hosting service.[2]

Limits of the evidence: The log establishes why this transaction failed, and the successful test after DreamHost removed the offending rule strongly corroborates the diagnosis. It does not establish that every earlier failed test had precisely the same cause. Comparable firewall entries were not preserved here for the initial PHP 8.4.27 tests, so their differing apparent behaviour remains unexplained. Two rule matches occurred in the same request; the log alone does not show whether either parameter would have been sufficient to trigger a block independently.

Controlled tests under PHP 8.3.36

Before the firewall entries were discovered, fifteen Page Forms preview tests were conducted in the Former name(s) field while editing Blackened Woods. The following table records their historical results before the firewall change; “Fails” no longer describes the known current behaviour of the installation. Not every case was separately retested after remediation. These observations do not demonstrate a Page Forms parser defect.

Test Markup arrangement Preview result
1 Two consecutive plain <ref> elements Works
2 Italicised wiki link inside <ref>, followed by year and chapter Fails
3 {{df}} inside <ref> Works
4 Wiki link inside <ref>, without italics Works
5 Italicised plain text inside <ref>, without a wiki link Works
6 Italicised wiki link inside <ref>, without other citation text Fails
7 Italicised wiki link immediately before a plain reference Fails
8 Italicised wiki link alone, without any reference Works
9 Plain reference before italicised wiki link, separated by a space Works
10 Italicised wiki link before plain reference, separated by a space Fails
11 Plain reference immediately before italicised wiki link Works
12 Ordinary wiki link before plain reference Works
13 Italicised plain text before plain reference Works
14 Bold wiki link before plain reference Fails
15 Wiki link with an italicised display label before a plain reference Works

Representative examples are shown below.

Failed before remediation: an italicised wiki link inside the reference.

Eversong Forest<ref>''[[Tides of Darkness]]''</ref>

Failed before remediation: an italicised wiki link before the reference.

Eversong Forest ''[[Tides of Darkness]]'' <ref>Test citation</ref>

Failed before remediation: a bold wiki link before the reference.

Eversong Forest '''[[Tides of Darkness]]''' <ref>Test citation</ref>

Worked before remediation: the reference precedes the italicised link.

Eversong Forest<ref>Test citation</ref>''[[Tides of Darkness]]''

Worked before remediation: italics are placed inside the wiki link's display label.

Eversong Forest [[Tides of Darkness|''Tides of Darkness'']] <ref>Test citation</ref>

The pre-remediation failures varied with the syntax and ordering of the submitted markup. The firewall finding supplies a strong explanation for the reproduced block: a generic attack-detection rule misclassified legitimate apostrophes, brackets, and other wikitext characters. The original tests did not measure individual ModSecurity rule scores, however; the table cannot establish precisely how each combination contributed to the blocking threshold.

Resolution by DreamHost

After the Apache log was examined, a support ticket was submitted to DreamHost identifying the domain, timestamp, endpoint /mediawiki/index.php, affected parameters Locationbox[fname] and pf_free_text, detection rule 942550, blocking rule 949110, HTTP 418 response, and the request identifier recorded in the log.

A DreamHost technician confirmed that rule 942550 was interfering with the requests and requested permission to remove it. The administrator approved the change. After the technician reported removing the offending rule, citations which had caused the Page Forms error worked normally. No further MediaWiki, PHP, Page Forms, or Cargo version changes were made between the logged failure and the successful retest.

This is a successful local remediation, not an assertion that every unrelated form error is caused by ModSecurity. The technician's message did not establish whether the rule removal was restricted to particular parameters or to the entire domain. The remaining WAF protections were stated to remain active.

Troubleshooting similar failures

For other site administrators encountering apparent HTTP 500 errors while submitting legitimate wikitext through Page Forms:

  1. Reproduce the problem using a harmless, identifiable example, and note the time of the request.
  2. Inspect the hosting provider's Apache or web application firewall error logs, if available. A visible “internal server error” does not establish that PHP threw an exception.
  3. Look for a ModSecurity entry containing the submitted text, an ARGS: parameter name, a detection-rule ID, a blocking-rule ID, and the request identifier.
  4. Where a false positive is demonstrated, contact the hosting provider with the matching evidence. Request the narrowest practicable rule or parameter exclusion rather than disabling the entire WAF.
  5. Repeat the same input after the provider's change and verify that the operation succeeds. Check the firewall log again if the problem continues.

On DreamHost, a blocked ModSecurity request may produce HTTP 418. DreamHost's documentation states that individual ModSecurity rule modifications are not supported through .htaccess; an administrator who needs a tailored exception should consult support.[1] Do not assume that every HTTP 500 response, or every Page Forms problem involving <ref>, is a firewall block.

Earlier workarounds

Construct the reference with #tag

Before the firewall issue was resolved, the most thoroughly tested workaround was MediaWiki's #tag parser function, which can construct a reference without placing a literal opening and closing ref tag directly in the affected input field.

Instead of:

Eversong Forest<ref>Citation text</ref>

Use:

Eversong Forest{{#tag:ref|Citation text}}

For a citation containing a template:

Eversong Forest{{#tag:ref|{{df}}, pp. 152–153}}

On Blackened Woods, the #tag:ref form rendered in preview, survived saving, remained intact when the page was reopened through Edit with form, and continued to preview normally. The method was also used to restore the Falstad Wildhammer citation in Wildhammer Clan. It uses standard MediaWiki parser-function syntax rather than a custom extension.[3]

With the ModSecurity false positive removed, this alternative is no longer required to avoid the documented failure. It remains valid MediaWiki syntax, but neither its general acceptance by WAFs nor equivalence of Cargo storage should be assumed.

Before remediation, replacing:

''[[Tides of Darkness]]''<ref>Test citation</ref>

with a wiki link whose display text contains the italics avoided the failure:

[[Tides of Darkness|''Tides of Darkness'']] <ref>Test citation</ref>

This alternative worked in the PHP 8.3.36 preview tests and continued to work after the MediaWiki 1.46.2 upgrade. Following the firewall fix, such rearrangement is no longer necessary for the successfully retested citations. The original testing did not establish the behaviour of every possible formatting combination.

Reuse previously defined named references

A further alternative, verified in Preview only, is to define the citation elsewhere on the page and insert a self-closing reference into the form field:

Eversong Forest<ref name="one" /><ref name="two" />

With the corresponding definitions present in the article, the preview displayed both reference numbers in the infobox and the full citations under Endnotes. The tested sources were Tides of Darkness (2007), chapter 14, and Dark Factions (2008), pages 152–153. This approach requires the named reference definitions to remain available, and saving and reopening were not independently verified.[4]

Separate Cargo issue: UNIQ markers

During the same investigation, the Locations Cargo table was found to contain internal reference placeholders, including UNIQ--ref-00000008-QINU, in the stored Source values for Kalidar and Nighthaven. The raw page wikitext contained valid reference tags, and the pages could render normally.

This is a separate data-storage or parsing problem, not evidence of a WAF block. The Source field is declared as Wikitext, whereas Former_name uses Wikitext string. Their differing types are relevant context but do not prove a cause.

A January 2026 discussion on the MediaWiki website describes a similar UNIQ-marker problem as originating in Cargo's storage of partially parsed reference and pre content rather than Page Forms.[5]

The discovery of a ModSecurity block does not resolve this Cargo issue, which should be investigated independently if its stored values need to be queried or displayed.

Earlier discussions prompted the original suspicion of a Page Forms defect. They are useful background, but none is confirmed to describe the same hosting-level firewall issue:

  • December 2014: A Semantic Forms user reported a literal reference in a textarea becoming a UNIQ...ref...QINU marker after saving, whereas direct editing worked.[6]
  • 2020: Page Forms 4.9 and 4.9.1 included improvements to handling XML-style tags and self-closing tags in template fields.[7]
  • July 2021: A MediaWiki support discussion recommended #tag:ref for a separate reference-expansion problem in templates, and the reporter confirmed that it worked.[8]
  • 2025–2026: Phabricator T406042 described a different Page Forms HTTP 500 failure involving templates inside pre tags and memory exhaustion; it was resolved in March 2026.[9]

Outcome and remaining questions

The Page Forms editing failure investigated here is resolved on Azeroth Gazetteer. The decisive evidence was an Apache ModSecurity log showing rule 942550 misclassifying valid wikitext, confirmation from DreamHost technical support, and successful citation editing after the rule was removed. A Page Forms defect report in Wikimedia Phabricator was therefore not submitted on the basis of these failures.

Two qualifications remain. First, the differing results observed under PHP 8.4.27 and PHP 8.3.36 were not independently explained, and the original fifteen cases were not all repeated after the firewall change. Second, the Cargo UNIQ-marker issue is separate and has not been resolved by the firewall change. Neither qualification undermines the confirmed ModSecurity block or the successful local remediation.

The practical lesson is to inspect web-server and WAF logs before concluding that complex wikitext has exposed a PHP or Page Forms bug. Legitimate markup can trigger generic security signatures, and a server-side rejection may appear in the browser as an application error.

Endnotes

  1. ↑ 1.0 1.1 DreamHost Knowledge Base, “Enabling the Web Application Firewall”, documentation of ModSecurity blocks and HTTP 418
  2. ↑ DreamHost Knowledge Base, “Enabling the Web Application Firewall”, sections on error responses and modifying rules
  3. ↑ MediaWiki: Help:Magic words, section on #tag; Help:XML-style tags
  4. ↑ MediaWiki: Help:Cite, section on reusing named references
  5. ↑ MediaWiki: Extension talk:Page Forms, Jonathan3, 13 January 2026
  6. ↑ MediaWiki: Extension talk:Page Forms, September–December 2014 archive, section on references transformed into UNIQ markers (26–30 December 2014)
  7. ↑ MediaWiki: Extension:Page Forms/Version history, entries for versions 4.9 and 4.9.1
  8. ↑ MediaWiki support desk, “Extension Cite: references-tag does not work in Templates for me”, 6–7 July 2021
  9. ↑ Wikimedia Phabricator T406042, history through March 2026