paviad / id4-replay-attack-demo

Identity Server 4 with React to demonstrate the replay attack

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Project Bebop

Introduction

We recently failed a pen test due to our implementation of Identity Server 4 not preventing a replay attack. I have uploaded a simplified version of our setup to github to demonstrate what is going wrong.

Running Instructions

  • Clone github repo
  • In VS start multiple projects (IdentityServer + API)
  • In VS Code navigate to Bebop.WebApp
  • npm install
  • npm start
  • Get a trial version of BurpSuite Pro: https://portswigger.net/burp/pro
  • Start a new temp project
  • Proxy
  • Options
  • Make sure Intercept Server response is ticked

enter image description here

  • On the Intercept tab
  • Click open browser
  • Navigate to http://localhost:3000
  • Click Login button
  • In Burpsuite click the "Intercept is off" to turn it on:

enter image description here

  • Input "alice" as username and password
  • In Burpsuite, Forward the first response
  • You should get a 302 as the second response:

enter image description here

  • Copy this response to Notepad
  • Turn off Intercept, and it will continue you back into localhost:3000
  • Click the Sign out button
  • Navigate back to http://localhost:3000
  • Click the Sign in button
  • Turn on Intercept back in Burpsuite.
  • Input an invalid username / password
  • Forward the first response
  • On the 200 response, where it displays the invalid username / password. Replace the response, with the text you previously copied into Notepad
  • Turn off Intercept
  • You will get an error page enter image description here
  • Navigate to http://localhost:3000
  • Click the Sign in button
  • You will see that you are not prompted for the username / password, but instead logged straight in.

  • Identity will run on https://localhost:5001.
  • Web API will run on https://localhost:5002.
  • React App will run on https://localhost:3000.

About

Identity Server 4 with React to demonstrate the replay attack

License:MIT License


Languages

Language:SCSS 63.1%Language:C# 22.6%Language:HTML 7.6%Language:PowerShell 3.4%Language:JavaScript 3.1%Language:CSS 0.1%