기본 콘텐츠로 건너뛰기

[Fighting-youth]First-project

힘내라 청춘 - 첫 번째 프로젝트

오디오 파일 포맷 퍼징_첫 번째 기록

2017년 목표 중에 하나 였던 취약점 찾기를 한해가 끝날 무렵 시작하게 되었다. 취약점은 프로그래밍 실수에서 비롯된다는 점에 착안하여 비교적 쉬운 파일 구조의 오디오 파일 퍼징을 프로젝트 주제를 잡았다. 복잡한 단일 모델 처리와 간단한 다중 모델 처리 시 프로그래밍 실수는 언제 더 많이 발생하는 가에 대한 고민을 했을 때, 복잡성이 낮더라도 여러 모델을 처리해야 할 경우 논리적 결함이 발생할 확률이 더 높지 않는 가하는 결론에 도달했다.

먼저 파일 구조 분석을 시작한 것은 WAV와 AIFF 파일이다. WAV 파일은 검색 시 자료를 쉽게 구할 수 있으며, Peach Fuzzer에서 Tutorial로 제공해주는 파일 구조라서 도입 단계에서 진행 계획을 수립하기에 적합하다고 판단되었다. AIFF 파일은 개발된지 상당히 오래된 구조로 무손실 음원을 위해 활용되는 파일이다.

WAV 파일 다음으로 AIFF 파일을 선택한 이유는 파일 퍼징 시 코드 커버리지를 높일 수 있는 방법은 해당 프로그램이 지원하는 파일 형식을 모두 대입하는 것 또한 하나의 방법이 될 수 있지 않을 까하는 판단에서 선택하였다. 많이 사용되는 mp3 나 mp4 와 같은 파일 형식은 이미 여러 퍼저들의 다양한 데이터 모델을 통해서 검증되었으리라 생각된다. 이에 비교적 검증 횟수가 적은 코드 경로를 거치기 위해서 사용률이 낮은 파일 형식을 선별하여 퍼징 테스트를 진행하고자 한다.

목표 프로그램 테스트 수행 전 단계로 VUPlayer를 활용하고 있으며, 아래는 현재 작성 중인 AIFF 데이터모델이다.

<?xml version="1.0" encoding="utf-8"?>
<Peach xmlns="http://peachfuzzer.com/2012/Peach" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://peachfuzzer.com/2012/Peach /peach/peach.xsd">

    <DataModel name="Chunk">
        <String name="ID" length="4" padCharacter=" "/>
        <Number name="Size" size="32" endian="big">
            <Relation type="size" of="Data"/>
        </Number>
        <Blob name="Data"/>
    </DataModel>

    <DataModel name="COMMChunk" ref="Chunk">
        <String name="ID" value="COMM" token="true"/>
        <Number name="numChannels" size="16"/>
        <Number name="numSampleFrames" size="32"/>
        <Number name="sampleSize" size="16"/>
        <String name="sampleRate" length="10"/>
    </DataModel>

    <DataModel name="FORMChunk" ref="Chunk">
        <String name="ID" value="FORM" token="true"/>
    </DataModel>

    <DataModel name="INSTChunk" ref="Chunk">
        <String name="ID" value="INST" token="true"/>
    </DataModel>

    <DataModel name="MARKChunk" ref="Chunk">
        <String name="ID" value="MARK" token="true"/>
    </DataModel>

    <DataModel name="SKIPChunk" ref="Chunk">
        <String name="ID" value="SKIP" token="true"/>
    </DataModel>

    <DataModel name="SSNDChunk" ref="Chunk">
        <String name="ID" value="SSND" token="true"/>
        <Number name="offset" size="32" value="0"/>
    </DataModel>

    <!-- Defines the format of a AIFF file -->
    <DataModel name="Aiff">
        <!-- aiff header -->
        <String name="ID" value="FORM" token="true"/>
        <Number name="Size" value="46992" size="32"/>
        <String name="Type" value="AIFF" token="true"/>

        <Choice name="DataChunk" maxOccurs="30000">
            <Block ref="COMMChunk"/>
            <Block ref="FORMChunk"/>
            <Block ref="INSTChunk"/>
            <Block ref="MARKChunk"/>
            <Block ref="SKIPChunk"/>
            <Block ref="SSNDChunk"/>
            <Block ref="Chunk"/>
        </Choice>
    </DataModel>

    <!-- This is our simple aiff state model -->
    <StateModel name="TheState" initialState="Initial">
        <State name="Initial">

            <!-- Write out our aiff file -->
            <Action type="output">
                <DataModel ref="Aiff"/>
                <!-- This is our sample file to read in -->
                <Data fileName="C:\Peach_fuzz\samples_aiff\sample.aif"/>
            </Action>

            <Action type="close"/>

            <!-- Launch the target process -->
            <Action type="call" method="StartMPlayer" publisher="Peach.Agent"/>
        </State>
    </StateModel>


    <!-- TODO: Configure agent -->
     <!--<Agent name="TheAgent" location="http://127.0.0.1:9000"/>-->

    <Agent name="WinAgent">
        <Monitor class="WindowsDebugger">

            <!-- The command line to run.  Notice the filename provided matched up
             to what is provided below in the Publisher configuration -->
            <Param name="CommandLine" value="C:\Program Files (x86)\VUPlayer\VUPlayer.exe fuzzed.aif"/>
            <!-- windbg 경로를 설정합니다. 64비트 peach라면 반드시 64비트 디버거여야 함 -->
            <Param name="WinDbgPath" value="C:\Program Files\Debugging Tools for Windows (x64)\"/>

            <!-- This parameter will cause the debugger to wait for an action-call in
             the state model with a method="StartMPlayer" before running
             program.
             -->
            <Param name="StartOnCall" value="StartMPlayer"/>

            <!-- This parameter will cause the monitor to terminate the process
             once the CPU usage reaches zero.
             -->
            <Param name="CpuKill" value="true"/>

        </Monitor>

        <!-- Enable heap debugging on our process as well. -->
        <Monitor class="PageHeap">
            <Param name="Executable" value="C:\Program Files (x86)\VUPlayer\VUPlayer.exe"/>
            <Param name="WinDbgPath" value="C:\Program Files\Debugging Tools for Windows (x64)\"/>
        </Monitor>

    </Agent>

    <Test name="Default">
        <Agent ref="WinAgent" platform="windows"/>


        <StateModel ref="TheState"/>

        <Publisher class="File">
            <Param name="FileName" value="fuzzed.aif"/>
        </Publisher>
        <Logger class="Filesystem">
            <Param name="Path" value="logs"/>
        </Logger>
    </Test>


</Peach>
<!-- end -->

이 블로그의 인기 게시물

데일 카네기 인간관계론 정리

Remove-Server-Header

응답 메시지 내 서버 버전 정보 제거 1. Apache 1) 조치 방법 “/etc/htpd/conf/httpd.conf” 파일 안에서 1. ServerTokens OS → ServerTokens Prod 2. ServerSignature On → ServerSignature Off 로 변경한 후 아파치를 재시작하면 헤더 값의 아파치 버전 정보 및 OS 정보를 제거할 수 있다. 2) 참고 URL http://zetawiki.com/wiki/CentOS_ 아파치_보안권장설정_ServerTokens_Prod,_ServerSignature_Off 2. IIS 1) 조치 방법 IIS 6.0 urlscan_setup 실행. 설치. \windows\system32\inetsrv\urlscan\urlscan.ini 파일을 열어 다음 수정(RemoveServerHeader=0 을 RemoveServerHeader=1 로 변경) 서비스에서 IIS Admin Service 재시작. IIS 7.0 IIS 관리자를 열고 관리하려는 수준으로 이동합니다. 기능 보기에서 HTTP 응답 헤더를 두 번 클릭합니다. HTTP 응답 헤더 페이지에서 제거할 헤더를 선택합니다. 작업 창에서 제거를 클릭하고 예를 클릭합니다. 2) 참고 URL IIS 6.0 : http://gonnie.tistory.com/entry/iis6- 응답헤더-감추기 IIS 7.0 : https://technet.microsoft.com/ko-kr/library/cc733102(v=ws.10).aspx 3. jetty 1) 조치 방법 “jetty.xml” 파일에서 jetty.send.server.version=false 설정 2) 참고 URL http://attenuated-perspicacity.blogspot.kr/2009/09/jetty-61x-hardening.html 4. Nginx ...

Linux-BlueBorne-vulnerabilities

Linux BlueBorne vulnerabilities 리눅스 블루투스 스택(BlueZ)에서 두 개의 보안 취약사항이 발견되었다. 이 취약점들은 2017년 9월 12일자로 공개 되어 BlueBorne 이라는 이름으로 불리고 있으며, 해당 취약점을 보유하고 있는 벤더 사 제품이 존재하여 총 8개의 취약점으로 분류되어졌다. 1) CVE-2017-1000250 이 취약점은 bluetoothd 프로세스에 존재하며, SDP server 요청을 처리하는 과정에서 나타난다. service_search_attr_req (src/sdpd-request.c) 함수에서 sdp 검색 요청 속성을 처리할 때 정보를 유출한다. 이로 인해 희생자 단말 사용자와 상호작용 없이, 어떤 사전의 인증 없이(페어링), 스택의 Service discovery protocol (SDP) server를 엑세스할 수 있다. 이 취약점은 bluetooth 프로세스의 힙으로 부터 정보 유출을 유도할 수 있으며, 여기에는 블루투스 암호 키나 다른 가치있는 데이터가 포함된다. Simple Service Discovery Protocol SSDP(Simple Service Discovery Protocol)은 네트워크 서비스나 정보를 찾기 위해서 사용하는 네트워크 프로토콜이다. SSDP를 이용하면, DHCP나 DNS와 같은 네트워크 서버 혹은 정적인 호스트 설정 없이 이런 일들을 수행할 수 있다. SSDP는 일반 거주지와 소규모 사무 환경에서 UPnP(Universal Plug and Play)를 위한 기본적인 프로토콜로 이미 널리 사용하고 있다. 1999년 MS와 HP가 IETF에 드래프트 했다. IETF제안이 만료된 이후 SSDP는 UPnP 표준에 포함됐다. 이 취약점의 세부사항을 살펴보자. 출처: joinc - SSDP 이 취약점의 세부사항을 살펴보자. - SDP 서버 검색 속성 핸들러( service_search_attr_req, under s...