CVE-2024-40464
Description
An issue in beego v.2.2.0 and before allows a remote attacker to escalate privileges via the sendMail function located in beego/core/logs/smtp.go file
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
Beego v2.2.0 and earlier has missing SSL certificate validation in the sendMail function, allowing remote attackers to escalate privileges via man-in-the-middle attacks.
Vulnerability
Description
An issue in beego v2.2.0 and earlier allows a remote attacker to escalate privileges via the sendMail function located in beego/core/logs/smtp.go [1][2]. The root cause is missing SSL certificate validation (InsecureSkipVerify defaults to true) in the SMTP writer component, which means the TLS connection does not properly verify the server's certificate [1][3].
Exploitation
A remote attacker in a man-in-the-middle position can exploit this by intercepting SMTP traffic and impersonating the mail server without the connection being rejected [2]. The default configuration in affected versions sets InsecureSkipVerify to true, automatically trusting any certificate presented during the TLS handshake; a fix introducing an insecureSkipVerify configuration option was added in commit 8f89e12e6cafb106d5c201dbc3b2a338bfde74e2 [3].
Impact
Successful exploitation allows an attacker to intercept or modify email notifications sent by the beego application, potentially leading to privilege escalation [1][2]. This could result in disclosure of sensitive information or unauthorized actions if email is used for password resets, notifications, or authentication workflows.
Mitigation
Users should upgrade beego to a version that includes the fix (v2.2.1 or later) and configure the insecureSkipVerify option appropriately for production environments [1][3]. There is no evidence this CVE is listed in CISA's Known Exploited Vulnerabilities catalog.
AI Insight generated on May 20, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
github.com/beego/beego/v2Go | < 2.2.1 | 2.2.1 |
Affected products
28- beego/beegodescription
- osv-coords27 versionspkg:apk/chainguard/harbor-2.10pkg:apk/chainguard/harbor-2.10-jobservicepkg:apk/chainguard/harbor-2.10-portalpkg:apk/chainguard/harbor-2.10-portal-nginx-configpkg:apk/chainguard/harbor-2.10-registryctlpkg:apk/chainguard/harbor-2.11pkg:apk/chainguard/harbor-2.11-exporterpkg:apk/chainguard/harbor-2.11-jobservicepkg:apk/chainguard/harbor-2.11-photon-registrypkg:apk/chainguard/harbor-2.11-portalpkg:apk/chainguard/harbor-2.11-portal-nginx-configpkg:apk/chainguard/harbor-2.11-redis-compatpkg:apk/chainguard/harbor-2.11-registryctlpkg:apk/chainguard/harbor-fips-2.11pkg:apk/chainguard/harbor-fips-2.11-dbpkg:apk/chainguard/harbor-fips-2.11-exporterpkg:apk/chainguard/harbor-fips-2.11-jobservicepkg:apk/chainguard/harbor-fips-2.11-photon-registrypkg:apk/chainguard/harbor-fips-2.11-portalpkg:apk/chainguard/harbor-fips-2.11-redis-compatpkg:apk/chainguard/harbor-fips-2.11-registryctlpkg:apk/wolfi/harbor-2.11pkg:apk/wolfi/harbor-2.11-jobservicepkg:apk/wolfi/harbor-2.11-portalpkg:apk/wolfi/harbor-2.11-portal-nginx-configpkg:apk/wolfi/harbor-2.11-registryctlpkg:golang/github.com/beego/beego/v2
< 2.10.3-r1+ 26 more
- (no CPE)range: < 2.10.3-r1
- (no CPE)range: < 2.10.3-r1
- (no CPE)range: < 2.10.3-r1
- (no CPE)range: < 2.10.3-r1
- (no CPE)range: < 2.10.3-r1
- (no CPE)range: < 2.11.2-r20
- (no CPE)range: < 2.11.2-r20
- (no CPE)range: < 2.11.2-r20
- (no CPE)range: < 2.11.2-r22
- (no CPE)range: < 2.11.2-r20
- (no CPE)range: < 2.11.2-r20
- (no CPE)range: < 2.11.2-r20
- (no CPE)range: < 2.11.2-r20
- (no CPE)range: < 2.11.2-r25
- (no CPE)range: < 2.11.2-r25
- (no CPE)range: < 2.11.2-r25
- (no CPE)range: < 2.11.2-r25
- (no CPE)range: < 2.11.2-r28
- (no CPE)range: < 2.11.2-r25
- (no CPE)range: < 2.11.2-r25
- (no CPE)range: < 2.11.2-r25
- (no CPE)range: < 2.11.2-r20
- (no CPE)range: < 2.11.2-r20
- (no CPE)range: < 2.11.2-r20
- (no CPE)range: < 2.11.2-r20
- (no CPE)range: < 2.11.2-r20
- (no CPE)range: < 2.2.1
Patches
12 files changed · +19 −15
core/logs/alils/request.go+2 −2 modified@@ -13,7 +13,7 @@ func request(project *LogProject, method, uri string, headers map[string]string, // The caller should provide 'x-sls-bodyrawsize' header if _, ok := headers["x-sls-bodyrawsize"]; !ok { - err = fmt.Errorf("Can't find 'x-sls-bodyrawsize' header") + err = fmt.Errorf("can't find 'x-sls-bodyrawsize' header") return } @@ -27,7 +27,7 @@ func request(project *LogProject, method, uri string, headers map[string]string, headers["Content-MD5"] = bodyMD5 if _, ok := headers["Content-Type"]; !ok { - err = fmt.Errorf("Can't find 'Content-Type' header") + err = fmt.Errorf("can't find 'Content-Type' header") return } }
core/logs/smtp.go+17 −13 modified@@ -32,29 +32,33 @@ type SMTPWriter struct { FromAddress string `json:"fromAddress"` RecipientAddresses []string `json:"sendTos"` Level int `json:"level"` - formatter LogFormatter - Formatter string `json:"formatter"` + // InsecureSkipVerify default value: true + InsecureSkipVerify bool `json:"insecureSkipVerify"` + + formatter LogFormatter + Formatter string `json:"formatter"` } // NewSMTPWriter creates the smtp writer. func newSMTPWriter() Logger { - res := &SMTPWriter{Level: LevelTrace} + res := &SMTPWriter{Level: LevelTrace, InsecureSkipVerify: true} res.formatter = res return res } // Init smtp writer with json config. // config like: // -// { -// "username":"example@gmail.com", -// "password:"password", -// "host":"smtp.gmail.com:465", -// "subject":"email title", -// "fromAddress":"from@example.com", -// "sendTos":["email1","email2"], -// "level":LevelError -// } +// { +// "username":"example@gmail.com", +// "password:"password", +// "host":"smtp.gmail.com:465", +// "subject":"email title", +// "fromAddress":"from@example.com", +// "sendTos":["email1","email2"], +// "level":LevelError, +// "insecureSkipVerify": false +// } func (s *SMTPWriter) Init(config string) error { res := json.Unmarshal([]byte(config), s) if res == nil && len(s.Formatter) > 0 { @@ -91,7 +95,7 @@ func (s *SMTPWriter) sendMail(hostAddressWithPort string, auth smtp.Auth, fromAd host, _, _ := net.SplitHostPort(hostAddressWithPort) tlsConn := &tls.Config{ - InsecureSkipVerify: true, + InsecureSkipVerify: s.InsecureSkipVerify, ServerName: host, } if err = client.StartTLS(tlsConn); err != nil {
Vulnerability mechanics
Generated on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
5- github.com/advisories/GHSA-r6qh-j42j-pw64ghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2024-40464ghsaADVISORY
- gist.github.com/nyxfqq/b53b0148b9aa040de63f58a68fd11445ghsaWEB
- github.com/beego/beego/commit/8f89e12e6cafb106d5c201dbc3b2a338bfde74e2ghsaWEB
- github.com/beego/beego/security/advisories/GHSA-6g9p-wv47-4fxqghsaWEB
News mentions
0No linked articles in our index yet.