ASP.NET代码审计 硬编码(后门账号)

XX系统

打开代码分析,这里的登录接口有好几个

Account\VipLogin.cs代码

using System;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using Plat.Common;
using Plat.Security;

namespace Web.Account;

public class VipLogin : Page
{
	protected HtmlForm form1;

	protected HtmlTable tb;

	protected HtmlInputText txtUserName;

	protected HtmlInputPassword txtPassword;

	protected HtmlInputText txtVCode;

	protected Button Button1;

	protected HtmlGenericControl btxt;

	protected void Page_Load(object sender, EventArgs e)
	{
	}

	private void login()
	{
		string userName = txtUserName.Value;
		string password = txtPassword.Value;
		if (WebContext.GetValidateCode() != txtVCode.Value.ToUpper())
		{
			WebMessage.Show(this, "您填写的验证码有误!请检查后重新输入!");
			return;
		}
		if (userName != "Vip")
		{
			WebMessage.Show(this, "用户名错误!");
			return;
		}
		if (password != "Vip123456")
		{
			WebMessage.Show(this, "密码错误!");
			return;
		}
		Session["AdminName"] = "Vip用户";
		Session["DistrictId"] = "1";
		Session["DistrictSn"] = "01";
		Session["DistrictCnName"] = "Vip用户";
		Session["OrganizationName"] = "中华人民共和国农业部渔业局";
		base.Response.Redirect("/Home/mainVip.aspx");
	}

	protected void Button1_Click(object sender, EventArgs e)
	{
		login();
	}
}

关键代码

代码中硬编码了Vip的账号密码

Vip Vip123456 密码正确跳转/Home/mainVip.aspx页面

访问/Account/VipLogin.aspx VIP用户登录接口

成功登录

跳转后台页面

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值