Skip to content

Open Redirect URL in Harbor

Moderate severity GitHub Reviewed Published May 31, 2024 in goharbor/harbor • Updated Jun 17, 2024

Package

gomod github.com/goharbor/harbor (Go)

Affected versions

< 2.8.5
>= 2.9.0, < 2.9.3
>= 2.10.0, < 2.10.1

Patched versions

2.8.5
2.9.3
2.10.1

Description

Description

Under OIDC authentication mode, there is a redirect_url parameter exposed in the URL which is used to redirect the current user to the defined location after the successful OIDC login, This redirect_url can be an ambiguous URL and can be used to embed a phishing URL.
For example: if a user clicks the URL with a malicious redirect_url:

https://<harbor_hostnmae>/c/oidc/login?redirect_url=https://<redirect_domain>

It might redirect the current user without their knowledge to a malicious site, posing a potential risk.
To avoid this issue, the redirect_url should be checked if it is a local path when reading it from the original request URL.

//src/core/controllers/oidc.go
...
redirectURL := oc.Ctx.Request.URL.Query().Get("redirect_url")
if !utils.IsLocalPath(redirectURL) {
    log.Errorf("invalid redirect url: %v", redirectURL)
    oc.SendBadRequestError(fmt.Errorf("cannot redirect to other site"))
    return
}
if err := oc.SetSession(redirectURLKey, redirectURL); err != nil {
...

Impact

When Harbor is configured with OIDC authentication and users log in via a link outside the Harbor server, it might be vulnerable to an open redirect attack. This attack only involves the OIDC Harbor user, if the current Harbor instance is not configured with OIDC auth, the redirect_url doesn't exist and the Harbor instance is not vulnerable to the open redirect attack.

The following versions of Harbor are involved:
<=Harbor 2.8.4, <=Harbor 2.9.2, <= Harbor 2.10.0

Patches

Harbor 2.8.5, Harbor 2.9.3, Harbor 2.10.1

Workarounds

When the Harbor is configured with OIDC authentication, warn the user not to log into the Harbor through external links.

References

N/A

Credit

Thanks Arnaud Cordier ([email protected])

References

@stonezdj stonezdj published to goharbor/harbor May 31, 2024
Published to the GitHub Advisory Database Jun 2, 2024
Reviewed Jun 2, 2024
Published by the National Vulnerability Database Jun 10, 2024
Last updated Jun 17, 2024

Severity

Moderate

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
Required
Scope
Unchanged
Confidentiality
Low
Integrity
None
Availability
None

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:N/A:N

EPSS score

0.061%
(27th percentile)

Weaknesses

CVE ID

CVE-2024-22244

GHSA ID

GHSA-5757-v49g-f6r7

Source code

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.