CS绕过登陆
最近博客少了更新,今天抽空写一篇吧。
大多数我们渗透都是针对b/s模型 很少是针对c/s模型。
无聊搞了两个图,别喷。
搞了个案例
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Data.SqlClient; namespace sqltest { class Program { static void Main(string[] args) { SqlConnection conn = new SqlConnection("server=.;database=test;uid=sa;pwd=123456"); conn.Open(); while (true) { Console.WriteLine("请输入账号"); string uname = Console.ReadLine(); Console.WriteLine("请输入密码"); string upass = Console.ReadLine(); string sql = "select * from users where uname='" + uname + "' and upass='" + upass + "'"; try { SqlCommand cmd = new SqlCommand(sql, conn); SqlDataReader sdr = cmd.ExecuteReader(); sdr.Read(); if (sdr.HasRows ==true) { Console.WriteLine("登陆成功"); } else { Console.WriteLine("登陆失败"); } Console.ReadKey(); } catch(Exception ex){ Console.WriteLine("异常:"+ex); Console.ReadKey(); } } } } }
这个是正常的登陆如图:
检测有没有安全漏洞我们可以使用单引号或者其他检测字符让其出错就好了。
出错之后,我们可以利用反编译工具 分析源码。
达到目的就好了。
- 左青龙
- 微信扫一扫
- 右白虎
- 微信扫一扫
评论