flappy-js

flappy bird clone.

Are you a pro gamer? Can you get a score of 31337 in this game?

(flag format is greyctf{...} because I made a mistake :p)

Author: daniellimws

We were given a site called "Clumsy Bird" which is essentially a Flappy Bird clone. There are TWO ways to solve this challenge. I will be explaining both of them! 🎉

much wow, such clone!

Solution 1

When we were given the link to the Clumsy Bird challenge, the first thing we did was "View Page Source". From there, we were able to see TWO scripts being loaded.

<!-- melonJS Library -->
<script type="text/javascript" src="js/melonJS-min.js" ></script>
<script type="text/javascript" src="build/clumsy-min.js" ></script>
<script type="text/javascript">
    window.onReady(function onReady() {
        game.onload();
    });
</script>

melonJS is just a standard HTML5 game engine library, so we looked at clumy-min.js and searched for the string "flag" via Firefox Developer Tools.

take note of genFlag()
draw: function (a) {
  game.data.start && me.state.isCurrent(me.state.PLAY) 
  && (
    this.stepsFont.draw(a, game.data.steps, me.game.viewport.width / 2, 10), 
  game.data.steps >= 31337 
  && (
    0 == this.flag.length && (this.flag = genFlag()), 
    this.flagFont = new me.Font('roboto', 35, '#000', 'center'), 
    this.flagFont.draw(a, 'greyctf{' + this.flag + '}', me.game.viewport.width / 2, 110)))
}

From the JavaScript code snippet, we can see that we need to call genFlag() in order to get the flag, and so we did via Firefox Browser Console!

Flag: greyctf{5uch_4_pr0_g4m3r}

Solution 2

Using the same JavaScript code snippet, we noticed the object game.data.steps >= 31337 and so we went to the Firefox Browser Console and ran game.data first, just to see what was the output.

We noticed the steps variable, and since the challenge wants us to get a score of 31337 and above, we then ran game.data.steps = 31337

Take Note: The game will pause when you tap onto the Firefox Developer Tools.

To ensure that Solution 2 works, be sure to pause the game before your Flappy Bird hits the floor, enter the command and then resume the game!

We got the flag!!!

Flag: greyctf{5uch_4_pr0_g4m3r}

I'm in this photo and I don't like it! 😡

Last updated