Skip to content

Commit

Permalink
Rename and rephrase DRY challenge
Browse files Browse the repository at this point in the history
  • Loading branch information
bkimminich committed Apr 15, 2019
1 parent b466d0b commit b9be5c7
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion config/fbctf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,6 @@ ctf:
privacyPolicyProofChallenge:
name: Namibia
code: NA
dryRegistrationChallenge:
passwordRepeatChallenge:
name: Guyana
code: GY
10 changes: 5 additions & 5 deletions data/static/challenges.yml
Original file line number Diff line number Diff line change
Expand Up @@ -680,10 +680,10 @@
hintUrl: 'https://bkimminich.gitbooks.io/pwning-owasp-juice-shop/content/part2/security-through-obscurity.html#prove-that-you-actually-read-our-privacy-policy'
key: privacyPolicyProofChallenge
-
name: 'User Registration'
name: 'Repetitive Registration'
category: 'Improper Input Validation'
description: 'Register but "<strong>D</strong>on''t <strong>R</strong>epeat <strong>Y</strong>ourself".'
description: 'Follow the DRY principle while registering a user.'
difficulty: 1
hint: 'Avoid any repetitive tasks during user registration.'
# hintUrl: ''
key: dryRegistrationChallenge
hint: 'You can solve this by cleverly interacting with the UI or bypassing it altogether.'
# hintUrl: 'https://bkimminich.gitbooks.io/pwning-owasp-juice-shop/content/part2/improper-input-validation.html#follow-the-dry-principle-while-registering-a-user'
key: passwordRepeatChallenge
6 changes: 3 additions & 3 deletions routes/verify.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ exports.registerAdminChallenge = () => (req, res, next) => {
next()
}

exports.dryRegistrationChallenge = () => (req, res, next) => {
if (utils.notSolved(challenges.dryRegistrationChallenge)) {
exports.passwordRepeatChallenge = () => (req, res, next) => {
if (utils.notSolved(challenges.passwordRepeatChallenge)) {
if (req.body && req.body.passwordRepeat !== req.body.password) {
utils.solve(challenges.dryRegistrationChallenge)
utils.solve(challenges.passwordRepeatChallenge)
}
}
next()
Expand Down
2 changes: 1 addition & 1 deletion server.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ app.post('/api/Feedbacks', captcha.verifyCaptcha())
app.post('/api/Feedbacks', verify.captchaBypassChallenge())
/* User registration challenge verifications before finale takes over */
app.post('/api/Users', verify.registerAdminChallenge())
app.post('/api/Users', verify.dryRegistrationChallenge())
app.post('/api/Users', verify.passwordRepeatChallenge())
/* Unauthorized users are not allowed to access B2B API */
app.use('/b2b/v2', insecurity.isAuthorized())
/* Add item to basket */
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/registerSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ describe('/#/register', () => {
protractor.expect.challengeSolved({ challenge: 'Admin Registration' })
})

describe('challenge "dryRegistration"', () => {
describe('challenge "passwordRepeat"', () => {
it('should be possible to register user without repeating the password', () => {
browser.executeScript(() => {
var xhttp = new XMLHttpRequest()
Expand Down

0 comments on commit b9be5c7

Please sign in to comment.