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 120399
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T03:48:19+00:00 2026-05-11T03:48:19+00:00

I ran a pen-testing app and it found a ton of XSS errors, specfically,

  • 0

I ran a pen-testing app and it found a ton of XSS errors, specfically, I’m guilty of echo’ing unverified data back to the browser through the querystring.

Specifically, running this puts javascript into my page. http://www.mywebsite.com/search.php?q=%00” [ScRiPt]%20%0a%0d>alert(426177032569)%3B[/ScRiPt].

Thankfully, no where do I let users save data to a database and display back to other uesrs, so I THINK people would only be able to hack themselves with this problem, but I still want to fix it.

The recommendation is to do this:

echo htmlentities($_POST[‘input’], ENT_QUOTES, ‘UTF-8’); 

But currently I need to get this patched up asap, then go fix on a case by case basis. I have a header file I include on every page on the site, I know it’s bad form, but what could blow up if I did:

array_walk($_POST, 'htmlentities');   

I’ll need to do it for COOKIE and GET as well. I never use _REQUEST.

Thanks

  • 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. 2026-05-11T03:48:19+00:00Added an answer on May 11, 2026 at 3:48 am

    HTML-escaping on the way in is obviously The Wrong Thing, but could be a temporary fix until you replace the code with something proper. In the long term it would be unmaintainable and you’ll have loads of weird application-level errors anywhere you start doing substring manipulations (including truncation, which your database may do automatically) across &-encoded characters. It’s not that likely to lead to security breaches, although you can’t tell without looking at the app in a lot more detail.

    If you start encoding things in $_SESSION each time, you’ll get multiply-encoded too-long strings like & very quickly.

    I THINK people would only be able to hack themselves

    Or, an attacker on another web page could redirect or iframe to yours, with enough script injected to display a fake login box that looks just like your site’s, harvest the username and password or automatically delete their account. Stuff like that. Not very good.

    The recommendation is to do this: echo htmlentities($_POST[‘input’], ENT _QUOTES, ‘UTF-8’);

    No need for htmlentities and all those parameters – use htmlspecialchars.

    You can save yourself a few keypresses using something like:

    function h($s) { echo(htmlspecialchars($s)); } ... <?php h($POST['input']) ?> 

    It’s really not that much extra hassle.

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

Sidebar

Related Questions

I ran Debugging and got a ton of "is not defined" errors in all
I ran the convert_to_south command on my app. Everything seems to have gone fine:
I ran some tests , and the data point that the jQuery inArray() is
Ran into another challenge. I looked through some of the questions that I found
I ran bundle update on my rails app. I'm not getting the following error
I ran into a bug I have trouble explaining. Now that I found the
I ran into an error trying to install MacRuby related to llvm and found
I ran into an issue with an IIS web app shutting down an idle
Ran into a very strange problem here using MVC3 and razor. The app I'm
Ran into an Out of Stack Space error trying to serialize an ASP.Net AJAX

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.