Advisory Database
  • Advisories
  • Dependency Scanning
  1. golang
  2. ›
  3. github.com/0xJacky/Nginx-UI
  4. ›
  5. CVE-2024-23827

CVE-2024-23827: Nginx-UI vulnerable to arbitrary file write through the Import Certificate feature

January 29, 2024 (updated July 6, 2026)

The Import Certificate feature allows arbitrary write into the system. The feature does not check if the provided user input is a certification/key and allows to write into arbitrary paths in the system.

https://github.com/0xJacky/nginx-ui/blob/f20d97a9fdc2a83809498b35b6abc0239ec7fdda/api/certificate/certificate.go#L72

func AddCert(c *gin.Context) {
var json struct {
Name                  string `json:"name"`
SSLCertificatePath    string `json:"ssl_certificate_path" binding:"required"`
SSLCertificateKeyPath string `json:"ssl_certificate_key_path" binding:"required"`
SSLCertificate        string `json:"ssl_certificate"`
SSLCertificateKey     string `json:"ssl_certificate_key"`
ChallengeMethod       string `json:"challenge_method"`
DnsCredentialID       int    `json:"dns_credential_id"`
}
if !api.BindAndValid(c, &json) {
return
}
certModel := &model.Cert{
Name:                  json.Name,
SSLCertificatePath:    json.SSLCertificatePath,
SSLCertificateKeyPath: json.SSLCertificateKeyPath,
ChallengeMethod:       json.ChallengeMethod,
DnsCredentialID:       json.DnsCredentialID,
}

err := certModel.Insert()

if err != nil {
api.ErrHandler(c, err)
return
}

content := &cert.Content{
SSLCertificatePath:    json.SSLCertificatePath,
SSLCertificateKeyPath: json.SSLCertificateKeyPath,
SSLCertificate:        json.SSLCertificate,
SSLCertificateKey:     json.SSLCertificateKey,
}

err = content.WriteFile()

if err != nil {
api.ErrHandler(c, err)
return
}

c.JSON(http.StatusOK, Transformer(certModel))
}

https://github.com/0xJacky/nginx-ui/blob/f20d97a9fdc2a83809498b35b6abc0239ec7fdda/internal/cert/write_file.go#L15

func (c *Content) WriteFile() (err error) {
// MkdirAll creates a directory named path, along with any necessary parents,
// and returns nil, or else returns an error.
// The permission bits perm (before umask) are used for all directories that MkdirAll creates.
// If path is already a directory, MkdirAll does nothing and returns nil.

err = os.MkdirAll(filepath.Dir(c.SSLCertificatePath), 0644)
if err != nil {
return
}

err = os.MkdirAll(filepath.Dir(c.SSLCertificateKeyPath), 0644)
if err != nil {
return
}

if c.SSLCertificate != "" {
err = os.WriteFile(c.SSLCertificatePath, []byte(c.SSLCertificate), 0644)
if err != nil {
return
}
}

if c.SSLCertificateKey != "" {
err = os.WriteFile(c.SSLCertificateKeyPath, []byte(c.SSLCertificateKey), 0644)
if err != nil {
return
}
}

return
}

References

  • github.com/0xJacky/nginx-ui/blob/f20d97a9fdc2a83809498b35b6abc0239ec7fdda/api/certificate/certificate.go
  • github.com/0xJacky/nginx-ui/blob/f20d97a9fdc2a83809498b35b6abc0239ec7fdda/internal/cert/write_file.go
  • github.com/0xJacky/nginx-ui/commit/8581bdd3c6f49ab345b773517ba9173fa7fc6199
  • github.com/0xJacky/nginx-ui/security/advisories/GHSA-xvq9-4vpv-227m
  • github.com/advisories/GHSA-xvq9-4vpv-227m
  • nvd.nist.gov/vuln/detail/CVE-2024-23827

Code Behaviors & Features

Detect and mitigate CVE-2024-23827 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions before 1.9.10-0.20240128060047-8581bdd3c6f4

Fixed versions

  • 1.9.10-0.20240128060047-8581bdd3c6f4

Solution

Upgrade to version 1.9.10-0.20240128060047-8581bdd3c6f4 or above.

Impact 9.8 CRITICAL

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

Learn more about CVSS

Weakness

  • CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')

Source file

go/github.com/0xJacky/Nginx-UI/CVE-2024-23827.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Sat, 08 Aug 2026 12:16:56 +0000.