-
-
Notifications
You must be signed in to change notification settings - Fork 1
chore(upstream): selective sync with CyberChef v10.20.0 #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -22,7 +22,7 @@ class Argon2 extends Operation { | |||||||||
|
|
||||||||||
| this.name = "Argon2"; | ||||||||||
| this.module = "Crypto"; | ||||||||||
| this.description = "Argon2 is a key derivation function that was selected as the winner of the Password Hashing Competition in July 2015. It was designed by Alex Biryukov, Daniel Dinu, and Dmitry Khovratovich from the University of Luxembourg.<br><br>Enter the password in the input to generate its hash.<br><br><strong>OWASP Recommendation:</strong> Use Argon2id with at least 19 MiB memory, 2 iterations, and parallelism of 1 (default settings)."; | ||||||||||
| this.description = "Argon2 is a key derivation function that was selected as the winner of the Password Hashing Competition in July 2015. It was designed by Alex Biryukov, Daniel Dinu, and Dmitry Khovratovich from the University of Luxembourg.<br><br>Enter the password in the input to generate its hash."; | ||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The new default parameters for Argon2 are significantly weaker and do not follow modern security recommendations. These changes could lead to users unknowingly generating weak password hashes.
It is strongly recommended to revert to more secure defaults (19456 KiB memory, |
||||||||||
| this.infoURL = "https://wikipedia.org/wiki/Argon2"; | ||||||||||
| this.inputType = "string"; | ||||||||||
| this.outputType = "string"; | ||||||||||
|
|
@@ -36,12 +36,12 @@ class Argon2 extends Operation { | |||||||||
| { | ||||||||||
| "name": "Iterations", | ||||||||||
| "type": "number", | ||||||||||
| "value": 2 | ||||||||||
| "value": 3 | ||||||||||
|
||||||||||
| }, | ||||||||||
| { | ||||||||||
| "name": "Memory (KiB)", | ||||||||||
| "type": "number", | ||||||||||
| "value": 19456 | ||||||||||
| "value": 4096 | ||||||||||
|
||||||||||
| "value": 4096 | |
| "value": 19456 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default parameters for Argon2 have been weakened. The memory requirement was reduced from 19,456 KiB to 4,096 KiB, and the default type was changed from Argon2id to Argon2i. OWASP recommends Argon2id with at least 19 MiB of memory to provide adequate resistance against GPU-based attacks.
| "value": 4096 | |
| "value": 19456 |
Copilot
AI
Feb 5, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change reorders the Argon2 type options, moving Argon2id from the first position (default) to the last. The MCP version intentionally set Argon2id as the default (index 0) because it provides the best balance of security against both side-channel and GPU attacks, as recommended by OWASP. Changing the default to Argon2i weakens security for users who don't explicitly select the type, as Argon2i is more vulnerable to GPU-based attacks.
| "value": ["Argon2i", "Argon2d", "Argon2id"], | |
| "value": ["Argon2id", "Argon2i", "Argon2d"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -40,7 +40,7 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "name": "Iterations", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "type": "number", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "value": 10000 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "value": 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "value": 1 | |
| "value": 10000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check failure
Code scanning / CodeQL
Use of password hash with insufficient computational effort High
an access to passphrase
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 3 months ago
In general, the problem is that the PBKDF is configured with parameters that permit very low computational effort (iterations can be 1 and MD5/SHA1 are allowed). To fix this, we need to ensure that password hashing is always done with a sufficiently slow configuration and without obviously broken hash algorithms. Since we must not change code outside the shown snippet, the best we can do here is to: (1) enforce a minimum iteration count high enough to be non‑trivial, and (2) restrict the selectable hash functions to safer options (e.g., SHA‑256/384/512) so that insecure hashes are no longer used.
Concretely, within src/core/operations/DeriveEVPKey.mjs:
-
Update the
this.argsconfiguration to:- Raise the default iteration count from
1to a more reasonable value, such as100000(common contemporary baseline for PBKDF2‑style KDFs). - Remove
MD5andSHA1from the"Hashing function"options, leaving onlySHA256,SHA384, andSHA512.
- Raise the default iteration count from
-
In the
runmethod, enforce a minimum iteration count at runtime to guard against user‑supplied low values. For example, clampiterationsto at least10000before passing it toCryptoJS.EvpKDF. This preserves functionality for higher values but prevents trivially weak configurations.
No new imports or helper methods are required; the adjustment is purely in argument defaults and basic value clamping inside run. This keeps the operation’s purpose (deriving EVP keys with CryptoJS.EvpKDF) intact while making it significantly harder to configure it in an obviously insecure way.
-
Copy modified line R43 -
Copy modified line R48 -
Copy modified line R64
| @@ -40,12 +40,12 @@ | ||
| { | ||
| "name": "Iterations", | ||
| "type": "number", | ||
| "value": 1 | ||
| "value": 100000 | ||
| }, | ||
| { | ||
| "name": "Hashing function", | ||
| "type": "option", | ||
| "value": ["SHA1", "SHA256", "SHA384", "SHA512", "MD5"] | ||
| "value": ["SHA256", "SHA384", "SHA512"] | ||
| }, | ||
| { | ||
| "name": "Salt", | ||
| @@ -65,7 +61,7 @@ | ||
| const passphrase = CryptoJS.enc.Latin1.parse( | ||
| Utils.convertToByteString(args[0].string, args[0].option)), | ||
| keySize = args[1] / 32, | ||
| iterations = args[2], | ||
| iterations = Math.max(10000, args[2]), | ||
| hasher = args[3], | ||
| salt = CryptoJS.enc.Latin1.parse( | ||
| Utils.convertToByteString(args[4].string, args[4].option)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot
AI
Feb 5, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change removes critical security protections that were added in the MCP version. The removed code enforced a minimum of 10,000 iterations per NIST SP 800-63B guidelines, provided user warnings for low iteration counts, and included security documentation explaining the vulnerability. Removing this validation and the minimum iteration enforcement reintroduces CWE-916 vulnerability, allowing users to specify dangerously low iteration counts without any warning or protection.
Copilot
AI
Feb 5, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change removes the minimum iteration count enforcement that was added in the MCP version for security. The removed code enforced 10,000 iterations minimum per NIST recommendations. Reverting to no explicit iteration count in the EvpKDF.create() call may result in using a default of 1 iteration, which provides minimal protection against brute-force attacks.
| const key = CryptoJS.algo.EvpKDF.create({ keySize: keySize + ivSize }).compute(password, salt); | |
| const key = CryptoJS.algo.EvpKDF.create({ | |
| keySize: keySize + ivSize, | |
| iterations: 10000 | |
| }).compute(password, salt); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing the iterations: 10000 parameter from CryptoJS.algo.EvpKDF.create causes it to default to 1 iteration. This is a critical security vulnerability that significantly weakens the key derivation. The explicit, secure iteration count should be restored.
| const key = CryptoJS.algo.EvpKDF.create({ keySize: keySize + ivSize }).compute(password, salt); | |
| const key = CryptoJS.algo.EvpKDF.create({ keySize: keySize + ivSize, iterations: 10000 }).compute(password, salt); |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -9,7 +9,6 @@ import Utils from "../Utils.mjs"; | |||||
| import {INPUT_DELIM_OPTIONS} from "../lib/Delim.mjs"; | ||||||
| import OperationError from "../errors/OperationError.mjs"; | ||||||
| import XRegExp from "xregexp"; | ||||||
| import { createSafeXRegExp } from "../lib/SafeRegex.mjs"; | ||||||
|
|
||||||
| /** | ||||||
| * Filter operation | ||||||
|
|
@@ -57,7 +56,7 @@ class Filter extends Operation { | |||||
| let regex; | ||||||
|
|
||||||
| try { | ||||||
| regex = createSafeXRegExp(XRegExp, args[1]); | ||||||
| regex = new XRegExp(args[1]); | ||||||
|
||||||
| regex = new XRegExp(args[1]); | |
| regex = createSafeXRegExp(XRegExp, args[1]); |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -7,7 +7,6 @@ | |||||
| import Operation from "../Operation.mjs"; | ||||||
| import Utils from "../Utils.mjs"; | ||||||
| import XRegExp from "xregexp"; | ||||||
| import { createSafeXRegExp } from "../lib/SafeRegex.mjs"; | ||||||
|
|
||||||
| /** | ||||||
| * Find / Replace operation | ||||||
|
|
@@ -77,7 +76,7 @@ class FindReplace extends Operation { | |||||
| if (s) modifiers += "s"; | ||||||
|
|
||||||
| if (type === "Regex") { | ||||||
| find = createSafeXRegExp(XRegExp, find, modifiers); | ||||||
| find = new XRegExp(find, modifiers); | ||||||
|
||||||
| find = new XRegExp(find, modifiers); | |
| find = createSafeXRegExp(XRegExp, find, modifiers); |
| Original file line number | Diff line number | Diff line change | |||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -162,8 +162,8 @@ | ||||||||||||||||||||||||||||||||||||||||||||||
| if (options.withLinks && isUrl(json)) { | |||||||||||||||||||||||||||||||||||||||||||||||
| html += `<a href="${json}" class="json-string" target="_blank">${json}</a>`; | |||||||||||||||||||||||||||||||||||||||||||||||
| } else { | |||||||||||||||||||||||||||||||||||||||||||||||
| // Properly escape for JSON display in HTML: backslashes first, then quotes | |||||||||||||||||||||||||||||||||||||||||||||||
| json = json.replace(/\\/g, "\\\\").replace(/"/g, "\\""); | |||||||||||||||||||||||||||||||||||||||||||||||
| // Escape double quotes in the rendered non-URL string. | |||||||||||||||||||||||||||||||||||||||||||||||
| json = json.replace(/"/g, "\\""); | |||||||||||||||||||||||||||||||||||||||||||||||
Check failureCode scanning / CodeQL Incomplete string escaping or encoding High
This does not escape backslash characters in the input.
Copilot AutofixAI 3 months ago In general, when manually escaping characters using backslashes, you must escape backslashes themselves before escaping other characters. Otherwise, sequences like The best targeted fix here is to extend the escaping step for non-URL strings to also escape backslashes. Since Concretely, in json = json.replace(/\\/g, "\\\\").replace(/"/g, "\\"");No new imports or helpers are required; this uses only built-in string replacement with a global regex for backslashes. This ensures that any backslash is rendered as an escaped backslash, and quotes (represented as
Suggested changeset
1
src/core/operations/JSONBeautify.mjs
Copilot is powered by AI and may make mistakes. Always verify output.
Refresh and try again.
Comment on lines
+165
to
+166
|
|||||||||||||||||||||||||||||||||||||||||||||||
| // Escape double quotes in the rendered non-URL string. | |
| json = json.replace(/"/g, "\\""); | |
| // Escape backslashes first, then double quotes in the rendered non-URL string. | |
| json = json.replace(/\\/g, "\\\\").replace(/"/g, "\\""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The removal of backslash escaping (.replace(/\\/g, "\\\\")) will cause strings containing backslashes to be rendered incorrectly as JSON strings in the HTML output. This makes the displayed JSON invalid. The backslash escaping should be restored.
| json = json.replace(/"/g, "\\""); | |
| json = json.replace(/\\/g, "\\\\").replace(/"/g, "\\""); |
| Original file line number | Diff line number | Diff line change | |||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -151,8 +151,7 @@ | ||||||||||||||||||||||||||||||||||||
| const value = read(length); | |||||||||||||||||||||||||||||||||||||
| expect('";'); | |||||||||||||||||||||||||||||||||||||
| if (args[0]) { | |||||||||||||||||||||||||||||||||||||
| // Properly escape backslashes first, then quotes to prevent injection | |||||||||||||||||||||||||||||||||||||
| return '"' + value.replace(/\\/g, "\\\\").replace(/"/g, '\\"') + '"'; | |||||||||||||||||||||||||||||||||||||
| return '"' + value.replace(/"/g, '\\"') + '"'; // lgtm [js/incomplete-sanitization] | |||||||||||||||||||||||||||||||||||||
Check failureCode scanning / CodeQL Incomplete string escaping or encoding High
This does not escape backslash characters in the input.
Copilot AutofixAI 3 months ago In general, the fix is to perform proper JSON string escaping instead of only escaping double quotes. The safest approach in JavaScript is to delegate to the built-in JSON encoder rather than implementing escaping manually. That way, all required characters (including backslashes, quotes, control characters, etc.) are correctly handled. The best minimal change here is to replace the manual
Suggested changeset
1
src/core/operations/PHPDeserialize.mjs
Copilot is powered by AI and may make mistakes. Always verify output.
Refresh and try again.
|
|||||||||||||||||||||||||||||||||||||
| return '"' + value.replace(/"/g, '\\"') + '"'; // lgtm [js/incomplete-sanitization] | |
| return '"' + value.replace(/\\/g, "\\\\").replace(/"/g, '\\"') + '"'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The removal of backslash escaping in the deserialized string output results in incomplete sanitization. This can lead to invalid JSON output and potential injection attacks if strings contain backslashes followed by double quotes. Restore the escaping.
| return '"' + value.replace(/"/g, '\\"') + '"'; // lgtm [js/incomplete-sanitization] | |
| return '"' + value.replace(/\\/g, "\\\\").replace(/"/g, '\"') + '"'; |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -5,8 +5,6 @@ | |||||||||||||||||||||
| */ | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| import Operation from "../Operation.mjs"; | ||||||||||||||||||||||
| import OperationError from "../errors/OperationError.mjs"; | ||||||||||||||||||||||
| import { createSafeRegExp } from "../lib/SafeRegex.mjs"; | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| /** | ||||||||||||||||||||||
| * RAKE operation | ||||||||||||||||||||||
|
|
@@ -56,14 +54,9 @@ class RAKE extends Operation { | |||||||||||||||||||||
| */ | ||||||||||||||||||||||
| run(input, args) { | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| // Get delimiter regexs with ReDoS protection | ||||||||||||||||||||||
| let wordDelim, sentDelim; | ||||||||||||||||||||||
| try { | ||||||||||||||||||||||
| wordDelim = createSafeRegExp(args[0], "g"); | ||||||||||||||||||||||
| sentDelim = createSafeRegExp(args[1], "g"); | ||||||||||||||||||||||
| } catch (err) { | ||||||||||||||||||||||
| throw new OperationError(`Invalid regex pattern: ${err.message}`); | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
| // Get delimiter regexs | ||||||||||||||||||||||
| const wordDelim = new RegExp(args[0], "g"); | ||||||||||||||||||||||
| const sentDelim = new RegExp(args[1], "g"); | ||||||||||||||||||||||
|
Comment on lines
+57
to
+59
|
||||||||||||||||||||||
| const wordDelim = new RegExp(args[0], "g"); | |
| const sentDelim = new RegExp(args[1], "g"); | |
| // Get delimiter regexs with ReDoS protection | |
| let wordDelim, sentDelim; | |
| try { | |
| wordDelim = createSafeRegExp(args[0], "g"); | |
| sentDelim = createSafeRegExp(args[1], "g"); | |
| } catch (err) { | |
| throw new OperationError(`Invalid regex pattern: ${err.message}`); | |
| } |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -8,7 +8,6 @@ import Operation from "../Operation.mjs"; | |||||
| import Dish from "../Dish.mjs"; | ||||||
| import XRegExp from "xregexp"; | ||||||
| import { isWorkerEnvironment } from "../Utils.mjs"; | ||||||
| import { createSafeXRegExp } from "../lib/SafeRegex.mjs"; | ||||||
|
|
||||||
| /** | ||||||
| * Register operation | ||||||
|
|
@@ -68,7 +67,7 @@ class Register extends Operation { | |||||
| if (m) modifiers += "m"; | ||||||
| if (s) modifiers += "s"; | ||||||
|
|
||||||
| const extractor = createSafeXRegExp(XRegExp, extractorStr, modifiers), | ||||||
| const extractor = new XRegExp(extractorStr, modifiers), | ||||||
|
||||||
| const extractor = new XRegExp(extractorStr, modifiers), | |
| const extractor = createSafeXRegExp(XRegExp, extractorStr, modifiers), |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -8,7 +8,6 @@ import XRegExp from "xregexp"; | |||||
| import Operation from "../Operation.mjs"; | ||||||
| import Utils from "../Utils.mjs"; | ||||||
| import OperationError from "../errors/OperationError.mjs"; | ||||||
| import { createSafeXRegExp } from "../lib/SafeRegex.mjs"; | ||||||
|
|
||||||
| /** | ||||||
| * Regular expression operation | ||||||
|
|
@@ -156,7 +155,7 @@ class RegularExpression extends Operation { | |||||
|
|
||||||
| if (userRegex && userRegex !== "^" && userRegex !== "$") { | ||||||
| try { | ||||||
| const regex = createSafeXRegExp(XRegExp, userRegex, modifiers); | ||||||
| const regex = new XRegExp(userRegex, modifiers); | ||||||
|
||||||
| const regex = new XRegExp(userRegex, modifiers); | |
| const regex = createSafeXRegExp(XRegExp, userRegex, modifiers); |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -7,7 +7,6 @@ | |||||
| import Operation from "../Operation.mjs"; | ||||||
| import Recipe from "../Recipe.mjs"; | ||||||
| import Dish from "../Dish.mjs"; | ||||||
| import { createSafeRegExp } from "../lib/SafeRegex.mjs"; | ||||||
|
|
||||||
| /** | ||||||
| * Subsection operation | ||||||
|
|
@@ -96,7 +95,7 @@ class Subsection extends Operation { | |||||
| if (!caseSensitive) flags += "i"; | ||||||
| if (global) flags += "g"; | ||||||
|
|
||||||
| const regex = createSafeRegExp(section, flags), | ||||||
| const regex = new RegExp(section, flags), | ||||||
|
||||||
| const regex = new RegExp(section, flags), | |
| const regex = createSafeRegExp(section, flags), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change removes OWASP-recommended security guidance that was added in the MCP version. The removed description included important security recommendations about using Argon2id with at least 19 MiB memory, 2 iterations, and parallelism of 1. Removing this guidance may lead users to use insecure parameters without understanding the security implications.