用户登录页面在 user/userlogin.aspx,看看点击登录按钮后的处理
protected void Button1_Click(object sender, EventArgs e) { string text = this.UserName.Text; string text2 = this.PassWord.Text; Utils.MD5(text2, 16); int int_ = 0; if (this.Cookies.Checked) { int_ = 3; } this.method_2(text, text2, this.VerifyCode.Text, int_, true); }
跟入method_2,发现是一堆一堆的登录验证流程,非常繁琐,验证登录成功之后,会进入method_3的方法中显示判断用户是否被锁定之类的,然后可以看到一句有意思的代码
CheckUserLogin.UpdateLoginInfo(username, password, lastlogintime, int_0, rndPassWord);
跟进去发现这是登录成功后,更新一些和当前用户相关的信息,看到这个地方
DataFactory.ExecuteNonQuery(string.Concat(new string[] { "Update KS_ProShoppingCart Set UserName='", username, "' Where userName='", BaseFun.GetTempUserName(), "'" })); DataFactory.ExecuteNonQuery(string.Concat(new string[] { "Update KS_ProAddress Set UserName='", username, "' Where userName='", BaseFun.GetTempUserName(), "'" }));
更新购物车和地址信息,跟入 BaseFun.GetTempUserName方法
public static string GetTempUserName() { string text = KSCMS.GetCookie("myShop", "userName"); if (string.IsNullOrEmpty(text)) { text = Utils.RndNum(12).ToLower(); HttpCookie httpCookie = new HttpCookie("myShop" + KSCMS.SiteSN); if (BaseConfigManage.AllowSubDomain.ToLower().Equals("true")) { httpCookie.Domain = BaseConfigManage.RootDomain; } httpCookie.Values.Add("userName", text); httpCookie.Expires = DateTime.Now.AddDays(30.0); HttpContext.Current.Response.AppendCookie(httpCookie); } return text; }
取cookie中myshop,如果不为null或者空就返回这个值,看看怎么取的
public static string GetCookie(string Key, string Name) { string result; try { result = HttpUtility.UrlDecode(Utils.GetCookie(Key, Name)); } catch { result = string.Empty; } return result; }
做个UrlDecode就返回回来了,没有任何过滤措施,那么回过头来看看更新信息的地方,在登陆之前修改一条myshop的cookie,值为注入语句,然后去登录一个正常用户,登陆成功的时候就是注入成功的时候,demo演示
访问原文
免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论