Hey, my son Timmy made his first website. He said he hid a ‘secret’ message within different parts of the website… can you find them all? I wanna make sure he isn’t saying any swear words online. The flag is broken up into 3 parts. The parts of the flag should be concatenated in the order they are numbered and then surrounded by the standard wrapper. For example: ‘swampCTF + part1 + part2 + part3 + ’ http://chals.swampctf.com:42222/
Solution
From Source:
<!--Part 1 of the flag: w3b_"-->deobfuscated main-34VY7I6V.js
import { Component, Inject } from '@angular/core';import { CookieService } from 'ngx-cookie-service';import * as CryptoJS from 'crypto-js';@Component({ selector: 'app-root', template: ` <p>Is it Tuesday?</p> <p *ngIf="date.getDay() === 2">Yes</p> <p *ngIf="date.getDay() !== 2">No</p> `, styles: [ ` p { font-family: Comic Sans MS, cursive, sans-serif; font-size: 24px; color: #ff69b4; text-shadow: 2px 2px 5px yellow; background: repeating-linear-gradient(45deg, #0ff, #f0f 10%, #ff0 20%); padding: 10px; border: 5px dashed lime; transform: rotate(-5deg); animation: wiggle 0.1s infinite alternate; } @keyframes wiggle { 0% { transform: rotate(-5deg); } 100% { transform: rotate(5deg); } } ` ]})export class AppComponent { date = new Date(); constructor(private cookieService: CookieService) { const key = 'flagPart2_3'; const encryptedFlagPart2 = 'U2FsdGVkX1/oCOrv2BF34XQbx7f34cYJ8aA71tr8cl8='; const encryptedFlagPart3 = 'U2FsdGVkX197aFEtB5VUIBcswkWs4GiFPal6425rsTU=';
// Decrypt and set flagPart2 in a cookie const decryptedFlagPart2 = CryptoJS.AES.decrypt(encryptedFlagPart2, key).toString(CryptoJS.enc.Utf8); this.cookieService.set('flagPart2', decryptedFlagPart2, { expires: 7, path: '/', secure: true, sameSite: 'Strict' });
// Decrypt flagPart3 and send it in a fetch request header const decryptedFlagPart3 = CryptoJS.AES.decrypt(encryptedFlagPart3, key).toString(CryptoJS.enc.Utf8); const headers = new Headers(); headers.set('flagPart3', decryptedFlagPart3); fetch('/favicon.ico', { headers }); }}decrypt the flags
const script = document.createElement('script');script.src = 'https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.1.1/crypto-js.min.js';script.onload = function() { const key = 'flagPart2_3'; const encryptedFlagPart2 = 'U2FsdGVkX1/oCOrv2BF34XQbx7f34cYJ8aA71tr8cl8='; const encryptedFlagPart3 = 'U2FsdGVkX197aFEtB5VUIBcswkWs4GiFPal6425rsTU=';
console.log(CryptoJS.AES.decrypt(encryptedFlagPart2, key).toString(CryptoJS.enc.Utf8)); console.log(CryptoJS.AES.decrypt(encryptedFlagPart3, key).toString(CryptoJS.enc.Utf8));};document.head.appendChild(script);decrypted flags:
Encrypted flagPart2: U2FsdGVkX1/oCOrv2BF34XQbx7f34cYJ8aA71tr8cl8=
Decrypted: br0w53r5_4r3_
Encrypted flagPart3: U2FsdGVkX197aFEtB5VUIBcswkWs4GiFPal6425rsTU=
Decrypted: c0mpl1c473dResulting flag:
swampCTF{w3b_br0w53r5_4r3_c0mpl1c473d}