Last active
March 18, 2016 19:41
-
-
Save kristovatlas/0434cc7dbb29fc772eba to your computer and use it in GitHub Desktop.
A simple Angular injection using $scope.$eval without reflection
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- angular injection using $scope.$eval --> | |
<!DOCTYPE html> | |
<html ng-app> | |
<head> | |
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.1.1/angular.js"></script> | |
<script type="text/javascript"> | |
function MyController($scope) { | |
$scope.hack_the_planet = function() { | |
// POC: constructor.constructor('alert(1337)')() | |
$scope.$eval($scope.myinput); | |
$scope.myoutput = $scope.myinput; | |
} | |
} | |
</script> | |
</head> | |
<body> | |
<div ng-controller="MyController"> | |
<input type="text" ng-model="myinput" /> | |
<button ng-click="hack_the_planet()">Hack The Planet</button> | |
<h1 ng-model="myoutput"> {{ myoutput }} </h1> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment