More information about TP-Link backdoor

admin 2021年4月3日19:25:20评论62 views字数 1934阅读6分26秒阅读模式

During the analysis of this TP-Link backdoor, I found other issues, which can be handy when analyzing other devices. Finally the following path leads to remote root exec (useful for debugging purposes). Let’s see.

The router allows for ftp connections. But the ftp session is somehow chrooted (ie. one can access only ftp root and USB shared directories):

Standard ftp connection

Let’s try a little trick now. After plugging a USB flash drive into the router we can share a folder from the USB to be available on FTP:

Folder sharing

By clicking ‘Save’ I issue an HTTP request, which I can intercept in local http proxy, and modify it like this (ie. path traversal):

path traversal

After this I can traverse all the filesystem – also in write mode:

Path traversal – ftp

But how can I have interactive root-shell? OK, after searching /tmp directory, there is /tmp/samba/smb.conf which can be overwritten. Brief analysis of samba documentation shows many ways of executing external binary. For example:

root preexec (S)

This is the same as the preexec parameter except that the command is run as root. This is useful for mounting filesystems (such as CDROMs) when a connection is opened.

As you can see, this option (root preexec) apart from CDROM mounting can be used to debug routers After modification the config looks like this:

Modified smb.conf

/tmp/szel is just a netcat binary (compiled for MIPS architecture) and uploaded by ftp (see the earlier path traversal trick). Now we can try out remote root shell:

remote root

Interactive root is nice, but how can it help with locating issues like this? OK, let’s search httpd binary for strings (httpd can be downloaded from the router – for example – using ftp):

Here we can see start_art.html string mentioned in the original disclosure. But how does it work? Let’s check what is going on on the router when start_art.html is launched:

Now it’s clear – 192.168.0.100 is my IP address and nart.out is 777 chmoded and then executed…

–Micha? Sajdak (michal.sajdaksecuritum.pl)

from: http://sekurak.pl/more-information-about-tp-link-backdoor/

文章来源于lcx.cc:More information about TP-Link backdoor

相关推荐: 【Dos】使用Cmd,Dos 命令修改指定文件的属性

使用 Cmd、Dos attrib 命令修改指定文件的属性: attrib /?     +   设置属性。     -    清除属性。     R   只读文件属性。     A   存档文件属性。     S   系统文件属性。     H   隐藏文件…

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2021年4月3日19:25:20
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   More information about TP-Link backdoorhttps://cn-sec.com/archives/322363.html

发表评论

匿名网友 填写信息