Skip to content

Commit

Permalink
feat: added Riches on Juice Shop challenge (juice-shop#2029)
Browse files Browse the repository at this point in the history
* feat: added Riches on Juice Shop challenge, implemented ethers seedphrase to private key conversion for challenge page routing, added new product 'NFT Me' on Juice Shop along with a new page for the challenge

* feat: added backend route for seedphrase leak challenge, added new user and feedback with seed phrase, implemented conditional rendering on form submission

* added css for the inputs, added new route for challenge solved check

* fixed response destructuring, remoted console logs, fixed check for challenge solved or successful input

* fix: added country mapping for seedPhraseLeakChallenge

* fix: repeat country code, added route path in feedback, fixed linting

* fix: added checks for input with special cases, made changes to the challenge details

* fix: lint fix

* feat: discarded .DS_store

* fix: rsn fix

* feat(challenge): Updated 'Juicy NFT Seed Saga' challenge with seed phrase leak

- Updated challenge name and description to 'Juicy NFT Seed Saga'
- Improved clarity in the challenge description
- Named the Angular component 'nft-unlock-component'

* feat: made changes to challenge name and description, changed static colors to material UI classes, changed error messages

* feat: removed unused comments

* Add Dublin AppSec 2023 video link

Be advised that the video and audio are severely out of sync on this one unfortunately.

* Update 2023 conference appearances

* Update GitHub contributor stats

* [ImgBot] Optimize images

/screenshots/git-stats.png -- 74.39kb -> 26.26kb (64.71%)

Signed-off-by: ImgBotApp <[email protected]>

* First bunch

* Next bunch

* Next bunch

* Next bunch

* Next bunch

* Next bunch

* Last bunch

* New translations en.json (German, Switzerland)
[ci skip]
Signed-off-by: Björn Kimminich <[email protected]>

* New translations en.json (Dutch)
[ci skip]
Signed-off-by: Björn Kimminich <[email protected]>

* New translations en.json (German, Switzerland)
[ci skip]
Signed-off-by: Björn Kimminich <[email protected]>

* New translations en.json (Dutch)
[ci skip]
Signed-off-by: Björn Kimminich <[email protected]>

* More translation and improved consistency

* added timout to make scroll correct for chatbot

Signed-off-by: Parth Nanda <[email protected]>

* Corrected lint error

* Remove semicolon

* New translations en.json (Dutch)
[ci skip]
Signed-off-by: Björn Kimminich <[email protected]>

* New translations en.json (Dutch)
[ci skip]
Signed-off-by: Björn Kimminich <[email protected]>

* New translations en.json (Dutch)
[ci skip]
Signed-off-by: Björn Kimminich <[email protected]>

* Bump to v15.1.0-SNAPSHOT

* Run `dom.watch()` only once

Previously a lot of component registered this watch.
Each of them created a MutationObserver running on dom modifications.
This slows down the page way more then it needs to as the action this performs is global and should not be triggered more than once.

Signed-off-by: Jannik Hollenbach <[email protected]>

* Double scroll timeout to 1/4 sec

(to allow non-localhost systems to respond before scrolling happens)

* Clear timeout chat scroll down timeout on ngDestroy

* Auto-fix linting issues

Signed-off-by: JuiceShopBot <[email protected]>

* Fix incorrect hardcoded node.js version in action name

* Update version to auto-commit action

* Upgrade to juicy-chat-bot version with en lang support

Signed-off-by: Jannik Hollenbach <[email protected]>

* build: add BOM files to dist packages

fixes juice-shop#2028

Signed-off-by: Jan Kowalleck <[email protected]>

* ci workflow version streamline

Signed-off-by: Jan Kowalleck <[email protected]>

* bom in docker image

Signed-off-by: Jan Kowalleck <[email protected]>

* New translations en.json (Portuguese, Brazilian)
[ci skip]
Signed-off-by: Björn Kimminich <[email protected]>

* New translations en.json (Portuguese, Brazilian)
[ci skip]
Signed-off-by: Björn Kimminich <[email protected]>

* New translations en.json (Portuguese, Brazilian)
[ci skip]
Signed-off-by: Björn Kimminich <[email protected]>

* New translations en.json (Portuguese, Brazilian)
[ci skip]
Signed-off-by: Björn Kimminich <[email protected]>

* Upgrade to latest cpu & memory improved version of swagger-ui-express

Signed-off-by: Jannik Hollenbach <[email protected]>

* New translations en.json (Turkish)
[ci skip]
Signed-off-by: Björn Kimminich <[email protected]>

* New translations en.json (Turkish)
[ci skip]
Signed-off-by: Björn Kimminich <[email protected]>

* Pin flag-icons library to 6.8.x version

(fixes juice-shop#2047)

* Update browsers list and Karma config for Angular 15

* Fix linting issues

* Switch to Windows Server 2019 OS

(to debug test runner issues not reproducable on local Win 11)

* Revert "Switch to Windows Server 2019 OS"

This reverts commit 48ca0c8.

* Remove Windows from build matrix for unit tests

(due to 'Error: ENOENT: no such file or directory, open' error
 breaking at least on Node 20.5.0 constantly)

* Switch wallet tests to demo user

(to avoid conflicts with shopping tests where Jim is used.
 Fixes juice-shop#2030)

---------

Signed-off-by: ImgBotApp <[email protected]>
Signed-off-by: Parth Nanda <[email protected]>
Signed-off-by: Jannik Hollenbach <[email protected]>
Signed-off-by: JuiceShopBot <[email protected]>
Signed-off-by: Jan Kowalleck <[email protected]>
Co-authored-by: Björn Kimminich <[email protected]>
Co-authored-by: Bjoern Kimminich <[email protected]>
Co-authored-by: ImgBotApp <[email protected]>
Co-authored-by: Eric Nieuwland <[email protected]>
Co-authored-by: Parth Nanda <[email protected]>
Co-authored-by: Parth Nanda <[email protected]>
Co-authored-by: Jannik Hollenbach <[email protected]>
Co-authored-by: JuiceShopBot <[email protected]>
Co-authored-by: Jan Kowalleck <[email protected]>
  • Loading branch information
10 people committed Jul 27, 2023
1 parent 516ce13 commit 9da0df1
Show file tree
Hide file tree
Showing 22 changed files with 366 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,6 @@ config/*.yml
!config/unsafe.yml
!config/tutorial.yml
!config/oss.yml

# System Files
.DS_Store
5 changes: 5 additions & 0 deletions config.schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,11 @@ ctf:
type: string
code:
type: string
nftUnlockChallenge:
name:
type: string
code:
type: string
securityPolicyChallenge:
name:
type: string
Expand Down
5 changes: 4 additions & 1 deletion config/fbctf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -320,4 +320,7 @@ ctf:
code: ZM
emptyUserRegistration:
name: Kenya
code: KE
code: KE
nftUnlockChallenge:
name: Afghanistan
code: AF
12 changes: 12 additions & 0 deletions data/static/challenges.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,18 @@
hintUrl: 'https://pwning.owasp-juice.shop/part2/security-through-obscurity.html#learn-about-the-token-sale-before-its-official-announcement'
mitigationUrl: ~
key: tokenSaleChallenge
-
name: 'NFT Takeover'
category: 'Sensitive Data Exposure'
tags:
- Contraption
- Good for Demos
description: 'Take over the wallet containing our official Soul Bound Token (NFT).'
difficulty: 2
hint: 'Find the seedphrase posted accidentally.'
hintUrl: ''
mitigationUrl: ~
key: nftUnlockChallenge
-
name: 'Blocked RCE DoS'
category: 'Insecure Deserialization'
Expand Down
4 changes: 4 additions & 0 deletions data/static/codefixes/adminSectionChallenge_1_correct.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,10 @@ const routes: Routes = [
component: LastLoginIpComponent
}
]
},
{
path: 'juicy-nft',
component: NFTUnlockComponent
},
{
matcher: oauthMatcher,
Expand Down
4 changes: 4 additions & 0 deletions data/static/codefixes/adminSectionChallenge_2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ const routes: Routes = [
component: LastLoginIpComponent
}
]
},
{
path: 'juicy-nft',
component: NFTUnlockComponent
},
{
matcher: oauthMatcher,
Expand Down
4 changes: 4 additions & 0 deletions data/static/codefixes/adminSectionChallenge_3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ const routes: Routes = [
component: LastLoginIpComponent
}
]
},
{
path: 'juicy-nft',
component: NFTUnlockComponent
},
{
matcher: oauthMatcher,
Expand Down
4 changes: 4 additions & 0 deletions data/static/codefixes/adminSectionChallenge_4.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ const routes: Routes = [
component: LastLoginIpComponent
}
]
},
{
path: 'juicy-nft',
component: NFTUnlockComponent
},
{
matcher: oauthMatcher,
Expand Down
4 changes: 4 additions & 0 deletions data/static/codefixes/scoreBoardChallenge_1_correct.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ const routes: Routes = [
component: LastLoginIpComponent
}
]
},
{
path: 'juicy-nft',
component: NFTUnlockComponent
},
{
matcher: oauthMatcher,
Expand Down
4 changes: 4 additions & 0 deletions data/static/codefixes/scoreBoardChallenge_2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ const routes: Routes = [
component: LastLoginIpComponent
}
]
},
{
path: 'juicy-nft',
component: NFTUnlockComponent
},
{
matcher: oauthMatcher,
Expand Down
4 changes: 4 additions & 0 deletions data/static/codefixes/scoreBoardChallenge_3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ const routes: Routes = [
component: LastLoginIpComponent
}
]
},
{
path: 'juicy-nft',
component: NFTUnlockComponent
},
{
matcher: oauthMatcher,
Expand Down
12 changes: 12 additions & 0 deletions data/static/users.yml
Original file line number Diff line number Diff line change
Expand Up @@ -253,3 +253,15 @@
securityQuestion:
id: 10
answer: "Used Ship Emporium" # https://monkeyisland.fandom.com/wiki/Stan_S._Stanman
-
email: ethereum
username: evmrox
password: 'private'
key: evm
role: 'deluxe'
feedback:
comment: 'Please send me the juicy chatbot NFT in my wallet at /juicy-nft : "purpose betray marriage blame crunch monitor spin slide donate sport lift clutch"'
rating: 1
securityQuestion:
id: 10
answer: "Used Emporium"
34 changes: 34 additions & 0 deletions frontend/src/app/Services/keys.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { Injectable } from '@angular/core'
import { HttpClient } from '@angular/common/http'
import { catchError, map } from 'rxjs/operators'
import { environment } from '../../environments/environment'

@Injectable({
providedIn: 'root'
})
export class KeysService {
private readonly hostServer = environment.hostServer
private readonly host = this.hostServer + '/rest/web3'

constructor (private readonly http: HttpClient) {}

nftUnlocked () {
return this.http.get(this.host + '/nftUnlocked').pipe(
map((response: any) => response),
catchError((err) => {
throw err
})
)
}

submitKey (privateKey: string) {
const endpoint = this.host + '/submitKey'
const params = { privateKey: privateKey }
return this.http.post(endpoint, params).pipe(
map((response: any) => response),
catchError((err) => {
throw err
})
)
}
}
8 changes: 6 additions & 2 deletions frontend/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { BrowserModule } from '@angular/platform-browser'
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'
import { HTTP_INTERCEPTORS, HttpClient, HttpClientModule } from '@angular/common/http'
import { CookieModule, CookieService } from 'ngx-cookie'
import { ReactiveFormsModule } from '@angular/forms'
import { ReactiveFormsModule, FormsModule } from '@angular/forms'
import { Routing } from './app.routing'
import { OverlayContainer } from '@angular/cdk/overlay'
import { TranslateLoader, TranslateModule } from '@ngx-translate/core'
Expand Down Expand Up @@ -43,6 +43,7 @@ import {
ChallengeSolvedNotificationComponent
} from './challenge-solved-notification/challenge-solved-notification.component'
import { OAuthComponent } from './oauth/oauth.component'
import { NFTUnlockComponent } from './nft-unlock/nft-unlock.component'
import { TokenSaleComponent } from './token-sale/token-sale.component'
import { ProductReviewEditComponent } from './product-review-edit/product-review-edit.component'
import { TwoFactorAuthEnterComponent } from './two-factor-auth-enter/two-factor-auth-enter.component'
Expand All @@ -68,6 +69,7 @@ import { BasketService } from './Services/basket.service'
import { ChallengeService } from './Services/challenge.service'
import { DataSubjectService } from './Services/data-subject.service'
import { ImageCaptchaService } from './Services/image-captcha.service'
import { KeysService } from './Services/keys.service'
import { AddressService } from './Services/address.service'
import { QuantityService } from './Services/quantity.service'
import { FlexLayoutModule } from '@angular/flex-layout'
Expand Down Expand Up @@ -169,6 +171,7 @@ export function HttpLoaderFactory (http: HttpClient) {
ChallengeSolvedNotificationComponent,
OAuthComponent,
TokenSaleComponent,
NFTUnlockComponent,
ProductReviewEditComponent,
TwoFactorAuthEnterComponent,
SidenavComponent,
Expand Down Expand Up @@ -226,6 +229,7 @@ export function HttpLoaderFactory (http: HttpClient) {
NgxSpinnerModule,
MatToolbarModule,
MatIconModule,
FormsModule,
MatFormFieldModule,
MatSelectModule,
MatButtonModule,
Expand Down Expand Up @@ -301,6 +305,7 @@ export function HttpLoaderFactory (http: HttpClient) {
AccountingGuard,
DeluxeGuard,
ImageCaptchaService,
KeysService,
AddressService,
QuantityService,
WalletService,
Expand All @@ -310,7 +315,6 @@ export function HttpLoaderFactory (http: HttpClient) {
],
bootstrap: [AppComponent]
})

export class AppModule {
constructor (public configurationService: ConfigurationService, public overlayContainer: OverlayContainer) {
configurationService.getApplicationConfiguration().subscribe((conf) => {
Expand Down
5 changes: 5 additions & 0 deletions frontend/src/app/app.routing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import { DeliveryMethodComponent } from './delivery-method/delivery-method.compo
import { PhotoWallComponent } from './photo-wall/photo-wall.component'
import { DeluxeUserComponent } from './deluxe-user/deluxe-user.component'
import { AccountingGuard, AdminGuard, LoginGuard } from './app.guard'
import { NFTUnlockComponent } from './nft-unlock/nft-unlock.component'

// vuln-code-snippet start adminSectionChallenge scoreBoardChallenge
const routes: Routes = [
Expand Down Expand Up @@ -200,6 +201,10 @@ const routes: Routes = [
}
]
},
{
path: 'juicy-nft',
component: NFTUnlockComponent
},
// vuln-code-snippet start tokenSaleChallenge
{
matcher: oauthMatcher,
Expand Down
89 changes: 89 additions & 0 deletions frontend/src/app/nft-unlock/nft-unlock.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<mat-card>
<div class="container" fxLayout="column" fxLayoutGap="20px">
<button
class="detail-container offer-container warning-container"
mat-raised-button
color="warn"
fxFlexAlign="center"
>
Note: Never reveal your personal private keys and seed phrase to anyone
</button>
<div
class="detail-container offer-container"
fxFlexAlign="center"
fxLayout="row"
fxLayout.lt-lg="column"
>
<div>
<img src="assets/public/images/products/juicy_chatbot.jpg" />
</div>
<div *ngIf="!successResponse">
<div>
<mat-card-title>Juicy Chatbot SBT</mat-card-title>
</div>
<form (ngSubmit)="submitForm()">
<div class="form-group">
<mat-form-field
style="width: 350px"
color="accent"
appearance="outline"
>
<mat-label>Enter Private Key</mat-label>
<input
matInput
[(ngModel)]="privateKey"
id="privateKey"
name="privateKey"
required
type="text"
aria-label="Text field for the private key"
/>
</mat-form-field>
<h5 class="error">{{ errorMessage }}</h5>
</div>

<button
type="submit"
class="btn btn-primary"
mat-raised-button
color="accent"
>
Authenticate
</button>
</form>
</div>
<div *ngIf="successResponse">
<div>
<mat-card-title>Juicy Chatbot SBT</mat-card-title>
</div>
<div class="owner-text">
Owned by
<a
target="_blank"
href="https://testnets.opensea.io/0x8343d2eb2B13A2495De435a1b15e85b98115Ce05"
>8343D2</a
>
</div>
<mat-divider class="detail-divider"></mat-divider>
<div class="detail-box mat-elevation-z6">
<div class="box-title">Account Address</div>
<mat-divider class="detail-divider"></mat-divider>
<p class="box-text">0x8343d2eb2B13A2495De435a1b15e85b98115Ce05</p>
</div>
<div class="detail-box mat-elevation-z6">
<div class="box-title">Description</div>
<mat-divider class="detail-divider"></mat-divider>
<p class="box-text">
Hurray! Find the Juice Shop SBT on
<a
target="_blank"
href="https://testnets.opensea.io/assets/mumbai/0xf4817631372dca68a25a18eb7a0b36d54f3dbcf7/0"
>Opensea here.</a
>
This is a non-transferable token and is here to stay forever.
</p>
</div>
</div>
</div>
</div>
</mat-card>
Loading

0 comments on commit 9da0df1

Please sign in to comment.