Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Cyber Security
  3. Question
Cyber Security

Can I directly echo the PHP user agent?

Asked by Andrew Jenkins Feb 2, 2022 1.2K views 1 answer
Share

About this question

 Is this script vulnerable to PHP or JS code injection? In my quick test I changed the useragent to a PHP script but it will not be executed just printed. If I change the user agent to a javascript code I receive a connection refused by the webserver. So am I safe with this type of script?

<?php 
$u=$_SERVER['HTTP_USER_AGENT']
?>
<html>
string

<?php echo $u; ?>
</html>

Your answer

1 Answer

More Cyber Security discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest Cyber Security Blogs

Guides, tips and career advice on Cyber Security from JanBask experts.