<?xml version="1.0" encoding="US-ASCII" ?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
<!ENTITY RFC2616 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2616.xml"><!--HTTP 1.1-->
<!ENTITY RFC3749 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.3749.xml"><!--TLS Compression -->
<!ENTITY RFC5246 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5246.xml"> <!-- TLS 1.2 -->
<!ENTITY ID-SPDY SYSTEM "http://xml.resource.org/public/rfc/bibxml3/reference.I-D.draft-mbelshe-httpbis-spdy-00.xml">

<!-- entities for RFC requirement keywords -->
<!ENTITY MUST "MUST">
<!ENTITY MUST_NOT "MUST&nbsp;NOT">
<!ENTITY SHALL "SHALL">
<!ENTITY SHALL_NOT "SHALL&nbsp;NOT">
<!ENTITY REQUIRED "REQUIRED">
<!ENTITY SHOULD "SHOULD">
<!ENTITY SHOULD_NOT "SHOULD&nbsp;NOT">
<!ENTITY RECOMMENDED "RECOMMENDED">
<!ENTITY NOT_RECOMMENDED "NOT&nbsp;RECOMMENDED">
<!ENTITY OPTIONAL "OPTIONAL">
<!ENTITY MAY "MAY">

<!-- additional generic entities -->

<!-- protocol-specific entities -->
]>

<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>
<?rfc strict="yes" ?>
<?rfc toc="yes"?>
<?rfc tocdepth="4"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes" ?>
<?rfc compact="yes" ?>
<?rfc subcompact="no" ?>

<rfc category="bcp" docName="draft-kihara-compression-considered-harmful-01" ipr="trust200902">

  <front>
    <title abbrev="Compression Considered Harmful">Considerations for Protocols with Compression over TLS</title>

    <author fullname="Boku Kihara" initials="B." surname="Kihara">
      <organization>Lepidum Co. Ltd.</organization>

      <address>
        <postal>
          <street>#602, Village Sasazuka 3</street>
          <street>1-30-3 Sasazuka</street>
          <city>Shibuya-ku</city><region>Tokyo</region>
          <country>JP</country>
        </postal>

        <email>kihara@lepidum.co.jp</email>
      </address>
    </author>

    <author fullname="Kazuki Shimizu" initials="K." surname="Shimizu">
      <organization>Lepidum Co. Ltd.</organization>
    </author>

    <date /> <!-- year="2012" month="October" day="15" /> -->

    <!-- Meta-data Declarations -->

    <area>Applications</area>
    <keyword>Internet-Draft, TLS, compression, side channel attack</keyword>

    <abstract>
      <t>
        Transport Layer Security is essential to secret communications in the Internet, and protecting TLS is our fundamental task.
        This document describes a threat to TLS when compression is used and proposes possible mitigations of the threat.
      </t>
    </abstract>

  </front>

<middle>

<section title="Introduction">
    <t>
        <xref target="RFC5246">Transport Layer Security</xref> is, needless to say, essential to contemporary customs in the Internet like secret communications on the web.
        Names, passwords, telephone numbers, credit card numbers, messages, session ids, and any other secrets are transported on TLS.
        Therefore, protecting TLS and underlying Public Key Infrastructure is our fundamental task.
        Unfortunately, TLS and PKI are not infallible, and sometimes vulnerable to new attack vectors.
        This document describes conditions for <xref target="CRIME">the CRIME attack</xref> which utilizes differences of compression rates to guess secret information from outside the encrypted transports and proposes possible mitigations of the threat that should be considered when someone designs protocols with compression.
    </t>
</section>

<section anchor="conditions" title="Conditions of Attacks">
    <t>
        "Commonly-used lossless compression algorithms leak information about the data being compressed, in the size of the compressor output." <xref target="IACR-fse-2002-3091"/>
        In other words, by nature compressing data has the risk of information leakage.
        Usually information from the size of compressed data is not enough to guess the secret easily; however, under some conditions the attack becomes much easier.
    </t>
    <t>
        Observing encrypted data itself is not so useful.
        Though, if the attacker can inject string into the compression context where the secret is compressed, the attacker would be able to know whether the injected string matches the secret or not.
        In addition, difference of the size of the compressed data in multiple tries will help the attacker to perform brute-force attacks.
    </t>
    <t>
        [[[More precise conditions are needed. For example, initalizing compression contexts on each try will be a great help.]]]
        [[[Note that ANY KIND OF COMPRESSION WILL REVEAL SECRETS REGARDLESS OF THE LAYER OF COMPRESSION, including TLS compression, SPDY, and HTTP gzip.]]]
    </t>
</section>

<section anchor="applications" title="Application to Existing Protocols">
    <section title="Attacks on HTTP">
        <t>
            The original CRIME is targeted at <xref target="RFC2616">HTTP</xref>.
            Web browsers tend to make requests according to malicious scripts, sending secret strings automatically together with injected strings by the scripts.
            To make matters worse, <xref target="RFC3749">TLS compression</xref> and <xref target="I-D.mbelshe-httpbis-spdy">SPDY</xref> had been compressing all data in the same context.
            Therefore, stealing session cookies by the CRIME attack was very easy.
            As a workaround, some web browsers disabled TLS compression and SPDY compression partially
            so that session cookies and bearer-token-type Authorization tokens cannot be stolen.
            However, compression of HTTP entities is still available and it is possible to guess some protions of HTTP entities
            if servers return injected strings in HTTP entities.
        </t>
   </section>

    <section title="More Applications">
        <t>
            [[[More applications are needed? Currently we have not found such applications.]]]
        </t>
    </section>
</section>

<section anchor="mitigations" title="Possible Mitigations">
    <section title="Abandon of Compression">
        <t>
            In principle, abandon of compression completely solves the problem of information leakage by compression.
            It is &RECOMMENDED; to disable compression when communications are not trivial, unless traffic increase is considerable.
            If data are confidentital and other mitigations are inapplicable, all kinds of compression &MUST; be disabled.
        </t>
    </section>
    <section title="Compressing Non-Sensitive Data Only">
        <t>
            The problem that this document describes is information leakage by compression.
            However, if transferred data are not sensitive, we do not have to take care of the problem.
            Therefore compressing non-sensitive data will save bandwidth without exposing sensitive data.
            Note that dynamically-generated contents can contain sensitive data and SHOULD NOT be compressed.
        </t>
    </section>
    <section title="Using Static Dictionary for Compression">
        <t>
            The CRIME attack utilizes differences of compression rate to estimate that the candidate string matches the sensitive data or not.
            In order to prevent such attacks, using static dictionary will be effective, especially when compressing patterned contents like HTTP headers.
        </t>
    </section>
    <section title="Inserting Random Paddings">
        <t>
            If it is unavoidable to compress whole data in the same context, inserting random paddings will be available to prevent disclosure of the original size of compressed data. Note that this mitigation cannot prevent attackers from guessing secrets by statistical approaches.
        </t>
        <t>
            [[[Requirements of padding (ranges of length, randomness, and so on) and quantitative evaluations are needed.]]]
        </t>
    </section>
    <section title="Detecting and Blocking Attacks">
        <t>
            To achieve attacks on compression, attackers have to make multiple traffics in order to observe differences of compresion rate.
            Therefore, detecting too frequent requests and blocking such requests will mitigate attacks.
            Note that this mitigation cannot prevent attacks completely and &SHOULD; be used with other mitigations.
        </t>
    </section>
    <section title="More Mitigations">
        <t>
            [[[There should be more mitigations.]]]
        </t>
    </section>
</section>

<section anchor="security-considerations" title="Security Considerations">
<t>
This document focuses on security.
</t>
</section>

<section anchor="iana-considerations" title="IANA Considerations">
<t>
This document does not require actions by IANA.
</t>
</section>


</middle>

<back>
    <references title="Informative References">
        &RFC5246;
        &RFC2616;
        &RFC3749;
        &ID-SPDY;
        <reference anchor="IACR-fse-2002-3091" target="http://www.iacr.org/cryptodb/archive/2002/FSE/3091/3091.pdf">
            <front>
                <title>Compression and Information Leakage of Plaintext</title>
                <author fullname="John Kelsey" initials="J.K." surname="Kelsey"/>
            </front>
            <seriesInfo name="IACR" value="fse-2002-3091"/>
        </reference>
        <reference anchor="CRIME" target="https://docs.google.com/presentation/d/11eBmGiHbYcHR9gL5nDyZChu_-lCa2GizeuOfaLU2HOU/edit?pli=1#slide=id.g1d134dff_1_222">
            <front>
                <title>The CRIME Attack</title>
                <author fullname="Juliano Rizzo" initials="J.R." surname="Rizzo"/>
                <author fullname="Thai Duong" initials="T.D." surname="Duong"/>
            </front>
            <seriesInfo name="" value=""/>
        </reference>
    </references>
</back>
</rfc>










