CVE-2020-36563: Weak hash (SHA-1) in github.com/RobotsAndPencils/go-saml

Summary

14/04/2021
No i
Moderate
5.3

CVE-2020-36563: Weak hash (SHA-1) in github.com/RobotsAndPencils/go-saml. Affected versions are not published. No fix is published. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

The package github.com/RobotsAndPencils/go-saml is a Go library that provides functionality for generating and validating XML Digital Signatures. It is commonly used for implementing SAML (Security Assertion Markup Language) authentication in Go applications. The package offers functions such as AuthnRequest.Validate, NewAuthnRequest, NewSignedResponse, and ServiceProviderSettings.GetAuthnRequest.

Vulnerability Detail

The vulnerability (CVE-2020-36563) in github.com/RobotsAndPencils/go-saml arises from the use of a weak hash algorithm, SHA-1, for generating and validating XML Digital Signatures. This can allow an attacker to craft inputs that result in hash collisions, depending on their control over the input. Hash collisions can lead to various security issues, such as impersonation attacks, data integrity violations, and unauthorized access to sensitive information.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Workaround

As a temporary workaround, users can modify the package code to replace the usage of SHA-1 with a stronger hash algorithm. Here is an example of how to replace SHA-1 with SHA-256 in the AuthnRequest.Validate function:

import (
	"crypto/sha256"
	"encoding/base64"
)

func (ar *AuthnRequest) Validate() error {
	// Existing code using SHA-1
	hash := sha1.Sum([]byte(ar.ID))
	// Replace with SHA-256
	hash := sha256.Sum256([]byte(ar.ID))
	// ...
}

Conclusion

In conclusion, the package github.com/RobotsAndPencils/go-saml is vulnerable to a weak hash (SHA-1) vulnerability (CVE-2020-36563). This vulnerability can be mitigated by updating the package to a version that uses a stronger hash algorithm or by modifying the package code to use a stronger hash algorithm as a temporary workaround. It is recommended to stay updated with the latest patched version and regularly check for vulnerabilities using tools like Vulert. For further support on vulnerability remediation, you can contact DevNack.com.

See every vulnerability recorded for github.com/RobotsAndPencils/go-saml →

Share this vulnerability

FAQ

The vulnerability allows an attacker to craft inputs that result in hash collisions, which can lead to various security issues such as impersonation attacks, data integrity violations, and unauthorized access to sensitive information.

You can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability. Simply upload your Gopkg.lock file and Vulert will analyze it for open-source vulnerabilities, including this one.

The package maintainers should release a patched version that addresses this vulnerability. It is recommended to update your dependencies to the latest patched version once it becomes available.

As a temporary workaround, you can modify the package code to replace the usage of SHA-1 with a stronger hash algorithm, such as SHA-256 or SHA-3. However, it is highly recommended to update to the latest patched version once it becomes available.

There are currently no known exploits for this vulnerability. However, it is important to address this vulnerability promptly to prevent any potential security incidents.

References

Related vulnerabilities

Recent vulnerabilities recorded for github.com/RobotsAndPencils/go-saml.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback