Skip to content

Commit

Permalink
Add KeePass challenge
Browse files Browse the repository at this point in the history
(resolves alexeisnyk#240)
  • Loading branch information
bkimminich committed Dec 5, 2016
1 parent e20dd18 commit be0f6bb
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/views/Login.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ <h3 class="page-header page-header-sm" translate="TITLE_LOGIN"></h3>
</div>
</div>
<div class="row">
<div class="form-group">
<div class="form-group"> <!-- @echipa de suport: folosiți fișierul nostru cheie a fost de acord, și lăsați-martor parola de master! -->
<label for="userPassword" translate="LABEL_PASSWORD"></label>
<input type="password" class="form-control input-sm" id="userPassword" name="userPassword" ng-model="user.password" required/>
</div>
Expand Down
14 changes: 14 additions & 0 deletions data/datacreator.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,14 @@ module.exports = function () {
}).success(function (challenge) {
challenges.loginCisoChallenge = challenge
})
models.Challenge.create({
name: 'loginSupport',
description: 'Log in with the support team\'s original user credentials without applying SQL Injection or any other bypass.',
difficulty: 5,
solved: false
}).success(function (challenge) {
challenges.loginSupportChallenge = challenge
})
}

function createUsers () {
Expand Down Expand Up @@ -332,6 +340,12 @@ module.exports = function () {
}).success(function (user) {
users.ciso = user
})
models.User.create({
email: '[email protected]',
password: 'J6aVjTgOpRs$?5l+Zkq2AYnCE@RF§P'
}).success(function (user) {
users.support = user
})
}

function createProducts () {
Expand Down
Binary file added ftp/incident-support.kdbx
Binary file not shown.
3 changes: 3 additions & 0 deletions routes/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ exports = module.exports = function login () {
if (utils.notSolved(challenges.weakPasswordChallenge) && req.body.email === '[email protected]' && req.body.password === 'admin123') {
utils.solve(challenges.weakPasswordChallenge)
}
if (utils.notSolved(challenges.loginSupportChallenge) && req.body.email === '[email protected]' && req.body.password === 'J6aVjTgOpRs$?5l+Zkq2AYnCE@RF§P') {
utils.solve(challenges.loginSupportChallenge)
}
if (utils.notSolved(challenges.oauthUserPasswordChallenge) && req.body.email === '[email protected]' && req.body.password === 'YmpvZXJuLmtpbW1pbmljaEBnb29nbGVtYWlsLmNvbQ==') {
utils.solve(challenges.oauthUserPasswordChallenge)
}
Expand Down
12 changes: 12 additions & 0 deletions test/e2e/loginSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,18 @@ describe('/#/login', function () {
protractor.expect.challengeSolved({challenge: 'adminCredentials'})
})

describe('challenge "loginSupport"', function () {
it('should be able to log in with original support-team credentials', function () {
email.sendKeys('[email protected]')
password.sendKeys('J6aVjTgOpRs$?5l+Zkq2AYnCE@RF§P')
loginButton.click()

expect(browser.getLocationAbsUrl()).toMatch(/\/search/)
})

protractor.expect.challengeSolved({challenge: 'loginSupport'})
})

describe('challenge "oauthUserPassword"', function () {
it('should be able to log in as [email protected] with base64-encoded email as password', function () {
email.sendKeys('[email protected]')
Expand Down
12 changes: 12 additions & 0 deletions test/server/userApiSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,18 @@ frisby.create('POST login with admin credentials')
})
.toss()

frisby.create('POST login with support-team credentials')
.post(REST_URL + '/user/login', {
email: '[email protected]',
password: 'J6aVjTgOpRs$?5l+Zkq2AYnCE@RF§P'
}, { json: true })
.expectStatus(200)
.expectHeaderContains('content-type', 'application/json')
.expectJSONTypes({
token: String
})
.toss()

frisby.create('POST login as [email protected] with known password')
.post(REST_URL + '/user/login', {
email: '[email protected]',
Expand Down

0 comments on commit be0f6bb

Please sign in to comment.