├── composer.json ├── logout.php ├── trigger_fake_admin.php ├── mysql.php ├── dbdata.sql ├── trigger_fake_admin_2.php ├── app.json ├── authenticate.php ├── composer.lock ├── README.md ├── setup_mysql.php ├── fake_admin_browser.js ├── register.php ├── login.php └── index.php /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": { 3 | "ext-mysql": "*", 4 | "ext-mbstring":"*" 5 | } 6 | } -------------------------------------------------------------------------------- /logout.php: -------------------------------------------------------------------------------- 1 |
3 | 6 | 7 | -------------------------------------------------------------------------------- /mysql.php: -------------------------------------------------------------------------------- 1 |
"; 7 | print "We caught an admin! Our XSS caught this information via alert():"; 8 | print "
"; 9 | print nl2br($results); 10 | print "
"; -------------------------------------------------------------------------------- /app.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "CTF_FLAG": "PUT-FLAG-HERE" 4 | }, 5 | "addons": [ 6 | "papertrail", 7 | "cleardb" 8 | ], 9 | "success_url": "/index.php", 10 | "scripts": { 11 | "postdeploy": "php setup_mysql.php" 12 | }, 13 | "buildpacks": [ 14 | { 15 | "url": "https://github.com/heroku/heroku-buildpack-php" 16 | }, 17 | { 18 | "url": "https://github.com/stomita/heroku-buildpack-phantomjs" 19 | } 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /authenticate.php: -------------------------------------------------------------------------------- 1 | > Back"); 11 | } 12 | else 13 | { 14 | $mem = mysql_fetch_assoc($uq); 15 | $_SESSION['id'] = $mem['id']; 16 | setcookie("hint", 'use-these-cookies-to-login-as-admin', time()+36000); 17 | header("Location: /index.php"); 18 | exit; 19 | } 20 | -------------------------------------------------------------------------------- /composer.lock: -------------------------------------------------------------------------------- 1 | { 2 | "_readme": [ 3 | "This file locks the dependencies of your project to a known state", 4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", 5 | "This file is @generated automatically" 6 | ], 7 | "hash": "4032f9a7678ad10ae1a13e7369f85d34", 8 | "content-hash": "a243a4e7654fee2a753e9fd9e0f4aec1", 9 | "packages": [], 10 | "packages-dev": [], 11 | "aliases": [], 12 | "minimum-stability": "stable", 13 | "stability-flags": [], 14 | "prefer-stable": false, 15 | "prefer-lowest": false, 16 | "platform": { 17 | "ext-mysql": "*", 18 | "ext-mbstring": "*" 19 | }, 20 | "platform-dev": [] 21 | } 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # XSS Cookie Stealing Challenge 2 | 3 | Challenge: See if you can become logged in as the "admin" user. 4 | 5 | Note that to do so, you'll need to create your own account and create an XSS attack on your user profile. 6 | 7 | For purposes of this challenge, anything you successfully "alert()" in the admin's browser will be passed along to you. (Admin browser is simulated using phantomjs) 8 | 9 | Deploy to your own Heroku instance with this button below, or try out our live demo [HERE](https://ctf-xss-challenge.herokuapp.com/) (not guaranteed to be up). 10 | 11 | [![Deploy](https://www.herokucdn.com/deploy/button.png)](https://heroku.com/deploy) 12 | 13 | Note that useful information for testing and debugging will be logged to the Papertrail app in your heroku instance. Open papertrail to view those streaming logs. 14 | -------------------------------------------------------------------------------- /setup_mysql.php: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 10 | breakthenet 11 | 12 | 13 | 14 | > Login"; 27 | } 28 | } 29 | else 30 | { 31 | ?> 32 |

33 | Register 34 |

35 |
36 | Username:
37 | 38 | Password:
39 | 40 |

41 | > Go Back 42 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /login.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BreakTheNet 6 | 7 | 8 |

9 | > BreakTheNet Log-In 10 |

11 | 12 | 13 | 22 | 32 | 33 |
14 |
15 | About BreakTheNet 16 | An XSS challenge - see if you can become logged in as the "admin" user.

17 | Note that to do so, you'll need to create your own account and create an XSS attack on your user profile.

18 | For purposes of this challenge, anything you successfully "alert()" in the admin's browser will be passed along to you.

19 | Feel free to review the source code as part of the challenge here. 20 |
21 |
23 |
24 | Login 25 |
26 | Username:
27 | Password:
28 | 29 |
30 |
31 |

34 |

35 | REGISTER NOW! 36 |


37 | 38 | 39 | -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | 25 | 31 | 32 | 82 |
33 |
34 | 's Profile 37 | 38 |

39 |

40 |

41 |

42 |

43 |

44 |

45 |

46 |

47 |

48 |
49 | CTF Flag: ".$ctf_flag.""; 53 | } 54 | else { 55 | print "CTF Flag: [disabled] - Must be logged in as admin to access."; 56 | } 57 | ?> 58 |
59 | 60 |
61 | 62 |
63 | Update your Profile Description 64 |
65 | Current Value:
66 |
67 | 68 |
69 |
70 | 71 |


72 | 77 | 78 | 79 |


80 | > LOGOUT 81 |
83 | --------------------------------------------------------------------------------