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

Fix protoc install vulnerability #630

Merged
merged 1 commit into from
Jul 31, 2023
Merged

Conversation

erikbosch
Copy link
Contributor

@erikbosch erikbosch commented Jul 31, 2023

See https://cwe.mitre.org/data/definitions/22.html

Theoretical risk in short:

  • We download a malicious zip archive
  • The zip archive contains items like "../../usr/bin/something"
  • We might end up with installing unwanted files at wrong places

Tested that it does not affect normal install
This was detected when running Github code scanning in my own fork

See https://cwe.mitre.org/data/definitions/22.html

Theoretical risk in short:
- We download a malicuos zip archive
- The zip archive contains items like "../../usr/bin/something"
- We might end up with installing unwanted files at wrong places
Copy link
Contributor

@lukasmittag lukasmittag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codewise seems good. Just one minor comment.

@@ -50,8 +51,11 @@ func UnzipSource(source, destination string) error {
}

for _, f := range reader.File {
if strings.Contains(f.Name, "..") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why .. ? Moving one directory up and installing something weird? I think its not that big of an issue since we get the source from the official website.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As always with security topics it is always a question on how easy it is to take advantage of a vulnerability. We use hard-coded links like https://github.com/protocolbuffers/protobuf/releases/download/v3.19.4/protoc-3.19.4-linux-x86_32.zip and https, but if an attacker either manages to get write access to the protocolbuffers Github account, or manages to do some form of Man-In-The-Middle attack he could theoretically replace the content with something else.

(As we specify specific version we could theoretically do as in https://github.com/eclipse/kuksa.val/blob/master/kuksa-val-server/boost.cmake and add a SHA256 checksum to make sure we get what we expect)

Here one can argue that the severity of the vulnerability is limited, it might be difficult to find a "good business case" for an attacker, but as it was reported by code scanning, mentioned in https://cwe.mitre.org/data/definitions/22.html and is easy to fix I think it is better to fix it than to dismiss it.

@erikbosch erikbosch merged commit 9065760 into eclipse:master Jul 31, 2023
3 checks passed
@erikbosch erikbosch deleted the erik_protoc branch July 31, 2023 12:24
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.

2 participants