SESSION ID:AIR-R12 THE BOTTOM OF THE BARREL: … · 4. Security Analyst with Cisco Umbrella for a...

78
SESSION ID: #RSAC Patrick Colford THE BOTTOM OF THE BARREL: SCRAPING PASTEBIN FOR OBFUSCATED MALWARE AIR-R12 Security Analyst Cisco Umbrella (formerly OpenDNS) Twitter: @kaoticrequiem

Transcript of SESSION ID:AIR-R12 THE BOTTOM OF THE BARREL: … · 4. Security Analyst with Cisco Umbrella for a...

SESSION ID:

#RSAC

Patrick Colford

THE BOTTOM OF THE BARREL:SCRAPING PASTEBIN FOR OBFUSCATED MALWARE

AIR-R12

Security AnalystCisco Umbrella (formerly OpenDNS)Twitter: @kaoticrequiem

#RSAC

Session Outline

2

Introductions - Who’s this Guy and What’s Pastebin?

Problems - Obfuscated Malware a-Plenty

Solutions - Fiercecroissant, a scrappy Pastebin scraper

Findings & Applications - What to look for, some interesting users, and what you might do with it all.

#RSAC

INTRODUCTIONS

#RSAC

Who’s This Guy? - About the Speaker

4

Security Analyst with Cisco Umbrella for a year and a half, employee with ODNS for 5 years.

Love of teaching, dancing, gaming, musical theater, and traveling.

Born on April 19th! Time for a birthday selfie, if you don’t mind.

#RSAC

The Barrel that is Pastebin

5

#RSAC

#RSAC

#RSAC

#RSAC

#RSAC

#RSAC

PROBLEMS

#RSAC

Obfuscated Malware on Pastebin

12

#RSAC

Malware in the Wild

13

#RSAC

Malware in the Wild

14

#RSAC

Malware in the Wild

15

#RSAC

Obfuscated Malware on Pastebin…5 Years Ago!

16

#RSAC

SOLUTIONS

#RSAC

Fiercecroissant: a Scrappy Scraper

18

Three parts to blocking bad stuff from Pastebin:Python scraper to detect it; python because it’s easy to use and we’re looking for non-word patterns.Decoding of commonly used obfuscation techniques to turn pastes into executables. Python is also good at this!Throwing of said executables into a sandbox environment: Threat Grid

#RSAC

Fiercecroissant: a Scrappy Scraper

19

Step One: Scrape that bin!

#RSAC

Fiercecroissant: a Scrappy Scraper

20

Step One: Scrape that bin!

#RSAC

Fiercecroissant: a Scrappy Scraper

21

Step One: Scrape that bin!

#RSAC

Fiercecroissant: a Scrappy Scraper

22

Step One: Scrape that bin!

#RSAC

Fiercecroissant: a Scrappy Scraper

23

Step One: Scrape that bin!

#RSAC

Fiercecroissant: a Scrappy Scraper

24

Step One: Scrape that bin!

#RSAC

Fiercecroissant: a Scrappy Scraper

25

Step One: Scrape that bin!

#RSAC

Fiercecroissant: a Scrappy Scraper

26

Step Two: Decode that paste!

#RSAC

Fiercecroissant: a Scrappy Scraper

27

Step Two: Decode that paste!

#RSAC

Fiercecroissant: a Scrappy Scraper

28

Step Two: Decode that paste!

#RSAC

Fiercecroissant: a Scrappy Scraper

29

Step Two: Decode that paste!

#RSAC

30

#RSAC

But I can’t read assembly! D:

#RSAC

Fiercecroissant: a Scrappy Scraper

32

Step Three: Run that malware!

#RSAC

Fiercecroissant: a Scrappy Scraper

33

Step Three: Run that malware!

#RSAC

Fiercecroissant: a Scrappy Scraper

34

Step Three: Run that malware!Delicious DNS information:

#RSAC

FINDINGS AND APPLICATIONS

#RSAC

Lessons and interesting stats!

36

2,230+ domains found through Fiercecroissant through May with 799 blocks as of November 2017. 29,229 pastes have been collected since its beginning. Most blocks (50%+) are DDNS domains.Malware comes in two forms:

Raw encoded text, usually in Base64 or binary, but which also has been observed as ASCII or hex values.Wrapped within another language as an encoded value.

Common wrappers are PHP and Java, but Visual Basic has also been observed.There’s a lot of malicious stuff on Pastebin to find: c99 shells, defacement kits, hacking guides, and images likely used for phishing.

#RSAC

Lessons and interesting stats!

37

2,230+ domains found through Fiercecroissant through May with 799 blocks as of November 2017. 29,229 pastes have been collected since its beginning. Most blocks (50%+) are DDNS domains.Malware comes in two forms:

Raw encoded text, usually in Base64 or binary, but which also has been observed as ASCII or hex values.Wrapped within another language as an encoded value.

Common wrappers are PHP and Java, but Visual Basic has also been observed.There’s a lot of malicious stuff on Pastebin to find: c99 shells, defacement kits, hacking guides, and images likely used for phishing.

#RSAC

Lessons and interesting stats!

38

2,230+ domains found through Fiercecroissant through May with 799 blocks as of November 2017. 29,229 pastes have been collected since its beginning. Most blocks (50%+) are DDNS domains.Malware comes in two forms:

Raw encoded text, usually in Base64 or binary, but which also has been observed as ASCII or hex values.Wrapped within another language as an encoded value.

Common wrappers are PHP and Java, but Visual Basic has also been observed.There’s a lot of malicious stuff on Pastebin to find: c99 shells, defacement kits, hacking guides, and images likely used for phishing.

#RSAC

Lessons and interesting stats!

39

2,230+ domains found through Fiercecroissant through May with 799 blocks as of November 2017. 29,229 pastes have been collected since its beginning. Most blocks (50%+) are DDNS domains.Malware comes in two forms:

Raw encoded text, usually in Base64 or binary, but which also has been observed as ASCII or hex values.Wrapped within another language as an encoded value.

Common wrappers are PHP and Java, but Visual Basic has also been observed.There’s a lot of malicious stuff on Pastebin to find: c99 shells, defacement kits, hacking guides, and images likely used for phishing.

#RSAC

Examples: Base64 (Clear)

40

#RSAC

Examples: Base64 (Reversed)

41

#RSAC

Examples: Base64 (Substitution)

42

#RSAC

Examples: Base64 (Wrapped)

43

#RSAC

Examples: Binary

44

#RSAC

Examples: Hexadecimal (unstructured)

45

#RSAC

Examples: Hexadecimal (byte structure)

46

#RSAC

Examples: ASCII

47

#RSAC

Examples: PHP (c99 shells)

48

#RSAC

Examples: PHP (c99 shells)

49

#RSAC

Examples: PHP (c99 shells)

50

#RSAC

Examples: Images! (Phishing)

51

#RSAC

Examples: Images! (Phishing)

52

#RSAC

Examples: Images! (Hidden Information?)

53

#RSAC

THREE PEOPLE WALK INTO A BIN

The Scriptkiddie, the “Whitehat”, and the Wildcard

#RSAC

Examples: Routine Bad Actors - Ribang

55

PB user for 4 years. Most active since ‘17.

Lots of shells and defacement scripts.

Part of the IndoXploit team.

#RSAC

Examples: Routine Bad Actors - Ribang

56

PB user for 4 years. Most active since ‘17.

Lots of shells and defacement scripts.

Part of the IndoXploit team.

#RSAC

Baby’s First Defacer

57

#RSAC

Examples: Routine Bad Actors - Ribang

58

PB user for 4 years. Most active since ‘17.

Lots of shells and defacement scripts.

Part of the IndoXploit team.

#RSAC

Examples: Routine Good(?) Actors (PELITABANGSA)

59

PB user for 1 year.

“Whitehat” (?) researcher.

Uses PB to disclose shells, defacement scripts, teach techniques, and maybe also apologize for hacking people.

#RSAC

Examples: Routine Good(?) Actors (PELITABANGSA)

60

PB user for 1 year.

“Whitehat” (?) researcher.

Uses PB to disclose shells, defacement scripts, teach techniques, and maybe also apologize for hacking people.

#RSAC

Examples: Routine Good(?) Actors (PELITABANGSA)

61

#RSAC

Examples: Routine Good(?) Actors (PELITABANGSA)

62

PB user for 1 year.

“Whitehat” (?) researcher.

Uses PB to disclose shells, defacement scripts, teach techniques, and maybe also apologize for hacking people.

#RSAC

Examples: Routine Good(?) Actors (PELITABANGSA)

63

Uses PB to disclose shells, defacement scripts, teach techniques, and maybe also apologize for hacking people.

#RSAC

This isn’t responsible disclosure at all! D:

64

Uses PB to disclose shells, defacement scripts, teach techniques, and maybe also apologize for hacking people.

#RSAC

Examples: Routine Bad Actors (Breaker9691)

65

PB user for 3 years.

History of questionable pastes.

May have deleted prior malicious submissions.

#RSAC

Examples: Routine Bad Actors (Breaker9691)

66

PB user for 3 years.

History of questionable pastes.

May have deleted prior malicious submissions.

#RSAC

Examples: Routine Bad Actors (Breaker9691)

67

History of questionable pastes.

#RSAC

Examples: Routine Bad Actors (Breaker9691)

68

#RSAC

#RSAC

Examples: Routine Bad Actors (Breaker9691)

70

#RSAC

Examples: Routine Bad Actors (Breaker9691)

71

#RSAC

Examples: Routine Bad Actors (Breaker9691)

72

PB user for 3 years.

History of questionable pastes.

May have deleted prior malicious submissions.

#RSAC

Examples: Routine Bad Actors (Breaker9691)

73

#RSAC

#RSAC

#RSAC

#RSAC

“Apply” Slide

77

There is a ton of malicious stuff on Pastebin that you may not be aware of, either as a security professional or as a corporate entity. Start scraping it! Find the malware before it finds you!

Pastebin is still regularly used by malicious actors for different kinds of things. Just because it’s ancient in internet terms doesn’t mean it’s ignorable.

Consider blocking Pastebin if you have no need for it. As a vector for attacks and misleading information, it can quickly become a security concern.

Malicious actors will keep adapting. It’s important to review information from peers in the security community to adapt your defenses as well. ASCII detection was added in large part thanks to @ScumBots

#RSAC

Sources:

78

1. https://twitter.com/pastebin/status/5419121872838615042. https://blog.sucuri.net/2015/01/website-backdoors-leverage-the-pastebin-service.html

About Me! Twitter: @kaoticrequiem email: [email protected] or [email protected]

About FC:https://github.com/kaoticrequiem/fiercecroissant/