The XSS triggered when the comment is opened in the background, where should the content system prevent it?

📅 October 12, 2026 👁️ 17

XSS triggered only when comments are opened in the admin backend, where should the content system prevent it? It should be prevented at the rendering layer, not the submission layer. The reason is that such defects belong to secondary context: malicious content quietly lies in the pending queue first, not displayed on the front end, and when the admin opens that line in the backend list, the page renders the comment content as part of the page structure, and the script gets an opportunity to execute. The filtering at the time of entry only covers the moment of submission, and does not manage this subsequent rendering.

Recently, the WordPress 7.1.3 security release provided an example: This version contains 7 security fixes, one of which is on the comment management page, which can trigger stored cross-site scripting through pending comments. This type of fix is worth looking at separately because it clearly states that the 'review interface itself is also an attack surface.'

Why does the attack occur on the back end instead of the front end?

The pending content naturally has a contradiction: to determine whether it should pass, the administrator must see it in a form close to the original. The front-end display goes through the filtering and escaping of the release process, while the back-end list strives for 'presentation as it is,' using different rendering paths, and the attack surface appears in the latter.

Three kinds of performance correspond to three causes.

Performance Trigger condition Cause location Effective protection
Pop-up window when the back-end comment line is opened Content is directly spliced into the page Unescaped output Escaped by context
The list is rewritten by scripts or hijacks the session. Execute login status inheritance in the background Boundary between permissions and sessions Minimum permissions with same-origin verification
Triggered only in preview functionality Preview goes through another rendering branch Filtering rules are inconsistent Both branches have the same escaping rules

The key judgment is: the security requirements of the same data in different contexts are different. It is treated as content when put into the text, as attributes when put into the list title, and as a template when put into the preview. It can only be cleaned once when stored, and it cannot meet all three contexts at the same time.

Why is the filtering in storage not enough

The filtering of sensitive words solves the issue of content compliance, replacing or blocking hit words without understanding the script semantics. Attackers can choose not to violate the construction of the word list, or let the malicious segments wait until the field concatenation takes effect. Therefore, content review and injection protection are two different things that cannot be replaced by each other.

The output escaping is effective because it acts at the moment of rendering: no matter where the data comes from or how it is stored, when outputting as HTML, it is re-constrained according to the current context. It is also配合 with the rendering method itself - inserting the content as a text node, which is safer than concatenating it into a tag string, as the former does not interpret the script.

The third is the permission boundary. After the back-end is hit by the script, the amount of loss depends on what the session can do. If the audit action requires explicit confirmation, and the write interface does not accept a way that can be triggered solely by address access, then the script execution can only read the list at most, and cannot change the site configuration. JWT authentication and role permissions play a role here: they determine the scope of impact after the script is triggered.

The corresponding control point within the site

AnQiCMS has corresponding mechanisms in these areas. The content security settings provide sensitive word filtering and keyword replacement, content review, to control the content entering the display; anti-crawling interference codes and comment anti-spam control the behavior of bulk content extraction and灌写; The security side is built-in JWT authentication and places SQL injection and XSS defense on the same chain. The interface layer also has an important principle: interfaces for high-risk operations such as backup, upgrade, and multi-site are not open by default, and need to be explicitly enabled to be used, which is equivalent to preemptively limiting how far the script can go after being triggered.

The recommended order of implementation on the configuration is as follows: First, confirm that the background list and preview rendering paths follow the same output rules, then check if the write action requires explicit confirmation and source verification, and finally check if the review interface requires complete session permissions. The reason for this order is very practical - issues with the rendering layer will directly affect the administrator's operations, while issues with the permission layer will determine the radius of loss after the problem occurs, both layers need to be collected.

How to self-inspect?

A low-cost self-check method: submit a message on the test station with a pair of tags that do not produce any actual effect, and then open it in three positions: front-end, back-end list, and preview. If it is displayed as is in all three positions, it means that the rendering layer is safe; if it is only parsed in the back-end, it means that the rendering path of the back-end is not consistent with the front-end, and this is the layer that needs to be repaired.

The same type of check should also cover entries like nicknames, field names, and attachment filenames that are not often changed. Their common point is that the content is not updated for a long time, but it is re-rendered every time the list is opened, which belongs to the easiest to miss persistent input surface. For sites that have installed old versions, the follow-up method is not to delete comments, but to upgrade to a version containing fixes first, and then clean up the long-stayed pending entries in the queue - keeping them is equivalent to keeping a batch of inputs that may be re-rendered at any time.

Common questions

Question: Isn't it more stable to only display the number of pending comments without displaying the content?
Answer: It can reduce the risk, but the content needs to be reviewed. A compromise is to only display plain text summaries without retaining the original markings.

Question: Isn't the sensitive word filtering enough?
Answer: Not enough. It targets the word list, not the script construction, and their targets are different.

Question: Can changing the back-end address alone prevent such problems?
Answer: Changing the address only reduces the chance of being automatically scanned, but the rendering layer issue still exists, and administrators will trigger it during normal operations.

Related articles

When old versions only patch security vulnerabilities, should we wait for the main branch to upgrade features?

The security patch and feature upgrade follow two timelines. Taking the recent WordPress 7.1.3 as an example, the official has patched the security fixes back to the old branches that still qualify, while reminding that only the latest version is actively supported. This article explains the difference between active support and security support levels, why feature improvements have to wait for the main branch, and what order to judge when arranging the upgrade timeline for the site.

2026-10-12

After the crawling behavior is divided into several categories, how should the site's release rules be adjusted accordingly.

Divide the automated capture into three layers according to behavior - for subsequent answer collection and indexing, for model training capture, and for replacing users to fetch pages in real time, the benefits and costs of the three types are completely different. This article explains why domain-based access is not enough, how the access rules should be layered, and why the robots only expressing intention determines that it must be used in conjunction with content-side protection.

2026-10-12

Is llms.txt a mandatory standard? What will sites lose if they do not perform this step?

llms.txt is not a mandatory standard, but a community proposal still under discussion: the file is written in Markdown for site descriptions and resource lists, with top-level headings being mandatory paragraphs. Not including this file will not trigger any crawling penalties, the cost being that the model will have one less level of navigation when extracting content. This article describes which formats are fixed in the proposal, what can be achieved, and where the automatically generated file is connected in the site.

2026-10-12

Which element is measured by LCP in the first screen time, and why are image sites prone to measurement bias?

LCP is not about whether there is something on the "first screen", but when the image or text block in the viewport is rendered. This article explains which elements enter the candidate list, why image sites are prone to bias, and explains how lazy loading, background images, and placeholder images push candidate elements backward in three cases, and finally gives the actual impact of server-side rendering and automatic title image matching on the first screen.

2026-10-12

Injections can also be hidden in exported files, where can the prevention of second-order SQL injection be found?

The feature of second-order injection is delayed execution: malicious content looks harmless when written for the first time, but triggers only when exported, imported, or rebuilt as a statement to be consumed. This article takes the second-order SQL injection in the WXR export fixed in WordPress 7.1.3 as an example, explaining the difference between first-order and second-order, why export has become a delivery channel, and where to place protection in the steps of writing, storing, and consuming, as well as the checks to be added to the backup and recovery process.

2026-10-12

What can unlogged-in users read, where are the permission boundaries of the content system likely to leak?

What can unlogged users read depends on where the permission boundary is drawn. Most unauthorized access is not in the main article itself, but in附属 data, interface lists, and preview entries: comments, attachments, and draft previews all have their own visibility. This article explains the three most easily overlooked positions and the methods of closing with in-station user group permissions, document status, and default closure of high-risk interfaces.

2026-10-12

Where do the differences in costs lie between self-built content systems and pay-as-you-go cloud services?

Self-built content system and pay-as-you-go Headless cloud services, the main cost difference lies in the four items of servers, request volume, integration expansion, and operation and maintenance personnel. Self-building on a small scale is usually more cost-effective, while maintenance and personnel become the main expenses as the scale increases; Headless deploys the front-end to the edge, retrieves content by interface, eliminates server-side rendering for each request, but introduces interface call billing. This article compares the four items and provides a comparison with self-hosting.

2026-10-12

The content management system released several security versions in a month, indicating what operation and maintenance should change.

The content management system released security maintenance versions consecutively within a month, indicating that the operational judgment criteria should shift from version numbers to the content of repairs. This article takes recent public information as an example: WordPress released three security maintenance versions consecutively in September and October, Joomla released security fixes for both 5.x and 6.x at the same time, from which three operational adjustments can be extracted - decide based on the content of repairs, leave a rollback point for upgrades, and rotate keys and passwords after upgrades.

2026-10-12