Giter Site home page Giter Site logo

marcinhoppe / aspnetcore.csrf.sample Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 532 KB

A sample application that shows three ways to mitigate CSRF attacks in ASP.NET Core applications

License: MIT License

C# 94.45% CSS 5.30% JavaScript 0.25%
asp-net asp-net-core csrf-attacks cookie http security

aspnetcore.csrf.sample's Introduction

ASP.NET Core CSRF Mitigation Sample

Introduction

Welcome to a sample application that shows three ways to mitigate CSRF attacks in ASP.NET Core applications:

  • SameSite cookies
  • Checking the Origin header
  • Leveraging built-in CSRF tokens

This site does not have a lot to offer but you can log in and edit your profile data. Here's the list of allowed logins:

  • marcin
  • janek
  • franek

The password is s3cr3t. Yes, all of the logins use the same password.

The main site is accompanied by an evil twin site that can be used to execute a CSRF attack!

Prerequisites

The sample consists of two Web sites:

  • http://web.local:57082/
  • http://evil.local:56326/

Using these host names is important due to cookies being bound to web.local. Make sure you add the following entries to your hosts file:

127.0.0.1 web.local
127.0.0.1 evil.local

You may also have to add URL reservations for both sites:

C:\>netsh http add urlacl url=http://web.local:57082/ user=<USER>
C:\>netsh http add urlacl url=http://evil.local:56326/ user=<USER>

aspnetcore.csrf.sample's People

Contributors

marcinhoppe avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.