Sometimes you fall down a GitHub rabbit hole, clicking through profiles, and find something like Dad Simulator.

Then you’re bonding with a virtual dad instead of closing issues.

Dad Simulator screenshot 1

Dad Simulator is a browser game, written in the Phaser framework. My understanding is it’s hackathon code from one Liam Gensel.

It’s basically a dad Tamagotchi. You have depleting stat bars, if they bottom out you die, and to keep that from happening you buy stuff to bump stats.

I acknowledge it as a novel concept, and I want to play but also have work to do. What’s a virtual son to do?

The game is written in JavaScript so… we’ll hack our way out of this.

i.e. type stuff in the Dev Tools console to speed this thing along

Dad Simulator’s a one-page app so we don’t need to recon here. No nmap or Burp spiders. Let’s just see what we’ve got for source.

Higher up in the HTML we see something about the dad dying. Morbid! 💀

Dad Simulator screenshot 2

Then towards the bottom we see what we need.

Dad Simulator screenshot 3

Let’s start with variables.js

    beer: {
        description: "A nice, ice cold beer will keep your Dad's thirst quenched and happiness up.",
        price: 2,
        stat: {
            health: 0,
            happiness: 5,
            hunger: 0,
            thirst: 15,
    burger: {
        description: "That's some good fucking meat.",
        price: 5,
        stat: {
            health: 0,
            happiness: 6,
            hunger: 10,
            thirst: 0,

So in the console we can change the price of anything like this. = 1;

Or we can make stuff more beneficial. = 100; = 100; = 100; = 100;

The most desirable item in this game is a car. It’s so expensive I think it was put in there to cheat for. Or maybe I’m justifying our actions.

car: {
        description: "A badass new car for your pops.",
        price: 25000,
        stat: {
            health: 100,
            happiness: 100,
            hunger: 0,
            thirst: 0,

In fact, if you buy this car, the dad turns into the car. If we transition from variables.js to main.js we can see this in code.

function itemRecieved(item) {
    if (hasItem && item != "DRILL" && item != "HAMMER") {
    } else {
        drill.visible = false;
        hammer.visible = false;

    if (item == "CAR") {
        dad = game.add.sprite(100, 250, 'car');

What does that look like?

Dad Simulator screenshot 4

That code snippet above also lets on another route for cheating.


Now, let’s look further into main.js 🤔

function makeJoke() {
    fetch("", {
        headers: {
            'Accept': 'text/plain'

    }).then(function (response) {
        return response.text();
    }).then(function (text) {

function killAllItems() {
    beer.visible = false;
    burger.visible = false;
    chicken.visible = false;

function payday() {
    Cookies.set("totalMoney", Cookies.getJSON("totalMoney") + Cookies.getJSON("allowance"));

function addAllowance() {
    Cookies.set("allowance", Cookies.getJSON("allowance") + (2 * Cookies.getJSON("allowance")));

More console tricks. Don’t want to wait (30 seconds) for Dad to make another joke?


Don’t want to wait (60 seconds) for an allowance bump?


Don’t want to wait (30 seconds) for allowance?


Maybe you also caught this file’s references to a Cookies class. What’s the deal with that?

Before we find out, let me just call out another snippet, this time from stats.js 📈

function updateStat(statType, value) {
    let stats = Cookies.getJSON("dad");
    switch (statType) {
        case 'HEALTH':
   += value;
        case 'HUNGER':
            stats.hunger += value;
        case 'THIRST':
            stats.thirst += value;
        case 'HAPPINESS':
            stats.happiness += value;

    stats = validateStats(stats);
    Cookies.set("dad", stats);

Hence we can modifying items and jump right to the following console cheats too.


Anyway. What’s the deal with those cookies? 🍪🍪🍪

Dad Simulator screenshot 5

Aha. The cookies, they are so sweet. We don’t have to touch a line of JavaScript. With the excellent EditThisCookie plugin for Chrome you can edit away…

Dad Simulator screenshot 6

Of course, if you insist on JavaScript…


That’s right, remember to update the state after changing the game any which way.

To close out this post, Dad Simulator is fun as a game and as an appsec exercise. I understand there weren’t security requirements around it. This was hackathon code.

The question remains — are all Phaser games written this way? Is there more code out there to exploit? That’s up to you.

Keep hacking. 🐱 💻

Randy Gingeleski - GitHub - - LinkedIn