Skip to content

feat: add From JS6Chars operation - #2681

Closed
Roma476 wants to merge 3 commits into
gchq:masterfrom
Roma476:feature/from-js6chars-clean
Closed

Roma476 wants to merge 3 commits into
gchq:masterfrom
Roma476:feature/from-js6chars-clean

Conversation

@Roma476

@Roma476 Roma476 commented Jul 22, 2026

Copy link
Copy Markdown

Adds a new operation to decode JavaScript obfuscated using only 6 characters ([ ] ( ) ! +), commonly known as an esoteric JS encoding style named JS6Chars.

  • Added src/core/operations/FromJS6Chars.mjs
  • Added operation to Code tidy category in Categories.json
  • Added tests in tests/operations/tests/FromJS6Chars.mjs

Description
This is a rework of a previously closed PR (#2358), renamed following maintainer feedback regarding the original operation name not being corporately acceptable. All references to the original name have been removed from the code, description, and tests, and the commit history has been squashed into a single commit as requested.

Existing Issue
Closes #1054

Screenshots
N/A, this operation does not change any existing visual aspects of CyberChef.

AI disclosure
I used Claude (Anthropic) to help debug a test failure I ran into while preparing this PR (a test using expectedError: true was failing because Recipe.execute handles OperationError as expected/handled output rather than a thrown error, so the test needed expectedOutput with the error message instead). I wrote the operation logic, description, and tests myself; Claude helped me understand the CyberChef Recipe/Chef error-handling flow to fix that specific test. I have reviewed and understand all the code being submitted.

Test Coverage
Added 4 tests covering: basic decoding, a longer string ("Hello"), numeric input, and invalid character input (verifying the error message output).

Roma476 added 2 commits July 22, 2026 10:15
Adds a new operation to decode JavaScript obfuscated using only 6 characters ([ ] ( ) ! +), commonly known as an esoteric JS encoding style.

- Added src/core/operations/FromJS6Chars.mjs
- Added operation to Code tidy category in Categories.json
- Added tests in tests/operations/tests/FromJS6Chars.mjs

fix: correct invalid input test to check error message output
@HackingRepo

HackingRepo commented Jul 22, 2026 •

Copy link
Copy Markdown

that operation is high risk of xss and very unsafe @Roma476

example

[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((!![]+[])[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+([][[]]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+!+[]]+(+[![]]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+!+[]]]+(![]+[])[+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(!![]+[])[+[]])((![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]+(!![]+[])[+[]])()

and then will trigger an alert 1 popup

since you calling new Function that is a dangerous evil method

@Roma476

Roma476 commented Jul 22, 2026

Copy link
Copy Markdown
Author

@HackingRepo Fair point, I'll rework it to decode statically instead of executing the code.

@Roma476

Roma476 commented Nov 6, 2026

Copy link
Copy Markdown
Author

@GCHQDeveloper581 @HackingRepo
I've replaced the previous new Function implementation with a static interpreter and opened #2932 with the full change. The new PR was closed automatically by the repository policy because I'm not an approved outside collaborator.

Would it be possible to add me as an outside collaborator so the PR can be reviewed? I'm happy to make any changes required.

I'll close this PR once #2932 is merged.

@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Thank you for your contribution - unfortunately this repository only accepts pull requests from organisation members or approved outside collaborators. Due to that, this pull request has been closed automatically.

@github-actions github-actions Bot closed this Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: JSF**k resolver

2 participants