29
SSL 우회 기법 응용 이경문( [email protected] )

이경문C0%CC%B0... · 2014-06-22 · 하나은행 신한카드 인터넷우체국 국세청 전자세금계산서 e세로 외환은행 현대카드 스탠다드차타드은행 KB국민카드

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: 이경문C0%CC%B0... · 2014-06-22 · 하나은행 신한카드 인터넷우체국 국세청 전자세금계산서 e세로 외환은행 현대카드 스탠다드차타드은행 KB국민카드

SSL 우회 기법 및 응용

이경문( [email protected] )

Page 2: 이경문C0%CC%B0... · 2014-06-22 · 하나은행 신한카드 인터넷우체국 국세청 전자세금계산서 e세로 외환은행 현대카드 스탠다드차타드은행 KB국민카드

Evolving of sniffing attacks

Simple Sniffing

Sniffing with Spoofing

Sniffing with MITM

Promiscuous mode, TCP/IP and so on

ARP spoofing, IP spoofing and so on

Proxy, Version rollback and so on

Packet sniffing attacks have been developed in connection with various techniques for a long time.

Page 3: 이경문C0%CC%B0... · 2014-06-22 · 하나은행 신한카드 인터넷우체국 국세청 전자세금계산서 e세로 외환은행 현대카드 스탠다드차타드은행 KB국민카드

Can I decrypt enciphered code?

Do you want to sniff?

Sniffing often requires not only high level technical skills

but also original ideas.

How can I analyze this encrypted code?

Page 4: 이경문C0%CC%B0... · 2014-06-22 · 하나은행 신한카드 인터넷우체국 국세청 전자세금계산서 e세로 외환은행 현대카드 스탠다드차타드은행 KB국민카드

MITM for SSL - What is SSL?

SSL (Secure Sockets Layer) is a protocol developed by Netscape for transmitting private documents via Internet.

http://www.webopedia.com/TERM/S/SSL.html http://www.ietf.org/rfc/rfc2246.txt?number=2246

Page 5: 이경문C0%CC%B0... · 2014-06-22 · 하나은행 신한카드 인터넷우체국 국세청 전자세금계산서 e세로 외환은행 현대카드 스탠다드차타드은행 KB국민카드

MITM for SSL - What is Secure Server?

A Web server that supports any of the major security protocols, like SSL, that encrypt and decrypt messages to protect them against third party tampering.

http://www.webopedia.com/TERM/S/secure_server.html

Page 6: 이경문C0%CC%B0... · 2014-06-22 · 하나은행 신한카드 인터넷우체국 국세청 전자세금계산서 e세로 외환은행 현대카드 스탠다드차타드은행 KB국민카드

MITM for SSL - What is SSL MITM attack?

The attacker must be positioned between the victim and the server.The attacker intercepts packets and routes them to the SSL Proxy.The SSL Proxy changes the SSL key value in order to get the decrypted information.

Private

Server

Private

Server

Public

Victim

Public

Victim

SSL

Public

Attacker

Private

SSL Proxy

SSL SSL

I can see plain text !!!

Page 7: 이경문C0%CC%B0... · 2014-06-22 · 하나은행 신한카드 인터넷우체국 국세청 전자세금계산서 e세로 외환은행 현대카드 스탠다드차타드은행 KB국민카드

How to disable SSL certificate warning message?

Change HTTP response payload from “https://” to “http://”

http://www.thoughtcrime.org/software/sslstrip/

Page 8: 이경문C0%CC%B0... · 2014-06-22 · 하나은행 신한카드 인터넷우체국 국세청 전자세금계산서 e세로 외환은행 현대카드 스탠다드차타드은행 KB국민카드

How to protect my web site from SSL Strip?

Automatically turn any insecure links referencing the web application into secure links. (For instance, http://example.com/some/page/ will be modified to https://example.com/some/page/ before accessing the server.)

If the security of the connection cannot be ensured (e.g. the server's TLS certificate is self-signed), show an error message and do not allow the user to access the web application.

http://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security https://tools.ietf.org/html/rfc6797

Page 9: 이경문C0%CC%B0... · 2014-06-22 · 하나은행 신한카드 인터넷우체국 국세청 전자세금계산서 e세로 외환은행 현대카드 스탠다드차타드은행 KB국민카드

Strict Transport Security HTTP Response

Page 10: 이경문C0%CC%B0... · 2014-06-22 · 하나은행 신한카드 인터넷우체국 국세청 전자세금계산서 e세로 외환은행 현대카드 스탠다드차타드은행 KB국민카드

Preloaded HSTS sites

A selected subset of the members of the preloaded HSTS list:

Google

Paypal

Twitter

Simple

Linode

Stripe

Lastpass

http://dev.chromium.org/sts

Page 11: 이경문C0%CC%B0... · 2014-06-22 · 하나은행 신한카드 인터넷우체국 국세청 전자세금계산서 e세로 외환은행 현대카드 스탠다드차타드은행 KB국민카드

Java Script Strip

Specific sites protect account information using Java Script Encryption as well as SSL Encryption.

http://www.gilgil.net/783115 http://www.snoopspy.com/988

Page 12: 이경문C0%CC%B0... · 2014-06-22 · 하나은행 신한카드 인터넷우체국 국세청 전자세금계산서 e세로 외환은행 현대카드 스탠다드차타드은행 KB국민카드

STS & JSE

Both STS(Strict Transport Security) and JSE(Java Script Encryption) are good solutions for preventing from hacking account information.

Site STS JSE

google.com O(Preloaded) X

twitter.com O(Preloaded) X

paypal.com O(Preloaded) X

facebook.com O X

naver.com X O

daum.net X O

nate.com X O

11st.co.kr X O

Page 13: 이경문C0%CC%B0... · 2014-06-22 · 하나은행 신한카드 인터넷우체국 국세청 전자세금계산서 e세로 외환은행 현대카드 스탠다드차타드은행 KB국민카드

국내 사이트 현황

국내 은행 사이트, 공공기관 사이트에서는 ActiveX 모듈이 구동되는 곳들이 많이 있다.

Page 14: 이경문C0%CC%B0... · 2014-06-22 · 하나은행 신한카드 인터넷우체국 국세청 전자세금계산서 e세로 외환은행 현대카드 스탠다드차타드은행 KB국민카드

어디에 ActiveX가 사용되나?

키로깅 방지.

방화벽(백신).

전용 암호화 통신.

등등...

Page 15: 이경문C0%CC%B0... · 2014-06-22 · 하나은행 신한카드 인터넷우체국 국세청 전자세금계산서 e세로 외환은행 현대카드 스탠다드차타드은행 KB국민카드

왜 하필 ActiveX가 사용되나?

웹브라우저에서 기본적으로 제공되지 않는 기능을 구현하다 보니 어쩔 수 없이 ActiveX로 구현이 되어 있다.

Page 16: 이경문C0%CC%B0... · 2014-06-22 · 하나은행 신한카드 인터넷우체국 국세청 전자세금계산서 e세로 외환은행 현대카드 스탠다드차타드은행 KB국민카드

무엇이 문제점인가?

웹 접근성 훼손.

외국인 : “천송이 옷 사게 해 주세요”

사용자 동의 없는 무분별한 모듈의 중복 설치.

난 다른 AV 쓰고 있다구... 버럭!!!

이로 인한 시스템의 불안정화.

최소한 블루스크린은 뜨지 말게 해야지...

등등 무지무지 많아서 일일이 열거가 힘듬.

Page 17: 이경문C0%CC%B0... · 2014-06-22 · 하나은행 신한카드 인터넷우체국 국세청 전자세금계산서 e세로 외환은행 현대카드 스탠다드차타드은행 KB국민카드

생각

이러한 사이트에서 ActiveX의 구동 없이 사이트를 이용할 수 있는 방법은 없을까?

Page 18: 이경문C0%CC%B0... · 2014-06-22 · 하나은행 신한카드 인터넷우체국 국세청 전자세금계산서 e세로 외환은행 현대카드 스탠다드차타드은행 KB국민카드

고민

개발자는 개발자스럽게 방법을 고민해 보자!!!

Page 19: 이경문C0%CC%B0... · 2014-06-22 · 하나은행 신한카드 인터넷우체국 국세청 전자세금계산서 e세로 외환은행 현대카드 스탠다드차타드은행 KB국민카드

뭘 했나?

국내 유명 금융 사이트 및 공공기관 사이트를 분함.

트래픽(HTTP, HTTPS)을 분석하여 특정 ActiveX가 어느 시점에, 어떻게 구동되는지 일일이 확인.

하나의 사이트를 분석하는데 적게는 10분, 많게는 몇시간 이상 소요.

Page 20: 이경문C0%CC%B0... · 2014-06-22 · 하나은행 신한카드 인터넷우체국 국세청 전자세금계산서 e세로 외환은행 현대카드 스탠다드차타드은행 KB국민카드

어디 어디 분석했나(1)?

랭키닷컴 TOP 100에서 사이트 선정. 국민은행 www.kbstar.com

우리은행 www.wooribank.com

신한은행 www.shinhan.com

NH농협 www.nonghyup.com

IBK기업은행 www.ibk.co.kr

IBK기업은행 오픈뱅킹 open.ibk.co.kr

하나은행 www.hanabank.com

신한카드 www.shinhancard.com

인터넷우체국 www.epost.go.kr

국세청 전자세금계산서 e세로 www.esero.go.kr

외환은행 www.keb.co.kr

현대카드 www.hyundaicard.com

스탠다드차타드은행 www.standardchartered.co.kr

KB국민카드 www.kbcard.com

Page 21: 이경문C0%CC%B0... · 2014-06-22 · 하나은행 신한카드 인터넷우체국 국세청 전자세금계산서 e세로 외환은행 현대카드 스탠다드차타드은행 KB국민카드

어디 어디 분석했나(2)?

기타 사이트 선정. 비씨카드 www.bccard.com

교육행정정보시스템 www.neis.go.kr

특허로 www.patent.go.kr

삼성카드 www.samsungcard.com

금융결제원 www.kftc.or.kr

시티은행 www.citibank.co.kr

여기 말고도 많이 있음.

Page 22: 이경문C0%CC%B0... · 2014-06-22 · 하나은행 신한카드 인터넷우체국 국세청 전자세금계산서 e세로 외환은행 현대카드 스탠다드차타드은행 KB국민카드

어떤 방식인가?

Web Browser

Java Script or HTML

ActiveX Module

ActiveX Module과 Web Bowser상의 연결 고리인

Javs Script를 내용을 변경하여 연결을 끊는다.

Page 23: 이경문C0%CC%B0... · 2014-06-22 · 하나은행 신한카드 인터넷우체국 국세청 전자세금계산서 e세로 외환은행 현대카드 스탠다드차타드은행 KB국민카드

우회 방식 A(DNS Sinkhole)

특정 사이트는 ActiveX 관련 모듈을 특정 도메인으로부터 받아 감. 해당 domain name을 127.0.0.1로 설정하면 ActiveX 우회 가능.

이 방식은 기존 인터넷에 많이 나와 있음.

사이트 예제 URL

금융결제원 http://ahnlabdownload.nefficient.co.kr/aos/plugin/aosmgr_common.js

나이스 http://update.nprotect.net/netizenv55/gov/neisnew/netizen55_p.js

현대카드 https://supdate.nprotect.net/netizen/card/hyundaicard/81/netizen_multios_check.js

... ...

Page 24: 이경문C0%CC%B0... · 2014-06-22 · 하나은행 신한카드 인터넷우체국 국세청 전자세금계산서 e세로 외환은행 현대카드 스탠다드차타드은행 KB국민카드

우회 방식 B(Web Proxy)

특정 사이트는 ActiveX 관련 모듈을 자체 도메인에서 받아 감. 해당 Domain Name을 127.0.0.1로 설정해서는 우회 불가능.

Web Proxy를 이용해서 해당 파일을 제거.

사이트 예제 URL

농협 https://banking.nonghyup.com/service/js/so/ahnlab/aos/aosmgr_common.js

국민은행 https://oimg1.kbstar.com/js/common/nprotect/op_netizen.js

... ...

Page 25: 이경문C0%CC%B0... · 2014-06-22 · 하나은행 신한카드 인터넷우체국 국세청 전자세금계산서 e세로 외환은행 현대카드 스탠다드차타드은행 KB국민카드

우회 방식 C(HTTP Response)

단순한 파일(html, js 등등)의 제거만으로는 안되는 사이트가 존재.

함수를 일일이 분석해야 하는 번거로움이 있음.

사이트 예제 js file

삼성카드 function scardLogin(sCallback,target,loginMethod,afterMainType) {

// AOS(AhnLab Online Security) 실행 대상 여부 판단

getAosTargetInfo('common-main.js.scardLogin');

...

if(window.location.href.indexOf('menuId=NHPIMCSPCX') > -1) {

if(aos_is_new()) { // AOS(AhnLab Online Security) 설치 여부

체크

aoswrap_run_only(); // AOS(AhnLab Online Security)

구동 실행

...

} else {

alert('PC 방화벽 프로그램이 설치되지 않았습니다. \n\n설치 후 이용해주시기

바랍니다.');

}

} else {

...

}

}

...

Page 26: 이경문C0%CC%B0... · 2014-06-22 · 하나은행 신한카드 인터넷우체국 국세청 전자세금계산서 e세로 외환은행 현대카드 스탠다드차타드은행 KB국민카드

결과

분석한 20개 사이트에서 방화벽(이라 쓰고 멘붕이라 읽는다) ActiveX 모듈은 모두 제거 성공.

키로깅 방지 ActiveX 모듈은 일부 제거 성공

암호화 모듈과 같이 무력화를 하였을 때 서비스를 이용하지 못하는 ActiveX는 제거가 힘듬.

Page 27: 이경문C0%CC%B0... · 2014-06-22 · 하나은행 신한카드 인터넷우체국 국세청 전자세금계산서 e세로 외환은행 현대카드 스탠다드차타드은행 KB국민카드

세부 결과 사이트 우회 모듈

bccard.com nProtect Netizen v5.5, nProtect KeyCrypt V6.0

citibank.co.kr AhnLab Online Security

epost.go.kr EasyKeytec (키보드 보안 프로그램)

esero.go.kr nProtect KeyCrypt V6.0

hanabank.com AhnLab Online Security

hyundaicard.com nProtect Netizen v5.5

ibk.co.kr nProtect Netizen v5.5

kbcard.com nProtect Netizen v5.5, npEfdsWCtrl

kbstar.com nProtect Netizen v5.5

keb.co.kr nProtect Netizen v5.5

kftc.or.kr AhnLab Online Security

neis.go.kr nProtect Netizen v5.5, nProtect X-Guard

nonghyup.com AhnLab Online Security, SoftCamp Secure KeyStroke 4.0

open.ibk.co.kr nProtect Netizen v5.5

patent.go.kr nProtect Netizen v5.5, nProtect KeyCrypt V6.0

samsungcard.com AhnLab Online Security

shinhan.com AhnLab Online Security, SoftCamp Secure KeyStroke 4.0

shinhancard.com nProtect Netizen v5.5

standardchartered.co.kr AhnLab Online Security

wooribank.com AhnLab Online Security

Page 28: 이경문C0%CC%B0... · 2014-06-22 · 하나은행 신한카드 인터넷우체국 국세청 전자세금계산서 e세로 외환은행 현대카드 스탠다드차타드은행 KB국민카드

결론

특정 사이트에 들어 가기만 하면 무조건 설치해야 하는 ActiveX 모듈들에 대해서는 사용자들의 동의를 얻어 선택적으로 설치를 할 수 있도록 하는 배려가 필요함.

Page 29: 이경문C0%CC%B0... · 2014-06-22 · 하나은행 신한카드 인터넷우체국 국세청 전자세금계산서 e세로 외환은행 현대카드 스탠다드차타드은행 KB국민카드

감사합니다.

http://www.gilgil.net

http://www.snoopspy.com

http://powerofcommunity.net/pt2014