Skip to content

Fix vulnerability in config user service backend #1411

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

Merged
merged 3 commits into from
Mar 14, 2022

Conversation

flaix
Copy link
Member

@flaix flaix commented Mar 13, 2022

No description provided.

flaix added 3 commits March 12, 2022 20:59
Add unit tests for exploiting the email address or display name
in the config user service by using newlines in the values.
Te `StoredUserConfig` did not handle sections without a subsection.
When the subsection did not exist, i.e. was `null`, then the subsection
name would be set to the string "null". This is not how the config file
format works. It should create a `[SECTIONNAME]` entry instead.

This fix handles a `null` subsection correctly, by handling it as a
section without a subsection.
The `StoredUserConfig` only escaped the escape character, i.e. backslash.
But it does not escape control characters like tab or newline. This
introduces a vulnerability where an attacker can create new entries
in their user account and create new accounts.
In addition, other characters are also not properly handled. Field values
with a comment character need to be quoted. This only happens for the
`#` character and only when the value starts with it. Also the quote
is note escaped in values.

This change completely rewrites the `escape` method of `StoredUserConfig`.
It takes care of properly escaping characters that need escaping for the
git configuration file format.

This fixes #1410
@flaix flaix merged commit b0c1565 into fixup-1.9 Mar 14, 2022
@flaix flaix deleted the 1410-vulnerability-userdb branch March 14, 2022 19:11
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 this pull request may close these issues.

A user privilege elevation vulnerability in the latest version of gitblit
1 participant