惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

J
Java Code Geeks
T
Tailwind CSS Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
L
LangChain Blog
博客园 - 【当耐特】
I
InfoQ
腾讯CDC
人人都是产品经理
人人都是产品经理
H
Help Net Security
Y
Y Combinator Blog
B
Blog
博客园 - Franky
Microsoft Security Blog
Microsoft Security Blog
Stack Overflow Blog
Stack Overflow Blog
The Cloudflare Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
WordPress大学
WordPress大学
H
Hackread – Cybersecurity News, Data Breaches, AI and More
博客园 - 叶小钗
D
Docker
博客园 - 聂微东
B
Blog RSS Feed
G
Google Developers Blog

博客园 - Sady

Start my new level SCM Chart How to read the contents of a remote web page rs.open syntax Deal with replacing a string in an NTEXT field Get random records How to debug a vb dll for asp SQL Value Example ASP Class 封装ASP Version 3 of OA System The relation chart of Supply Chain Management Version 2 of our oa system Supply Chain Management on Website Away for so long Self-promotion CSharp中几个关键概念 类的继承 DTD
javascript injection attack - Sady
Sady · 2009-04-17 · via 博客园 - Sady

Today, I read an article about "Do not believe...". It mentions javascript injection attack.

Yes, crazy! I do never know this problem.
In the url address input the code:
javascript:alert(window.c=function(){document.getElementById("Type").value = "change hidden value"}())

Test code:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>change hidden value</title>
<script type="text/javascript">
function showValue(){alert("Hidden value: " + document.getElementById("Type").value);}
</script>
</head>
 
<body>
<form>
<input type="hidden" id="Type" name="Type" value="hidden value" />
<input type="button" onclick="showValue();"  value="View Hidden Value"/><br />
<textarea>
javascript:alert(window.c=function(){document.getElementById("Type").value = "change hidden value"}())</textarea>
</body>
</html>