MapServer's OpenLayers HTML output for the endpoint `SERVICE=WMS&REQUEST=GetMap&FORMAT=application/openlayers` reflects an attacker-controlled `X-Forwarded-Host` value received as `HTTP X FORWARDED HOST` through the functions `msBuildOnlineResource()`, `processLine()`, and the `[mapserv onlineresource]` substitution in `src/maputil.c` and `src/maptemplate.c` without proper escaping for a single-quoted JavaScript string. If the deployment trusts the forwarded header and lacks a fixed `ows onlineresource` or `MS ONLINERESOURCE` value, embedded single quotes can escape the generated URL string. This allows an unauthenticated attacker to execute arbitrary JavaScript in the MapServer site origin, potentially granting access to sessions, tokens, same-origin data, and requests.