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

推荐订阅源

Google DeepMind News
Google DeepMind News
Application and Cybersecurity Blog
Application and Cybersecurity Blog
P
Privacy International News Feed
T
Tor Project blog
Spread Privacy
Spread Privacy
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
L
Lohrmann on Cybersecurity
博客园_首页
T
Tailwind CSS Blog
A
Arctic Wolf
P
Proofpoint News Feed
H
Help Net Security
V
Vulnerabilities – Threatpost
云风的 BLOG
云风的 BLOG
Microsoft Azure Blog
Microsoft Azure Blog
月光博客
月光博客
大猫的无限游戏
大猫的无限游戏
F
Fortinet All Blogs
罗磊的独立博客
阮一峰的网络日志
阮一峰的网络日志
酷 壳 – CoolShell
酷 壳 – CoolShell
aimingoo的专栏
aimingoo的专栏
D
DataBreaches.Net
博客园 - 聂微东
Security Latest
Security Latest
V
Visual Studio Blog
腾讯CDC
D
Darknet – Hacking Tools, Hacker News & Cyber Security
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Microsoft Security Blog
Microsoft Security Blog
I
InfoQ
S
Schneier on Security
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Cyberwarzone
Cyberwarzone
T
Tenable Blog
B
Blog RSS Feed
博客园 - 三生石上(FineUI控件)
N
Netflix TechBlog - Medium
The Cloudflare Blog
U
Unit 42
Latest news
Latest news
AWS News Blog
AWS News Blog
J
Java Code Geeks
N
News and Events Feed by Topic
Blog — PlanetScale
Blog — PlanetScale
G
Google Developers Blog
S
SegmentFault 最新的问题
M
MIT News - Artificial intelligence
Help Net Security
Help Net Security

猫涅的秘密结社

关于就职的思考 hackthissite-org 数据库原理相关 关于在与我互动前你可能需要了解的事 信安roadmap 个人主页开发汇报 六级生词速记本——附考后感想 数据结构C++自学相关 NewStarCTF-2025 三款steam付费番茄钟软件测评 夏令营-ai hello-world qt环境下的c++程序编写 新新的年 qq机器人配置二三事 搞点java 读书笔记-当下的力量 网页小修时间 glibc更新记录 Vulhub在线靶场记录 Vulhub记录(旧的) 神奇脚本在哪里-CTF之Pwn BaseCTF高校联合新生赛2024 逆逆逆逆逆向-CTF之reverse 求解 夺旗时间 学学学 渗透测试相关 协议/漏洞/网络 最新的知识点 数据分析相关 zico2解析 OverTheWire-bandit解析 CTF实战相关2 靶机解析-gigachad ctf实战相关1 复习time 开学季 维修时间 小小修整 学校实训-笔记 每周靶机之Beelzebub 读书笔记-如何阅读一本书 DC-4解析 DC-2解析 每周靶机之ted 靶机-DC-1 每周靶机之bob potato解析 每周靶机之Tommyboy1dot0 owasp命令执行漏洞 owasp文件包含漏洞 每周靶机之WALLABY'S-NIGHTMARE owasp上传漏洞 Hackademic.RTB1 owasp与sql注入与sqlmap liunx中sudo服务相关知识 liunx中ssh服务相关知识 moneybox解析 C语言相关1 关于加入aplayer的方式 再来一次 关于在next7.8.0中建设评论功能这件事 目前的进展 编辑小提示
xss跨站点脚本攻击
nirvana_felis · 2023-12-05 · via 猫涅的秘密结社

总之这是今天的笔记

XSS的原理和分类
跨站脚本攻击XSS(Cross Site Scripting),为了不和层叠样式表(Cascading Style Sheets, CSS)的缩写混淆,故将跨站脚本攻击缩写为XSS。恶意攻击者往Web页面里插入恶意Script代码,当用户浏览该页面时,嵌入Web里面的Script代码会被执行,从而达到恶意攻击用户的目的。XSS攻击针对的是用户层面的攻击!

1.什么是Javascript
JavaScript是指在网页上编写的脚本语言,是对HTML在功能上的扩展。
JavaScript与Java没有任何关系,它们只是名字相似而已。
JavaScript的代码嵌入在HTML里,直接在客户端的浏览器上执行,属于前端语言。
大多数的XSS代码都是使用JavaScript语言编写的,JavaScript能做到什么效果,XSS的威力就有多大。
JavaScript自测
https://www.w3school.com.cn/quiz/quiz.asp?quiz=js
JavaScript基础语法练习
搭建环境(WS2008+AppServ+Sublime)
例子1:JavaScript test

1
2
3
4
5
6
7
8
9
10
11
12
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>JavaScript test</title>
</head>
<body>
<script>
document.write("<h1>Hello,world")
</script>
</body>
</html>

例子2:JavaScript 变量

1
2
3
4
5
6
7
8
9
10
11
12
13
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>JavaScript 变量</title>
</head>
<body>
<script>
var name = "shuke";
document.write("<h1>hello,"+ name)
</script>
</body>
</html>

例子3:JavaScript 字符串拼接

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>字符串拼接</title>
</head>
<body>
<script>
var name = "leiyu";
var age = 17;
document.write("<h1>Hello,everyone! My name is " + name +". I'm " + age +" years old.");
</script>
</body>
</html>

例子4:JavaScript 事件响应

1
2
3
4
5
6
7
8
9
10
11
12
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>JavaScript 事件响应</title>
</head>
<body>
<form action="">
<input type="button" value="请单击此处" onclick=alert('你单击了此按钮,触发了弹窗') >
</form>
</body>
</html>

例子5:JavaScript OnError事件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>JavaScript OnError事件</title>
</head>
<body onload=alert("客官,您久等了....")>
<img src="./images/welcome.png" onerror=alert("请检查图片路径....")>
</body>
</html>
加载外部js文件
jstest.html文件
<script src="/js/test.js"></script>
test.js文件
alert("hello,world!");

例子6:加载外部文件

1
2
3
4
5
6
7
8
9
10
11
<script src=“URL"></script>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>加载外部js文件</title>
</head>
<body>
<script src="./js/test.js"></script>
</body>
</html>

例子7:加载外部文件document对象的常用属性:cookie,location

1
2
3
4
5
6
7
8
9
10
11
12
13
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>document对象的常用属性:cookie,location</title>
</head>
<body>
<script>
alert(document.cookie);
alert(document.location);
</script>
</body>
</html>

例子8:location.href实现页面跳转

1
2
3
4
5
6
7
8
9
10
11
12
13
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>location.href实现页面跳转</title>
</head>
<body>
<script>
alert(document.location);
location="http://www.51cto.com";
</script>
</body>
</html>

例子9:Javascript语法-条件判断+函数

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Javascript语法-条件判断+函数</title>
</head>
<body>
<script>
function getGrade(score){
if (score>=60){
return "及格";
}
else{
return "不及格";
}
}
document.write(getGrade(40));
</script>
</body>
</html>

例子10:条件分支

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>根据分数给出等第</title>
</head>
<body>
<script>
function getGrade(score)
{
if(score>=90)
{
return "excellent";
}
else if(score>=80)
{
return "good";
}
else if(score>=70){
return "just so so";
}
else if(score>=60){
return "pass";
}
else if{
return "not good";
}
}
document.write(getGrade(70));
</script>
</body>
</html>