The script in the pending comments is executed on the background page, why can't it be seen on the front page?
Why is the script executed in the background page of the pending review comments not visible on the front page? The reason is not mysterious: the front template only renders the content that has passed the review, and the part that has not passed the review does not appear in the visitor's address, so this injection path is left with only one trigger scenario - the moment the administrator opens the comment management page. Once the text in the queue is treated as 'data already stored in the database' rather than 'still controllable external input', the script is pieced together at this background layer.
Why does the problem appear in the background specifically
The rendering logic of the background list page is different from the front-end. The front-end needs to go through status judgment, and unreviewed content cannot enter the template at all; the back-end must display the original text to allow administrators to review, otherwise, they cannot see the full picture of the content to be processed. If the 'display original text' step is not escaped, the script carried in the comment text will be executed as part of the page.
The second difference is session permissions. Visitors to the front desk read public pages, and even if scripts are executed, they can only reach anonymous sessions; the back-end pages carry the administrator's login status, and the same script can use this session to call interfaces and change configurations. Therefore, 'what visitors on the front desk cannot see' is not that the risk has become smaller, but that the risk has changed its location - from the public side to the highest permission side.
The content awaiting review is also input: how should a notice be read?
WordPress in version 7.1.3 of this maintenance version, one of the seven security fixes was a stored cross-site scripting vulnerability on the comment management page, the reporter explicitly wrote 'can be triggered by pending comments.' The value of this statement is not in the vulnerability itself, but in the qualitative assessment it provides: Pending status is just a business status, not a security status.
When reading such announcements, you can separate the three fields. The first is the trigger location, whether it is written on the management page or the front page, it determines whose session is affected; the second is the required permissions, anonymous submission and submission requiring login have completely different handling orders; the third is whether to roll back to the old branch, rolling back means that the old version will continue to receive the same fix. It is much more useful to check these three items against your own site than to just remember a number.
Is it safe if it is not visible on the front page?
No. There are at least three easily overlooked paths:
- Notification and reminder emails will include the comment text snippet in the email body, and the administrator will still read the original text in the email client;
- The exported and backed up files save the original text entered, and any action of 'taking a look' may trigger execution;
- When the in-site interface returns the pending content to the front-end script, if the caller writes directly to the page, the injection point returns to the browser.
In other words, 'not displayed on the front end' only blocks the visitor path. What needs to be prevented is all places that treat unfiltered text as tags for rendering, and most of these places are concentrated in the background and auxiliary links.
The three-level reception on the back-end side
The first layer is the filtering before storage. Within the site, messages and comments are first placed in the pending review status, sensitive word filtering and keyword replacement take effect at this step, and the content matched is replaced or blocked according to the rules. The meaning of this layer is to block obvious dirty data before display, but the blacklist-based replacement itself is not entirely reliable and cannot rely on it alone.
The second layer is the escaping at output time. Separate the 'who wrote the content' and 'what role this content is': All text should be escaped as plain text, and the position requiring rich text should be declared separately. It is the easiest way to make mistakes when the same data goes through a set of output functions in the front-end and another set in the back-end—the two places should default to escaping, not trusting by default.
The third layer is the convergence of permissions and entry. The review page should only do the review job, actions like deleting and status switching should be with verification, and it should not be allowed to be completed with a single ordinary page load. The back-end address itself being not public does not equal to authorization, login status, operation confirmation, and interface authorization are three different things. The site provides JWT authentication and built-in protection related to XSS and SQL injection, but these are all 'a default protection on the program side', which cannot replace this step of output escaping.
Where do review and filtering take effect separately?
The two points that are easy to confuse: content review is about 'whether this content can be displayed externally', and sensitive word filtering is about 'which words need to be replaced or blocked during display'. The former depends on state transition, and the latter depends on string processing at the input or output stage. If only the review stage is monitored, the original script will still be sent to the background as is after approval; if only replacement is done, it can be bypassed by changing the encoding or writing style.
The document status within the station is divided into draft, pending release, official document, and recycle bin. The review process for comments and messages is managed separately. It is recommended to divide the content into two groups during safety self-inspection: one group will be rendered externally, and one group will only appear in the background or notifications. Both groups must follow the same rule - whether to escape by default. Pay special attention to the scenario where the draft link is accompanied by a preview parameter, as the status that can be opened externally should be handled as external content.
Common questions
Question: Is it the most convenient to turn off all comments?Of course, turning it off is the most convenient, but it is often necessary to leave a message in business. A compromise is to review and then publish, and at the same time, the display content of the review page should be processed as plain text, so that even if there is dirty data in the queue, it will not be executed.
Is it enough to do escaping only on the front end?Not enough. The front-end escaping protects the visitor, while the back-end display and notification chain protects the administrator session, and the latter has higher privileges. The same data needs to be confirmed separately at each rendering point.
Can the announcement of upgrading the peer program be directly applied to your own site?Answer: No. The announcement provides the code path and affected version of the program itself, the only thing that can be used is the定性 of 'Review content must also be processed according to external input', and each rendering point of the home site needs to be checked one by one.
Question: How often should this type of maintenance version be followed up?Answer: Sort according to the severity and trigger position in the announcement. Prioritize those that fall on the management page and can be submitted anonymously, and merge the rest into the regular maintenance window.