From 7f0544e1c62ddf2a5c7351d046a7859ffb858843 Mon Sep 17 00:00:00 2001 From: sky Date: Mon, 15 Jun 2026 16:02:56 +0800 Subject: [PATCH 1/6] fix: validate hexdump width upper bound (#2514) --- src/core/operations/ToHexdump.mjs | 8 +++++++- tests/operations/tests/Hexdump.mjs | 11 +++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/core/operations/ToHexdump.mjs b/src/core/operations/ToHexdump.mjs index a52b0451..f73f2608 100644 --- a/src/core/operations/ToHexdump.mjs +++ b/src/core/operations/ToHexdump.mjs @@ -8,6 +8,8 @@ import Operation from "../Operation.mjs"; import Utils from "../Utils.mjs"; import OperationError from "../errors/OperationError.mjs"; +const MAX_WIDTH = 65536; + /** * To Hexdump operation */ @@ -30,7 +32,8 @@ class ToHexdump extends Operation { "name": "Width", "type": "number", "value": 16, - "min": 1 + "min": 1, + "max": MAX_WIDTH }, { "name": "Upper case hex", @@ -63,6 +66,9 @@ class ToHexdump extends Operation { if (length < 1 || Math.round(length) !== length) throw new OperationError("Width must be a positive integer"); + if (length > MAX_WIDTH) + throw new OperationError(`Width must be no more than ${MAX_WIDTH}`); + const lines = []; for (let i = 0; i < data.length; i += length) { let lineNo = Utils.hex(i, 8); diff --git a/tests/operations/tests/Hexdump.mjs b/tests/operations/tests/Hexdump.mjs index 6eb486db..12d04492 100644 --- a/tests/operations/tests/Hexdump.mjs +++ b/tests/operations/tests/Hexdump.mjs @@ -126,6 +126,17 @@ TestRegister.addTests([ } ], }, + { + name: "To Hexdump: Width too large", + input: "H", + expectedOutput: "Width must be no more than 65536", + recipeConfig: [ + { + op: "To Hexdump", + args: [155555555555555, false, false, false] + } + ], + }, { name: "From Hexdump: xxd", input: `00000000: 0001 0203 0405 0607 0809 0a0b 0c0d 0e0f ................ From 91178a8e6fc300a79cb27a55cfdb935ee07060ba Mon Sep 17 00:00:00 2001 From: axjp <63340001+heapframe@users.noreply.github.com> Date: Mon, 15 Jun 2026 09:05:24 +0100 Subject: [PATCH 2/6] Add integer check for alphabet size (#2458) Co-authored-by: GCHQDeveloper581 <63102987+GCHQDeveloper581@users.noreply.github.com> --- src/core/operations/GenerateDeBruijnSequence.mjs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/core/operations/GenerateDeBruijnSequence.mjs b/src/core/operations/GenerateDeBruijnSequence.mjs index f28d421f..1ac415da 100644 --- a/src/core/operations/GenerateDeBruijnSequence.mjs +++ b/src/core/operations/GenerateDeBruijnSequence.mjs @@ -50,6 +50,14 @@ class GenerateDeBruijnSequence extends Operation { throw new OperationError("Invalid alphabet size, required to be between 2 and 9 (inclusive)."); } + if (!Number.isInteger(k)) { + throw new OperationError("Invalid alphabet size, required to be integer."); + } + + if (!Number.isInteger(n)) { + throw new OperationError("Invalid key length, required to be integer."); + } + if (n < 2) { throw new OperationError("Invalid key length, required to be at least 2."); } From 3f62b14d8357b613e7b181c0efea5e62a7e27577 Mon Sep 17 00:00:00 2001 From: qais <134843180+qa2me@users.noreply.github.com> Date: Mon, 15 Jun 2026 12:15:40 +0400 Subject: [PATCH 3/6] =?UTF-8?q?Fix=20typos=20and=20documentation=20errors?= =?UTF-8?q?=20(bytes=E2=86=92bits,=20wrong=20release=20link,=20spelling)?= =?UTF-8?q?=20(#2404)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: GCHQDeveloper581 <63102987+GCHQDeveloper581@users.noreply.github.com> --- CHANGELOG.md | 2 +- src/core/dishTypes/DishType.mjs | 2 +- src/core/errors/ExcludedOperationError.mjs | 2 +- src/core/operations/ParityBit.mjs | 2 +- src/core/operations/SHA2.mjs | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e4e3be87..b609c201 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -725,7 +725,7 @@ Breaking changes: [10.11.0]: https://github.com/gchq/CyberChef/releases/tag/v10.11.0 [10.10.0]: https://github.com/gchq/CyberChef/releases/tag/v10.10.0 [10.9.0]: https://github.com/gchq/CyberChef/releases/tag/v10.9.0 -[10.8.0]: https://github.com/gchq/CyberChef/releases/tag/v10.7.0 +[10.8.0]: https://github.com/gchq/CyberChef/releases/tag/v10.8.0 [10.7.0]: https://github.com/gchq/CyberChef/releases/tag/v10.7.0 [10.6.0]: https://github.com/gchq/CyberChef/releases/tag/v10.6.0 [10.5.0]: https://github.com/gchq/CyberChef/releases/tag/v10.5.0 diff --git a/src/core/dishTypes/DishType.mjs b/src/core/dishTypes/DishType.mjs index d89e3c0b..04da53dc 100644 --- a/src/core/dishTypes/DishType.mjs +++ b/src/core/dishTypes/DishType.mjs @@ -11,7 +11,7 @@ class DishType { /** - * Warn translations dont work without value from bind + * Warn translations don't work without value from bind */ static checkForValue(value) { if (value === undefined) { diff --git a/src/core/errors/ExcludedOperationError.mjs b/src/core/errors/ExcludedOperationError.mjs index 2972c31d..657051f2 100644 --- a/src/core/errors/ExcludedOperationError.mjs +++ b/src/core/errors/ExcludedOperationError.mjs @@ -1,5 +1,5 @@ /** - * Custom error type for handling operation that isnt included in node.js API + * Custom error type for handling operation that isn't included in node.js API * * @author d98762625 [d98762625@gmail.com] * @copyright Crown Copyright 2018 diff --git a/src/core/operations/ParityBit.mjs b/src/core/operations/ParityBit.mjs index c5ac1d1e..35912f3c 100644 --- a/src/core/operations/ParityBit.mjs +++ b/src/core/operations/ParityBit.mjs @@ -20,7 +20,7 @@ class ParityBit extends Operation { this.name = "Parity Bit"; this.module = "Default"; - this.description = "A parity bit, or check bit, is the simplest form of error detection. It is a bit which is added to a string of bits and represents if the number of 1's in the binary string is an even number or odd number.

If a delimiter is specified, the parity bit calculation will be performed on each 'block' of the input data, where the blocks are created by slicing the input at each occurence of the delimiter character"; + this.description = "A parity bit, or check bit, is the simplest form of error detection. It is a bit which is added to a string of bits and represents if the number of 1's in the binary string is an even number or odd number.

If a delimiter is specified, the parity bit calculation will be performed on each 'block' of the input data, where the blocks are created by slicing the input at each occurrence of the delimiter character"; this.infoURL = "https://wikipedia.org/wiki/Parity_bit"; this.inputType = "string"; this.outputType = "string"; diff --git a/src/core/operations/SHA2.mjs b/src/core/operations/SHA2.mjs index ecdc4cc5..9844070d 100644 --- a/src/core/operations/SHA2.mjs +++ b/src/core/operations/SHA2.mjs @@ -20,7 +20,7 @@ class SHA2 extends Operation { this.name = "SHA2"; this.module = "Crypto"; - this.description = "The SHA-2 (Secure Hash Algorithm 2) hash functions were designed by the NSA. SHA-2 includes significant changes from its predecessor, SHA-1. The SHA-2 family consists of hash functions with digests (hash values) that are 224, 256, 384 or 512 bits: SHA224, SHA256, SHA384, SHA512.

The message digest algorithm for SHA256 variants consists, by default, of 64 rounds, and for SHA512 variants, it is, by default, 160."; + this.description = "The SHA-2 (Secure Hash Algorithm 2) hash functions were designed by the NSA. SHA-2 includes significant changes from its predecessor, SHA-1. The SHA-2 family consists of hash functions with digests (hash values) that are 224, 256, 384 or 512 bits: SHA224, SHA256, SHA384, SHA512.

The message digest algorithm for SHA256 variants consists, by default, of 64 rounds, and for SHA512 variants, it is, by default, 160."; this.infoURL = "https://wikipedia.org/wiki/SHA-2"; this.inputType = "ArrayBuffer"; this.outputType = "string"; From 31808e83d5715f744ee3d74df7e3d0912c1038ea Mon Sep 17 00:00:00 2001 From: Shivam Kumar Date: Mon, 15 Jun 2026 14:04:25 +0530 Subject: [PATCH 4/6] Fix Uint8Array concat crash in Parse IPv4 header (#2409) --- src/core/operations/ParseIPv4Header.mjs | 2 +- tests/operations/tests/ParseIPv4Header.mjs | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/core/operations/ParseIPv4Header.mjs b/src/core/operations/ParseIPv4Header.mjs index a1ab93b3..65a8b63f 100644 --- a/src/core/operations/ParseIPv4Header.mjs +++ b/src/core/operations/ParseIPv4Header.mjs @@ -74,7 +74,7 @@ class ParseIPv4Header extends Operation { checksum = input[10] << 8 | input[11], srcIP = input[12] << 24 | input[13] << 16 | input[14] << 8 | input[15], dstIP = input[16] << 24 | input[17] << 16 | input[18] << 8 | input[19], - checksumHeader = input.slice(0, 10).concat([0, 0]).concat(input.slice(12, 20)); + checksumHeader = [...input.slice(0, 10), 0, 0, ...input.slice(12, 20)]; let version = (input[0] >>> 4) & 0x0f, options = []; diff --git a/tests/operations/tests/ParseIPv4Header.mjs b/tests/operations/tests/ParseIPv4Header.mjs index 47c2592a..ddebe3b9 100644 --- a/tests/operations/tests/ParseIPv4Header.mjs +++ b/tests/operations/tests/ParseIPv4Header.mjs @@ -19,5 +19,16 @@ TestRegister.addTests([ args: ["Hex", "Data (raw)"] } ] + }, + { + name: "Parse IPv4 header: regression for Uint8Array.concat crash on truncated raw input", + input: "\x45\x00\x00\x14\x00\x00\x00\x00\x40\x06\x00\x00", + expectedOutput: "", + recipeConfig: [ + { + op: "Parse IPv4 header", + args: ["Raw", "Data (raw)"] + } + ] } ]); From 7a28e0534b943202f5cb6b91847db4a5d5682260 Mon Sep 17 00:00:00 2001 From: Kendall Goto Date: Mon, 15 Jun 2026 02:06:51 -0700 Subject: [PATCH 5/6] Fix: Reverse highlights unwind incorrectly (#2022) Co-authored-by: GCHQ Developer 85297 <95289555+C85297@users.noreply.github.com> --- src/core/Chef.mjs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/core/Chef.mjs b/src/core/Chef.mjs index 5be10868..426d9643 100755 --- a/src/core/Chef.mjs +++ b/src/core/Chef.mjs @@ -138,6 +138,8 @@ class Chef { if (!highlights) return false; + if (direction === "reverse") highlights.reverse(); + for (let i = 0; i < highlights.length; i++) { // Remove multiple highlights before processing again pos = [pos[0]]; From cc38f3a53f6e7876540e02802610553b723e1052 Mon Sep 17 00:00:00 2001 From: Subhadeep Date: Mon, 15 Jun 2026 18:07:04 +0530 Subject: [PATCH 6/6] Fix: Add input validation for XOR Checksum blocksize (#2537) (#2542) --- src/core/operations/XORChecksum.mjs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/core/operations/XORChecksum.mjs b/src/core/operations/XORChecksum.mjs index 1603a265..ca9c6fac 100644 --- a/src/core/operations/XORChecksum.mjs +++ b/src/core/operations/XORChecksum.mjs @@ -7,12 +7,12 @@ import Operation from "../Operation.mjs"; import Utils from "../Utils.mjs"; import { toHex } from "../lib/Hex.mjs"; +import OperationError from "../errors/OperationError.mjs"; /** * XOR Checksum operation */ class XORChecksum extends Operation { - /** * XORChecksum constructor */ @@ -21,7 +21,8 @@ class XORChecksum extends Operation { this.name = "XOR Checksum"; this.module = "Crypto"; - this.description = "XOR Checksum splits the input into blocks of a configurable size and performs the XOR operation on these blocks."; + this.description = + "XOR Checksum splits the input into blocks of a configurable size and performs the XOR operation on these blocks."; this.infoURL = "https://wikipedia.org/wiki/XOR"; this.inputType = "ArrayBuffer"; this.outputType = "string"; @@ -29,7 +30,7 @@ class XORChecksum extends Operation { { name: "Blocksize", type: "number", - value: 4 + value: 4, }, ]; } @@ -41,6 +42,12 @@ class XORChecksum extends Operation { */ run(input, args) { const blocksize = args[0]; + + + if (!Number.isInteger(blocksize) || blocksize <= 0) { + throw new OperationError("Blocksize must be a positive integer."); + } + input = new Uint8Array(input); const res = Array(blocksize);