jeudi 28 juin 2018

How to exploit XSS in Angular with $sceProvider being disabled

I am trying to implement XSS vulnerable app so that afterwards I could improve security aspects by using Domain Driven Design principles. The front-end is implemented with AngularJS for which I have disabled $sceProvider. Still, any of the XSS attack examples I tried so far didn't work.

HTML page:

<div class="row" ng-init="loadArticles()">
    <h1>Existing articles</h1>
    <table id="tabela1"  class="table table-striped table-hover">
        <thead>
        <tr>
            <th>Book title: </th>
            <th>Description: </th>
        </tr>
        </thead>
        <tbody>
        <tr ng-repeat="b in BOOKS track by $index" >
            <td style="padding-right: 15px"></td>
            <td style="padding-right: 15px"></td>
        </tr>
        </tbody>
    </table>
</div>
</div>

ArticleController.js

$scope.loadArticles = function () {
    console.log("loading articles");

    var url = "/api/article/getAll";
    $.ajax({
        type: 'GET',
        url : url,
        contentType: 'application/json',
        dataType: 'text',
        success:  function (data) {
            $scope.BOOKS = JSON.parse(data);
            $scope.$apply();
        },
        error : function(XMLHttpRequest, textStatus, errorThrown) {
            //toaster poruka
            alert('Could not load articles!');
        }
    });
};

When for example

<script>alert();</script>

is put into description, and sent to server to be saved into database, next time the page is loaded, it is printed in the same way, without the alert being shown.




Aucun commentaire:

Enregistrer un commentaire