The GoogleDocs4MW extension does not properly sanitize the style parameter before inserting it into HTML. This can be abused to retrieve users' IP addresses, e.g. using the CSS url() function.
Reproduction steps
- Insert the following into Special:ExpandTemplates: <googlespreadsheet width="600" height="200" style="width:50%; background-image: url(https://http.cat/200);">test</googlespreadsheet>
- Open dev tools, click the "OK" button in the ExpandTemplates form and observe that a request to http.cat is sent:
Cause
The style parameter is only sanitized using htmlspecialchars which is insufficient for CSS.
https://github.com/wikimedia/mediawiki-extensions-GoogleDocs4MW/blob/7e9db3b1b596b2569b6d9d85c283f50b086c80fa/src/GoogleDocs4MW.php#L39
Additional information
MW: 1.45.0-alpha (4a86955)
GoogleDocs4MW: 1.4 (7e9db3b)
Browser: Firefox 139.0 on Fedora Linux 42
