I wrote a php script to fetch the email content.
These contents are HTML format.
I'd like to display the content, as below
<?php
$email_content = '
<html>
<script>alert("XSS");</script>
<body>
<div>Line1</div>
<div>Line2</div>
</body>
</html>
';
echo $email_content;
?>
As you can see, it will cause XSS attacks. But if I use htmlspecialchars function, it will not show the correct HTML format, how should I do in this case? Thanks.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…