从某洗衣机day打入JP企业

开发调优开发调优, Lv1纯水网络安全
查看原帖
你正在查看历史版本 v1。返回最新版本

在模态框中查看主贴与评论的删除、修改和新增情况。

Cipher69 楼主
#1

刚加入 linux.do,发一篇之前写的较为有趣的打站文章。
最早发在吐司但是因为权限限制没有多少浏览量 :rofl:
技术点并不难,后来看也有其他师傅复刻过。
主要还是思路比较好玩,浅浅的水一篇~

从某洗衣机day打入JP企业

序章

故事的开头来自某天被推送的一条“0day”
图片

点开康康是什么,发现是一个很常见的rce方式,即管道符命令拼接实现rce

这个rce方式想必很多师傅都很熟悉,曾经常见于各家路由器的后台

而就是这样一个看似简单又不具什么利用价值的漏洞,其实是一些Jp企业的突破口

复现

正好无事,想着复现一下

根据poc提供的特征随便找了一个站

/cgi-bin/network_test.php

访问之,页面是这样的

问题就出现在/cgi-bin/network_test.php这个路由中

一个简单的命令拼接,没什么好说的

折腾

既然已经rce了,何必不写个shell呢,于是在这个过程中发生了各种问题。。。

避免过多废话,总结一下

用户为consec
web路径为/usr/apache/cgi-bin

无sudo
机器出网,没有wget和curl
web路径没权限写
tmp路径可以写但是只能touch文件,无法写入内容
尖括号过滤,管道符只能有一个

于是我决定开始查看其它php文件是否有突破口

total 1826
drwxrwxrwx    3 root     root         4096 Jun 13  2018 .
drwxrwxrwx    5 root     root         1024 Aug 28  2019 ..
lrwxrwxrwx    1 root     root           12 Dec 29  2004 .htaccess -> ../.htaccess
-rwxr-xr-x    1 root     root         6945 Sep 28  2005 alert_rss.rdf
-rwxr-xr-x    1 root     root         1322 Jan 11  2005 downloader.php
lrwxrwxrwx    1 root     root           23 Dec 29  2004 images -> /usr/apache/html/images
-rwxr-xr-x    1 root     root         5869 Oct 24  2005 imode_alldata.php
-rwxr-xr-x    1 root     root         7784 Jan 12  2005 imode_eventlog.php
-rwxr-xr-x    1 root     root         3234 Dec  6  2005 imode_eventstat.php
-rwxr-xr-x    1 root     root         2101 Jan 12  2005 imode_info.php
drwxrwxrwx    2 root     root         2048 Nov 27  2018 include
-rwxrwxrwx    1 root     root         4801 Oct 25  2017 index_x1.php
-rwxrwxrwx    1 root     root         4957 Feb 25  2011 index_x11.php
-rwxrwxrwx    1 root     root         6535 Oct 25  2017 index_x12.php
-rwxrwxrwx    1 root     root        11650 Feb 25  2011 index_x13.php
-rwxrwxrwx    1 root     root         4383 Feb 25  2011 index_x14.php
-rwxrwxrwx    1 root     root         5804 Mar  6  2018 index_x15.php
-rwxrwxrwx    1 root     root         2093 Dec 24 05:31 login.php
-rwxrwxrwx    1 root     root        33241 Sep 14  2017 mainte_jikan_kadou.php
-rwxrwxrwx    1 root     root        44011 Sep 14  2017 mainte_jikan_uriage.php
-rwxr-xr-x    1 root     root         2275 Apr 15  2016 network_test.php
-rwxrwxrwx    1 root     root         5951 Apr 15  2016 p1_conf_update.php
-rwxrwxrwx    1 root     root         6973 Apr 15  2016 p1_ftpserver.php
-rwxrwxrwx    1 root     root         9315 Jun 23  2016 p1_info_device.php
-rwsr-xr-x    1 root     root        17492 Apr  5  2016 p1_network_dns.cgi
-rwsr-xr-x    1 root     root        14092 Jun 14  2016 p1_network_inetd.cgi
-rwsrwxrwx    1 root     root        20908 Apr  5  2016 p1_network_mail.cgi
-rwsr-xr-x    1 root     root        24400 Apr 15  2016 p1_schedule_setting.cgi
-rwsr-xr-x    1 root     root        14484 Apr  5  2016 p1_setdate.cgi
-rwsr-xr-x    1 root     root        17324 Apr  5  2016 p1_setipadr.cgi
-rwxrwxrwx    1 root     root         1147 May  6  2011 p1_system_check.php
-rwsr-xr-x    1 root     root        20364 Apr  5  2016 p1_system_ntp.cgi
-rwsr-xr-x    1 root     root        14324 Jun 14  2016 p1_system_user.cgi
-rwxrwxrwx    1 root     root         1275 Apr 26  2011 p1_user_check.php
-rw-r--r--    1 root     contec      17703 May 21  2007 style_tosei.css
-rwxrwxrwx    1 root     root         2792 Sep 18  2007 tosei-i_running.php
-rwxrwxrwx    1 root     root         2338 Sep 18  2007 tosei-i_running1.php
-rwxrwxrwx    1 root     root        20226 Mar 19  2018 tosei-i_sousa.php
-rwxrwxrwx    1 root     root        16842 Feb 23  2018 tosei-i_sousa_2.php
-rwxrwxrwx    1 root     root         8762 Feb 19  2018 tosei-i_sousa_3.php
-rwxrwxrwx    1 root     root         7546 Jan 30  2011 tosei-i_sousa_check.php
-rwxrwxrwx    1 root     root         1606 Sep 12  2007 tosei-i_sousa_check1.php
-rwxrwxrwx    1 root     root         5191 Jan 30  2011 tosei-i_sousa_check2.php
-rw-r--r--    1 fws      fws         35644 Dec  1  2010 tosei_common.def
-rwxrwxrwx    1 root     root         2694 Aug 28  2017 tosei_creditinfo.php
-rwxrwxrwx    1 root     root        21951 Sep 15  2017 tosei_datasend.php
-rwxrwxrwx    1 root     root         1976 Sep 14  2017 tosei_error.php
-rwxrwxrwx    1 root     root        37082 Jan 10  2018 tosei_getubetu_kadou.php
-rwxrwxrwx    1 root     root        30678 Jan 10  2018 tosei_getubetu_uriage.php
-rwxrwxrwx    1 root     root         4058 Apr 15  2016 tosei_gokiinfo.php
-rwxrwxrwx    1 root     root        13447 Sep 14  2017 tosei_gulisu_settei.php
-rwxrwxrwx    1 root     root         8803 Aug  9  2017 tosei_gulisu_tenken.php
-rwxrwxrwx    1 root     root        17259 Apr 20  2016 tosei_haraidashi.php
-rwxrwxrwx    1 root     root         4355 Sep 19  2007 tosei_help.php
-rwxrwxrwx    1 root     root        44233 Jan 10  2018 tosei_hiduke_kadou.php
-rwxrwxrwx    1 root     root        27449 Jan 10  2018 tosei_hiduke_uriage.php
-rwxrwxrwx    1 root     root         7550 Apr  4  2018 tosei_honjitsu_tenko.php
-rwxrwxrwx    1 root     root         8641 Sep 14  2017 tosei_ipento_setei.php
-rwxrwxrwx    1 root     root        35246 Jan 10  2018 tosei_jikan_kadou.php
-rwxrwxrwx    1 root     root        51635 Jan 10  2018 tosei_jikan_uriage.php
-rwxrwxrwx    1 root     root        26847 Dec  4  2015 tosei_kikai.php
-rwxrwxrwx    1 root     root        10468 Sep 14  2017 tosei_kikai_era.php
-rwxrwxrwx    1 root     root        10635 Sep 20  2017 tosei_kikai_jyouhou.php
-rwxrwxrwx    1 root     root         8554 Mar 26  2018 tosei_kikai_kanri.php
-rwxrwxrwx    1 root     root        11639 Sep 14  2017 tosei_kikai_name.php
-rwxrwxrwx    1 root     root        10982 Sep  8  2017 tosei_kikai_seisanki.php
-rwxrwxrwx    1 root     root         6461 Apr  6  2016 tosei_kikai_siyou.php
-rwxrwxrwx    1 root     root        18401 Nov 16  2017 tosei_kikai_sousa.php
-rwxrwxrwx    1 root     root        11492 Feb 22  2018 tosei_kishuinfo.php
-rwxr-xr-x    1 root     root          354 Feb 18  2016 tosei_login_check.php
-rwsrwxrwx    1 root     root        13620 Apr  5  2016 tosei_mainte_user.cgi
-rwxrwxrwx    1 root     root        13442 Sep 14  2017 tosei_oiru_settei.php
-rwxrwxrwx    1 root     root         8809 Aug  9  2017 tosei_oiru_tenken.php
-rwxrwxrwx    1 root     root         4812 May 26  2016 tosei_owner_card.php
-rwxrwxrwx    1 root     root        11079 Apr  3  2018 tosei_owner_helocall.php
-rwxrwxrwx    1 root     root         2664 Aug 28  2017 tosei_payment_info.php
-rwsr-xr-x    1 root     root        14852 Jun 20  2016 tosei_payment_user.cgi
-rwsrwxrwx    1 root     root        12100 Apr  5  2016 tosei_reboot.cgi
-rwxrwxrwx    1 root     root        16839 Sep 14  2017 tosei_rinfareta_settei.php
-rwxrwxrwx    1 root     root        14980 May 31  2012 tosei_rinfareta_tenken.php
-rwxrwxrwx    1 root     root         2070 Apr  5  2016 tosei_running.php
-rwxrwxrwx    1 root     root         9388 Feb 22  2018 tosei_ryoukin_henkou.php
-rwxrwxrwx    1 root     root        86105 Sep 14  2017 tosei_save_data.php
-rwxrwxrwx    1 root     root        39929 Feb 22  2018 tosei_setup.php
-rwxrwxrwx    1 root     root         9285 Apr  4  2018 tosei_shisutemu_helocall.php
-rwxrwxrwx    1 root     root         3191 Apr 15  2016 tosei_shopinfo.php
-rwxrwxrwx    1 root     root        48411 Mar 19  2018 tosei_sousa.php
-rwxrwxrwx    1 root     root        32791 Mar 11  2016 tosei_sousa_2.php
-rwxrwxrwx    1 root     root         8046 May 26  2016 tosei_sousa_check.php
-rwxrwxrwx    1 root     root         3994 Sep 14  2017 tosei_sousa_history.php
-rwsrwxrwx    1 root     root        13716 Apr  5  2016 tosei_sub_user.cgi
-rwxrwxrwx    1 root     root         9095 Sep 14  2017 tosei_syuusei.php
-rwxr-xr-x    1 root     root         5982 Mar 14  2007 tosei_syuusei.php.org
-rwxrwxrwx    1 root     root        24081 Sep  5  2017 tosei_top.php
-rwxrwxrwx    1 root     root       140317 Jan 10  2018 tosei_uriage.php
-rwxrwxrwx    1 fws      fws        106281 Dec  1  2010 tosei_uriage.php.org
-rwxrwxrwx    1 root     root        51738 Feb 16  2018 tosei_waribiki_1.php
-rwxrwxrwx    1 root     root        43549 Sep 12  2007 tosei_waribiki_1a.php
-rwxrwxrwx    1 root     root        41119 Feb 27  2018 tosei_waribiki_2.php
-rwxrwxrwx    1 root     root        31438 Feb 23  2018 tosei_waribiki_check.php
-rwxrwxrwx    1 root     root        46636 Jan 10  2018 tosei_youbi_kadou.php
-rwxrwxrwx    1 root     root        30434 Jan 10  2018 tosei_youbi_uriage.php

随便访问了几个php文件,发现都有401,只有一开始rce的那个php文件不校验权限

正好有.htaccess文件,翻看一下有啥其它信息不

中奖了,随即翻阅/usr/apache/.pass

很可惜是存在加密的,当然此处去找一下加密方式也是可解的,但是我选择直接尝试一下用户名+密码

contecfws01
contecfws01

于是乎直接登陆进去了23333,在后来对其它机器的复现中也发现该账号是默认存在可登录的

那我们继续前面的思路吧,开始访问各php文件查看是否有突破口

此处快进到我们的重点

/cgi-bin/p1_ftpserver.php

surprise,发现这个ftpserver中存在着ftp的连接信息

在此处我们知道了

ftpserver:xxxxx.jp
ftpuser:sanwa
ftppass:UaBqxxxxxkq2

此处密码原来是*******,当然我们直接F12查看就能看到明文了

其实我们直接就可以用ftp来get webshell到本地机器了,但是一个关键点让我发现该洗衣机所能造成的危害会更大

因为脱敏所以打了码,实际上这个位置是一个域名

而根据百度翻译+理解,可以知道洗衣机这部分的功能是将洗衣机的一些文件传送到这个服务器上去

而我们直接访问这个域名会发现什么呢

经信息搜集可知,这是一家日本的企业,而企业下属各产业集群中包含洗衣机产业

那我们是否能直接从一台洗衣机打到该企业呢

直接开干,使用上面得到的信息连接ftp服务器

进入洗衣机传送的路径

看来我们上面的猜测是正确的了,但是应该如何打到企业呢

其实我们不难发现此时的路径是企业域名的子路径

我们直接移动到企业域名路径下看看

我们此刻发现了一个很令人振奋的事情

这个路径好像就是官网的web路径???

于是我们随便访问一个该路径下的文件

发现还真的是哈,我们通过put随便写个文件进去,看能不能访问到

太对劲了兄弟们

直接写个马上去

连接成功!

拿下!

后话

  1. 大家也发现这个站还有wp,包括还可以内网渗透等等,这个就留到以后慢慢来看吧
  2. 经批量探测了一下,这个洞本身公网还是挺多的,而且如上所述都是存在默认账号的
  3. 通过这一条利用链能打入的企业还是不少的,并且部分几个企业还涉及到了其它产业
  4. 永远不要因为一个洞看起来简单就忽略它的危害
  5. 千里之堤,溃于蚁穴
:heart:14:+1:2:distorted_face:1:tieba_087:1
SydneyNewZealandSydneyNewZealand
tifetife
alphamiaomiaoalphamiaomiao
TOPIC OWNER
6楼层
5回复
4用户
Maii dv868 kevfen
Maii
Maii
#2

好奇洗衣机为啥要上传文件,能有什么可传的

:heart:1
1个回复
Cipher69 楼主

洗衣机配置下发(如定价等)、固件升级、日志上报 etc~

TOPIC OWNER
↓ 跳到帖子
Cipher69 楼主 ↶ @Maii
#3

洗衣机配置下发(如定价等)、固件升级、日志上报 etc~

1个回复
dv868
dv868

那能不能写个配置下发,让所有的洗衣机晚上12点开始洗衣服

↓ 跳到帖子
TOPIC OWNER
dv868
#4

那能不能写个配置下发,让所有的洗衣机晚上12点开始洗衣服

1个回复
Cipher69 楼主

后台已经完全控制了,是可以的,不过太浪费水了,驳回 :alien:

TOPIC OWNER
↓ 跳到帖子
Cipher69 楼主 ↶ @dv868
#5

后台已经完全控制了,是可以的,不过太浪费水了,驳回 :alien:

TOPIC OWNER
kevfen
kevfen
#6

以后谁家洗衣机半夜离家出走,请不要惊慌

:laughing:1