Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8271417
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T06:50:07+00:00 2026-06-08T06:50:07+00:00

Following on from a question I asked about escaping content when building a custom

  • 0

Following on from a question I asked about escaping content when building a custom cms I wanted to find out how dangerous not escaping content from the db can be – assume the data ha been filtered/validated prior to insertion in the db.

I know it’s a best practice to escape output but I’m just not sure how easy or even possible it is for someone to ‘inject’ a value into page content that is to be displayed.

For example let’s assume this content with HTML markup is displayed using a simple echo statement:

<p>hello</p>

Admittedly it won’t win any awards as far as content writing goes 😉

My question is can someone alter that for evil purposes assuming filtered/validated prior to db insertion?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T06:50:08+00:00Added an answer on June 8, 2026 at 6:50 am

    If you do not escape your HTML output, one could simply insert scripts into the HTML code of your page – running in the browser of every client that visits your page. It is called Cross-site scripting (XSS).

    For example:

    <p>hello</p><script>alert('I could run any other Javascript code here!');</script>
    

    In the place of the alert(), you can use basically anything: access cookies, manipulate the DOM, communicate with other servers, et cetera.

    Well, this is a very easy way of inserting scripts, and strip_tags can protect against this one. But there are hundreds of more sophisticated tricks, that strip_tags simply won’t protect against.

    If you really want to store and output HTML, HTMLPurifier could be your solution:

    Hackers have a huge arsenal of XSS vectors hidden within the depths of
    the HTML specification. HTML Purifier is effective because it
    decomposes the whole document into tokens and removing non-whitelisted
    elements, checking the well-formedness and nesting of tags, and
    validating all attributes according to their RFCs. HTML Purifier’s
    comprehensive algorithms are complemented by a breadth of knowledge,
    ensuring that richly formatted documents pass through unstripped.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Following on from another question I asked, Scala 2.8 breakout , I wanted to
Following on from this question , I am interested in finding out how you
Following on from a question I posted yesterday about GUIs, I have another problem
Earlier today I asked a question about configuring log4net from code and got an
A few days ago I asked a question about returning select fields from a
I have been asked a question in an interview about interfaces. I am not
Today i was asked this question about sharing data from a thread t1 that
I recently asked a question about building a SOAP message using the java provided
Following on from the question asked by Mykroft Best way to handle input from
Following from these question Subset sum problem and Sum-subset with a fixed subset size

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.