Wednesday, August 29, 2012

WAF Normalization and I18N

WAF Normalization and I18N:
Submitted By Breno Silva Pinto and Ryan Barnett

WAF Normalization and I18N

Web application firewalls must be able to handle Internationaliztion (I18N) and thus properly handle various data encodings including Unicode and UTF-8 in order to prevent not only evasion issues but also to minimize false positives.  In an earlier blog post, we highlighted ModSecurity's new support for Unicode mapping and decoding.  This capability helps us to more accurately decode characters from different Unicode code points.  While this certainly helps our accuracy, we still had the issue of UTF-8 encodings..  This is a challenge for any WAF as it must be able to handle UTF-8 encodings of characters for different languages such as Portuquese.  So, if you are running ModSecurity to protect a non-English language website then this blog post is for you!  We introduce a new transformation function called utf8toUnicode that helps to normalize data for inspection.

Incorrect UTF-8 Decoding

We have received some recent reports of false positive issues with the OWASP ModSecurity CRS that were due to existence of UTF-8 encoded characters.  As an example, the Portuguese language has many "special" characters with different accent characters.  For example:

1-    á Á  ã Ã â Â à À
2-    é É ê Ê í Í
3-    ó Ó õ Õ ô Ô
4-    ú Ú ü Ü
5-    ç Ç 
When these characters are UTF-8 encoded, they use multiple bytes.  As an example, the "ę" character is encoded as "%c4%99".  If ModSecurity only applies the standard t:urlDecodeUni, it will decode each byte individually which results in an impedance mismatch.  In this case, this incorrect decoding resulted in a false positive match against some SQL Injection rules in the OWASP ModSecurity CRS.  While this is a bit of a pain, it is not as bad as a false negative bypass situation that may be caused by this type of incorrect decoding.  Let's look an this type of SQL Injection evasion issue.  What if  we send the following request:
http://172.16.51.132/index.php?foo=’úníón+séléct+data+fróm+námés
Let's see how ModSecurity will decode this data when checking for an example SQL Injection keyword:
Recipe: Invoking rule 21b67e38;
Rule 21b67e38: SecRule "ARGS:foo"
"@rx select"
"phase:2,log,auditlog,pass,id:1111,t:urlDecodeUni"
T (0) urlDecodeUni:
"'\xc3\xban\xc3\xad\xc3\xb3n s\xc3\xa9l\xc3\xa9ct
data fr\xc3\xb3m n\xc3\xa1m\xc3\xa9s"
Transformation completed in 13 usec.
Executing operator "rx" with
param "select" against ARGS:foo.
Target value:
"'\xc3\xban\xc3\xad\xc3\xb3n s\xc3\xa9l\xc3\xa9ct data fr\xc3\xb3m
n\xc3\xa1m\xc3\xa9s"
Operator completed in 7 usec.
Rule
returned 0.
As you can see above the character sequence “úníón+séléct+data+fróm+námés“ was handled by the engine as “\xc3\xban\xc3\xad\xc3\xb3n
s\xc3\xa9l\xc3\xa9ct data fr\xc3\xb3m n\xc3\xa1m\xc3\xa9s”.
However the rule
was looking for the pattern “select”.  So, what happen if the application applies best-fit mapping conversions and removes the accents before sending the data to
the database ? This may allow the payload to bypass our signatures.

Utf8 to Unicode Mapping

In order to better handle this data, we should first map the UTF-8 encoded data to Unicode and then use the unicode point mapping capabilities mentioned at the beginning of the blog post.  This configuration is achieved by first setting the SecUnicodeCodePage and SecUnicodeMapFile directives in your main ModSecurity configuration file:
SecUnicodeCodePage 20127
SecUnicodeMapFile /etc/apache2/unicode.mapping
The SecUnicodeCodePage directive sets the proper Unicode code point used for your site.  The example 20127 is the US-ASCII code point.  The SecUnicodeMapFile poinst to the unicode.mapping file that comes with the ModSecurity source archive and includes all of the Unicode conversions.  Here is an example of the 20127 (US-ASCII) mapping data:
20127 (US-ASCII)
00a0:20 00a1:21 00a2:63 00a4:24 00a5:59 00a6:7c 00a9:43 00aa:61
00ab:3c 00ad:2d 00ae:52 00b2:32 00b3:33 00b7:2e 00b8:2c 00b9:31 00ba:6f 00bb:3e
00c0:41 00c1:41 00c2:41 00c3:41 00c4:41 00c5:41 00c6:41 00c7:43 00c8:45 00c9:45
00ca:45 00cb:45 00cc:49 00cd:49 00ce:49 00cf:49 00d0:44 00d1:4e 00d2:4f 00d3:4f
00d4:4f 00d5:4f 00d6:4f 00d8:4f 00d9:55 00da:55 00db:55 00dc:55 00dd:59 00e0:61
00e1:61 00e2:61 00e3:61 00e4:61
00e5:61 00e6:61 00e7:63 00e8:65
00e9:65 00ea:65 00eb:65 00ec:69 00ed:69 00ee:69 00ef:69 00f1:6e 00f2:6f 00f3:6f
00f4:6f 00f5:6f 00f6:6f 00f8:6f 00f9:75 00fa:75 00fb:75 00fc:75 00fd:79 00ff:79
0100:41 0101:61 0102:41 0103:61 0104:41 0105:61 0106:43 0107:63 0108:43 0109:63
010a:43 010b:63 010c:43 010d:63 010e:44 010f:64 0110:44 0111:64 0112:45 0113:65
0114:45 0115:65 0116:45 0117:65 0118:45 0119:65 011a:45 011b:65 011c:47 011d:67
011e:47 011f:67 0120:47 0121:67 0122:47 0123:67 0124:48 0125:68 0126:48 0127:68
0128:49 0129:69 012a:49 012b:69 012c:49 012d:69 012e:49 012f:69 0130:49 0131:69
0134:4a 0135:6a 0136:4b 0137:6b 0139:4c 013a:6c 013b:4c 013c:6c 013d:4c 013e:6c
0141:4c 0142:6c 0143:4e 0144:6e 0145:4e 0146:6e 0147:4e 0148:6e 014c:4f 014d:6f
014e:4f 014f:6f 0150:4f 0151:6f 0152:4f 0153:6f 0154:52 0155:72 0156:52 0157:72
0158:52 0159:72 015a:53 015b:73 015c:53 015d:73 015e:53 015f:73 0160:53 0161:73
0162:54 0163:74 0164:54 0165:74 0166:54 0167:74 0168:55 0169:75 016a:55 016b:75
016c:55 016d:75 016e:55 016f:75 0170:55 0171:75 0172:55 0173:75 0174:57 0175:77
0176:59 0177:79 0178:59 0179:5a 017b:5a 017c:7a 017d:5a 017e:7a 0180:62 0189:44
0191:46 0192:66 0197:49 019a:6c 019f:4f 01a0:4f 01a1:6f 01ab:74 01ae:54 01af:55
01b0:75 01b6:7a 01cd:41 01ce:61 01cf:49 01d0:69 01d1:4f 01d2:6f 01d3:55 01d4:75
01d5:55 01d6:75 01d7:55 01d8:75 01d9:55 01da:75 01db:55 01dc:75 01de:41 01df:61
01e4:47 01e5:67 01e6:47 01e7:67 01e8:4b 01e9:6b 01ea:4f 01eb:6f 01ec:4f 01ed:6f
01f0:6a 0261:67 02b9:27 02ba:22 02bc:27 02c4:5e 02c6:5e 02c8:27 02cb:60 02cd:5f
02dc:7e 0300:60 0302:5e 0303:7e 030e:22 0331:5f 0332:5f 2000:20 2001:20 2002:20
2003:20 2004:20 2005:20 2006:20 2010:2d 2011:2d 2013:2d 2014:2d 2018:27 2019:27
201a:2c 201c:22 201d:22 201e:22 2022:2e 2026:2e 2032:27 2035:60 2039:3c 203a:3e
2122:54 ff01:21 ff02:22 ff03:23 ff04:24 ff05:25 ff06:26 ff07:27 ff08:28 ff09:29
ff0a:2a ff0b:2b ff0c:2c ff0d:2d ff0e:2e ff0f:2f ff10:30 ff11:31 ff12:32 ff13:33
ff14:34 ff15:35 ff16:36 ff17:37 ff18:38 ff19:39 ff1a:3a ff1b:3b ff1c:3c ff1d:3d
ff1e:3e ff20:40 ff21:41 ff22:42 ff23:43 ff24:44 ff25:45 ff26:46 ff27:47 ff28:48
ff29:49 ff2a:4a ff2b:4b ff2c:4c ff2d:4d ff2e:4e ff2f:4f ff30:50 ff31:51 ff32:52
ff33:53 ff34:54 ff35:55 ff36:56 ff37:57 ff38:58 ff39:59 ff3a:5a ff3b:5b ff3c:5c
ff3d:5d ff3e:5e ff3f:5f ff40:60 ff41:61 ff42:62 ff43:63 ff44:64 ff45:65 ff46:66
ff47:67 ff48:68 ff49:69 ff4a:6a ff4b:6b ff4c:6c ff4d:6d ff4e:6e ff4f:6f ff50:70
ff51:71 ff52:72 ff53:73 ff54:74 ff55:75 ff56:76 ff57:77 ff58:78 ff59:79 ff5a:7a
ff5b:7b ff5c:7c ff5d:7d ff5e:7e
With these Unicode mapping directives in place, we now can use the new t:utf8toUnicode transformation function which was just added to the v2.7.0 code.  Here is a new example rule:
SecRule "ARGS:foo" "@rx select" "phase:2,log,auditlog,pass,id:1111,t:utf8toUnicode,t:urlDecodeUni"
Let’s see how ModSecurity will handle the same request, but now
using the mentioned features:

Recipe: Invoking rule 21717d58;
Rule 21717d58: SecRule "ARGS:foo"
"@rx select"
"phase:2,log,auditlog,pass,id:1111,t:utf8toUnicode,t:urlDecodeUni"
T (0) Utf8toUnicode:
"'%u00fan%u00ed%u00f3n
s%u00e9l%u00e9ct data fr%u00f3m n%u00e1m%u00e9s"
T (0) urlDecodeUni:
"'union select data from names"
Transformation completed in 29 usec.
Executing operator "rx" with
param "select" against ARGS:foo.
Target value: "'union select data from
names"
Operator completed in 16 usec.
Warning. Pattern match "select"
at ARGS:foo.
Rule
returned 1.
As you can see, the sequence “úníón+séléct+data+fróm+names” is now normalized to “union select data from names” and thus the rule matched.  Summarizing the engine steps for data
normalization:
  1. Attacker input: úníón+séléct+data+fróm+names.
  2. Input in UTF-8 format: \xc3\xban\xc3\xad\xc3\xb3n s\xc3\xa9l\xc3\xa9ct data
    fr\xc3\xb3m n\xc3\xa1m\xc3\xa9s
  3. Input in Unicode format: %u00fan%u00ed%u00f3n s%u00e9l%u00e9ct data fr%u00f3m
    n%u00e1m%u00e9s 
  4. Input in ASCII format: union select data from names
With this new UTF-8 and Unicode mapping and decoding support, ModSecurity can now more accurately normalize data from
non-english languages which results in better rule accuracy.

Backward Compatibility Plays to Malware’s Hands

Backward Compatibility Plays to Malware’s Hands:
Maintaining backward compatibility in software products is
hard. Technology evolves on a daily basis, and while it feels “right” to go
ahead and ditch the old technology in favor of the new, it sometimes might
cause issues, especially when a software platform which millions of developers develop
for is in question. However, it turns out that the desire of software vendors
to keep backward compatibly is abused by malware authors.
Let’s have a look at a piece of malware recently spotted in
the wild:

XML_heaplib
Most of you will find it familiar, since it is the latest MS
XML Core Services vulnerability (CVE-2012-1889) along with the notorious
heaplib which became popular once more thanks to this vulnerability. But wait,
something is weird about this snippet from heaplib… look at the if-else
statement at the beginning of the screenshot – it was modified from the
original version and now has those semicolons. So why did the malware authors
put them there?
Let’s have a look at a simpler case:

If_else_semicolon
All modern browsers consider this code as an invalid
JavaScript, and won’t execute even a single line of it. IE, on the other hand,
considers this as a perfectly legitimate JavaScript, and will execute the alert
function with x=3.
So why did the malware author modify heaplib like this? It
should be quite clear now that:
  1. It can be used as an
    evasion technique and avoid running unnecessary heap spraying on browsers that
    aren’t relevant to this specific CVE.
  2. It can be used as a method
    to trick various dynamic analysis engines such as Wepawet and JS-Unpack. Such
    engines usually handle well only strict JavaScript, based on the RFC, without
    vendor quirks.
Great, so we know what the problem is, and what it is good
for, but what about a solution?

We tried to get an answer from MS regarding why would IE allow such syntax for
JavaScript, and were responded that it is supported in IE versions <9 and in
the compatibility mode of 9 and 10. Since the compatibility mode can be easily
requested by the page (X-UA-Compatible), even users who use the most modern
version of Microsoft’s browsers are still vulnerable to this trick.
We learn 2 things from this event:
  1. Straying too far away from
    standards and supporting all sorts of quirks not only can, but will, turn into a
    security risk.
  2. Malware authors continue
    with their efforts to not only discover new vulnerabilities, but also to find interesting
    ways
    to evade security engines.
Unfortunately, it is not possible to force IE to use the
standards mode for internet sites, so our best advice for IE users would be to
keep the system up-to-date with the latest security updates at all times.

Tuesday, August 28, 2012

[News] Java 7 0-Day vulnerability information and mitigation.

[News] Java 7 0-Day vulnerability information and mitigation.: The cat is out of the bag. There is a 0-day out there currently being used in targeted attacks. The number of these attacks has been relatively low, but it is likely to increase due to the fact that this is a fast and reliable exploit that can be used in drive-by attacks and all kinds of links in emails. Interestingly, Mark Wuergler mentioned on August 10 that VulnDisco SA CANVAS exploit pack now has a new Java 0-day. It makes you wonder if it is the same exploit that leaked from, or was found in the wild and then added to the CANVAS pack. Or if it is totally unrelated and there are two 0-day exploits now.
The purpose of this post is not to provide the vulnerability analysis or samples, but to offer additional information that may help prevent infections on some targeted networks. We all know what kind of damage Java vulnerabilities can cause if used in drive by exploits or in exploit packs. We believe that revealing technical vulnerability details in the form of a detailed technical analysis is dangerous, and releasing working exploits before the patch is vain and irresponsible.
The Oracle patch cycle is 4 months (middle of February, June, October) with bugfixes 2 months after the patch. The next patch day is October 16 - almost two months away. Oracle almost never issue out-of-cycle patches but hopefully they will do consider it serious enough to do it this time.
We have been in contact with Michael Schierl the Java expert who discovered a number of Java vulnerabilities, including recent the Java Rhino CVE-2011-3544 / ZDI-11-305 and CVE-2012-1723. We asked him to have a look at this last exploit . Michael sent his detailed analysis, which we will publish in the nearest future and a patch , which we offer on a per request basis today.
The reason for limited release is the fact that this patch can be reversed, thus making the job of exploit creation easier, which certainly is not our goal.
Atif Mushtaq from FireEye covered the payload part of the exploit, which is helpful and something to look out for if you are protecting your network or your customers. We should note that attackers are not limited to .net addresses and already used other domains and IP addresses.

Monday, August 27, 2012

Post Exploitation Command Lists - Request to Edit

Post Exploitation Command Lists - Request to Edit:
The post exploitation command lists:
Linux/Unix/BSD Post Exploitation:
https://docs.google.com/document/d/1ObQB6hmVvRPCgPTRZM5NMH034VDM-1N-EWPRz2770K4/edit
Windows Post Exploitation:
https://docs.google.com/document/d/1U10isynOpQtrIK6ChuReu-K1WHTJm4fgG3joiuz43rw/edit
OSX Post Exploitation:
https://docs.google.com/document/d/10AUm_zUdAQGgoHNo_eS0SO1K-24VVYnulUD2x3rJD3k/edit
and the newly added Obsucure Syststem's Post Exploitation:
https://docs.google.com/document/d/1CIs6O1kMR-bXAT80U6Jficsqm0yR5dKUfUQgwiIKzgc/edit
and Metasploit Post Exploitation:
https://docs.google.com/document/d/1ZrDJMQkrp_YbU_9Ni9wMNF2m3nIPEA_kekqqqA2Ywto/edit
Have been a weekly upkeep for me with so many… I don't know what to call it, 'undesirable edits' to them. Bad copies, bad pastes, formatting issues and some times deletion or vandalism of the docs. Anyways, I have finally broken down and removed 'world' editable permissions. Anyone who has these links can still comment and copy the docs, but they can no longer edit them directly.
If you would like to contribute, please shoot me a tweet, a email, a .. anything and I will gladly add you to the permissions to edit. Honestly it just became so overwhelming that every time I thought to add something I would cringe away because I know I'd spend most of time fixing them.
Anyone enough of my crying, please if you have stuff to add or are just really good at fixing up formatting, let me know and I'll add you to the editors list.
Thanks,
mubix

Thursday, August 23, 2012

[News] Some Signs Point to Shamoon as Malware in Aramco Attack

[News] Some Signs Point to Shamoon as Malware in Aramco Attack: While researchers continue to dig into the Shamoon malware, looking for its origins and a complete understanding of its capabilities, a group calling itself the Cutting Sword of Justice is claiming responsibility for an attack on the massive Saudi oil company Aramco, which some experts believe employed Shamoon to destroy data on thousands of machines.
The attack on Aramco occurred on August 15, taking the main Web site of Saudi Aramco offline. Officials at the company said that the attack affected some of the company's workstations, but did not have any effect on oil production or on the main Aramco networks. The attackers claiming responsibility for the incident dispute that, saying that they deployed a destructive piece of malware that erased data on infected machines and then made them unusable.
"As previously said by hackers, about 30000 (30k) of clients and servers in the company were completely destroyed. Symantec, McAfee and Kaspersky wrote a detail analysis about the virus, good job. Hackers published the range of internal clients IPs which were found in the internal network and became one of the phases of the attack target," the group said in a post on Pastebin shortly after the attack.

Monday, August 20, 2012

Endpoint Security Management Buyer’s Guide: Ongoing Controls—File Integrity Monitoring

Endpoint Security Management Buyer’s Guide: Ongoing Controls—File Integrity Monitoring:
After hitting on the first of the ongoing controls, device control, we now turn to File Integrity Monitoring (FIM). Also called change monitoring, this entails monitoring files to see if and when files change. This capability is important for endpoint security management. Here are a few scenarios where FIM is particularly useful:

  • Malware detection: Malware does many bad things to your devices. It can load software, and change configurations and registry settings. But another common technique is to change system files. For instance, a compromised IP stack could be installed to direct all your traffic to a server in Eastern Europe, and you might never be the wiser.
  • Unauthorized changes: These may not be malicious but can still cause serious problems. They can be caused by many things, including operational failure and bad patches, but ill intent is not necessary for exposure.
  • PCI compliance: Requirement 11.5 in our favorite prescriptive regulatory mandate, the PCI-DSS, requires file integrity monitoring to alert personnel to unauthorized modification of critical system files, configuration files, or content files. So there you have it – you can justify the expenditure with the compliance hammer, but remember that security is about more than checking the compliance box, so we will focus on getting value from the investment as well.

FIM Process


Again we start with a process that can be used to implement file integrity monitoring. Technology controls for endpoint security management don’t work well without appropriate supporting processes.

  • Set policy: Start by defining your policy, identifying which files on which devices need to be monitored. But there are tens of millions of files in your environment so you need to be pretty savvy to limit monitoring to the most sensitive files on the most sensitive devices.
  • Baseline files: Then ensure the files you assess are in a known good state. This may involve evaluating version, creation and modification date, or any other file attribute to provide assurance that the file is legitimate. If you declare something malicious to be normal and allowed, things go downhill quickly. The good news is that FIM vendors have databases of these attributes for billions of known good and bad files, and that intelligence is a key part of their products.
  • Monitor: Next you actually monitor usage of the files. This is easier said than done because you may see hundreds of file changes on a normal day. So knowing a good change from a bad change is essential. You need a way to minimize false positives from flagging legitimate changes to avoid wasting everyone’s time.
  • Alert: When an unauthorized change is detected you need to let someone know.
  • Report: FIM is required for PCI compliance, and you will likely use that budget to buy it. So you need to be able to substantiate effective use for your assessor. That means generating reports. Good times.

Technology Considerations


Now that you have the process in place, you need some technology to implement FIM. Here are some things to think about when looking at these tools:

  • Device and application support: Obviously the first order of business is to make sure the vendor supports the devices and applications you need to protect. We will talk about this more under research and intelligence, below.
  • Policy Granularity: You will want to make sure your product can support different policies by device. For example, a POS device in a store (within PCI scope) needs to have certain files under control, while an information kiosk on a segmented Internet-only network in your lobby may not need the same level of oversight. You will also want to be able to set up those policies based on groups of users and device types (locking down Windows XP tighter, for example, as it doesn’t newer protections in Windows 7).
  • Small footprint agent: In order to implement FIM you will need an agent on each protected device. Of course there are different definitions of what an ‘agent’ is, and whether one needs to be persistent or it can be downloaded as needed to check the file system and then removed – a “dissolvable agent”. You will need sufficient platform support as well as some kind of tamper proofing of the agent. You don’t want an attacker to turn off or otherwise compromise the agent’s ability to monitor files – or even worse, to return tampered results.
  • Frequency of monitoring: Related to the persistent vs. dissolvable agent question, you need to determine whether you require continuous monitoring of files or batch assessment is acceptable. Before you respond “Duh! Of course we want to monitor files at all times!” remember that to take full advantage of continuous monitoring, you must be able to respond immediately to every alert. Do you have 24/7 ops staff ready to pounce on every change notification? No? Then perhaps a batch process could work.
  • Research & Intelligence: A large part of successful FIM is knowing a good change from a potentially bad change. That requires some kind of research and intelligence capability to do the legwork. The last thing you want your expensive and resource-constrained operations folks doing is assembling monthly lists of file changes for a patch cycle. Your vendor needs to do that. But it’s a bit more complicated, so here are some other notes on detecting bad file changes.

    • Change detection algorithm: Is a change detected based on file hash, version, creation date, modification date, or privileges? Or all of the above? Understanding how the vendor determines a file has changed enables you to ensure all your threat models are factored in.
    • Version control: Remember that even a legitimate file may not be the right one. Let’s say you are updating a system file, but an older legitimate version is installed. Is that a big deal? If the file is vulnerable to an attack it could be, so ensuring that versions are managed by integrating with patch information is also a must.
    • Risk assessment: It’s also helpful if the vendor can assess different kinds of changes for potential risk. Replacing the IP stack is a higher-risk change than updating an infrequently used configuration file. Again, either could be bad, but you need to prioritize, and a first cut from the vendor cut can be useful.
  • Forensics: In the event of a data loss you will want a forensics capability such as a log of all file activity. Knowing when different files were accessed, by what programs, and what was done can be very helpful for assessing the damage of an attack and nailing down the chain of events which resulted in data loss.
  • Closed loop reconciliation: Thousands of file adds, deletes, and changes happen every – and most are authorized and legitimate. That said, for both compliance and operational reliability, you want to be able to reconcile the changes you expect against the changes that actually happened. During a patch cycle, a bunch of changes should have happened. Did all of them complete successfully? We mentioned verification in the patch management process, and FIM technology can provide that reconciliation as well.
  • Integration with Platform: There is no reason to reinvent the wheel – especially for cross-functional capabilities such as discovery, reporting, agentry, and agent deployment/updating/maintenance – so leverage your endpoint security management platform to streamline implementation and for operational leverage.

This description of file integrity monitoring completes our controls discussion. Between periodic and ongoing controls you have seen with a fairly comprehensive toolset for managing the security of endpoints in your environment. We have alluded extensively to the Endpoint Security Management platform, and in the next post will flesh it out – as well as mentioning buying considerations.

- Mike Rothman
(0) Comments

Thursday, August 16, 2012

ShellBag Analysis

ShellBag Analysis: What are "shellbags"?
To get an understanding of what "shellbags" are, I'd suggest that you start by reading Chad Tilbury's excellent SANS Forensic blog post on the topic.  I'm not going to try to steal Chad's thunder...he does a great job of explaining what these artifacts are, so there's really no sense in rehashing everything.

Discussion of this topic goes back well before Chad's post, with this DFRWS 2009 paper.  Before that, John McCash talked about ShellBag Registry Forensics on the SANS Forensics blog.  Even Microsoft mentions the keys in question in KB 813711. 

Without going into a lot of detail, a user's shell window preferences are maintained in the Registry, and the hive and keys being used to record these preferences will depend upon the version of the Windows operating system.  Microsoft wants the user to have a great experience while using the operating system and applications, right?  If a user opens up a window on the Desktop and repositions and resizes that window, how annoying would it be to shut the system down, and have to come back the next day and have to do it all over again?  Because this information is recorded in the Registry, it is available to analysts who can parse and interpret the data. As such, "ShellBags" is sort of a colloquial term used to refer to a specific area of Registry analysis.

Tools such as Registry Decoder, TZWorks sbag, and RegRipper are capable of decoding and presenting the information available in the ShellBags.

How can ShellBags help an investigation?
I think that one of the biggest issues with ShellBags analysis is that, much like other lines of analysis that involve the Windows Registry, they're poorly understood, and as such, underutilized.  Artifacts like the ShellBags can be very beneficial to an examiner, depending upon the type of examination they're conducting.  Much like the analysis of other Windows artifacts, ShellBags can demonstrate a user's access to resources, often well after that resource is no longer available.  ShellBag analysis can demonstrate access to folders, files, external storage devices, and network resources.  Under the appropriate conditions, the user's access to these resources will be recorded and persist well after the accessed resource has been deleted, or is no longer accessible via the system.

If an organization has an acceptable use policy, ShellBags data may demonstrate violations of that policy, by illustrating access to file paths with questionable names, such as what may be available via a thumb drive or DVD.  Or, it may be a violation of acceptable use policies to access another employee's computer without their consent, such as:

Desktop\My Network Places\user-PC\\\user-PC\Users

...or to access other systems, such as:

Desktop\My Network Places\192.168.23.6\\\192.168.23.6\c$

Further, because of how .zip files are handled by default on Windows systems, ShellBag analysis can illustrate that a user not only had a zipped archive on their system, but that they opened it and viewed subfolders within the archive.

This is what it looks like when I accessed Zip file subfolders on my system:

Desktop\Users\AppData\Local\Temp\RR.zip\DVD\RegRipper\DVD

Access to devices will also be recorded in these Registry keys, including access to specific resources on those devices.

For example, from the ShellBags data available on my own system I was able to see where I'd accessed an Android system:


Desktop\My Computer\F:\Android\data


...as well as a digital camera...

Desktop\My Computer\Canon EOS DIGITAL REBEL XTi\CF\DCIM\334CANON

...and an iPod.

Desktop\My Computer\Harlan s iPod\Internal Storage\DCIM

Another aspect of ShellBags analysis that can be valuable to an examination is by the analyst developing an understanding the actual data structures, referred to as "shell item ID lists", used within the ShellBag.  It turns out that these data structures are not only used in other values within the Registry, but they're also used in other artifacts, such as Windows shortcut/LNK files, as well as within Jump List files.  Understanding and being able to recognize and parse these structures lets an analyst get the most out of the available data.

Locating Possible Data Exfil/Infil Paths via ShellBags
As information regarding access to removable storage devices and network resources can be recorded in the ShellBags, this data may be used to demonstrate infiltration/infection or data exfiltration paths.

For example, one means of getting data off of a system is via FTP.  Many Windows users aren't aware that Windows has a command line FTP client, although some are; in my experience, it's more often intruders who are conversant in the use of the command line client.  One way that analysts look for the use of the FTP client (i.e., ftp.exe) is via Prefetch files, as well as via the MUICache Registry key.

However, another way to access FTP on a Windows system is via the Windows Explorer shell itself.  I've worked with a couple of organizations that used FTP for large file transfers and had us use this process rather than use the command line client.   A couple of sites provide simple instructions regarding how to use FTP via Windows Explorer:

MS FTP FAQ
HostGator: Using FTP via Windows Explorer

Here's what a URI entry looks like when parsed (obfuscated, of course):

Desktop\Explorer\ftp://www.site.com

One of the data types recorded within the ShellBags keys is a "URI", and this data structure includes an embedded time stamp, as well as the protocol (ie, ftp, http, etc.) used in the communications.  The embedded time stamp appears (via timeline analysis) to correlate with when the attempt was made to connect to the FTP site.  If the connection is successful, you will likely find a corresponding entry for the site in the NTUSER.DAT hive, in the path:

HKCU/Software/Microsoft/FTP/Accounts/www.site.com

Much like access via the keyboard, remote access to the system that provides shell-based control, such as via RDP, will often facilitate the use of other graphical tools, including the use of the Windows Explorer shell for off-system communications.  ShellBag analysis may lead to some very interesting findings, not only with respect to what a user may have done, but also other resources an intruder may have accessed.

Summary
Like other Windows artifacts, ShellBags persist well after the accessed resources are no longer available.  Knowing how to parse and interpret this Registry data

Parsing ShellBags data can provide you with indications of access to external resources, potentially providing indications of one avenue of off-system communications.  If the concern is data infiltration ("how did that get here?"), you may find indications of access to an external resource, followed by indications of access to Zip file subfolders.  ShellBags can be used to demonstrate access to resources where no other indications are available (because they weren't recorded some where else, or because they were intentionally deleted), or they can be used in conjunction with other resources to build a stronger case.  Incorporation of ShellBag data into timelines for analysis can also provide some very valuable insight that might not otherwise be available to the analyst.

Resources
ForensicsWiki Shell Item page