Commit Graph

154 Commits

Author SHA1 Message Date
timothybritton
c4016ec2a4
CI: Setting non-required deb_packages fields as optional in test (#7001) 2021-03-12 23:26:48 -05:00
Alessandro Gario
cf722bc3f3
chrome_extensions: Refactor the table, add tests (#6780) 2021-03-11 16:38:10 -05:00
Josh Brower
77361f15f9
Adds support for the computer field in Windows Eventlogs (#6952) 2021-02-26 20:57:31 -05:00
puffyCid
121f7e2589
Add Shellbags table (#6949)
Hello, this largish PR adds shellbags support to osquery.
Shellbags is a complex (imo) windows Registry artifact that primarily keeps track of directories a user has browsed to (specifically directories accessed using Windows Explorer).  By parsing shellbags its possible to recreate what directories a user accessed
Shellbags are composed of shellitems, this PR also adds support to parsing several shellitems, finally shellbags also contain FAT timestamps that show when a directory was created, modified, accessed, FAT timestamp parsing is also included in this PR

Example query of what shellbags looks like
```
osquery> select * from shellbags;
+-----------------------------------------------+--------------+-------------------------------------------------------------------------------------+---------------+--------------+---------------+-----------+--------------+
| sid                                           | source       | path                                                                                | modified_time | created_time | accessed_time | mft_entry | mft_sequence |
+-----------------------------------------------+--------------+-------------------------------------------------------------------------------------+---------------+--------------+---------------+-----------+--------------+
| S-1-5-21-1079689790-2336414676-942872339-1001 | usrclass.dat | This PC\C:\Users\bob                                                                | 0             | 0            | 0             | 0         | 0            |
| S-1-5-21-1079689790-2336414676-942872339-1001 | usrclass.dat | This PC\C:\Users\bob\Downloads                                                      | 1571635108    | 1571620406   | 1571635108    | 3074      | 5            |
| S-1-5-21-1079689790-2336414676-942872339-1001 | usrclass.dat | This PC\C:\Users\bob\Projects                                                       | 0             | 0            | 0             | 0         | 0            |
| S-1-5-21-1079689790-2336414676-942872339-1001 | usrclass.dat | This PC\C:\Users\bob\Projects\osquery                                               | 0             | 0            | 0             | 0         | 0            |
| S-1-5-21-1079689790-2336414676-942872339-1001 | usrclass.dat | This PC\C:\Users\bob\Projects\osquery\build                                         | 0             | 0            | 0             | 0         | 0            |
| S-1-5-21-1079689790-2336414676-942872339-1001 | usrclass.dat | This PC\C:\Users\bob\Projects\osquery\build\osquery                                 | 0             | 0            | 0             | 0         | 0            |
| S-1-5-21-1079689790-2336414676-942872339-1001 | usrclass.dat | This PC\C:\Users\bob\Projects\osquery\build\osquery\RelWithDebInfo                  | 0             | 0            | 0             | 0         | 0            |
| S-1-5-21-1079689790-2336414676-942872339-1001 | usrclass.dat | This PC\C:\Users\bob\Projects\osquery\osquery                                       | 1578192498    | 1571701478   | 1578192498    | 495902    | 4            |
| S-1-5-21-1079689790-2336414676-942872339-1001 | usrclass.dat | This PC\C:\Users\bob\Projects\osquery\osquery\killswitch                            | 1578192406    | 1575859554   | 1578192406    | 707032    | 2            |
| S-1-5-21-1079689790-2336414676-942872339-1001 | usrclass.dat | This PC\C:\Users\bob\Projects\clamav-osquery                                        | 1572045050    | 1572045050   | 1572045050    | 221518    | 14           |
| S-1-5-21-1079689790-2336414676-942872339-1001 | usrclass.dat | This PC\C:\Users\bob\Projects\clamav-osquery\extension_clamav                       | 1572045050    | 1572045050   | 1572045050    | 432733    | 8            |
| S-1-5-21-1079689790-2336414676-942872339-1001 | usrclass.dat | This PC\C:\Users\bob\Projects\clamav-osquery\extension_clamav\src                   | 1572045050    | 1572045050   | 1572045050    | 432736    | 11           |
| S-1-5-21-1079689790-2336414676-942872339-1001 | usrclass.dat | This PC\C:\Users\bob\.osquery                                                       | 1571706262    | 1571706212   | 1571706262    | 575462    | 4            |
| S-1-5-21-1079689790-2336414676-942872339-1001 | usrclass.dat | This PC\C:\Users\bob\AppData                                                        | 1571623328    | 1571623318   | 1571623328    | 206482    | 7            |
| S-1-5-21-1079689790-2336414676-942872339-1001 | usrclass.dat | This PC\C:\Users\bob\AppData\Local                                                  | 1571701908    | 1571623318   | 1571701908    | 206502    | 8            |
| S-1-5-21-1079689790-2336414676-942872339-1001 | usrclass.dat | This PC\C:\Users\bob\AppData\Local\Microsoft                                        | 1593297370    | 1571623318   | 1593297370    | 206504    | 8            |
| S-1-5-21-1079689790-2336414676-942872339-1001 | usrclass.dat | This PC\C:\Users\bob\AppData\Local\Microsoft\Office                                 | 1593297370    | 1593295160   | 1593297370    | 52684     | 60           |
| S-1-5-21-1079689790-2336414676-942872339-1001 | usrclass.dat | This PC\C:\Users\bob\AppData\Local\Microsoft\Office\16.0                            | 1593297388    | 1593295160   | 1593297388    | 81742     | 11           |
| S-1-5-21-1079689790-2336414676-942872339-1001 | usrclass.dat | This PC\C:\Users\bob\AppData\Local\autopsy                                          | 1612935328    | 1612935328   | 1612935328    | 37041     | 7            |
| S-1-5-21-1079689790-2336414676-942872339-1001 | usrclass.dat | This PC\C:\Users\bob\AppData\Local\autopsy\Cache                                    | 1612935328    | 1612935328   | 1612935328    | 37104     | 8            |
| S-1-5-21-1079689790-2336414676-942872339-1001 | usrclass.dat | This PC\C:\Users\bob\super secret sensitive stuff                                   | 1613198066    | 1613198066   | 1613198066    | 101729    | 123          |
| S-1-5-21-1079689790-2336414676-942872339-1001 | usrclass.dat | This PC\C:\Users\bob\super secret sensitive stuff\secret data                       | 1613198092    | 1613198092   | 1613198092    | 383733    | 38           |
| S-1-5-21-1079689790-2336414676-942872339-1001 | usrclass.dat | This PC\C:\Users\bob\super secret sensitive stuff\secret data\dont look secret data | 1613198108    | 1613198108   | 1613198108    | 383736    | 15           |
+-----------------------------------------------+--------------+-------------------------------------------------------------------------------------+---------------+--------------+---------------+-----------+--------------+
```
Due to the complexity of shellbags currently this PR does not support (or only has partial support) for the following shellitems:
* optical disc
* variable (partial support)
* mtp (partial support)
* user property view data (partial support)

I was not able to generate shellbag data (or only some data) for the above shellitems in my windows vms (tested on two different Windows 10 systems, Windows 8.1, and Windows Server 2019), if osquery encounters any unknown shellbag data it will log a warning and mark the shellitem as "[UNKNOWN SHELL FORMAT]" when building directory paths.  
The main value of shellbags is reconstructing directories accessed as shown above, but this PR does include additional shellbag support such as FTP servers connected to via Windows Explorer, ZIP files opened, MTP devices (partial), and network shares browsed to via Windows Explorer
This PR is kind of large, let me know if there are any questions, suggestions for improvements, or issues, thanks!

Shellbags references:
[Shellitems](https://github.com/libyal/libfwsi/blob/main/documentation/Windows%20Shell%20Item%20format.asciidoc)
[Shellbags](https://www.magnetforensics.com/blog/forensic-analysis-of-windows-shellbags/)
[Property Stores](https://github.com/libyal/libfwps/blob/main/documentation/Windows%20Property%20Store%20format.asciidoc)
2021-02-26 15:47:37 -08:00
Eugene Sidorov
b6b17f7629
Implementation of VM metadata table for Yandex.Cloud (#6961) 2021-02-26 15:44:20 -08:00
Stefano Bonicatti
56b56cd26e
Fix an incorrect check in StartupItems test (#6950) 2021-02-15 22:14:06 -05:00
Stefano Bonicatti
358db03eff
Fix StartupItemTest failing due to unexpected values (#6940)
The "path" column for a systemd unit row can be empty.

Added missing possible values for the "status" column,
when the "type" column value is "systemd unit".

Removed "Login Item" as a possible value for the "type" column,
since now "Startup Item" is used.

Removed "disabled" as a possible value for the "status" column,
since it's not returned anymore and due to the type "Startup Item"
being either a script or a .desktop file, which do not have a disabled state;
if they need to be they'll just be removed
and they won't appear in the table anymore.

Separately check for the "status" column possible values
since they differ based on the "type" column value.
2021-02-10 21:03:08 -05:00
Stefano Bonicatti
54b3e1297c
Fix SystemControlsTest adding sunrpc as an expected subsystem (#6932) 2021-01-31 16:57:24 -05:00
Alessandro Gario
2729225ef2
CI: Add support for GitHub Actions (#6885) 2021-01-16 15:21:34 +01:00
Mike Myers
b803743bf7
Fix typos across source code (#6901) 2021-01-14 23:49:06 -08:00
kumarak
4bef4e4c78
Add system extension table (#6863) 2021-01-11 10:34:11 -05:00
Seshu Pasam
8fd470ca92
docker_image_history table (#6884)
This table provides output similar to "docker history" command.
See: https://docs.docker.com/engine/reference/commandline/history/
created_by column has useful information related to the command history
2021-01-11 10:31:20 -05:00
Teddy Reed
2c0791276e
CMake: Add an option to disable building libdpkg tables and library (#6848) 2020-12-26 16:09:16 -05:00
Sharvil Shah
fb2bb9521f
[CI] Update macOS agent to 10.15 Catalina (#6680) 2020-12-22 10:11:25 -05:00
Stefano Bonicatti
704d75abed
CMake: Add an option to disable building AWS tables and library (#6831)
Added the OSQUERY_BUILD_AWS option due to
oss-fuzz CI failing to build the AWS EC2 library,
due to its high requirement of memory.
The fuzzers do not gain much from having these tables enabled,
moreover this can be used during development
to avoid building a possibly unneeded table.

Done some minor cleanups to remove logic duplication
and enable ec2 integration tests on all the platforms
that supports them.
2020-12-22 09:10:32 -05:00
Jason Meller
6e9f8720ae
Add new table location_services for darwin (#6826) 2020-12-21 10:37:31 -08:00
Alessandro Gario
cfabaa9e28
Eventing framework refactor (#6610) 2020-12-17 22:21:53 -05:00
Rachel Cipkins
90e23398bd
systemd_units: Implement new table that tracks systemd units (#6593)
Co-authored-by: Alessandro Gario <alessandro.gario@gmail.com>
2020-12-16 07:52:16 -08:00
Stefano Bonicatti
4dd97ea6a0
Update cmake_minum_required to 3.17.5 and pin version in CI (#6770) 2020-11-30 15:02:19 +01:00
Stefano Bonicatti
35417f589b
Remove boost workaround introduced in #5591 for string_view (#6771) 2020-11-29 15:13:03 +01:00
Rachel Cipkins
82908870a1
startup_items: Add systemd support on Linux (#6562)
Co-authored-by: Alessandro Gario <alessandro.gario@gmail.com>
2020-11-22 22:37:55 -08:00
Ateeq Sharfuddin
5d8d25b3e4
bugfix-6719: removing PUNYCODE flag (#6730)
Remove `PUNYCODE` flag from cert string parsing.

Fixes #6719
2020-10-27 20:07:56 -04:00
Teddy Reed
14804127d8
Reduce linkage requirements for tests (#6715) 2020-10-18 10:47:00 -04:00
Sharvil Shah
76bac4c3ab
Fix apps and startup_items tests on Catalina (#6704) 2020-10-08 09:44:46 -04:00
Teddy Reed
5b8f20bfce
refactor: Move ephemeral database plugin into core and simplify tests (#6648) 2020-09-21 18:25:08 -04:00
puffyCid
bd545631ed
Support for Office MRU (most recently used) entries (#6587) 2020-09-13 10:51:51 -04:00
puffyCid
10b0635bc2
Support for Background Activity Moderator (#6585) 2020-09-10 22:20:34 -04:00
Artemis Tosini
a5492c55da Make cpuid table x86_only
The instruction doesn't exist on other processors, and while there
might be ways to retrieve the equivalent information, none directly
matches the x86 "cpuid". This takes out the table completely on
non-x86_64 architectures.

Co-Authored-By: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2020-09-05 16:50:28 -04:00
Teddy Reed
b36678d707
refactor: Rename database APIs to not use DatabasePlugin class (#6620) 2020-08-31 22:45:43 -04:00
kumarak
c7e37c2a05
Add non-evented table for querying Windows Events Log (#6563)
The PR adds an on-demand version of the Windows events log table that can return the WEL entries from an arbitrary event provider. It supports selective filtering based on additional query parameters.  An example query:

```
osquery>  select * from windows_events_vtable where channel = 'Application' and eventid = 1000;
+-------------+--------------------------------+------+-------+----------------------------+----------------------------------------+---------+----------+--------------------+--------------------------------------------------------------------------------------------------------------------------------------------+------+------+
| channel     | datetime                       | task | level | provider_name              | provider_guid                          | eventid | recordid | keywords           | data                                            | pid  | tid  |
+-------------+--------------------------------+------+-------+----------------------------+----------------------------------------+---------+----------+--------------------+--------------------------------------------------------------------------------------------------------------------------------------------+------+------+
| Application | 2020-07-22T03:19:32.617052900Z | 0    | 4     | Microsoft-Windows-LoadPerf | {122EE297-BB47-41AE-B265-1CA8D1886D40} | 1000    | -1       | 0x8000000000000000 | {"UserData":{"EventXML":"","binaryData":"EC2C0000BC2D0000ED2C0000BD2D0000","binaryDataSize":"16","param1":"WmiApRpl","param2":"WmiApRpl"}} | 5824 | 5828 |
+-------------+--------------------------------+------+-------+----------------------------+----------------------------------------+---------+----------+--------------------+--------------------------------------------------------------------------------------------------------------------------------------------+------+------+
```
2020-08-26 14:17:29 -07:00
Ateeq Sharfuddin
a19d910d21
bug: Improve chassis_types and security_breach columns within chassis_info (#6608) 2020-08-25 22:25:21 -04:00
seph
29f4694df2
Update copyright notices (#6589)
Bulk update copyright notices from Facebook to "The osquery authors"
2020-08-11 16:46:54 -04:00
Teddy Reed
8ee7e3a3b0
refactor: Move osquery/include files to appropriate places (#6557) 2020-08-11 11:54:54 -04:00
Animesh Tewari
dcf72523f7
curl_certificate test (#5281) 2020-07-26 16:38:59 -04:00
Animesh Tewari
6101a0aee5
Fix #5737: Add FileVersionRaw column to file table for windows (#5771) 2020-07-26 16:37:49 -04:00
kumarak
2aa313db40
Enable yara table on windows (#6564) 2020-07-23 21:16:10 -04:00
seph
32cafe518c
Light refactor on users & groups (#5686)
This does a little refactoring on the users and groups tables, and adds test cases for more those tables.
2020-07-23 01:38:19 -04:00
Rachel Cipkins
6096347c6b
Add startup_items table for linux (#6502) 2020-07-20 21:52:43 -04:00
puffyCid
336e6b075f
Shimcache Table (#6463) 2020-07-12 21:54:37 -04:00
Ted Reed
5cd2d6cbd3 detangle: Move platform setup and teardown out of Initializer 2020-07-09 10:38:53 -04:00
Ted Reed
89953d3340 detangle: Move start time getter and setter out of Config 2020-07-09 10:38:53 -04:00
Ted Reed
3fbe55a108 detangle: Move tooltype setter and getters out of Initializer 2020-07-09 10:38:53 -04:00
Teddy Reed
6710dbd5a6
build: Add Azure tables to specs CMakeLists (#6507) 2020-06-25 09:10:17 -04:00
Teddy Reed
8310159a7a
tests: Fix atom_packages, processes, rpm_packages flakiness (#6518) 2020-06-24 08:21:23 -04:00
James Jerger
d09ad2b1d7
Add support for basic chassis information (#5282) 2020-06-10 17:28:21 -04:00
Stefano Bonicatti
411556b9a5
Make file and hash container columns hidden (#6486)
This is for consistency with the decisions taken
for PR osquery/osquery#6413 and osquery/osquery#6414.

We also update the integration test helper to accept custom constraints,
in the case the table has required columns.
2020-06-06 21:26:44 -04:00
Stefano Bonicatti
2085b175e1
Add validate_container_rows helper for integration tests (#6485)
This simple helper takes a table name and
an already prepared rows map to add the container
columns, which are normally hidden, and call validate_rows on it.

We use this function in deb_packages, rpm_packages, npm_packages,
os_version integration tests.
2020-06-05 21:22:44 -04:00
Zachary Wasserman
4e1d31c72a
Use 'denylist' instead of 'blacklist' in query scheduling (#6487) 2020-06-05 21:05:59 -04:00
Stefano Bonicatti
e2d885b335
Add container access to the os_version table (#6413)
* Add container access to the os_version table

* Change new container columns to hidden
2020-06-05 20:22:34 +02:00
Stefano Bonicatti
dba5f1464e
Add container access to DEB, RPM, NPM packages tables (#6414)
* Add container access to DEB, RPM, NPM packages tables

* Change new container columns to hidden
2020-06-05 20:22:03 +02:00