Goal Reached Thanks to every supporter — we hit 100%!

Goal: 1000 CNY · Raised: 1000 CNY

100.0%

CVE-2016-2402 PoC — Square OkHttp 安全漏洞

Source
Associated Vulnerability
Title:Square OkHttp 安全漏洞 (CVE-2016-2402)
Description:Square OkHttp是美国Square公司的一套用于Android系统和Java应用程序的HTTP和HTTP /2客户端软件。该软件支持同步阻塞调用和回调的异步调用、响应缓存避免网络重复请求等。 Square OkHttp 2.7.4之前的版本和3.1.2之前的3.x版本中存在安全漏洞。攻击者可利用该漏洞实施中间人攻击,绕过证书锁定。
Description
OkHttp sample app vulnerable to CVE-2016-2402
Readme
# OkHttp simple-client app vulnerable to CVE-2016-2402

This is a fork of the default [simple-client](https://github.com/square/okhttp/blob/okhttp_31/samples/simple-client) from the okhttp project.

Simple-client is a Java app that just does a GET request to https://api.github.com and fetches the names of okhttp's contributors.

This fork has been edited so that OkHttp 3.0.1 is used for networking connections and certificate pinning is also used.

OkHttp 3.0.1 is vulnerable to CVE-2016-2402 - this app demonstrates the flaw.

For more information please read:

* [https://koz.io/pinning-cve-2016-2402](https://koz.io/pinning-cve-2016-2402)
* [https://www.cigital.com/blog/ineffective-certificate-pinning-implementations/](https://www.cigital.com/blog/ineffective-certificate-pinning-implementations/)


## Building

To build the app, first clone the repository and then run:

`ant build`

## Usage

If you don't have the private key of a CA trusted by your system's JRE, you'll have to add the proxy's certificate to your CA store.
Let's say CA_CERT.pem is your proxy's CA certificate.

`$cp /etc/ssl/certs/java/cacerts .`

`$keytool -import -trustcacerts -alias ikozCA -file CA_CERT.pem -keystore cacerts -storepass changeit`

Then start simple-client using the following parameters to connect through a local proxy

`$java -DproxyHost=127.0.0.1 -DproxyPort=8080 -Djavax.net.ssl.trustStore=cacerts -jar certPinningVulnerableOkHttp.jar`

John Kozyrakis
File Snapshot

[4.0K] /data/pocs/3a18a3aa4b19a525094bd9e563decb39c9a0db20 ├── [8.8K] build.xml ├── [297K] certPinningVulnerableOkHttp.jar ├── [4.0K] lib │   ├── [224K] gson-2.6.2.jar │   ├── [319K] okhttp-3.0.1.jar │   └── [ 64K] okio-1.6.0.jar ├── [1.4K] README.md └── [4.0K] src ├── [4.0K] META-INF │   └── [ 69] MANIFEST.MF └── [4.0K] okhttp3 └── [4.0K] sample └── [2.0K] OkHttpContributors.java 5 directories, 8 files
Shenlong Bot has cached this for you
Remarks
    1. It is advised to access via the original source first.
    2. If the original source is unavailable, please email f.jinxu#gmail.com for a local snapshot (replace # with @).
    3. Shenlong has snapshotted the POC code for you. To support long-term maintenance, please consider donating. Thank you for your support.