Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
152 views
in Technique[技术] by (71.8m points)

怎么禁止含有js的文本在网页中执行???

测试给我提了个问题,他将下面这段代码从后台发布到前台网页上,但是每次初始化的时候一定会弹一个alert

'"><img src=1 onerror=alert(1)>#

我就想问一下,如何在前台使初始化加载页面,或者就不让这个alert执行


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

喔.存储型 XSS

后台输入的地方,需要先转义后在存入数据库... 不清楚你们的后端语言是啥,,可以查找下对应语言的 specialChar 转义 方法..

另外,搜索下 XSS ,好好看下.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...