Skip to content

Commit fcea4c2

Browse files
Merge pull request #4228 from CodeVigilanteOfficial/fix_rce_eval
Update utils.py (fix dangerous code)
2 parents 2b9e953 + ef87a75 commit fcea4c2

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

litellm/utils.py

+4-7
Original file line numberDiff line numberDiff line change
@@ -7182,14 +7182,11 @@ def get_secret(
71827182
b64_flag = _is_base64(encrypted_secret)
71837183
if b64_flag == True: # if passed in as encoded b64 string
71847184
encrypted_secret = base64.b64decode(encrypted_secret)
7185-
if not isinstance(encrypted_secret, bytes):
7186-
# If it's not, assume it's a string and encode it to bytes
7187-
ciphertext = eval(
7188-
encrypted_secret.encode()
7189-
) # assuming encrypted_secret is something like - b'\n$\x00D\xac\xb4/t)07\xe5\xf6..'
7190-
else:
71917185
ciphertext = encrypted_secret
7192-
7186+
else:
7187+
raise ValueError(
7188+
f"Google KMS requires the encrypted secret to be encoded in base64"
7189+
)#fix for this vulnerability https://huntr.com/bounties/ae623c2f-b64b-4245-9ed4-f13a0a5824ce
71937190
response = client.decrypt(
71947191
request={
71957192
"name": litellm._google_kms_resource_name,

0 commit comments

Comments
 (0)