Skip to content

Instantly share code, notes, and snippets.

@pgainda
Created May 28, 2013 18:19
Show Gist options
  • Save pgainda/5664890 to your computer and use it in GitHub Desktop.
Save pgainda/5664890 to your computer and use it in GitHub Desktop.
Now, let's say you're an attacker that really doesn't like Jones. You want to change the amount of money in Jones' bank account from $1,000,000 to $5.
function BankAccount( lastname ) {
this.lastname = lastname;
this.balance = 1000000;
}
// write your function here
function attackBalance(account){
account.balance = 5;
}
var jonesBankAccount = new BankAccount ("Jones");
console.log("jonesBankAccount has " + jonesBankAccount.balance + " dollars!");
attackBalance(jonesBankAccount);
console.log("After attack, jonesBankAccount has " + jonesBankAccount.balance + " dollars!");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment