Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

500 Internal Server Error for createUser with toString #1159

Closed
ElectricNroff opened this issue Jan 2, 2024 · 0 comments · Fixed by #1162
Closed

500 Internal Server Error for createUser with toString #1159

ElectricNroff opened this issue Jan 2, 2024 · 0 comments · Fixed by #1162
Assignees

Comments

@ElectricNroff
Copy link
Contributor

ElectricNroff commented Jan 2, 2024

By combining the findings of the #609 and #1158 issues, it's possible to trigger a 500 error if one is allowed to create users. In other words, unlike in the #1158 issue, it is not necessary to be an ADP to redefine a toString() method.

For example,

curl -X POST \
-H "CVE-API-ORG: ..." \
-H "CVE-API-USER: ..." \
-H "CVE-API-KEY: ..." \
-d 'username=bob&authority.active_roles[toString]=true' \
https://cveawg-test.mitre.org/api/org/Mickey%20Mouse/user

results in:

HTTP/1.1 500 Internal Server Error

{"error":"SERVICE_NOT_AVAILABLE","message":"This service appears to not be available."}

Alternatively, this body can be used:

-d 'username=bob&authority.active_roles[][toString]=true'

This is specific to certain method names such as toString. If, for example, xyString is used instead, then the error message is:

{"error":"BAD_INPUT","message":"Parameters were invalid","details":[{"msg":"Parameter must be a one-dimensional array of strings","param":"authority.active_roles","location":"body"},{"msg":"User role does not exist.","param":"authority.active_roles","location":"body"}]}

In other words, a client user, by placing "toString" within a POST /org/{shortname}/user API call, can interfere with the server's ability to execute this code:

return val.toString().toUpperCase()
}
const newArr = val.map(k => {
if (Array.isArray(k)) {
return toUpperCaseArray(k)
} else {
return k.toString().toUpperCase()

(As far as I know, authority.active_roles[toString]=true fails with TypeError: val.toString is not a function whereas authority.active_roles[][toString]=true fails with TypeError: k.toString is not a function)

@jdaigneau5 jdaigneau5 self-assigned this Jan 5, 2024
@jdaigneau5 jdaigneau5 linked a pull request Jan 5, 2024 that will close this issue
david-rocca added a commit that referenced this issue Jan 10, 2024
#1159 Prevents possible toString override
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants