Skip to contentSkip to conversation

nginx: patch CVE-2025-53859

PATCH Marko, Peter 1 participant 1 message Aug 25, 2025 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

Please ignore, wrong mailing list.
Peter

Quoted 182 lines

-----Original Message-----
From: [email protected] <openembedded- [email protected]> On Behalf Of Peter Marko via lists.openembedded.org
Sent: Monday, August 25, 2025 15:50
To: [email protected]
Cc: Marko, Peter (FT D EU SK BFS1) <[email protected]>
Subject: [OE-core][walnascar][PATCH] nginx: patch CVE-2025-53859

From: Peter Marko <[email protected]>

Pick patch from nginx site which is also mentioned in [1].

[1] https://security-tracker.debian.org/tracker/CVE-2025-53859

---
 .../nginx/files/CVE-2025-53859.patch          | 131 ++++++++++++++++++
 meta-webserver/recipes-httpd/nginx/nginx.inc  |   1 +
 2 files changed, 132 insertions(+)
 create mode 100755 meta-webserver/recipes-httpd/nginx/files/CVE-2025-

53859.patch

meta-webserver/recipes-httpd/nginx/files/CVE-2025-53859.patch new file +9 -0
new file mode 100755
index 0000000000..6f689938f4
@@ -0,0 +1,131 @@
+CVE: CVE-2025-53859
+Upstream-Status: Backport [https://nginx.org/download/patch.2025.smtp.txt]
+Signed-off-by: Peter Marko <[email protected]>
+
+diff --git a/src/mail/ngx_mail_handler.c b/src/mail/ngx_mail_handler.c
+index 1167df3fb..d3be7f3b3 100644
+--- a/src/mail/ngx_mail_handler.c
++++ b/src/mail/ngx_mail_handler.c
+@@ -523,7 +523,7 @@ ngx_mail_starttls_only(ngx_mail_session_t *s,

ngx_connection_t *c)
+ ngx_int_t
+ ngx_mail_auth_plain(ngx_mail_session_t *s, ngx_connection_t *c, ngx_uint_t n)
+ {

+-    u_char     *p, *last;
++    u_char     *p, *pos, *last;
meta-webserver/recipes-httpd/nginx/files/CVE-2025-53859.patch new file +4 -0
+     ngx_str_t  *arg, plain;
+
+     arg = s->args.elts;
+@@ -555,7 +555,7 @@ ngx_mail_auth_plain(ngx_mail_session_t *s,

ngx_connection_t *c, ngx_uint_t n)

meta-webserver/recipes-httpd/nginx/files/CVE-2025-53859.patch new file +9 -0
+         return NGX_MAIL_PARSE_INVALID_COMMAND;
+     }
+
+-    s->login.data = p;
++    pos = p;
+
+     while (p < last && *p) { p++; }
+
+@@ -565,7 +565,8 @@ ngx_mail_auth_plain(ngx_mail_session_t *s,

ngx_connection_t *c, ngx_uint_t n)

meta-webserver/recipes-httpd/nginx/files/CVE-2025-53859.patch new file +22 -0
+         return NGX_MAIL_PARSE_INVALID_COMMAND;
+     }
+
+-    s->login.len = p++ - s->login.data;
++    s->login.len = p++ - pos;
++    s->login.data = pos;
+
+     s->passwd.len = last - p;
+     s->passwd.data = p;
+@@ -583,24 +584,26 @@ ngx_int_t
+ ngx_mail_auth_login_username(ngx_mail_session_t *s, ngx_connection_t *c,
+     ngx_uint_t n)
+ {
+-    ngx_str_t  *arg;
++    ngx_str_t  *arg, login;
+
+     arg = s->args.elts;
+
+     ngx_log_debug1(NGX_LOG_DEBUG_MAIL, c->log, 0,
+                    "mail auth login username: \"%V\"", &arg[n]);
+
+-    s->login.data = ngx_pnalloc(c->pool,

ngx_base64_decoded_length(arg[n].len));

+-    if (s->login.data == NULL) {
++    login.data = ngx_pnalloc(c->pool, ngx_base64_decoded_length(arg[n].len));
++    if (login.data == NULL) {
meta-webserver/recipes-httpd/nginx/files/CVE-2025-53859.patch new file +16 -0
+         return NGX_ERROR;
+     }
+
+-    if (ngx_decode_base64(&s->login, &arg[n]) != NGX_OK) {
++    if (ngx_decode_base64(&login, &arg[n]) != NGX_OK) {
+         ngx_log_error(NGX_LOG_INFO, c->log, 0,
+             "client sent invalid base64 encoding in AUTH LOGIN command");
+         return NGX_MAIL_PARSE_INVALID_COMMAND;
+     }
+
++    s->login = login;
++
+     ngx_log_debug1(NGX_LOG_DEBUG_MAIL, c->log, 0,
+                    "mail auth login username: \"%V\"", &s->login);
+
+@@ -611,7 +614,7 @@ ngx_mail_auth_login_username(ngx_mail_session_t *s,

ngx_connection_t *c,
+ ngx_int_t
+ ngx_mail_auth_login_password(ngx_mail_session_t *s, ngx_connection_t *c)
+ {

+-    ngx_str_t  *arg;
++    ngx_str_t  *arg, passwd;
meta-webserver/recipes-httpd/nginx/files/CVE-2025-53859.patch new file +4 -0
+
+     arg = s->args.elts;
+
+@@ -620,18 +623,19 @@ ngx_mail_auth_login_password(ngx_mail_session_t

*s, ngx_connection_t *c)

meta-webserver/recipes-httpd/nginx/files/CVE-2025-53859.patch new file +7 -0
+                    "mail auth login password: \"%V\"", &arg[0]);
+ #endif
+
+-    s->passwd.data = ngx_pnalloc(c->pool,
+-                                 ngx_base64_decoded_length(arg[0].len));
+-    if (s->passwd.data == NULL) {
++    passwd.data = ngx_pnalloc(c->pool,

ngx_base64_decoded_length(arg[0].len));
++ if (passwd.data == NULL) {

meta-webserver/recipes-httpd/nginx/files/CVE-2025-53859.patch new file +28 -0
+         return NGX_ERROR;
+     }
+
+-    if (ngx_decode_base64(&s->passwd, &arg[0]) != NGX_OK) {
++    if (ngx_decode_base64(&passwd, &arg[0]) != NGX_OK) {
+         ngx_log_error(NGX_LOG_INFO, c->log, 0,
+             "client sent invalid base64 encoding in AUTH LOGIN command");
+         return NGX_MAIL_PARSE_INVALID_COMMAND;
+     }
+
++    s->passwd = passwd;
++
+ #if (NGX_DEBUG_MAIL_PASSWD)
+     ngx_log_debug1(NGX_LOG_DEBUG_MAIL, c->log, 0,
+                    "mail auth login password: \"%V\"", &s->passwd);
+@@ -674,24 +678,26 @@ ngx_int_t
+ ngx_mail_auth_cram_md5(ngx_mail_session_t *s, ngx_connection_t *c)
+ {
+     u_char     *p, *last;
+-    ngx_str_t  *arg;
++    ngx_str_t  *arg, login;
+
+     arg = s->args.elts;
+
+     ngx_log_debug1(NGX_LOG_DEBUG_MAIL, c->log, 0,
+                    "mail auth cram-md5: \"%V\"", &arg[0]);
+
+-    s->login.data = ngx_pnalloc(c->pool,

ngx_base64_decoded_length(arg[0].len));

+-    if (s->login.data == NULL) {
++    login.data = ngx_pnalloc(c->pool, ngx_base64_decoded_length(arg[0].len));
++    if (login.data == NULL) {
meta-webserver/recipes-httpd/nginx/files/CVE-2025-53859.patch new file +15 -0
+         return NGX_ERROR;
+     }
+
+-    if (ngx_decode_base64(&s->login, &arg[0]) != NGX_OK) {
++    if (ngx_decode_base64(&login, &arg[0]) != NGX_OK) {
+         ngx_log_error(NGX_LOG_INFO, c->log, 0,
+             "client sent invalid base64 encoding in AUTH CRAM-MD5 command");
+         return NGX_MAIL_PARSE_INVALID_COMMAND;
+     }
+
++    s->login = login;
++
+     p = s->login.data;
+     last = p + s->login.len;
+
meta- renamed from meta-webserver/recipes-httpd/nginx/nginx.inc +0 -0

webserver/recipes-httpd/nginx/nginx.inc
index bcc384bd8a..4a7be2f99a 100644

meta-webserver/recipes-httpd/nginx/nginx.inc +1 -0
@@ -23,6 +23,7 @@ SRC_URI = " \
     file://nginx.service \
     file://nginx-fix-pidfile.patch \
     file://0001-configure-libxslt-conf.patch \
+    file://CVE-2025-53859.patch \
 "
 
 inherit siteinfo update-rc.d useradd systemd