34 Commits
Author SHA1 Message Date
Nex 1962aa3fa8 Using safelist/blocklist 2020-06-02 09:30:18 +02:00
Ricardo van Zutphen 25eb3d25f7 Add tests 2019-05-18 23:22:32 +02:00
ihatecsv d168984fc0 Fixed valid docstrings to comply with PEP 257 2019-05-13 13:31:29 +02:00
Jurriaan Bremer ab1f694f6c resolve a number of incorrect file-related unit tests
Before the Files & Folders classes would actually create directories
such as "/tmp". Now that logic has been stripped away, these unit tests
throw errors as they should've for a long time already.
2018-02-18 04:20:50 +01:00
Jurriaan Bremer 5f552c0eea per-user tmpdir and move tmpdir verification around
Finally introduce the per-user temporary directory usage, i.e., if
multiple users on a system run Cuckoo, they'll not share the same
temporary directory which would almost always break one of the two
setups.

Also slightly move the tmpdir verification (and creation!) as it was
called too early before. Namely, before the check_config() and other
similar code was executed, leaving us with odd errors.
2018-02-18 03:32:15 +01:00
Jurriaan Bremer c895a6cba4 remove javascript beautification from logs processing
Besides the fact that it is slow, it's also causing exceptions on one
specific "function(p,a,c,k,e,d){...}" payload as can be seen in the new
unit test. We should revisit the beautification once again later on, and
perhaps introduce those blobs as Extracted Artifacts.
2018-01-14 14:40:56 +01:00
Jurriaan Bremer c1d36d9a93 further integrate and make cwd whitelists available
Adds some CWD migrations and unit tests to #1791. Also replaces the
custom domain whitelist logic in the network.py processing module with
the already existing is_whitelisted_domain() method as well as fixes an
issue when calling is_whitelisted_domain() the first time.
2017-08-25 14:54:27 +02:00
Jurriaan Bremer f7bd4b37ad slight tweaks to latest pr merges 2017-08-25 13:49:22 +02:00
doomedraven 2d5b411d3b allow some invalid urls with double schema for example
maybe will be extended in future
2017-08-25 13:21:54 +02:00
Jurriaan Bremer 831a9859ad mitigate arbitrary file overwrite issue (thanks Hayden Eskriett)
Due to code refactoring a little while ago a vulnerability had been
introduced in the way that the Cuckoo API accepts submitted files.
Particularly, the /tasks/create/file API endpoint wouldn't properly
sanitize the filepath provided by the user.
2017-05-19 14:04:28 +02:00
Jurriaan Bremer 6bf00570ca validate-hash should accept only hashes (thanks heavyknights)
Before validate_hash() would accept any string with the correct length
and strip out any non-alphabet characters basically, turning, e.g.,
"http://cuckoosandbox.org/1234567" (a URL with length 32) into
"httpcuckoosandboxorg1234567", which naturally isn't a valid hash.
2017-04-20 14:21:55 +02:00
Jurriaan Bremer b4be1b90c0 only allow integer task ids for tasks/info/ 2017-03-29 00:32:10 +02:00
Jurriaan Bremer 8a4495f2c7 get rid of two more usages of old-style config 2017-03-23 00:41:49 +01:00
Jurriaan Bremer 9a5c4aba73 properly display url and archives in postsubmit
* From now on we'll be masking URLs with hxxp:// & hxxps:// as per
  the "industry standard" on not revealing a clickable URL directly.
* Represent archive analyses with the filename & archive name.
2017-03-21 01:17:16 +01:00
Jurriaan Bremer 90fd97b44d prevent potential mongodb injection
I'm not sure if this is a real attack scenario, but better safe than
sorry. Small start on what should later be a complete MongoDB
abstraction layer.
2017-02-27 17:45:07 +01:00
Jurriaan Bremer 168cabf867 various submission-related improvements
* Kill off a couple of path disclosure items that were in plain sight.
* Update to SFlock 0.2.5 which features a "filepath" sanitize flag.
* Properly merge analysis options provided by the Web Interface.
* Actually show the filename / URL in the postsubmission screen.
* Some minor tweaks.
2017-02-21 01:09:25 +01:00
Jurriaan Bremer 1c661d6c5b Merge core-submit into package (using imerge) 2017-02-20 20:21:19 +01:00
Jurriaan Bremer 0061f0498d code cleanup 2017-02-18 20:49:55 +01:00
Jurriaan Bremer 25efe9a263 tweak validate-url function to be more user-friendly
* For now only allow http/https URLs (as, e.g., we don't support FTP).
* If no URL scheme has been provided, try http by default.
2017-01-29 10:36:58 +01:00
Jurriaan Bremer b0711db3da future signature compatibility with older cuckoo versions
Just in case we ever get to a stage where our current Signature version
criteria is not good enough (e.g., support for multiple major releases)
we will be able to provide backwards compatibility through the enable()
method. With the new Signature inheritance support it will be possible
to backport certain features into the Cuckoo Community repository
(again, if this will ever be necessary).
2017-01-18 00:04:16 +01:00
Jurriaan Bremer 9cb3184989 update and unit test signature version pinning 2016-12-15 21:13:12 +01:00
Jurriaan Bremer 18a658b377 Merge branch 'jbremer/core_feedback' into package
This merge commit also performs the following changes:
* Introduce "sanitize" flag for configuration values.
* Add "feedback" to configuration.
* Normalize configuration-related changes of the feedback module.
* Adjust unit tests to adhere to changes from this PR.
* Code cleanup.

Conflicts:
	cuckoo/common/config.py
2016-11-23 16:57:23 +01:00
Sander Ferdinand 5fee26fa0a Cuckoo feedback unit testing - additional features: Added a 'deepcopy' feature to core Folders() class (for which there is also an unit test) and replaced the 'safe dict lookup' function in the AbstractMongo class by using reduce() 2016-11-21 18:38:26 +01:00
Jurriaan Bremer 83f903e887 first draft on getting cuckoo ready to r/w configuration
This commit has been manually verified to result in pretty much the same
configuration as we'd expect before this commit took place. It affects a
bit of the abstract Machinery class and as such introduces unit testing
in that area.

Aside from moving all default values to cuckoo/common/config.py and
reusing the *.conf files as jinja2 templates this commit also introduces
the concept of having, e.g., comma-separated, lists in *.conf files.

The only todo item with regards to configuration checking is ensuring
that all referenced sections in these section lists actually exist.
2016-11-15 01:34:57 +01:00
Jurriaan Bremer 9ed7fdfccd fix directory removal attempt and fd exhaustion bugs 2016-11-01 13:51:37 +01:00
Jurriaan Bremer 9554eb08de windows support and unit tests for community command
Due to the need of extra packages during the unit testing, namely the
responses library, we switch from invoking py.test directly to using
pytest-runner. This will transparently install any required unit testing
related packages for us.
Note that pytest-related libraries don't have hardcoded version numbers,
as those may already have been installed on continuous integration
servers (i.e., Travis CI) and therefore end up throwing around issues.
2016-10-30 22:18:58 +01:00
Jurriaan Bremer 5ceda18633 tweak some unit tests for windows compatibility 2016-10-30 16:35:24 +01:00
Jurriaan Bremer 735500efba support operating systems where /tmp is not the temp dir 2016-10-29 19:33:43 +02:00
Jurriaan Bremer af687dc5a6 near-complete coverage for files.py
Folders.create_temp() bugfix by Sander Ferdinand.
2016-10-12 02:27:23 +02:00
Jurriaan Bremer e58569ab09 code cleanup and some additional utils tests 2016-10-05 00:32:52 +02:00
Jurriaan Bremer c653c66606 dynamically expose the cuckoo version through cuckoo.__version__ 2016-10-04 13:58:58 +02:00
jekil 131ad3213c Added more utils tests 2016-10-03 00:40:16 +02:00
Jurriaan Bremer d205392b3f untested usage, but at least some unittests 2016-09-05 05:16:00 +02:00
Jurriaan Bremer afe8077162 rewrite the tests so they use pytest
Also reintroduce the capability to provide a custom connection string to
the Database (which is possible now that making the connection is no
longer part of __init__).
2016-08-23 02:10:14 +02:00