CVE-2023-20902: Github.com/goharbor/harbor Harbor Timing Attack Risk Vulnerability

MODERATE
Advisory Identifier: GHSA-mq6f-5xh5-hgcf
CVSS 5.9
CWE-362 CWE-208
Published
Advisory Summary

CVE-2023-20902 is a MODERATE (CVSS 5.9) harbor timing attack risk vulnerability (CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')) affecting Github.com/goharbor/harbor libraries in the Go ecosystem. The issue involves harbor timing attack risk. Remediation is available by upgrading affected packages to version 1.10.18, 2.7.3, 2.8.3.

CVE-2023-20902 at a Glance

CVE Identifier CVE-2023-20902
GHSA Identifier GHSA-mq6f-5xh5-hgcf
Severity MODERATE
CVSS v3.1 Base Score 5.9
CWE Classification CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')
Affected Product Github.com/goharbor/harbor
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 5.9

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2023-20902

To remediate this vulnerability, upgrade all affected Github.com/goharbor/harbor dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/goharbor/harbor fixed: 1.10.18
Upgrade github.com/goharbor/harbor to 1.10.18
github.com/goharbor/harbor fixed: 2.7.3
Upgrade github.com/goharbor/harbor to 2.7.3
github.com/goharbor/harbor fixed: 2.8.3
Upgrade github.com/goharbor/harbor to 2.8.3
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/goharbor/harbor

How to Check if You Are Affected

To determine whether your application is affected by CVE-2023-20902, inspect your project dependencies for Github.com/goharbor/harbor:

inspect dependencies for github.com/goharbor/harbor

Analyze the terminal output to locate any version of Github.com/goharbor/harbor in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.10.18), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition'), where the product contains a concurrent code sequence that requires temporary, exclusive access to a shared resource, but a timing window exists in which the shared resource can be modified by another code sequence operating concurrently. In Github.com/goharbor/harbor, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

In the Harbor jobservice container, the comparison of secrets in the authenticator type is prone to timing attacks. The vulnerability occurs due to the following code: https://github.com/goharbor/harbor/blob/aaea068cceb4063ab89313d9785f2b40f35b0d63/src/jobservice/api/authenticator.go#L69-L69 To avoid this issue, constant time comparison should be used. ``` subtle.ConstantTimeCompare([]byte(expectedSecret), []byte(secret)) == 0 ``` ### Impact This attack might be possible theoretically, but no workable proof of concept is available, and access complexity is set at High. The jobservice exposes these APIs ``` Create a job task --- POST /api/v1/jobs Get job task information --- GET /api/v1/jobs/{job_id} Stop job task --- POST /api/v1/jobs/{job_id} Get job log task --- GET /api/v1/jobs/{job_id}/log Get job execution --- GET /api/v1/jobs/{job_id}/executions Get job stats --- GET /api/v1/stats Get job service configuration --- GET /api/v1/config ``` It is used to create jobs/stop job tasks and retrieve job task information. If an attacker obtains the secrets, it is possible to retrieve the job information, create a job, or stop a job task. The following versions of Harbor are involved: <=Harbor 2.8.2, <=Harbor 2.7.2, <= Harbor 2.6.x, <=Harbor 1.10.17 ### Patches Harbor 2.8.3, Harbor 2.7.3, Harbor 1.10.18 ### Workarounds Because the jobservice only exposes HTTP service to harbor-core containers, blocking any inbound traffic from the external network to the jobservice container can reduce the risk. ### Credits Thanks to Porcupiney Hairs for reporting this issue.

CVE-2023-20902 Affected Github.com/goharbor/harbor Versions

3 component(s)
Fixed Versions:
1.10.182.7.32.8.3
Product / Package Ecosystem Affected Versions Fixed Version
github.com/goharbor/harbor
Go
< 1.10.18
1.10.18
github.com/goharbor/harbor
Go
≥ 2.0.0
< 2.7.3
2.7.3
github.com/goharbor/harbor
Go
≥ 2.8.0
< 2.8.3
2.8.3

References

Frequently Asked Questions

What is CVE-2023-20902?
CVE-2023-20902 is a security vulnerability in Github.com/goharbor/harbor involving Harbor timing attack risk under CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition').
Which Github.com/goharbor/harbor versions are affected?
Affected versions include releases prior to 1.10.18, 2.7.3, 2.8.3 across affected packages: github.com/goharbor/harbor.
What version fixes CVE-2023-20902?
Upgrading to 1.10.18, 2.7.3, 2.8.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/goharbor/harbor affected?
Yes, github.com/goharbor/harbor is affected in releases prior to 1.10.18, 2.7.3, 2.8.3. Upgrade your dependency to 1.10.18, 2.7.3, 2.8.3 or later.
What is the CVSS score of CVE-2023-20902?
CVE-2023-20902 has a CVSS v3.1 base score of 5.9 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N.
What CWE is associated with CVE-2023-20902?
CVE-2023-20902 is classified under CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition') (The product contains a concurrent code sequence that requires temporary, exclusive access to a shared resource, but a timing window exists in which the shared resource can be modified by another code sequence operating concurrently.).
How can I check Go dependencies for CVE-2023-20902?
Run the dependency tree command: 'inspect dependencies for github.com/goharbor/harbor'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-mq6f-5xh5-hgcf",
  "modified" : "2023-11-09T16:38:40Z",
  "published" : "2023-10-10T21:29:02Z",
  "aliases" : [ "CVE-2023-20902" ],
  "summary" : "Harbor timing attack risk",
  "details" : "In the Harbor jobservice container, the comparison of secrets in the authenticator type is prone to timing attacks. The vulnerability occurs due to the following code: https://github.com/goharbor/harbor/blob/aaea068cceb4063ab89313d9785f2b40f35b0d63/src/jobservice/api/authenticator.go#L69-L69\nTo avoid this issue, constant time comparison should be used.\n```\nsubtle.ConstantTimeCompare([]byte(expectedSecret), []byte(secret)) == 0\n```\n\n### Impact\nThis attack might be possible theoretically, but no workable proof of concept is available, and access complexity is set at High.\nThe jobservice exposes these APIs\n```\nCreate a job task --- POST /api/v1/jobs    \nGet job task information --- GET /api/v1/jobs/{job_id}\nStop job task ---  POST /api/v1/jobs/{job_id}\nGet job log task ---  GET /api/v1/jobs/{job_id}/log\nGet job execution --- GET /api/v1/jobs/{job_id}/executions\nGet job stats ---  GET /api/v1/stats\nGet job service configuration ---  GET /api/v1/config\n```\nIt is used to create jobs/stop job tasks and retrieve job task information.  If an attacker obtains the secrets, it is possible to retrieve the job information, create a job, or stop a job task. \n\nThe following versions of Harbor are involved:\n<=Harbor 2.8.2, <=Harbor 2.7.2, <= Harbor 2.6.x, <=Harbor 1.10.17\n\n\n### Patches\nHarbor 2.8.3, Harbor 2.7.3, Harbor 1.10.18\n\n### Workarounds\nBecause the jobservice only exposes HTTP service to harbor-core containers, blocking any inbound traffic from the external network to the jobservice container can reduce the risk.\n\n### Credits\nThanks to Porcupiney Hairs for reporting this issue.\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/goharbor/harbor"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.10.18"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/goharbor/harbor"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.0.0"
      }, {
        "fixed" : "2.7.3"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/goharbor/harbor"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.8.0"
      }, {
        "fixed" : "2.8.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/goharbor/harbor/security/advisories/GHSA-mq6f-5xh5-hgcf"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-20902"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/goharbor/harbor"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/goharbor/harbor/blob/aaea068cceb4063ab89313d9785f2b40f35b0d63/src/jobservice/api/authenticator.go#L69-L69"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/goharbor/harbor/releases/tag/v1.10.18"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/goharbor/harbor/releases/tag/v2.7.3"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/goharbor/harbor/releases/tag/v2.8.3"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-208", "CWE-362" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-10-10T21:29:02Z",
    "nvd_published_at" : "2023-11-09T01:15:07Z"
  }
}