71 Commits
Author SHA1 Message Date
Ricardo van Zutphen 5b619d0a75 Add dir cleanup to processing tests 2019-06-12 00:09:25 +02:00
Jurriaan Bremer c92a2a779e code cleanup 2018-04-21 13:24:13 +02:00
Ricardo van Zutphen bd3489ca78 Add missing file for testing
- And undelete file
2018-04-21 13:01:20 +02:00
Ricardo van Zutphen 434d8c9afb Fix some pdf static issues 2018-04-21 13:01:19 +02:00
Jurriaan Bremer 502128e378 standardize the keys used for extracted artefacts 2017-12-04 06:06:28 +01:00
Jurriaan Bremer 0749faaa0f code cleanup and leftover changes 2017-12-03 06:41:31 +01:00
Jurriaan Bremer 489eb8ba2c finalize some merges
* Simplifies some logic.
* Ensures that there will still be PDF results (for samples submitted as
  PDF) and that the "no pdf metadata" error message remains shown.
* Unit test for #1980 and fixes some other unit tests.

The .LNK parser certainly could use some more bounds checking, but for
now let's keep it as-is.
2017-12-01 18:43:45 +01:00
Jurriaan Bremer de56cf68ff perform static analysis before the extracted module
In the case of Office DDE files the Static module will run a number of
Yara rules and Extractor plugins. In order to record this in our report,
the Extracted processing module should be ran afterwards.

This commit also fixes a regression with regards to not recording PID
and first_seen information in the ExtractScripts class anymore.
2017-11-29 16:07:32 +01:00
Ricardo van Zutphen 53218e55a2 Fix issue #446 and #451 + more js extraction 2017-11-17 07:28:55 +01:00
Jurriaan Bremer 049ffc02bc unittest for suricata parsing error
The underlying issue appears to be the introduction of the CWD which, by
default, takes the $HOME/.cuckoo/ directory - which includes a dot.
2017-11-12 21:24:40 +01:00
Jurriaan Bremer f56688f06f further streamline extractor support for handling office files
This commit introduces and improves a number of things related to static
analysis of malicious Microsoft Office files. In particular:
* Extend Extractor logic to allow for static-only analysis.
* Enhance Yara integration allowing it to take external variables,
  perform on in-memory buffers, and work correctly with Office archives.
* Improve parsing logic of cmd.exe in our Scripting engine.
* More Extracted Artefacts logic and handling as well as versioning.
* Various tweaks and improvements.

This commit is mostly complete, however, it could certainly use more
error/exception handling. We should also more generically catch
exceptions thrown in Extractor plugins.
2017-11-08 14:38:39 +01:00
Jurriaan Bremer 79603bf5fc code cleanup 2017-09-01 23:47:33 +02:00
Daan Spitz 33b81d50f0 fix test for LinuxSystemTap behavioral coverage 2017-08-29 14:17:44 +02:00
Daan Spitz ce8434efd3 add full stap log with forking entries to test files 2017-08-28 16:37:35 +02:00
Jurriaan Bremer cb83bef0de rework some linux analysis things
Provided that large parts of LinuxSystemTap() aren't covered yet
(including the "command_line"-related tweaks) we should await some
additional unit tests.
2017-08-24 17:08:02 +02:00
Jurriaan Bremer 382b66ca69 various tweaks and move elf to its own static.elf key 2017-08-07 14:17:42 +02:00
Jurriaan Bremer 6a95fe79a2 allow processing tests to run on their own 2017-08-01 12:54:12 +02:00
Jurriaan Bremer 14abeb6eed unittest for pdf recursive/openaction/attachment extraction
See also the following PR for more information [1].

[1]: https://github.com/jbremer/cuckoo/pull/2
2017-07-14 17:59:17 +02:00
Jurriaan Bremer d17cb01afa fix unable to open dump-sorted #1676 (thanks lazybluefrog)
In the event of an empty .pcap file (i.e., only the header is present)
our sort_pcap() method doesn't actually get to writing a new pcap
(provided dump_sorted.pcap is only created when there are packets
available). This commit fixes a related warning that'd be thrown in that
case. Also fixes a NoneType issue introduced [1].

[1]: db38a5093c
2017-06-26 19:42:35 +02:00
Jurriaan Bremer f8e9b1f633 simplify deletion of temporary file and unit test #1368 #1025
Thanks to liuchuang for bringing up this issue a while ago and chigley
for providing a patch. This commit merges that patch and simplifies it
a little bit as well as providing some basic unit tests.
2017-06-24 20:57:39 +02:00
Jurriaan Bremer 92939a92d5 avoid empty errors in case of an action
When the "gatherer" action had been sent in, with an empty error
message, the analysis report would feature an empty error string.
2017-06-02 20:45:46 +02:00
Jurriaan Bremer 26fba3e178 move results into its own extracted processing module, yara scripts
Introduces the concept of Yara rules for extracted scripts. We'll likely
also have a category for extracted shellcode soon. First to work on
recursive extraction and allowing 3rd party plugins to, e.g., extract a
shellcode stream from a PowerShell script (statically).
2017-05-27 23:06:11 +02:00
Jurriaan Bremer 0c61c4756e automatically extract embedded scripts from invoked command-lines
This is a first step towards the ability of providing static analysis
on, e.g., PowerShell scripts embedded in the command-line.
2017-05-27 23:05:34 +02:00
Jurriaan Bremer 5c3f7e32d2 walk down the dictionary to fetch nested urls (thanks seanthegeek) 2017-05-09 18:14:16 +02:00
Jurriaan Bremer b807016d25 perform static analysis on .lnk shortcuts
Thanks to Will Schroeder for [1] which in turn was based on [2] by
Jacob Cunningham for code documentation on the file format. This
implementation is loosely based upon it. Includes a simple unittest.

[1]: https://github.com/HarmJ0y/pylnker
[2]: https://code.google.com/archive/p/revealertoolkit/source
2017-05-06 15:31:18 +02:00
Jurriaan Bremer 909fab855d filter duplicate dns responses (thanks doomedraven)
If no DNS caching is in-place then one might see multiple DNS requests
for the same domain and thus also the same DNS responses.
2017-05-03 19:16:27 +02:00
Jurriaan Bremer e5f87bae0d throw a useful error when the wrong vm profile has been set 2017-04-28 11:44:28 +02:00
Jurriaan Bremer c60e0e755e error early on empty memory.dmp file #1467 (thanks Killerwhale91) 2017-04-28 11:42:50 +02:00
Jurriaan Bremer 08c5a2dd7f move empty osprofile check to raise an operational error 2017-04-28 11:27:31 +02:00
Jurriaan Bremer 7329be9aa0 skip incorrectly truncated screenshots #1474 (thanks Maurotb SparkyNZL) 2017-04-27 12:26:24 +02:00
Jurriaan Bremer 6e4451fb3f if volatility is missing skip their unittests altogether 2017-04-25 21:17:10 +02:00
Jurriaan Bremer 51a5bb1995 suppress some superfluous logging from volatility 2017-04-25 20:55:35 +02:00
Jurriaan Bremer cbdae90e68 throw a hard error when an invalid osprofile was selected
This is much better than ending up with the well-known AddressSpace
errors that people have been posting lately #1455 #1388.
2017-04-25 20:55:35 +02:00
Jurriaan Bremer 3d1dfc0e0f require osprofile, unittest selection process, improve logging
From now on it will be possible to set per-VM OS profiles so that one
may have a Windows XP VM as well as a Windows 7 VM etc.
2017-04-25 20:55:35 +02:00
Jurriaan Bremer cc6a901e80 additional volatility module loading tweaks and handling
Raises an exception for ImportError's not related to Volatility which
is useful in case a future update decides to add another dependency
that's not installed by default in our setups.
Removes the attempt at trying to unittest importing Volatility as this
is non-trivial in Python - it has been tested manually, though.
2017-04-25 20:55:35 +02:00
Jurriaan Bremer cb54fede1a start on filling out machine info during results processing
Renames XenServerMachinery to XenServer because "XenServer".lower()
matches the configuration section required by the call to config2(),
all the other machineries already had the correct non-lower names.
2017-04-25 20:55:35 +02:00
Jurriaan Bremer 7435f5495b proper error message for missing volatility dependencies #1418 (thanks plaxer)
Unit testing import statements isn't the most trivial, but the
distorm3-related lines have been tested manually as working.
2017-04-19 17:30:20 +02:00
Jurriaan Bremer cd006f51bf handle missing status field in spoofed http _response obj
And of course some code cleanup. This is a temporary change and we
should come up with a more proper solution in httpreplay directly.
2017-04-03 19:16:57 +02:00
Jurriaan Bremer 0b97275133 handle targetinfo with missing archive files 2017-04-03 18:19:32 +02:00
Jurriaan Bremer 764b7cc01f use weasyprint to create a pdf report (to be UX'd) 2017-03-23 14:26:52 +01:00
Jurriaan Bremer 46b032694a provide static analysis of archived samples
* Make Static handle archives transparently.
* Take the "exe" package for granted just as the others.
* Move get_keys() to File where it's more appropriate.
2017-03-22 14:59:16 +01:00
Jurriaan Bremer 7066301f70 make network unittest work without internet access
What some network downtime may show you :-)
2017-03-22 14:19:29 +01:00
Jurriaan Bremer 8211466d85 move config dict to dictionary conversion to set-options
This simplifies unittests which would otherwise have to
.set_options(Dictionary({ ... }).
2017-03-22 14:10:15 +01:00
Jurriaan Bremer a2e2cf8fa7 analysis summary and targetinfo archive support
In order to show proper information about the file that has been
analyzed, these two need each other. From now on the reports will be
able to share information (size, hashes, etc) about the actual file
being analyzed rather than the archive around it.
Introduces the concept of temporary files that are removed after the
object expires / is no longer used.
2017-03-22 10:55:05 +01:00
Jurriaan Bremer 1dcf1654c3 embed archives in targetinfo and display in recent page 2017-03-21 13:41:20 +01:00
Jurriaan Bremer 9988d5b045 fixup url processing issue with droidmon module #1316 (thanks andr6)
A dictionary containing set()'s as values was returned in the case the
analysis category was "not file".
2017-03-19 23:51:42 +01:00
Jurriaan Bremer 0356883c45 wip on host vs guest communication issues and more
* Identify and report Host <> Guest connection issues and drop hints to
  the user in both the command-line logs as well as the Web Interface.
* Provide FAQ entry for these issues.
* Only keep unique errors & actions in the report.
* Some other documentation tweaks (regarding formatting etc).
2017-03-16 12:48:34 +01:00
Jurriaan Bremer 2687e33ec6 Merge branch 'internal/http-page' into package
Conflicts:
	tests/test_processing.py
2017-03-10 16:11:41 +01:00
Jurriaan Bremer f03e1d7a52 move procmon output parsing to stdlib xml
Which releases us of the necessary lxml dependency (aside from that
still being used in the peepdf dependency currently).
2017-03-10 01:16:51 +01:00
Jurriaan Bremer ac17e1761c further minimize on reading in configuration files
It's most certainly not necessary to read in configuration files once or
multiple times for each processed analysis. We strip down on re-reading
configuration files by, yet again, moving away from Config() usage to
the config() and config2() variants (which cache results).

* Use config2() to obtain cached versions of the configuration values
  for running Auxiliary, Processing, and Reporting modules.
* Get rid of Config() usage in some processing modules.
* Unittests for all of the above, including a unittest which ensures
  that Config() is only called twice when processing multiple analyses;
  once for reading in processing.conf and once for reporting.conf.

Without these changes, it would be possible to have a dozens (although
for larger analyses this could be much, much more) configuration reads
per processed analysis.
2017-03-06 15:31:47 +01:00