Repository navigation
json CVE-2026-33210: add 2.18.3 to patched_versions - #1344
Open
imoshkinlocal wants to merge 1 commit into
Open
imoshkinlocal wants to merge 1 commit into
imoshkinlocal wants to merge 1 commit into
Conversation
Author
|
Adding the runnable PoC used to verify the 2.18.2 / 2.18.3 split, in case # json_dupkey_poc.rb
# CVE-2026-33210 / GHSA-3m6g-2423-7cp3
$stdout.sync = true
require "json"
puts "json #{JSON::VERSION}"
key = "%s%s%s%s" # attacker-controlled object key
doc = %({"#{key}":1,"#{key}":2}) # duplicate keys -> raise_duplicate_key_error
begin
JSON.parse(doc, allow_duplicate_key: false)
puts "no error (unexpected)"
rescue => e
puts "#{e.class}: #{e.message.inspect}"
endNo sanitizer needed: $ GEM_HOME=/tmp/json2182 gem install json -v 2.18.2 --no-document
$ GEM_HOME=/tmp/json2182 GEM_PATH=/tmp/json2182 ruby json_dupkey_poc.rb
json 2.18.2
.../gems/json-2.18.2/lib/json/common.rb:353: [BUG] Segmentation fault at 0x0000000000000027
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-linux-gnu]
-- Control frame information -----------------------------------------------
c:0004 p:---- s:0021 e:000020 CFUNC :parse
c:0003 p:0039 s:0015 e:000014 METHOD .../json-2.18.2/lib/json/common.rb:353
c:0002 p:0094 s:0009 E:002288 EVAL json_dupkey_poc.rb:11 [FINISH]
$ echo $?
134$ GEM_HOME=/tmp/json2183 gem install json -v 2.18.3 --no-document
$ GEM_HOME=/tmp/json2183 GEM_PATH=/tmp/json2183 ruby json_dupkey_poc.rb
json 2.18.3
JSON::ParserError: "duplicate key \"%s%s%s%s\" at line 1 column 1"So 2.18.2 does not just mishandle the format string — it dereferences the Same results on Ruby 3.1.2 and on Ruby 4.0.10 (which ships json 2.18.3, so it |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
"~> 2.18.3"topatched_versionsingems/json/CVE-2026-33210.yml(GHSA-3m6g-2423-7cp3, format string injectionin
JSON.parse(allow_duplicate_key: false)).The advisory currently lists
~> 2.15.2.1,~> 2.17.1.2and>= 2.19.2, soevery 2.18.x release is reported as vulnerable, including the patched
2.18.3 (released 2026-11-13). That range (
>= 2.18.3, < 2.19.0) is whatthis PR adds; 2.19.0/2.19.1 stay flagged because the next fix is 2.19.2,
already covered by
>= 2.19.2.Why 2.18.3 and not 2.18.2
CHANGES.mdin 2.18.3 has a single entry dated2026-11-02 (2.18.2)thatmentions the GHSA, which makes it look like the fix shipped in 2.18.2. It did
not — the 2.18.2 tarball still passes the user-controlled key through
rb_sprintf:2.18.3 rewrites this into
build_parse_error_message/parse_error_new, sothe key is no longer used as a format string.
Verified by building both versions' C extensions and running the same PoC
(
{"%s%s%s%s":1,"%s%s%s%s":2}withallow_duplicate_key: false):[BUG] Segmentation fault/ abort (reproduced on Ruby 3.1.2 and 4.0.10)JSON::ParserError: "duplicate key \"%s%s%s%s\" at line 1 column 1"Ruby 4.0.10 ships json 2.18.3, and its
ext/json/parser/parser.cmatchesthe 2.18.3 gem, so with the current metadata Ruby 4.0.10 is flagged as
vulnerable to CVE-2026-33210 even though the PoC only yields a literal
%serror message.
Validation
yamllint gems rubies— cleanrspec spec/schema_validation_spec.rb— 1571 examples, 0 failuresrspec spec/advisories_spec.rb— 72124 examples, 0 failures