Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] quickjs: Fix stack overflow in CVE-2023-31922
@ 2023-05-30 16:01 Gottox
  2023-06-10 11:34 ` [PR PATCH] [Updated] " Gottox
  2023-06-11 22:29 ` [PR PATCH] [Merged]: " classabbyamp
  0 siblings, 2 replies; 3+ messages in thread
From: Gottox @ 2023-05-30 16:01 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1070 bytes --]

There is a new pull request by Gottox against master on the void-packages repository

https://github.com/Gottox/void-packages quickjs-cve-2023-31922
https://github.com/void-linux/void-packages/pull/44173

quickjs: Fix stack overflow in CVE-2023-31922
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/44173.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-quickjs-cve-2023-31922-44173.patch --]
[-- Type: text/x-diff, Size: 1890 bytes --]

From d1b02413884099bd2c438a6416b674a3a855cae4 Mon Sep 17 00:00:00 2001
From: Enno Boland <gottox@voidlinux.org>
Date: Tue, 30 May 2023 18:00:45 +0200
Subject: [PATCH] quickjs: Fix stack overflow in CVE-2023-31922

---
 .../patch-gh-issue-178-cve-2023-31922.patch   | 42 +++++++++++++++++++
 1 file changed, 42 insertions(+)
 create mode 100644 srcpkgs/quickjs/patches/patch-gh-issue-178-cve-2023-31922.patch

diff --git a/srcpkgs/quickjs/patches/patch-gh-issue-178-cve-2023-31922.patch b/srcpkgs/quickjs/patches/patch-gh-issue-178-cve-2023-31922.patch
new file mode 100644
index 000000000000..754924c60639
--- /dev/null
+++ b/srcpkgs/quickjs/patches/patch-gh-issue-178-cve-2023-31922.patch
@@ -0,0 +1,42 @@
+From 056459314305f666aee132565df710c42f41ec04 Mon Sep 17 00:00:00 2001
+From: Nick Vatamaniuc <vatamane@gmail.com>
+Date: Sun, 28 May 2023 01:50:46 -0400
+Subject: [PATCH] Fix stack overflow in CVE-2023-31922
+
+isArray and proxy isArray can call each other indefinitely in a mutually
+recursive loop.
+
+Add a stack overflow check in the js_proxy_isArray function before calling
+JS_isArray(ctx, s->target).
+
+With ASAN the the poc.js from issue 178:
+
+```
+./qjs ./poc.js
+InternalError: stack overflow
+  at isArray (native)
+  at <eval> (./poc.js:4)
+```
+
+Fix: https://github.com/bellard/quickjs/issues/178
+---
+ quickjs.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/quickjs.c b/quickjs.c
+index 79160139..a3b0b55f 100644
+--- a/quickjs.c
++++ b/quickjs.c
+@@ -45243,6 +45243,12 @@ static int js_proxy_isArray(JSContext *ctx, JSValueConst obj)
+     JSProxyData *s = JS_GetOpaque(obj, JS_CLASS_PROXY);
+     if (!s)
+         return FALSE;
++
++    if (js_check_stack_overflow(ctx->rt, 0)) {
++        JS_ThrowStackOverflow(ctx);
++        return -1;
++    }
++
+     if (s->is_revoked) {
+         JS_ThrowTypeErrorRevokedProxy(ctx);
+         return -1;

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PR PATCH] [Updated] quickjs: Fix stack overflow in CVE-2023-31922
  2023-05-30 16:01 [PR PATCH] quickjs: Fix stack overflow in CVE-2023-31922 Gottox
@ 2023-06-10 11:34 ` Gottox
  2023-06-11 22:29 ` [PR PATCH] [Merged]: " classabbyamp
  1 sibling, 0 replies; 3+ messages in thread
From: Gottox @ 2023-06-10 11:34 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1124 bytes --]

There is an updated pull request by Gottox against master on the void-packages repository

https://github.com/Gottox/void-packages quickjs-cve-2023-31922
https://github.com/void-linux/void-packages/pull/44173

quickjs: Fix stack overflow in CVE-2023-31922
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**
- 
https://github.com/bellard/quickjs/issues/178
<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/44173.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-quickjs-cve-2023-31922-44173.patch --]
[-- Type: text/x-diff, Size: 2312 bytes --]

From 10864c182336684c23391b8df6150d32c9dd3079 Mon Sep 17 00:00:00 2001
From: Enno Boland <gottox@voidlinux.org>
Date: Tue, 30 May 2023 18:00:45 +0200
Subject: [PATCH] quickjs: Fix stack overflow in CVE-2023-31922

---
 .../patch-gh-issue-178-cve-2023-31922.patch   | 42 +++++++++++++++++++
 srcpkgs/quickjs/template                      |  2 +-
 2 files changed, 43 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/quickjs/patches/patch-gh-issue-178-cve-2023-31922.patch

diff --git a/srcpkgs/quickjs/patches/patch-gh-issue-178-cve-2023-31922.patch b/srcpkgs/quickjs/patches/patch-gh-issue-178-cve-2023-31922.patch
new file mode 100644
index 000000000000..754924c60639
--- /dev/null
+++ b/srcpkgs/quickjs/patches/patch-gh-issue-178-cve-2023-31922.patch
@@ -0,0 +1,42 @@
+From 056459314305f666aee132565df710c42f41ec04 Mon Sep 17 00:00:00 2001
+From: Nick Vatamaniuc <vatamane@gmail.com>
+Date: Sun, 28 May 2023 01:50:46 -0400
+Subject: [PATCH] Fix stack overflow in CVE-2023-31922
+
+isArray and proxy isArray can call each other indefinitely in a mutually
+recursive loop.
+
+Add a stack overflow check in the js_proxy_isArray function before calling
+JS_isArray(ctx, s->target).
+
+With ASAN the the poc.js from issue 178:
+
+```
+./qjs ./poc.js
+InternalError: stack overflow
+  at isArray (native)
+  at <eval> (./poc.js:4)
+```
+
+Fix: https://github.com/bellard/quickjs/issues/178
+---
+ quickjs.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/quickjs.c b/quickjs.c
+index 79160139..a3b0b55f 100644
+--- a/quickjs.c
++++ b/quickjs.c
+@@ -45243,6 +45243,12 @@ static int js_proxy_isArray(JSContext *ctx, JSValueConst obj)
+     JSProxyData *s = JS_GetOpaque(obj, JS_CLASS_PROXY);
+     if (!s)
+         return FALSE;
++
++    if (js_check_stack_overflow(ctx->rt, 0)) {
++        JS_ThrowStackOverflow(ctx);
++        return -1;
++    }
++
+     if (s->is_revoked) {
+         JS_ThrowTypeErrorRevokedProxy(ctx);
+         return -1;
diff --git a/srcpkgs/quickjs/template b/srcpkgs/quickjs/template
index 7cfe6f3e7f43..562ca371bc5d 100644
--- a/srcpkgs/quickjs/template
+++ b/srcpkgs/quickjs/template
@@ -1,7 +1,7 @@
 # Template file for 'quickjs'
 pkgname=quickjs
 version=2021.03.27
-revision=3
+revision=4
 build_style=gnu-makefile
 make_use_env=true
 make_build_args="CONFIG_LTO="

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PR PATCH] [Merged]: quickjs: Fix stack overflow in CVE-2023-31922
  2023-05-30 16:01 [PR PATCH] quickjs: Fix stack overflow in CVE-2023-31922 Gottox
  2023-06-10 11:34 ` [PR PATCH] [Updated] " Gottox
@ 2023-06-11 22:29 ` classabbyamp
  1 sibling, 0 replies; 3+ messages in thread
From: classabbyamp @ 2023-06-11 22:29 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 955 bytes --]

There's a merged pull request on the void-packages repository

quickjs: Fix stack overflow in CVE-2023-31922
https://github.com/void-linux/void-packages/pull/44173

Description:
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**
- 
https://github.com/bellard/quickjs/issues/178
<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-06-11 22:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-30 16:01 [PR PATCH] quickjs: Fix stack overflow in CVE-2023-31922 Gottox
2023-06-10 11:34 ` [PR PATCH] [Updated] " Gottox
2023-06-11 22:29 ` [PR PATCH] [Merged]: " classabbyamp

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).