Urgent.News

What's breaking now, across thousands of outlets.

Tech

A Practical CMS Security Review: XSS, CSRF, and SQL Injection

A CMS editor form crosses several trust boundaries. It accepts a request from a browser, changes stored records, and later displays content to readers or administrators. XSS, CSRF, and SQL injection affect different parts of that journey. A control that addresses one boundary should not be treated as a universal security switch. This guide uses a content-editing workflow as an audit example. The…

A content management system editor engages multiple security gaps as it transitions from user input to rendered content. Cross-site scripting, cross-site request forgery, and SQL injection each threaten individual stages of this workflow. Each threat requires distinct mitigation techniques that should not be treated as generic safeguards.

This guide examines a draft-editing scenario as an audit case study, but the recommended procedures extend to the application's codebase, themes, plugins, and integrations. Begin by examining the data flow from request to display. Identify the authentication method used and the roles permitted to perform each action. Record the exact fields accepted, their source, and how they are protected from browser autofill.

Note the database actions performed, including any transformations of user-provided values. Examine every location where the edited content is later shown, including preview panels, dashboards, notifications, and export files. Comment on any public URLs, search parameters, file imports, or third-party responses that may affect the audit.

Remember that stored data remains susceptible to attacks even after being written to the database. Cross-site scripting vulnerabilities arise when untrusted content is treated as executable code rather than plain text. Render ordinary HTML using automatic output encoding. For formatted HTML, employ a trusted HTML sanitizer with a defined whitelist of permitted elements, attributes, and URLs.

Regular expressions alone are insufficient for HTML sanitization. Different contexts require different handling: values placed in JavaScript, CSS, or URLs must be encoded according to that context, not just HTML. Avoid embedding untrusted data directly into executable code or event attributes. Prefer APIs that treat content as text rather than HTML on the client side.

The Content Security Policy can provide additional protection, but it does not replace proper encoding or sanitization. Secure cookies, while useful, do not eliminate XSS risks. Similarly, cross-site request forgery can occur if a user's session credentials are automatically included in state-changing requests without explicit consent.

Use the framework's built-in CSRF protection, which typically involves generating unpredictable tokens tied to the user's session and verifying their presence in forms or requests. The token should not be exposed in URLs or logs, and an additional role-based authorization check should be implemented to ensure users can only modify objects they are authorized to edit.

Extend CSRF protections to asynchronous requests and avoid using GET methods for state-changing operations. Implement SameSite cookie settings, Origin or Referer checks, and reauthentication for highly sensitive actions as needed. Do not rely solely on JSON formatting or CORS headers for CSRF prevention. Similarly, SQL injection attacks occur when user-supplied data is directly incorporated into SQL queries, blurring the line between data and query syntax.

Utilize parameterized queries with the database library's built-in functions to separate data from query structure. Conduct comprehensive reviews of all data-access points, including administrative filters, searches, reports, and scheduled jobs, not just the login interface. While validation can enforce business rules, it is insufficient to replace parameterized queries.

Carefully evaluate the data-access layer and ensure the chosen library and driver safely handle query construction. Use placeholders to denote parameter values rather than direct table or column names. For user-selectable sorting, map inputs to a predefined list of allowed values and directions before constructing query clauses.

Run the application in a test environment using a limited database account with only the necessary permissions, and maintain detailed error logs without sensitive information. This structured approach will help identify and mitigate security vulnerabilities at each stage of the content creation and publishing process.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Signal and Noise: Why Morse Code Still Works When Voice Radio Fails

When storms knock out infrastructure or a hiker is lost beyond mobile coverage, radio amateurs and emergency teams still reach for a code invented in the 1840s.

  • Morse code remains reliable during voice radio failures in disasters.
  • Concentrated power density makes Morse signal 10-20 dB stronger than voice signals.
  • Morse code degrades gracefully, allowing operators to recognize words despite missed dots or dashes.

Stop Paying the Blank-Chat Tax: Install a SKILL.md in 10 Minutes

Stop Paying the Blank-Chat Tax: Install a SKILL.md in 10 Minutes Byline: AgentOps Lab Dek: A practical install path for Cursor-style agents—plus a free teaser so you can try the format before buying…

  • "Blank-chat tax" wastes time and tokens in AI interactions
  • SKILL.md file eliminates this tax by providing clear task instructions
  • Installing SKILL.md takes ~10 minutes, achievable in under 45 minutes

What SMS and Voice Calls Give a Fall Alert That Push Notifications Cannot

Every fall-alarm article on this site ends the same way: step five is yours. The radar detects the collapse, waits out its configured delay, publishes fallStatus , and on the finished units even…

  • SMS and voice calls ensure reliable communication.
  • SMS works without device capabilities or network issues.
  • Voice calls provide immediate auditory alert.

Detect a GIF file before choosing its browser preview

A file called reaction.gif can still contain MP4 video. This matters in upload widgets: choosing an <img> solely from the filename can produce a broken preview, while accepting the file as a verified…

  • GIF files may contain MP4 video data, requiring early detection.
  • Header examination can provide an error message before decoder usage.
  • Browser preview should only display if image decoder accepts the file.

More from Sunday 1 November →