Giter VIP home page Giter VIP logo

juice-shop / juice-shop-ctf Goto Github PK

View Code? Open in Web Editor NEW
399.0 16.0 109.0 3.72 MB

Tool to export Juice Shop challenges and hints in data format compatible with CTFd, RootTheBox or FBCTF

Home Page: http://owasp-juice.shop

License: MIT License

JavaScript 98.08% Shell 0.33% Dockerfile 1.59%
owasp ctf ctfd application-security capture-the-flag pentesting hacking owasp-juice-shop ctfd-database ctfd-setup

juice-shop-ctf's Introduction

Juice Shop CTF Logo OWASP Juice Shop CTF Extension

OWASP Flagship
GitHub release
Twitter Follow
Subreddit subscribers

CI Pipeline Docker Cloud Build Status Coverage Status Code Climate Code Climate technical debt
GitHub stars

The Node package juice-shop-ctf-cli helps you to prepare Capture the Flag events with the OWASP Juice Shop challenges for different popular CTF frameworks. This interactive utility allows you to populate a CTF game server in a matter of minutes.

Screenshot of juice-shop-ctf-cli in Powershell

Supported CTF Frameworks

The following open source CTF frameworks are supported by juice-shop-ctf-cli:

Setup node npm npm npm bundle size

npm install -g juice-shop-ctf-cli

Usage

Interactive Mode

Open a command line and run:

juice-shop-ctf

Then follow the instructions of the interactive command line tool.

Configuration File

Instead of answering questions in the CLI you can also provide your desired configuration in a file with the following format:

ctfFramework: CTFd | FBCTF | RootTheBox
juiceShopUrl: https://juice-shop.herokuapp.com
ctfKey: https://raw.githubusercontent.com/bkimminich/juice-shop/master/ctf.key # can also be actual key instead URL
countryMapping: https://raw.githubusercontent.com/bkimminich/juice-shop/master/config/fbctf.yml # ignored for CTFd and RootTheBox
insertHints: none | free | paid # "paid" handled as "free" for CTFd
insertHintUrls: none | free | paid # optional for FBCTF; "paid" handled as "free" for CTFd
insertHintSnippets: none | free | paid # optional for FBCTF; "paid" handled as "free" for CTFd

You can then run the generator with:

juice-shop-ctf --config myconfig.yml

Optionally you can also choose the name of the output file:

juice-shop-ctf --config myconfig.yml --output challenges.out

You can ignore certificate warnings like this:

juice-shop-ctf --ignoreSslWarnings

Docker Container Docker Automated build Docker Pulls Docker Stars

Share your current directory with the /data volume of your bkimminich/juice-shop-ctf Docker container and run the interactive mode with:

docker run -ti --rm -v $(pwd):/data bkimminich/juice-shop-ctf

Alternatively you can provide a configuration file via:

docker run -ti --rm -v $(pwd):/data bkimminich/juice-shop-ctf --config myconfig.yml

Choosing the name of the output file is also possible:

docker run -ti --rm -v $(pwd):/data bkimminich/juice-shop-ctf --config myconfig.yml --output challenges.out

On Windows cmd.exe you have to use %cd% instead of $(pwd) to mount your current working directory.


For detailed step-by-step instructions and examples please refer to the Hosting a CTF event chapter in our (free) companion guide ebook.

Screenshots

CTFd challenge overview

FBCTF world map

RTB challenge boxes

Troubleshooting Gitter

If you need help with the application setup please check the Troubleshooting section below or post your specific problem or question in the official Gitter Chat.

  • If using Docker Toolbox on Windows make sure that you also enable port forwarding for all required ports from Host 127.0.0.1:XXXX to 0.0.0.0:XXXX for TCP in the default VM's network adapter in VirtualBox. For CTFd you need to forward port 8000.

Contributing GitHub contributors

Found a bug? Got an idea for enhancement? Improvement for cheating prevention?

Feel free to create an issue or post your ideas in the chat! Pull requests are also highly welcome - please refer to CONTRIBUTING.md for details.

Donations

The OWASP Foundation gratefully accepts donations via Stripe. Projects such as Juice Shop can then request reimbursement for expenses from the Foundation. If you'd like to express your support of the Juice Shop project, please make sure to tick the "Publicly list me as a supporter of OWASP Juice Shop" checkbox on the donation form. You can find our more about donations and how they are used here:

https://pwning.owasp-juice.shop/part3/donations.html

Contributors

The OWASP Juice Shop core project team are:

For a list of all contributors to the OWASP Juice Shop CTF Extension please visit our HALL_OF_FAME.md.

Licensing license

This program is free software: you can redistribute it and/or modify it under the terms of the MIT license. OWASP Juice Shop CTF Extension and any contributions are Copyright © by Bjoern Kimminich & the OWASP Juice Shop contributors 2016-2024.

Juice Shop CTF Logo

juice-shop-ctf's People

Contributors

bkimminich avatar dependabot[bot] avatar eljeffeg avatar greenkeeper[bot] avatar j12934 avatar jamiemccrindle avatar juiceshopbot avatar simbas avatar tghosth 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

juice-shop-ctf's Issues

non-interactive cli

Hello,

I love the inquirer interface when I want to manually setup a ctf event.
But in an automated context, it could be useful to have a juice-shop-ctf cli accepting all parameters as flags:

juice-shop-ctf-flags --juiceShopUrl https://juice-shop.herokuapp.com --ctfKey https://raw.githubusercontent.com/bkimminich/juice-shop/master/ctf.key --insertHints 0 --insertHintUrls 0
# eventually choose the output
juice-shop-ctf-flags --juiceShopUrl https://juice-shop.herokuapp.com --ctfKey https://raw.githubusercontent.com/bkimminich/juice-shop/master/ctf.key --insertHints 0 --insertHintUrls 0 -o out.zip

I think I can propose a PR if the idea seems okay.

Optional challenge hints

  • In accordance with juice-shop/juice-shop#305 add an additional question INSERT a hint along with each CTFd Challenge? that takes the hints from the webapps API
  • Warn in CLI when choosing YES for hints but the Juice Shop instance to retrieve the challenges from has hints disabled
  • Make sure that the default Juice Shop instance on Heroku is launched with hints enabled

juice-shop-cff failed in fbctf

Failed to fetch country mapping from API! end of the stream or a document separator is expected at line 32, column 55:
... ption" content="OWASP Juice Shop: Probably the most modern and s ...

Version 10 of node.js has been released

Version 10 of Node.js (code name Dubnium) has been released! 🎊

To see what happens to your code in Node.js 10, Greenkeeper has created a branch with the following changes:

  • Added the new Node.js version to your .travis.yml
  • The engines config in 1 of your package.json files was too ambiguous to be updated automatically

If you’re interested in upgrading this repo to Node.js 10, you can open a PR with these changes. Please note that this issue is just intended as a friendly reminder and the PR as a possible starting point for getting your code running on Node.js 10.

More information on this issue

Greenkeeper has checked the engines key in any package.json file, the .nvmrc file, and the .travis.yml file, if present.

  • engines was only updated if it defined a single version, not a range.
  • .nvmrc was updated to Node.js 10
  • .travis.yml was only changed if there was a root-level node_js that didn’t already include Node.js 10, such as node or lts/*. In this case, the new version was appended to the list. We didn’t touch job or matrix configurations because these tend to be quite specific and complex, and it’s difficult to infer what the intentions were.

For many simpler .travis.yml configurations, this PR should suffice as-is, but depending on what you’re doing it may require additional work or may not be applicable at all. We’re also aware that you may have good reasons to not update to Node.js 10, which is why this was sent as an issue and not a pull request. Feel free to delete it without comment, I’m a humble robot and won’t feel rejected 🤖


FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

RTB import

I'd be very interested in adding JuiceShop support for RootTheBox. Would I start by creating a generator js file? I expect this would create an file that would be read by the CTF import, which in our case is an xml file. Is that how it works?

Also would be good if you happen to have a sample export that I can use as a guideline.

Import to CTFd is broken

With latest CTFd, Juice Shop and juice-shop-ctf installed, CTFd reports the following error after importing the file:

KeyError("There is no item named 'db/alembic_version.json' in the archive",)

After that the CTFd instance is unusable.

An in-range update of nyc is breaking the build 🚨

Version 11.7.1 of nyc was just published.

Branch Build failing 🚨
Dependency nyc
Current Version 11.7.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

nyc is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details

Commits

The new version differs by 2 commits.

  • 5e40c7c chore(release): 11.7.1
  • 5c0adb5 chore: explicit upgrade of istanbul-reports (#816)

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

"Bonus Payload" XSS payload broken from HTML entity encoding [🐛]

🐛 Bug report

Description

At least in CTFd the payload as part of the "Bonus Payload" challenge description is this

<iframe width="100%" height="166" scrolling="no" frameborder="no" allow="autoplay" src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/771984076&amp;color=%23ff5500&amp;auto_play=true&amp;hide_related=false&amp;show_comments=true&amp;show_user=true&amp;show_reposts=false&amp;show_teaser=true&quot;&gt;&lt;/iframe>

where on the Juice Shop score board it is actually

<iframe width="100%" height="166" scrolling="no" frameborder="no" allow="autoplay" src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/771984076&color=%23ff5500&auto_play=true&hide_related=false&show_comments=true&show_user=true&show_reposts=false&show_teaser=true"></iframe>

Copy/paste of the payload from CTFd doesn't work, which might be confusing/frustrating to users.

Replace SQL with native CTFd file-import format

CTFd 1.0.2 introduced a file-based export/import feature:

CTFd now has the ability to export and import data. This lets you save your CTFs as zip files and redeploy them again and again.

Given its format is already stable, it would make sense to generate such a file instead of SQL statements.

CTFd generator as node.js CLI app

User Story

As a CTF event organizer
I want to have a command line client to set up CTFd for OWASP Juice Shop
so that I can have the whole environment creation process automated (including the now manual step 5)

MVP

Implement exactly the HTML page feature set as a node.js CLI app, e.g. in a wizard style with similar defaults, for example like this:

npm i -g juice-shop-ctf
juice-shop-ctf

Generate INSERT statements for CTFd with the OWASP Juice Shop challenges
-------------------------------------------------------------------------------------
1. Juice Shop URL to retrieve challenges (https://juice-shop.herokuapp.com)
localhost:3000 <Enter>
2. Path or URL to ctf.key file (https://raw.githubusercontent.com/bkimminich/juice-shop/master/ctf.key)
c:\github\juice-shop\ctf.key <Enter>
3. DELETE all CTFd Challenges before INSERTs? (Y/n)
<Enter for "Yes" default>
4. SELECT all CTFd Challenges after INSERTs? (Y/n)
N <Enter>
SQL statements are generated...................Done!
--> c:\github\juice-shop-ctf\ctfd-inserts.sql
5. Display CTFd setup step-by-step guide? (y/N)
<Enter for "No" default>

Ideas

  • Use https://github.com/mysqljs/mysql or a similar library to connect to the CTFd DB and execute the INSERTs instead of leaving this a manualy copy-paste-execute job
  • Download, installation and launching of the CTFd server in the tool
  • Offer a dedicated docker-compose.yml which launches a fully OWASP Juice-Shop-ready CTFd server

An in-range update of yargs is breaking the build 🚨

The dependency yargs was updated from 13.2.2 to 13.2.4.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

yargs is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • ci/gitlab/greenkeeper/yargs-13.2.4: Pipeline passed with warnings on GitLab (Details).
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Commits

The new version differs by 14 commits.

  • a6e67f1 chore(release): 13.2.4
  • fc13476 chore: update standard-verison dependency
  • bf46813 fix(i18n): rename unclear 'implication failed' to 'missing dependent arguments' (#1317)
  • a3a5d05 docs: fix a broken link to MS Terminology Search (#1341)
  • b4f8018 build: add .versionrc that hides test/build
  • 0c39183 chore(release): 13.2.3
  • 08e0746 chore: update deps (#1340)
  • 843e939 docs: make --no- boolean prefix easier to find in the docs (#1338)
  • 84cac07 docs: restore removed changelog of v13.2.0 (#1337)
  • b20db65 fix(deps): upgrade cliui for compatibility with latest chalk. (#1330)
  • c294d1b test: accept differently formatted output (#1327)
  • ac3f10c chore: move .hbs templates into .js to facilitate webpacking (#1320)
  • 0295132 fix: address issues with dutch translation (#1316)
  • 9f2468e doc: clarify parserConfiguration object structure (#1309)

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

FBCTF backup generator option

https://github.com/facebook/fbctf/wiki/FAQ states that FBCTF can also export an entire game:

Through the FBCTF Platform:

Click the Controls tab under the Game Admin panel.
Click Export Full Game to export your event.
Click Import Full Game to import your saved event.

It would be nice to be able to choose if challenges for CTFd or FBCTF should be created. This might be the final select-option question in the tool, e.g. For what framework do you want to create the data? with CTFd and FBCTF as options.

Note: This change would impact juice-shop/juice-shop#403 because hardcoding the Juice Shop to CTFd would not be a good approach any more. It would need to be configurable or might just invalidate that issue.

Cannot import challenges in CTFd docker edition (latest)

Hi, I tried to use CTFd and imported the challenges created.
Now the statistics show that there are 47 challenges, however: when i try to look at the challenges using admin/challs or ...
Then i get a loading screen, while the docker logs of CTFd give:
ctfd_1 | * Loaded module, <module 'CTFd.plugins.keys' from '/opt/CTFd/CTFd/plugins/keys/__init__.pyc'> ctfd_1 | /usr/local/lib/python2.7/site-packages/sqlalchemy/dialects/mysql/reflection.py:56: SAWarning: Unknown schema content: u' CONSTRAINT ``CONSTRAINT_1`` CHECK (hidden in (0,1))' ctfd_1 | util.warn("Unknown schema content: %r" % line)

[🐛] Error when generating hints shows incorrect config option (showChallengeHints instead of showHints)

🐛 Bug report

Description

When attempting to generate a zip file with hints based on a juice shop instance that doesn't have hints enabled (for example one running in CTF mode) the error message displayed shows the wrong configuration value that needs updated.

See the screenshot below for further information:
Screenshot 2020-03-23 at 11 36 08

The message that showChallengeHints: true in its config should be showHints: true as this value was updated in release 10.0.0. to be challenges.showHints.

Steps to reproduce

  • Download the latest juice-shop docker container
  • Run the following command to run the container in ctf mode:
docker run -d -e "NODE_ENV=ctf" -p 3000:3000 bkimminich/juice-shop
  • Run the juice-shop-ctf CLI
  • For the Juice Shop URL add the following:
http://localhost:3000
  • Note the error message displayed

It looks like there are only two references that need updated:
Here
And here

I'm happy to fire up a pull request if you'd like!

"SyntaxError: Unexpected token (" When running juice-shop-ctf

Hi,

I received an error when attempting to run juice-shop-ctf.

$ npm -v
6.1.0

$ npm install -g juice-shop-ctf-cli
/usr/local/bin/juice-shop-ctf -> /usr/local/lib/node_modules/juice-shop-ctf-cli/bin/juice-shop-ctf.js

$ juice-shop-ctf
/usr/local/lib/node_modules/juice-shop-ctf-cli/index.js:33
const juiceShopCtfCli = async () => {
^

SyntaxError: Unexpected token (
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:542:28)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object. (/usr/local/lib/node_modules/juice-shop-ctf-cli/bin/juice-shop-ctf.js:2:25)

An in-range update of mocha is breaking the build 🚨

Version 5.0.1 of mocha was just published.

Branch Build failing 🚨
Dependency mocha
Current Version 5.0.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

mocha is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push The Travis CI build passed Details
  • bitHound - Dependencies No failing dependencies. Details
  • bitHound - Code 3 failing files. Details
  • coverage/coveralls First build on greenkeeper/mocha-5.0.1 at 97.248% Details

Commits

The new version differs by 15 commits.

  • 09ce746 Release v5.0.1
  • 70027b6 update changelog for v5.0.1 [ci skip]
  • 44aae9f add working wallaby config
  • 412cf27 [Update] license year
  • b7377b3 rename help-wanted to "help wanted" in stale.yml
  • d975a6a fix memory leak when run in v8; closes #3119
  • 3509029 update .gitignore to only ignore root mocha.js [ci skip]
  • b57f623 fix: When using --delay, .only() no longer works. Issue #1838
  • cd74322 Slight copy update on docs for test directory
  • f687d2b update docs for the glob
  • 14fc030 Add all supported wallaby editors
  • 2e7e4c0 rename "common-mistake" label to "faq"
  • bca57f4 clarify docs on html, xunit and 3p reporters; closes #1906
  • 2fe2d01 Revert "fix travis "before script" script"
  • c0ac1b9 fix travis "before script" script

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

[🐛] Heroku application returning API error

🐛 Bug report

Description

Accessing challenges from http://juice-shop.herokuapp.com/ results in an Application Error. The details are not specific, unfortunately. It appears this Heroku app has crashed.

Is this a regression?

Yes, this has worked before. Earliest I can tell this was broken is 3/19/21, but I don't know how long before that date the application was not responding.

🔬 Minimal Reproduction

Access this URL: http://juice-shop.herokuapp.com/

Option to not include challenges disabled in docker

Currently the export always includes the challenges which are (currently) disabled in the docker containers due to segmentation faults. When creating configs for ctf which are run primarily in docker containers these have to be removed by hand.

To fix this there should be an option to remove these challenges from the exports.
If we anticipate that the currently disabled challenges get reenabled soon, this would probably not be worth the effort.

Decouple e2e test suite from demo instance [🐛]

🐛 Bug report

Description

The e2e test suite fails when demo.owasp-juice.shop is offline as it tries to pull challenges from it.

Is this a regression?

No.

🔬 Minimal Reproduction

Run npm run e2e

🔥 Exception or Error





🌳 Your Environment





Additional Information

Possible fix that would also improve overall performance is running a Juice Shop locally before running the suite and using it to retrieve the challenges.

An in-range update of stryker-javascript-mutator is breaking the build 🚨

Version 0.8.1 of stryker-javascript-mutator was just published.

Branch Build failing 🚨
Dependency stryker-javascript-mutator
Current Version 0.8.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

stryker-javascript-mutator is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ci/gitlab/greenkeeper/stryker-javascript-mutator-0.8.1: Pipeline passed on GitLab (Details).
  • continuous-integration/travis-ci/push: The Travis CI build failed (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Add SQLite and console as INSERT output targets

Extended CLI Questions

✅ Juice Shop URL to retrieve challenges?
✅ Secret key <or> URL to ctf.key file?

  • SQL statements output target? (select from: File, Console, SQLite)
  • (only if SQLite was selected) Location of CTFd SQLite database? ({workdir}/CTFd/ctfd.db)

✅ DELETE all CTFd Challenges before INSERT statements?
✅ SELECT all CTFd Challenges after INSERT statements?

Process extensions

  • Test connection to SQLite database (fail CLI if file not found, locked or otherwise corrupt)
  • Programmatically connect to SQLite db and execute & commit generated statements (fail CLI on any error)
  • Implement output to console as alternative to file

CTFd 3.x generator [🚀]

User Story

As a user who upgraded from CTFd 2.x to CTFd 3.x at some point
I want a compatible generator for OWASP Juice Shop challenges
so that I can use juice-shop-ctf-cli again to pre-populate CTFd

Recommended Approach

  • Copy the existing ctfd.js as ctfd3.js
  • Update ctfd3.js to match the new backup format of CTFd 3.x
  • Check with CTFd team how many users are still on 2.x and then either add 3.x as additional framework or replace 2.x with 3.x generator

An in-range update of stryker-javascript-mutator is breaking the build 🚨

☝️ Greenkeeper’s updated Terms of Service will come into effect on April 6th, 2018.

Version 0.6.0 of stryker-javascript-mutator was just published.

Branch Build failing 🚨
Dependency stryker-javascript-mutator
Current Version 0.5.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

stryker-javascript-mutator is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • coverage/coveralls Coverage pending from Coveralls.io Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

[🐛] Unable to import to ctfd

🐛 Bug report

Description

When I follow the instructions here, select the backup file and click the "Import" button in CTFd, it stuck at "Upload Process", and when I refresh the page, I get an "Internal Server Error".

image

Here is the log from CTFd:

Failed to disable foreign key checks. Continuing.
INFO  [alembic.runtime.migration] Context impl SQLiteImpl.
INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
ERROR [root] Error: Can't locate revision identified by '4d3c1b59d011'
[2023-08-24 09:10:50 +0000] [1] [INFO] Handling signal: winch
[2023-08-24 09:10:50 +0000] [1] [INFO] Handling signal: winch

I've tried to restart the CTFd docker container as described in #57 but then I cannot login to the admin panel because it says username or password wrong, and there is no challenges.

Is this a regression?

I don't know, I'm new to juice-shop.

🔬 Minimal Reproduction

First run juice-shop with the following command.

$ sudo docker run --rm -it -p 3000:3000 --env NODE_ENV=ctf --env CTF_KEY=abcdefg bkimminich/juice-shop

> [email protected] start /juice-shop
> node build/app

info: All dependencies in ./package.json are satisfied (OK)
info: Chatbot training data botDefaultTrainingData.json validated (OK)
info: Detected Node.js version v14.18.2 (OK)
info: Detected OS linux (OK)
info: Detected CPU x64 (OK)
info: Configuration ctf validated (OK)
info: Required file server.js is present (OK)
info: Required file index.html is present (OK)
info: Required file styles.css is present (OK)
info: Required file main.js is present (OK)
info: Required file tutorial.js is present (OK)
info: Required file polyfills.js is present (OK)
info: Required file runtime.js is present (OK)
info: Required file vendor.js is present (OK)
info: Port 3000 is available (OK)
info: Server listening on port 3000

And then generate the backup archive.

$ sudo docker run --rm -it -v ./juice-shop:/data bkimminich/juice-shop-ctf

Generate OWASP Juice Shop challenge archive for setting up CTFd, FBCTF or RootTheBox score server
? CTF framework to generate data for? CTFd
? Juice Shop URL to retrieve challenges? http://192.168.224.129:3000
? Secret key <or> URL to ctf.key file? abcdefg
? Insert a text hint along with each challenge? No text hints
? Insert a hint URL along with each challenge? No hint URLs
? Insert a code snippet as hint for each challenge? No hint snippets

Backup archive written to /data/OWASP_Juice_Shop.2023-08-24.CTFd.zip

After the import you will have to set up the CTF name and administrator credentials again!

For a step-by-step guide to import the ZIP-archive into CTFd, please refer to
https://pwning.owasp-juice.shop/part1/ctf.html#running-ctfd

Then import the generated zip archive in CTFd admin panel.

🌳 Your Environment

juice-shop: 13.0.2
CTFd: 3.6.0
Docker: 24.0.5

Suggestion: Custom flags

I think that having a way to specify specific flags would be a nice feature especially when I am doing this in a middle or high school where I want to be able to remember the flags easier or relate them to what we are learning. Also, custom lengths for flags would be nice. Sometimes I just want to have 5 character flags as opposed to the really long ones that are the default.

[🐛] Bug or change the behavior of the function 'fetchCodeSnippets'

🐛 Bug report

Description

the problem is easy and not for CTF Extension I think that it is a bug on JuiceShop itself.
The Api Snippets give this out file Json with threes bad entries and I try it more 5 times and it's the same.

In juiceShopUrl + '/snippets'

{
"challenges": [
"directoryListingChallenge",
"accessLogDisclosureChallenge",
"resetPasswordMortyChallenge",
"changeProductChallenge",
"registerAdminChallenge",
"exposedMetricsChallenge",
"fileWriteChallenge",
"loginAdminChallenge",
"loginBenderChallenge",
"loginJimChallenge",
"unionSqlInjectionChallenge",
"dbSchemaChallenge",
"noSqlReviewsChallenge",
"forgedReviewChallenge",
"noSqlCommandChallenge",
"nippet",
"start",
".*/",
"redirectCryptoCurrencyChallenge",
"redirectChallenge",
"adminSectionChallenge",
"scoreBoardChallenge",
"tokenSaleChallenge",
"resetPasswordBjoernOwaspChallenge",
"resetPasswordBjoernChallenge",
"resetPasswordJimChallenge",
"resetPasswordBenderChallenge",
"resetPasswordUvoginChallenge",
"passwordRepeatChallenge",
"restfulXssChallenge",
"localXssChallenge",
"xssBonusChallenge"
]
}

This is not good :
"nippet",
"start",
".*/",

🔬 Minimal Reproduction

Import Database Key Error

im generate OWASP JUICE and Finish

and im upload to CTFD import wth console or web warning Error Key

`root@ubuntu:/home/owasp# juice-shop-ctf

Generate OWASP Juice Shop challenge archive for setting up CTFd (>=1.1.0) or FBCTF score server
? CTF framework to generate data for? CTFd
? Juice Shop URL to retrieve challenges? http://192.168.43.108:3000/
? Secret key URL to ctf.key file? \x1e\xa9\xca\xef\x13s\x80B\x17\xac\xa1J\xd8-}\x1b\x05S\x0f\xb9\x16\x06\x15\xe3\xda\xa0\x8d]\xe8\xbcil
? Insert a text hint along with each challenge? Free text hints
? Insert a hint URL along with each challenge? Paid hint URLs

Backup archive written to /home/owasp/OWASP_Juice_Shop.2018-10-18.CTFd.zip

For a step-by-step guide to import the ZIP-archive into CTFd, please refer to
https://bkimminich.gitbooks.io/pwning-owasp-juice-shop/content/part1/ctf.html#running-ctfd
`

`python import.py /home/owasp/OWASP_Juice_Shop.2018-10-18.CTFd.zip

  • Loaded module, <module 'CTFd.plugins.keys' from '/home/CTFd/CTFd/CTFd/plugins/keys/init.pyc'>
  • Loaded module, <module 'CTFd.plugins.challenges' from '/home/CTFd/CTFd/CTFd/plugins/challenges/init.pyc'>
    Traceback (most recent call last):
    File "import.py", line 16, in
    import_ctf(sys.argv[1], segments=segments)
    File "/home/CTFd/CTFd/CTFd/utils/init.py", line 904, in import_ctf
    data = backup.open(path).read()
    File "/usr/lib/python2.7/zipfile.py", line 961, in open
    zinfo = self.getinfo(name)
    File "/usr/lib/python2.7/zipfile.py", line 909, in getinfo
    'There is no item named %r in the archive' % name)
    KeyError: "There is no item named 'db/config.json' in the archive"
    `

Please Problem Solution

Thanks

"Juice Shop" CTFd-theme

CTFd supports custom themes. It would be great to have one for OWASP Juice Shop!

General customization ideas

  • similar color scheme as as the shop (Bootswatch slate)
  • include the generic and/or CTF-variant logo (see #6)

Challenge selection visualization

  • shelf with bottles and packs of juice (=challenge) in different colors (=category) and sizes (=price value), being "emptied" when solved
  • Juice Shop logo in b/w split into jigsaw pieces where each represents a challenge, being colorized when solved

Please post ideas in the comments below!

[🐛] Docker container fails due to permission issue

🐛 Bug report

Description

Running the docker container using docker run -ti --rm -v $(pwd):/data bkimminich/juice-shop-ctf:v10.0.1 results in an error:

sh: /juice-shop-ctf/bin/juice-shop-ctf.js: Permission denied

Manually running chmod +x /juice-shop-ctf/bin/juice-shop-ctf.js solves the problem.

Is this a regression?

Probably, but I didn't bisect it.

🔬 Minimal Reproduction

See below.

🔥 Exception or Error


$ docker run -ti --rm -v $(pwd):/data bkimminich/juice-shop-ctf:v10.0.1 /bin/sh
sh: /juice-shop-ctf/bin/juice-shop-ctf.js: Permission denied

🌳 Your Environment


v18.18.0
9.8.1

Additional Information

Hints missing when not part of initial API response

When the URL chosen to retrieve the challenges is a Juice Shop with hints configured off, then no matter if hints are selected they cannot be part of the export data.

A warning should be displayed in such cases at the end of the export process.

Add CTFd 2.x as distinct framework

  • Identify and list all breaking changes between CTFd 1.x and 2.x data models (https://github.com/CTFd/CTFd/blob/master/CHANGELOG.md)
  • Add CTFd 2.x as a separate framework with its own generators (or shared where possible with 1.x)
  • Rename CTFd framework option into CTFd 1.x
  • Make CTFd 1.x the default selection and also map the old alias CTFd to it (for non-breaking change of existing config files - but with deprecation warning upon parsing)

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

[🚀] Support multiple flags

🚀 Feature request

Description

In a ctf setting it can be useful to have multiple flag strings for a task --> every team/instance can get its own unique flag.

Solution ideas

Overload the configuration option ctfKey.

[🐛] paid insertHints and insertHintUrls not working when set from yaml config

🐛 Bug report

Description

Setting these values:

insertHints: paid
insertHintUrls: paid

doesn't result in a cost being assigned to hints.

Is this a regression?

N/A

🔬 Minimal Reproduction

ctfFramework: CTFd
juiceShopUrl: https://juice-shop.herokuapp.com
ctfKey: https://raw.githubusercontent.com/bkimminich/juice-shop/master/ctf.key
insertHints: paid
insertHintUrls: paid

🌳 Your Environment

debian 10
node 14

Additional Information

N/A

[🐛] Bug or Behavior not again inside this extension

🐛 Bug report - Description

(En mode Docker) and ACI (Azure Container Instance)

On mode CTF (Yaml or Directly by Docker Run and ENV command) if you request JuiceShop URL / Challanges
For 5 times differents again I have not Hints ou HintsURL on Json file

I put just one example. Not All Json file it's the same for all another challenges.

{
  "id": 3,
  "key": "registerAdminChallenge",
  "name": "Admin Registration",
  "category": "Improper Input Validation",
  "tags": null,
  "description": "Register as a user with administrator privileges.",
  "difficulty": 3,
  "hint": null,
  "hintUrl": null,
  "mitigationUrl": "https://cheatsheetseries.owasp.org/cheatsheets/Mass_Assignment_Cheat_Sheet.html",
  "solved": false,
  "disabledEnv": null,
  "tutorialOrder": null,
  "createdAt": "2021-09-13T17:07:58.516Z",
  "updatedAt": "2021-09-13T17:07:58.516Z"
},

You have a mitigationUrl with information but you don't manage it inside Juice-shop-ctf.

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.