KesionImallCMS V4.0一处sql注入漏洞

颓废 2019年5月19日09:54:41评论573 views字数 1597阅读5分19秒阅读模式
摘要

用户登录页面在 user/userlogin.aspx,看看点击登录按钮后的处理 跟入method_2,发现是一堆一堆的登录验证流程,非常繁琐,验证登录成功之后,会进入method_3的方法中显示判断用户是否被锁定之类的,然后可以看到一句有意思的代码

用户登录页面在 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演示

KesionImallCMS V4.0一处sql注入漏洞

KesionImallCMS V4.0一处sql注入漏洞

访问原文

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
颓废
  • 本文由 发表于 2019年5月19日09:54:41
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   KesionImallCMS V4.0一处sql注入漏洞http://cn-sec.com/archives/68362.html

发表评论

匿名网友 填写信息