Giter Club home page Giter Club logo

cyberchef's Introduction

CyberChef

npm Gitter

The Cyber Swiss Army Knife

CyberChef is a simple, intuitive web app for carrying out all manner of "cyber" operations within a web browser. These operations include simple encoding like XOR and Base64, more complex encryption like AES, DES and Blowfish, creating binary and hexdumps, compression and decompression of data, calculating hashes and checksums, IPv6 and X.509 parsing, changing character encodings, and much more.

The tool is designed to enable both technical and non-technical analysts to manipulate data in complex ways without having to deal with complex tools or algorithms. It was conceived, designed, built and incrementally improved by an analyst in their 10% innovation time over several years.

Live demo

CyberChef is still under active development. As a result, it shouldn't be considered a finished product. There is still testing and bug fixing to do, new features to be added and additional documentation to write. Please contribute!

Cryptographic operations in CyberChef should not be relied upon to provide security in any situation. No guarantee is offered for their correctness.

A live demo can be found here - have fun!

Containers

If you would like to try out CyberChef locally you can either build it yourself:

docker build --tag cyberchef --ulimit nofile=10000 .
docker run -it -p 8080:80 cyberchef

Or you can use our image directly:

docker run -it -p 8080:80 ghcr.io/gchq/cyberchef:latest

This image is built and published through our GitHub Workflows

How it works

There are four main areas in CyberChef:

  1. The input box in the top right, where you can paste, type or drag the text or file you want to operate on.
  2. The output box in the bottom right, where the outcome of your processing will be displayed.
  3. The operations list on the far left, where you can find all the operations that CyberChef is capable of in categorised lists, or by searching.
  4. The recipe area in the middle, where you can drag the operations that you want to use and specify arguments and options.

You can use as many operations as you like in simple or complex ways. Some examples are as follows:

Features

  • Drag and drop
    • Operations can be dragged in and out of the recipe list, or reorganised.
    • Files up to 2GB can be dragged over the input box to load them directly into the browser.
  • Auto Bake
    • Whenever you modify the input or the recipe, CyberChef will automatically "bake" for you and produce the output immediately.
    • This can be turned off and operated manually if it is affecting performance (if the input is very large, for instance).
  • Automated encoding detection
    • CyberChef uses a number of techniques to attempt to automatically detect which encodings your data is under. If it finds a suitable operation that make sense of your data, it displays the 'magic' icon in the Output field which you can click to decode your data.
  • Breakpoints
    • You can set breakpoints on any operation in your recipe to pause execution before running it.
    • You can also step through the recipe one operation at a time to see what the data looks like at each stage.
  • Save and load recipes
    • If you come up with an awesome recipe that you know youโ€™ll want to use again, just click "Save recipe" and add it to your local storage. It'll be waiting for you next time you visit CyberChef.
    • You can also copy the URL, which includes your recipe and input, to easily share it with others.
  • Search
    • If you know the name of the operation you want or a word associated with it, start typing it into the search field and any matching operations will immediately be shown.
  • Highlighting
  • Save to file and load from file
    • You can save the output to a file at any time or load a file by dragging and dropping it into the input field. Files up to around 2GB are supported (depending on your browser), however, some operations may take a very long time to run over this much data.
  • CyberChef is entirely client-side
    • It should be noted that none of your recipe configuration or input (either text or files) is ever sent to the CyberChef web server - all processing is carried out within your browser, on your own computer.
    • Due to this feature, CyberChef can be downloaded and run locally. You can use the link in the top left corner of the app to download a full copy of CyberChef and drop it into a virtual machine, share it with other people, or host it in a closed network.

Deep linking

By manipulating CyberChef's URL hash, you can change the initial settings with which the page opens. The format is https://gchq.github.io/CyberChef/#recipe=Operation()&input=...

Supported arguments are recipe, input (encoded in Base64), and theme.

Browser support

CyberChef is built to support

  • Google Chrome 50+
  • Mozilla Firefox 38+

Node.js support

CyberChef is built to fully support Node.js v16. For more information, see the "Node API" wiki page

Contributing

Contributing a new operation to CyberChef is super easy! The quickstart script will walk you through the process. If you can write basic JavaScript, you can write a CyberChef operation.

An installation walkthrough, how-to guides for adding new operations and themes, descriptions of the repository structure, available data types and coding conventions can all be found in the "Contributing" wiki page.

  • Push your changes to your fork.
  • Submit a pull request. If you are doing this for the first time, you will be prompted to sign the GCHQ Contributor Licence Agreement via the CLA assistant on the pull request. This will also ask whether you are happy for GCHQ to contact you about a token of thanks for your contribution, or about job opportunities at GCHQ.

Licencing

CyberChef is released under the Apache 2.0 Licence and is covered by Crown Copyright.

cyberchef's People

Contributors

a3957273 avatar ashcorr avatar aussieklutz avatar bwhitn avatar cbeuw avatar cplussharp avatar cynser avatar d98762625 avatar ge0rg3 avatar graingert avatar h345983745 avatar j433866 avatar jarmovanlenthe avatar jl5193 avatar kassi avatar klaxon1 avatar mattnotmitt avatar mikecat avatar mikescher avatar mshwed avatar n1073645 avatar n1474335 avatar qistoph avatar s2224834 avatar sw5678 avatar thesavageteddy avatar tlwr avatar tomgond avatar virtualcolossus avatar zb3 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cyberchef's Issues

JSON Beautify and Minify code tidy operations yield error when input box is empty

JSON Beautify and JSON Minify code tidy operations yield an error message when the input box is empty.

Steps to reproduce the issue (please be as specific as possible)

  1. Visit https://gchq.github.io/CyberChef
  2. Expand the code tidy operations
  3. Double click on the JSON Beautify or JSON Minify code tidy operations screen shot 2016-12-02 at 12 18 06 am

Expected behavior

It should add the operation to the recipe box without error, similar to the other operations.

Actual behavior

The following error message is displayed: screen shot 2016-12-02 at 12 20 14 am

  • Operating system (Mac OS X Yosemite 10.10.5)
  • Web browser and version (Chrome 55.0.2883.75 (64-bit))
  • Date, specific time and time zone when issue was found (Friday, December 2, 2016 8:28a UTC)

Issues with Unique and HTML Strip

Neither of these operations perform as I would expect.
Unique does not delete a duplicate.
HTML Strip removes all text between angle brackets and not just valid HTML tags.

chef

restructure project to keep components and their styles/markup together

eg:

css/lib/bootstrap3.min.css
html/index.html
js/config/Categories.js

Your source code directories should be chosen by feature, not filetype. This keeps style, markup and code together when navigating your codebase.

There's no need to add extra redundant file type information to your paths, we already know it's a js file because the path ends with js. You can use **/*.js to select them in scripts.

Feature request: Chain output as parameter

Hi,
It looks like it's not possible to use the output of an action as a parameter (ex: a key) in another action. Am I right? If yes, that could be an interesting feature so one could chain operations like using a key derivation function to generate the key used to encrypt an input).
Thanks.

Feature Request: Ability to set comments/notes on an operation

It would be nice to have the ability to add a note or comment to an operation. I can see this being useful if you publish a receipt and you want to provide some clarity on why your doing a specific operations. An example would be why your using the "Drop Bytes" operation.

This could be represented by icon on the operation and then displayed with a mouse over event.

Thanks,

Superhac

Operation request: base58 encoding/decoding

Hello, thanks to all contributors working on this project.
I would like to request the addition of base58 en/decoding, which is used for human-friendly encoding in cases like bitcoin addresses, etc.

Cheers!

Drag item to Favourites on iPad does not work

It works fine in Chrome on iMac but not in Chrome on IPad, I guess the drag target event might not be handled. Mostly other things seem to be fine on an iPad. The app is a boon due to the paucity of text tools on the device.

use babel and babel-preset-env

Using the following babel config you can encode your supported browsers:

{
  "presets": [
    ["env", {
      "targets": {
        "chrome": 55,
        "firefox": 50,
      },
      "modules": false,
    }]
  ]
}

This way you'll be able to use all features of es2016 and those features not supported in chrome or firefox will be automatically translated by babel.

modules: false is set because module bundlers need the "import/export" keywords to create an optimized bundle.

XOR Differential

I'm trying something very simple and I can't figure out if the flaw is on me or on them.

  1. Take a base64 encoded payload as Input: "AAAAI9Dw0qHYq9+61/XPtJS20bTAn+yV5o/hh+jK8J7rh+vLtpbr". I use the "From Base64" module.

  2. The result is differential XOR crypt. The seed is 171. I select the XOR module and use 171 as the key. Then i pick "differential" option. Doesn't work.

Recipe:
[{"op":"From Base64","args":["A-Za-z0-9+/=",false]}
{"op":"Drop bytes","args":["0","4",false]}
{"op":"XOR","args":[{"option":"Hex","string":"AB"},false,true]}]

Am I missing something? This is a very simple example.

The simple python code that decodes it is this:

def decrypt(string):
key = 171
result = ""
for i in string:
a = key ^ ord(i)
key = ord(i)
result += chr(a)
return result

string = "AAAAKtDygfiL/5r31e+UtsWg1Iv5nPCR6LfEsNGlwOLYo4HyhueT9tTu36Lfog=="
result = decrypt(base64.b64decode(string)[4:])
print "decoded: ", result
print "Length: " , struct.unpack("I", string[0:4])

Bug: Tooltip stays shown, after moving mouse

When bug happends, the tooltip popup stays shown, and you have to reload the page to make it dissapear.

Bug

How to reproduce bug

  1. Focus search bar
  2. Hover over an operation
  3. Type something in the searchbar, thile still hovering over an operation
  4. Move the mouse away, and the popup will stay open.

AESEncrypt->AESDecrypt not functioning properly

All the other encrypt/decrypt pairs appear to work except for the AESEncrypt->AESDecrypt. If you AESEncrypt a string with any key, AESDecrypt does not output that same string with the same key. In fact, it doesn't seem to output anything.

"Find / Replace" Operation fails to replace recursively for "Extended" and "Simple string".

When using the "Find / Replace" Operation with the "Extended" and "Simple string" options, the first instance of the text is replaced and no recursion takes place (with and without the "Multiline matching" option checked).

The sample case:

Attachment MESSAGE_7.zip

Attachment MESSAGE_9.zip

Attachment MESSAGE_0.zip

When using "Extended" with one Find / Replace recipe finding "\r\n" or two recipes finding "\r" and "\n", replacing with "" (nothing), the first line is modified and no others (with or without "Multiline matching" enabled). However, utilizing these Extended search terms as "Regex" in two recipes, all new lines are removed.

When using "Simple string" to find "Attachment " or "Attachment " and replace it with "" (nothing), the same behavior noted above for "Extended" occurs. Only the first line is modified, unless the option is toggled to "Regex", then all lines are parsed.

My initial workaround was to create one recipe parsing to replace about ten lines with Regex, move the data to Notepad++ to replace the Extended and Simple string, then back to CyberChef to use a second recipe to bake out the final changes needed. After testing, I am able to use the Regex option as a workaround to find/replace the needed Extended and Simple string in one recipe.

Broken on ios

Sometime between November 28 when it worked on an iPad and now, the web app stopped working. In particular, the operations tab no longer appears and the layout of the input/output areas is below the Bake button. Nor do links at the top right function. I suspect a JavaScript error is interrupting the page load but the debugging environment on iOS is not conducive to seeing what is going on.

Operation improvement: Unicode support for the Strings operation

Request summary

Development of Unicode support for the Strings operation. Currently the Strings operation can only detect strings matching the following regular expression: [A-Z\\d/\\-:.,_$%'\"()<>= !\\[\\]{}@].

It should also be able to detect strings that have been encoded in UTF-16 and (ideally) other Unicode formats. This support should be toggle-able via an argument.

Example input and output

The following recipe should match against the word "Test": https://gchq.github.io/CyberChef/?recipe=%5B%7B%22op%22%3A%22Text%20encoding%22%2C%22args%22%3A%5B%22UTF8%22%2C%22UTF16%22%5D%7D%2C%7B%22op%22%3A%22Strings%22%2C%22args%22%3A%5B%223%22%2Cfalse%5D%7D%5D&input=VGVzdA

Installation issue

Hello,

It's probably something I'm doing wrong, but I'm trying to get this to work with Apache and CentOS 7.

/var/www/CyberChef/build/prod/
total 232
drwxr-sr-x 3 root apache   4096 Dec  3 22:44 .
drwxr-sr-x 4 root apache   4096 Dec  3 22:44 ..
-rw-r--r-- 1 root apache  28005 Dec  3 22:44 cyberchef.htm
-rwxr-xr-x 1 root apache   1800 Dec  3 22:44 .htaccess
drwxr-sr-x 2 root apache   4096 Dec  3 22:44 images
-rw-r--r-- 1 root apache  28069 Dec  3 22:44 index.html
-rw-r--r-- 1 root apache 162961 Dec  3 22:44 styles.css
<VirtualHost *:80>
    ServerName cyberchef.outsideit.net
    ServerAlias cyberchef.outsideit.net
    DirectoryIndex index.html
    DocumentRoot /var/www/CyberChef/build/prod/
    LogLevel warn
    ErrorLog /var/log/httpd/error_http.log
    CustomLog /var/log/access_http.log combined
</VirtualHost>

The results look like this in http://cyberchef.outsideit.net/

The Operations column isn't shown and the buttons don't seem to work. Any advice to get this working is very much appreciated.

Willem

Feature Request: Split's "Join delimiter" deletes after "Split delimiter"

To allow for quick parsing of senders from a domain in an email list, can a delete action be added to the Split Operation's "Split delimiter" where any characters trailing the "Join delimiter" are removed? Currently, this is being performed by a bulkier Excel "Text to Columns" delimited on "@".

For example (Note: ";" used in place of '\n\r'):

Join delimiter - @
Split delimiter - Deletes trailing
Input - [email protected];[email protected];[email protected]
Output - sender1;sender2;sender3

Thanks for the consideration.

User input is disclosed to web server

With the setting "Update the URL when the input or recipe changes" turned on (the default), each update of the URL results in Chrome 54.0.2840.99m on Win10 rerequesting the favicon.

As a result, user input including parameters supplied to operations such as cryptographic keys are disclosed to the server via URL parameters in the Referer header. This is inconsistent with the feature statement "it should be noted that none of your input or recipe configuration is ever sent to the CyberChef web server". Worth noting to paranoid users that the web server in this instance belongs to GitHub, not to the GCHQ.

Perhaps these parameters could be moved into client-side hash parameters or this setting turned off by default and a warning provided when turned on?

Any tags or release?

Can we have a tag or a release please?

As a packager, without a tag or release, it is difficult to create reproducible builds without this.

Allow multiple inout/output windows

It would be really cool to allow multiple input/output windows, and assign various recipes to them.

As a simple example, I want to be able to:

  • Paste some base64'd, urlencoded, htmlencoded data into the input
  • Apply the various recipe's to get this to plaintext (bonus points if each recipe has an optional 'display data' step so I can see each one as it goes)
  • Be able to modify the decoded plaintext
  • Build up a list of encoders to get it back to it's original encoded state (htmlencode, then urlencode, then base64)

As a pentester, this would be really useful when wanting to mess around with data then stick it back into a request.

Obviously the current workaround to this is to have 2 CyberChef tabs open (one for decoding, one for encoding), and then copy between them.

Broken on IOS

Re Issue #45 that was closed. It still seems broken on my iPad running ios 9 with Chrome. I sleuthed where the breakage seemed to be. It works at this commit:

https://cdn.rawgit.com/gchq/CyberChef/a4c9bb890746cbea09de1b775f64b21577c59362/cyberchef.htm

and fails at the next commit:

https://cdn.rawgit.com/gchq/CyberChef/7bcf560ff15ba59379b7af14b98498b5b5a924d7/cyberchef.htm

The only change at that commit is the switch from jsHint to EsLint so I think it must be something esLint is doing or maybe the order files are being packaged and maybe two functions with the same name but different load orders -- just theories.

No dependencies?

I noticed that the package.json file has no external dependencies at all (except for dev). This seems like a bad idea as it results in the planned obsolescence and excessive bundling highlighted in #2. I'd like to add features that depend on npm packages, but before I do so, I want to know if there is some specific policy about not using external dependencies or whether I should import stuff manually.

Operation request: MD6 hashing

Request summary

Development of an operation to calculate MD6 hashes. CyberChef already supports MD5 hashing thanks to CryptoJS (example and code).

Arguments

  • Output length - Allow the user to specify the digest length from a list including at least 128, 256, and 512 (see SHA3 for an example)

Example input and output

Digest length == 128
Input: Test
Output: bc7e7a90c6610310a6c386ba0482c889

Digest length == 256
Input: Test
Output: 2543e1c393d880e4564fed11f15d03ade6c5ccb9dbbd45ff1808010cbd82bdd2

Digest length == 512
Input: Test
Output: 702fd91632a6df15bb5041eb2ea031f7b931564eeb5324e92250bf2f4a8cb5eb7f40a607341b1ede16c880040bd04ab828f9aa81b5da3967111cdcdafd390839

Resources

https://en.wikipedia.org/wiki/MD6
http://groups.csail.mit.edu/cis/md6/submitted-2008-10-27/Supporting_Documentation/md6_report.pdf
http://groups.csail.mit.edu/cis/md6/ - An implementation in C can be found in the Downloads section
https://github.com/Snack-X/md6 - Includes a JavaScript implementation (which will need to be checked for correctness)

ToHex + FromHexDump omits the last character

just adding ToHex + FromHexDump after eachother should return the input as it forms an identity function. In CyberChef it returns the input without the last character.

Example: 'hello' -> 'hell'

XSS via unsafe innerHTML mapping of receipe parameter value

Hi all, there's a small XSS bug in your tool that you might wanna fix:

PoC:

https://gchq.github.io/CyberChef/?recipe=[{"op"%3A"XOR"%2C"args"%3A[{"option"%3A"He<iframe onload%3Dalert`1`>x"%2C"string"%3A""}%2Cfalse%2Cfalse]}]

The problem seems to be located in the method HTMLApp.prototype.set_recipe_config:

Affected Source:

[...]
        for (var j = 0; j < args.length; j++) {
            if (args[j].getAttribute("type") == "checkbox") {
                // checkbox
                args[j].checked = recipe_config[i].args[j];
            } else if (args[j].classList.contains("toggle-string")) {
                // toggle_string
                args[j].value = recipe_config[i].args[j].string;
                args[j].previousSibling.children[0].innerHTML = recipe_config[i].args[j].option +
                    " <span class='caret'></span>";
            } else {
                // all others
                args[j].value = recipe_config[i].args[j];
            }
        }
[...]

The recipe JSON from location.search is parsed correctly yet not sanitized before user input hits the recipe list's innerHTML property. It might make sense to sanitize those using DOMPurify or comparable tools.

Note: this attack can even be persisted by using the reflected XSS to modify the content of the localStorage container.

The attacker would simply add another HTML injection into the object favourites and thereby make sure, that the injected JavaScript executes next time the user re-opens CyberChef. After one successful injection and execution, the localStorage object has to be modified again to persist the attack.

PoC for persistence:

  1. Click this link
  2. Open CyberChef w/o parameters

small css issue in firefox

firefox 48.0.2.

About/Support dialog > FAQs tab:

the anchors on the current 3 faqs for some reason do not create the usual cursor (pointer). not sure why. the blockquote??

possible fixes (not all checked):

  • add ids
  • blockquote a { cursor: pointer; }
  • a[data-target='#faq-examples'] { cursor: pointer; }
  • a[data-target='#faq-load-files'] { cursor: pointer; }
  • a[data-target='#faq-fork'] { cursor: pointer; }

other...

html (starting line 301): https://github.com/gchq/CyberChef/blob/master/src/html/index.html

Translate operation

Hi :)

I'm French developer and because we develop in English, we often need to translate french words to english to create variables or anything.

It would be great to have a translation operation in CyberChef ๐Ÿ‘

For example to create a slug url from french sentence :
Input text : "Ma page d'accueil"
Translate operation (FR -> EN) : "My homepage"
To lowercase : "my homepage"
Regex to replace whitespaces : "my-homepage"
Tadaaa ๐ŸŒ๏ธโ€โ™‚๏ธ

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.