Easy way to secure ur site from xss

Started on the old forum in April 2011 · view the original in the archive · old links redirect here

2 replies · 774 views · started 15 years ago · 1 min read

3 participants
Rekon Developer · 215 posts #1

XSS stands for Cross Site Scripting. In such attacks a hacker seems to inject some scripts into your site source code.Lets see some basic precautions to protect site from XSS attack. Mainly hackers have two objectives in doing XSS:

  1. Redirecting all site visits to some other site
  2. Running a malicious script on user PC and stealing his account or other private information.

XSS increases possibility when you are taking an input from user and showing it on some page of site. Hacker tries to find such an input and enters his malicious script code. The script gets injected into your site. Such an input can be a HTML form or GET passed in URL.

To protect site from such a script input,always have moderate content on site. If your site is big and moderating is not easy then you can have auto moderator script which checks for invalid inputs.

For example to run a script hacker must use <script> html tag. To embed it in your page he will input <script>. So instead of keeping angular bracket < , replace it by < before displaying iton page. When you use < it won’t be treated as a HTML tag and script won’t be executed.

Also disable “.js” in input, so it will block all JavaScripts. You can also disable external links for more security.

Advance level: One can think of advance level algorithm like this.

Store checksum of all your files. Compare checksum time by time setting a cron job. If change is found restore original file

Girls are like internet domain name, The girls i like are already taken!

Write your reply now; next you create a free account (or sign in) and it is posted right away. Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close