Forum Moderators: coopster

Message Too Old, No Replies

Xss?

         

ayushchd

11:24 am on Aug 26, 2007 (gmt 0)

10+ Year Member



i juss came to know that someone has extracted the username and password frm my database?

when i asked him, i came across the term XSS..
can someone guide me?

dreamcatcher

11:30 am on Aug 26, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This might be useful:
[en.wikipedia.org...]

dc

ayushchd

1:50 pm on Aug 26, 2007 (gmt 0)

10+ Year Member



Is there any good tutorial on how i can protect my php scripts from XSS attacks?

henry0

5:19 pm on Aug 26, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It's all about escaping and properly filtering input

get "essential PHP Security" that little book is in our library PHP book list

<edit>
this means Cross site scripting
but read also about
cross site forgeries
</edit>

dreamcatcher

6:30 pm on Aug 26, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Did you check out some of the links at the base of the wiki page?

dc

ayushchd

4:42 pm on Aug 27, 2007 (gmt 0)

10+ Year Member



hi...after a lotta reading and head scratching, i just want to ask that in my site,i m filtering almost every input like :

if (!preg_match("/^([a-zA-Z0-9]+)$/", $user)) {
$notice = "<div id=\"failure\">Only alphabets and numbers allowed for usernames.</div>";

so, is it vulnerable to XSS attacks even if m filtering the data and allowing the insertion of trusted data?

RonPK

5:25 pm on Aug 27, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It seems to me that two concepts are being mixed in this thread.

Cross Site Scripting (XSS): this involves the bad guy injecting HTML and JavaScript into a page through a form, which enables him to read cookies or make fake pages. Can easily be prevented by using

htmlspecialchars()
when writing user input to HTML.

SQL injection: query a database at will by forgering the query string. Can easily be prevented by proper escaping of user input (

mysql_real_escape_string()
).