javascript - Using jQuery Selectors Passed as URL Parameter - Safe? -


i have need pass selectors jquery using url parameters.

like: page.php?sel=li.current,%23active,a[href=%27string%27]

those echoed out php like:

$('<?=$request[sel]?>').funct(); 

my questions are:

1) security risk?

2) if risk is, how can safely this?

the jquery code doesn't other manipulate css of elements defined selector.

thank you

no, not safe. it's vulnerable xss attack vector.

for example, sel=');alert('xssd')$(' alert show on user's screen. allow attackers execute arbitrary javascript. can execute code log them out or perform actions them on website, or show prompt asks them password revalidation.


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -