Simulate xss in angular

Discussão em 'Angular' iniciado por Juraj Jakubov, Novembro 10, 2024.

  1. I am trying to simulate very simple xss in angular but I cant is there any reason why it does not work?
    TS

    showOutput() {
    let badOutput = document.getElementById('bad-output');
    const badInput = document.getElementById('bad-input') as HTMLInputElement;
    if (badOutput && badInput) {
    badOutput.innerHTML = badInput.value;
    }
    }


    HTML

    <input type="text" id="bad-input" name="bad-input" />
    <button id="show-output" (click)="showOutput()">Show output</button>
    <br />
    <p id="bad-output"></p>


    INPUT

    <script>alert('xss')</alert>

    Continue reading...

Compartilhe esta Página