Reflected XSS in "Create Category" Functionality of Post Creation Module
The Category Name field in the Create Category feature reflected user input back into the HTML response without sanitisation, so a script payload executed on submission. The execution only occurred in the submitter's own session and did not persist or reach other users.
- Triaged in 25 hours
- Fixed in 8 days
- Paid in 8 days
- Disclosed after 42 days
A reflected Cross-Site Scripting (XSS) vulnerability was identified in the “Create Category” feature of the post creation functionality.
When a user enters a malicious JavaScript payload in the Category Name field, the input is reflected and executed immediately after submission. However, this XSS only executes in the attacker’s own session, and does not persist or affect other users.
Impact
The presence of such a vulnerability indicates that user input is not properly sanitized or encoded before being reflected back into the HTML response.
While not directly exploitable by other users, this flaw can have the following implications:
-
It highlights a potential entry point for more severe XSS vulnerabilities if similar input handling exists elsewhere in the application.
-
It poses a client-side security risk, especially in environments with browser extensions, debugging tools, or when integrating third-party scripts.
-
It reduces trust in the platform’s secure coding practices, especially in an admin interface that manages multiple WordPress sites.
-
It can be used by attackers with access to the dashboard (e.g., insider threat or compromised low-privilege user) to test or explore further payload injection points.
Addressing such vulnerabilities improves the overall resilience of the application and helps prevent future, more impactful exploits.
Attachments
Context
MainWP is a self-hosted management dashboard for administering multiple WordPress sites from a single interface. One of its modules handles post creation, and within that module there is a "Create Category" feature that lets an operator add a new post category by supplying a category name. The category name is submitted from the dashboard and reflected back into the HTML response of the page.
The report covers a reflected Cross-Site Scripting (XSS) issue in that Category Name field, in the MainWP codebase hosted at https://github.com/mainwp/mainwp. It was filed on HackerOne, rated low severity with a CVSS score of 2.3, and disclosed on 17 July 2025. A bounty of 50.00 USD was paid.
Setup
The report does not describe any particular account setup, role configuration, tooling or version. The only precondition that matters for the finding is access to the dashboard's post creation module and its "Create Category" functionality, since the payload has to be typed into the Category Name field there. The researcher notes that the payload executes only in the session of the person who submitted it.
Finding it
The report identifies the "Create Category" feature of the post creation functionality as the location: the value entered in the Category Name field is reflected into the page and executed immediately after submission. That is the classic signature of reflected XSS: input goes straight back into the HTML response without being sanitised or encoded, and the browser parses it as markup and script rather than as text.
The important qualification, stated plainly in the report, is that the script runs in the attacker's own session. It does not persist and does not affect other users. So this is not a stored XSS that would fire for an administrator viewing a category list, and it is not a reflected XSS that can be delivered to a victim through a crafted link in the usual way. It behaves like self-XSS, since the payload only runs in the submitter's own session.
Exploitation
Step 1: Open the Create Category feature
Navigate to the post creation module in the MainWP dashboard and open the "Create Category" functionality. This is the form that accepts a new category name.
Step 2: Enter a JavaScript payload as the category name
In the Category Name field, enter a malicious JavaScript payload. The report does not reproduce the exact payload string used.
Step 3: Submit the form
Submit the form. The value from the Category Name field is reflected back into the HTML response and the JavaScript executes immediately after submission, in the session of the user who submitted it.
The report does not include the raw HTTP request, the response body, or the exact payload, so the precise reflection point and the encoding context cannot be reconstructed from it. The attached proof of concept is a screen recording of the behaviour:
Root cause
User input from the Category Name field is reflected back into the HTML response without being properly sanitised or encoded first. Because the browser receives the submitted value as part of the page markup, any script contained in it is parsed and executed rather than displayed as text.
The report frames this as an input handling failure rather than a flaw in a specific output encoding routine, and it does not identify the particular function or template responsible. The report does not identify the particular function or template responsible.
Impact
The report is explicit about the limits: the XSS executes only in the attacker's own session, does not persist, and does not affect other users. It is therefore not directly exploitable against other users.
The implications the researcher lists are indirect:
- It marks a potential entry point for more severe XSS if similar input handling exists elsewhere in the application.
- It is a client-side security risk, particularly in environments with browser extensions, debugging tools, or third-party scripts integrated into the page.
- It reduces trust in the platform's secure coding practices, especially given that this is an admin interface managing multiple WordPress sites.
- It can be used by someone who already has dashboard access, such as an insider threat or a compromised low-privilege user, to test or explore further payload injection points.
In short, the value is in what the flaw signals about input handling across the product, not in a direct attack path against another user.
Fix
The report does not state what change was made, if any, or which component was patched. The remediation it argues for follows from the root cause: sanitise or encode user input before it is reflected back into the HTML response, so that a submitted category name is rendered as text and never parsed as markup or script. The report notes that addressing such vulnerabilities improves overall resilience and helps prevent future, more impactful exploits.
Variants to test
- Other name and label fields in the post creation module (tags, custom fields, slugs). A positive result is the submitted value coming back in the response unencoded and executing in the browser.
- The same Create Category flow reached through a different route or with different request parameters. A positive result is the same immediate execution after submission.
- Other MainWP modules that accept free-text names for objects (sites, groups, clients). A positive result is reflection without encoding in the response body.
- Fields whose values are echoed into attributes or JavaScript blocks rather than element text. A positive result is a payload that breaks out of the attribute or script context and executes.
Hunting notes
This class of bug tends to hide in admin interfaces where a form submission is answered by re-rendering the page with the submitted values, particularly in CRUD forms for categories, tags and other named objects.
On impact: the researcher was candid that the payload only fires in the submitter's own session, and the report was still accepted at low severity with a small bounty. The reasoning that carried it was the exposure of an input handling weakness in an admin interface that manages many WordPress sites, plus the list of indirect risks.
What happened, in plain words
MainWP is a tool that lets one person look after many WordPress websites from a single control panel, instead of logging in to each site separately. One part of that control panel helps you write and publish posts, and inside it there is a small form called "Create Category" where you type a name for a new category (a label used to group posts, like "News" or "Reviews").
The researcher found that if you type JavaScript code into that Category Name field instead of an ordinary name, the dashboard sends the value back to your browser as part of the page, and the browser runs the code straight away. This is called reflected Cross-Site Scripting, or reflected XSS for short.
The catch, and the report says this clearly, is that the code only runs in the browser session of the person who typed it. It is not saved anywhere, and it does not affect anybody else. So it is not a way to attack another user. It is still worth fixing, because it shows that the application is not handling typed input safely, and the same mistake could exist in more dangerous places.
The report was filed on HackerOne, a platform where security researchers report bugs to companies. It was rated low severity with a CVSS score of 2.3 (CVSS is a standard scoring system where 0 is harmless and 10 is catastrophic), a bounty of 50.00 USD was paid, and it was disclosed on 17 July 2025. The code lives at https://github.com/mainwp/mainwp.
The pieces you need to know
Before the steps make sense, a few everyday ideas:
- A web page is text that the browser turns into a picture. When you visit a page, the server sends back a document written in HTML. Your browser reads that text and draws the buttons, boxes and labels you see. If the text contains a piece of JavaScript (the language browsers use to make pages interactive), the browser runs it.
- A form field is just a box that sends text to the server. When you type a category name and press submit, your browser packages what you typed and sends it to the server. The server then usually sends a fresh page back, often with your value shown somewhere so you can see it was accepted.
- Reflected XSS means the server takes what you typed and puts it back into the page it returns, without cleaning it first. If what you typed was ordinary text, you see ordinary text. If what you typed was code, the browser cannot tell the difference and runs the code. The word "reflected" is used because the input bounces straight back at you in the response, like an echo.
- Sanitising or encoding is the cleaning step. Encoding means turning dangerous characters into harmless stand-ins, so that a
<becomes something the browser displays as a character rather than treats as the start of a tag. If that step is missing, the input arrives "raw". - A session is the browser's logged-in state. When you log in, the server gives your browser a small piece of data (often a cookie) so it can recognise you on the next request. "Runs in the attacker's own session" means the code only executes while the person who typed it is logged in, in their own browser, and nobody else sees it.
- Stored versus reflected XSS. Stored XSS is saved on the server (for example in a database) and fires for anyone who later views the page. Reflected XSS is not saved; it only exists in the response to the request that carried it. This report is the reflected kind, and because the payload is only ever submitted by the person attacking themselves, it behaves like self-XSS.
Setting up
The report does not describe any particular account setup, role configuration, tooling or version. The only thing you need is access to the dashboard's post creation module and its "Create Category" functionality, because that is where the payload has to be typed. The researcher notes that the payload executes only in the session of the person who submitted it.
Finding it
The report identifies the "Create Category" feature of the post creation functionality: whatever is entered in the Category Name field comes back in the page and runs immediately after submission. That is the classic signature of reflected XSS: the input goes straight back into the HTML response without being sanitised or encoded, and the browser parses it as markup and script rather than as text.
The important qualification, stated plainly in the report, is that the script runs in the attacker's own session. It does not persist and does not affect other users. So this is not a stored XSS that would fire for an administrator viewing a category list, and it is not a reflected XSS that can be delivered to a victim through a crafted link in the usual way. It behaves like self-XSS, since the payload only runs in the submitter's own session.
Reproducing it
Step 1: Open the Create Category feature
Go to the post creation module in the MainWP dashboard and open the "Create Category" functionality. This is the form that accepts a new category name. You start here because this is the only place the report says the flaw lives; there is no point poking at other screens until you have seen this one behave.
Step 2: Enter a JavaScript payload as the category name
In the Category Name field, type a malicious JavaScript payload. The report does not reproduce the exact payload string used, so there is nothing to copy here. The idea is simply that the box expects a name like "News", and instead you give it code.
Step 3: Submit the form
Submit the form. The value from the Category Name field is reflected back into the HTML response and the JavaScript executes immediately after submission, in the session of the user who submitted it. You submit because the reflection only happens on the response to that submission; the page has to be rebuilt with your value in it for the browser to run anything.
The report does not include the raw HTTP request, the response body, or the exact payload, so the precise reflection point and the encoding context cannot be reconstructed from it. The attached proof of concept is a screen recording of the behaviour:
Why it happens
User input from the Category Name field is reflected back into the HTML response without being properly sanitised or encoded first. Because the browser receives the submitted value as part of the page markup, any script contained in it is parsed and executed rather than displayed as text. Think of a form that asks for your name and then prints "Hello, [your name]" on a receipt: if the receipt printer also obeyed instructions written in the name field, a name like "tear this receipt" would be carried out instead of printed.
The report frames this as an input handling failure rather than a flaw in a specific output encoding routine, and it does not identify the particular function or template responsible. The report does not identify the particular function or template responsible.
What it means in practice
The report is explicit about the limits: the XSS executes only in the attacker's own session, does not persist, and does not affect other users. It is therefore not directly exploitable against other users.
The implications the researcher lists are indirect:
- It marks a potential entry point for more severe XSS if similar input handling exists elsewhere in the application. In other words, the same careless handling might sit behind a field that other people can see.
- It is a client-side security risk, particularly in environments with browser extensions, debugging tools, or third-party scripts integrated into the page. Anything else running in that browser tab could be affected by code that executes there.
- It reduces trust in the platform's secure coding practices, especially given that this is an admin interface managing multiple WordPress sites. A dashboard that controls many sites is a high-value place to get things right.
- It can be used by someone who already has dashboard access, such as an insider threat or a compromised low-privilege user, to test or explore further payload injection points. If you are already inside, a flaw like this gives you a place to experiment.
In short, the value is in what the flaw signals about input handling across the product, not in a direct attack path against another user.
The fix
The report does not state what change was made, if any, or which component was patched. The remediation it argues for follows from the cause: sanitise or encode user input before it is reflected back into the HTML response, so that a submitted category name is rendered as text and never parsed as markup or script. The report notes that addressing such vulnerabilities improves overall resilience and helps prevent future, more impactful exploits.
Other places to look
- Other name and label fields in the post creation module (tags, custom fields, slugs). A positive result is the submitted value coming back in the response unencoded and executing in the browser.
- The same Create Category flow reached through a different route or with different request parameters. A positive result is the same immediate execution after submission.
- Other MainWP modules that accept free-text names for objects (sites, groups, clients). A positive result is reflection without encoding in the response body.
- Fields whose values are echoed into attributes or JavaScript blocks rather than element text. A positive result is a payload that breaks out of the attribute or script context and executes.
Notes for anyone hunting the same thing
This class of bug tends to hide in admin interfaces where a form submission is answered by re-rendering the page with the submitted values, particularly in forms for creating, reading, updating and deleting categories, tags and other named objects. If you type something like marker123 and the page sends back marker123 unchanged, the input is not being transformed; if it sends back something altered, encoding is happening.
On impact: the researcher was candid that the payload only fires in the submitter's own session, and the report was still accepted at low severity with a small bounty. The reasoning that carried it was the exposure of an input handling weakness in an admin interface that manages many WordPress sites, plus the list of indirect risks.
Glossary
- MainWP: a self-hosted dashboard for managing multiple WordPress sites from one interface.
- WordPress: a popular system for building and running websites and blogs.
- Module: a self-contained part of an application that handles one area of work, such as post creation.
- Category: a label used to group posts together, like "News" or "Reviews".
- Reflected XSS: XSS where the malicious input is echoed straight back in the response to the same request, rather than being stored.
- Stored XSS: XSS where the malicious input is saved on the server and later shown to other users.
- Self-XSS: XSS that only fires in the session of the person who submitted the payload, so it cannot be used against anyone else.
- Payload: the piece of text or code an attacker submits, designed to do something when it is processed.
- JavaScript: the programming language that browsers run to make web pages interactive.
- HTML: the text format that describes the structure of a web page; browsers read it and draw the page.
- HTML response: the page content a server sends back to the browser after a request.
- Sanitise: to clean input so that anything dangerous in it is removed or neutralised.
- Encode: to convert special characters into harmless stand-ins so the browser displays them as text instead of acting on them.
- Reflection: the point in a response where submitted input is placed back into the page.
- Session: the logged-in state a browser holds after you sign in, usually tracked with a cookie.
- Cookie: a small piece of data a site stores in your browser so it can recognise you on later requests.
- Client-side: happening in the user's browser rather than on the server.
- Admin interface: the part of an application used by administrators to manage it.
- CRUD: create, read, update and delete, the four basic operations on stored items.
- CVSS: a standard scoring system for the severity of a security flaw, from 0 to 10.
- Severity: a rating of how serious a flaw is, often low, medium, high or critical.
- Bounty: a payment a company makes to a researcher who reports a valid security flaw.
- HackerOne: a platform where researchers report security flaws to companies and track the results.
- Disclosed: made public, usually after the company has had time to fix the issue.
- Recon: the exploratory phase of security testing, where you look around an application to find interesting behaviour.
- Marker string: a harmless, unique piece of text you submit so you can search for it in the response and see whether it comes back unchanged.
- Attribute: a setting written inside an HTML tag, such as a link target or an input name.
- Slug: the short, URL-friendly version of a name, often used in web addresses.