PHP cURL Security Bypass

Curl is a command line tool and library for transferring data using URL. Curl supports almost all protocols like HTTP, HTTPs, FTP, FTPs, IMAP, IMAPS etc. CURL comes under free and open source software. The latest stable version of curl is 7.60.0. This was released on 16th May 2018.

There are many servers having Unfiltered curl file support. As curl supports any protocol, there are chances for many attacks like:-

file inclusion Command Injection etc.

Example

The below code is a form.

        <form method="POST" action="beagletest.cgi">
        <input type=text name="Name">
        <input type=submit name=press value="OK">
        </form>

    

The form can be submitted through curl as follows.

        curl --data "Name=sashwat&press=%20OK%20"  http://www.beagleexample.com/beagletest.cgi

    

Using this format, an attacker can use curl to interact with server.

Impact

Using this vulnerability, an attacker can:-

  • 1manipulate sensitive information
  • leak sensitive information
  • gain administrator access to the web application

Mitigation / Precaution

Beagle recommends the following:-

  • Create a whitelist of accepted URLs.
  • Deny the usage of file:// protocol.

Latest Articles