Commit Graph

373 Commits

Author SHA1 Message Date
Alessandro Gario
507638dda0 chrome_extensions: Add the profile name to the table (#5213)
Summary:
This PR adds a new column to the `chrome_extensions` table named `profile`, used to show the name of the Chrome profile that owns each extension.

```
osqueryi --verbose 'SELECT profile, name, version FROM chrome_extensions;'
```
```
+---------------+---------------------+--------------+
| profile       | name                | version      |
+---------------+---------------------+--------------+
| trail_of_bits | Slides              | 0.10         |
| trail_of_bits | Docs                | 0.10         |
| trail_of_bits | Google Drive        | 14.1         |
| trail_of_bits | YouTube             | 4.2.8        |
| trail_of_bits | Sheets              | 1.2          |
| trail_of_bits | HTTPS Everywhere    | 2018.8.22    |
| trail_of_bits | Google Docs Offline | 1.7          |
| trail_of_bits | __MSG_APP_NAME__    | 1.0.0.4      |
| trail_of_bits | Gmail               | 8.1          |
| trail_of_bits | Chrome Media Router | 6818.528.0.0 |
| Person 1      | Slides              | 0.10         |
| Person 1      | Docs                | 0.10         |
| Person 1      | Google Drive        | 14.1         |
| Person 1      | YouTube             | 4.2.8        |
| Person 1      | Sheets              | 1.2          |
| Person 1      | Google Docs Offline | 1.7          |
| Person 1      | __MSG_APP_NAME__    | 1.0.0.4      |
| Person 1      | Gmail               | 8.1          |
| Person 1      | Chrome Media Router | 6818.528.0.0 |
+---------------+---------------------+--------------+
```
Pull Request resolved: https://github.com/facebook/osquery/pull/5213

Reviewed By: mkareta

Differential Revision: D14224080

Pulled By: guliashvili

fbshipit-source-id: 8f831163ccf38c7ba6c8d17aeb8c90c43031529f
2019-03-27 03:02:16 -07:00
Filipe Manco
353d7613d7 Add missing tables to windows build. (#5497)
Summary:
Pull Request resolved: https://github.com/facebook/osquery/pull/5497

Some tables were forgotten during the port to Buck.

Checking missing tables:

```
diff <(find oss/specs -iname "*.table" -exec basename {} \; | sort) <(grep -e "[a-z0-9_]\+\.table\"," oss/specs/BUCK | sed -e 's: *"\([a-z]*/\)*\(.*\)",:\2:' | sort)
```

Reviewed By: guliashvili

Differential Revision: D14300038

fbshipit-source-id: 70939d8540f141e256259eb0f722f3994af7e6f0
2019-03-05 08:53:57 -08:00
William Woodruff
fe70a514af windows/logged_in_users: Add sid, hive columns (#5454)
Summary:
This introduces two new (Windows-only) columns to the `logged_in_users` table:

* `sid` corresponds to the logged in user's security identifier, used to uniquely identify the user and their permissions on the local system.
* `registry_hive` corresponds to the user's HKU registry hive, used to look up per-user configuration information.

I've updated the integration tests to test for these columns on Windows only. Please let me know if there's anything else I can do!
Pull Request resolved: https://github.com/facebook/osquery/pull/5454

Differential Revision: D14195466

Pulled By: fmanco

fbshipit-source-id: def9c362fac1b5a68b68f826916daafee224295b
2019-02-27 05:52:56 -08:00
William Woodruff
139aaef0ed windows/logical_drives: Refactor (#5400)
Summary:
This generally refactors the `logical_drives` table on Windows to conform more closely to C++11 idioms. It also enables the integration test for `logical_drives`.

See #5367. I'll open a PR for the boot partition fixes once this is merged.

cc akindyakov guliashvili
Pull Request resolved: https://github.com/facebook/osquery/pull/5400

Differential Revision: D14131722

Pulled By: fmanco

fbshipit-source-id: c3077da48147a9880ce08925d165e5d1da363bb9
2019-02-26 16:03:20 -08:00
Mark Mossberg
5edb4c5b81 Add Windows product version information to file table (#5431)
Summary:
Hi! This PR adds a new column called `product_version` to the file table, which is only
populated when queries are done on Windows. It is a very minimal PR that uses an existing helper function (`windowsGetFileVersion`) to populate the column.

The column is not named `file_version`, despite the name of the helper function because the underlying data retrieved by that helper function is actually the `dwProductVersion*` fields of the `VS_FIXEDFILEINFO` struct. In the future, if we want to add a column that _actually_ contains the results of the `dwFileVersion*` fields, we can add a new column called `file_version` without modifying existing functionality.
Pull Request resolved: https://github.com/facebook/osquery/pull/5431

Differential Revision: D14169773

Pulled By: fmanco

fbshipit-source-id: 6fa7c92425fc92aa2e83a37383b1a8c796b17644
2019-02-21 13:45:46 -08:00
Alexandru Stefanica
1621213813 fix magic table (#5438)
Summary:
Pull Request resolved: https://github.com/facebook/osquery/pull/5438

currently the magic table is broken. libmagic which is used to generate this information needs a database/configuration file that it usually auto-finds.
Our libmagic library tries to open the following file ```open("/usr/local/osquery/Cellar/libmagic/5.32_200/share/misc/magic.mgc", O_RDONLY) = -1 ENOENT (No such file or directory)``` (you can generate  this by using strace like ```trace -q -e trace=open ./buck-out/debug/gen/xplat/osquery/oss/osquery/osqueryd#gcc-5-glibc-2.23-clang -verbose -S "select * from magic where path = '/etc/passwd'"```).
How it auto-finds it I don't know 100%, but I guess it has something to with how the libmagic.so is actually build and installed. Basically this never works unless you are a developer on mac and used our previous build system.

I've updated the table to be able to specify the path to magic database file. If you don't specify it, I tried to check if one of the default files (files that should be present under /usr/share/ exists and use the first found). If all fail, I try the default one, but that most likely will fail.

Reviewed By: guliashvili

Differential Revision: D14066467

fbshipit-source-id: d9d2aca4829b2275e6792f974de1f2a7808dc321
2019-02-13 13:58:52 -08:00
Max Kareta
e79d0ae5ce add feature that allow to mark tables foreign at build time
Summary:
Not every environment requires all tables, this diff introduce flag that allows you mark table as foreign. New option should be used in conjunction with target filer.

Example:
> buck build ... --config osquery.target_ignore_list="smart" --config osquery.spec_ignore_list="smart/smart_drive_info.table" -- -S

Reviewed By: fmanco

Differential Revision: D13942107

fbshipit-source-id: fb34d6b7a296f69f6b95bf17bfd19cee31b34dec
2019-02-05 04:03:50 -08:00
Alexander Kindyakov
84b7f4f7a4 Change semantics of 'start_time' colume in processes table (#5414)
Summary:
Pull Request resolved: https://github.com/facebook/osquery/pull/5414

Now on different platforms column `start_time` in `processes` table means different things. On Linux it is seconds since system boot, but it works correct only for some platforms, because the number of clock ticks per second was hardcoded. On windows it was abs unix time in seconds since Epoch. On macos it is a time in milliseconds (may be?) since system boot. On freeBSD as far as I can see it an abs time since boot, but also I'm not sure.

In order to make it consistent for all OS we changed to more convenient format - absolute time since Epoch. This commit is about Linux. Next diffs going to be about Darwin and freeBSD.

Reviewed By: guliashvili

Differential Revision: D13918626

fbshipit-source-id: a9cf0570dc6ac9fa125bc8233e9965c4e01566a6
2019-02-05 03:50:20 -08:00
drakearonhalt
e205458be0 Added is_hidden column to the users and groups tables on macOS. (#5368)
Summary:
This PR is the result of the discussion in a previous PR (#5348) after we determined account_policy_data was the wrong place for the column.

Add `is_hidden` column to the users and groups tables in macOS. `is_hidden` is populated by looking for the `dsAttrTypeNative:IsHidden` attribute in the OpenDirectory record for the user/group if the value is `1`, `True`, or `Yes` is_hidden is 1. If the value is anything else it's set to 0. Invalid values have the same affect as the attribute not existing at all.

The `dsAttrTypeNative:IsHidden` attribute controls whether a user account is is visible in the preferences panel similar to having a uid < 500.

One test failed when running buck test:
```
====STANDARD OUT====
tests/integration/tables/helper.cpp:159: Failure
Value of: boost::get<CustomCheckerType>(validator)(value)
  Actual: false
Expected: true
Custom validator of the column "mask" with value "" failed
```
This also fails when I ran the test on the current experimental branch as well.

Important to note I had to remove the optimization on both the user and group tables that just called `getpwnam` if the query specified the `uid` or `gid` since the struct returned doesn't contain the `IsHidden` attribute.  I'm not sure if or how much this will affect performance since I wasn't able to get the profiling to work with the new version (very likely I'm just doing it incorrectly).
Pull Request resolved: https://github.com/facebook/osquery/pull/5368

Differential Revision: D13862375

Pulled By: akindyakov

fbshipit-source-id: 1fec88a6ba71884f7e611e1d96ea00630c5be655
2019-01-30 09:07:56 -08:00
aporlebeke@gmail.com
96e0cd2fd6 Fix typo: "Extensions" (#5388)
Summary:
Fix minor typo in description.  Moved original PR (#5380) from master to experimental
Pull Request resolved: https://github.com/facebook/osquery/pull/5388

Differential Revision: D13781801

Pulled By: guliashvili

fbshipit-source-id: d57d5e45c1597c6d640dbf908a42ced4f4bbf54c
2019-01-23 09:50:49 -08:00
Filipe Manco
a67525fae1 Fix LICENSE information on file headers (#5375)
Summary:
Pull Request resolved: https://github.com/facebook/osquery/pull/5375

LICENSE is now defined in a single file on the root of the project, update the
header to contain that information.

**Project LICENSE did not change.**

Reviewed By: akindyakov

Differential Revision: D13750575

fbshipit-source-id: 1e608a81b260b8395f9d008fc67f463160c1fc2b
2019-01-21 11:51:54 -08:00
William Woodruff
bab228b8fa sudoers table: Support file and directory includes (#5350)
Summary:
This adds support for the `#includedir` and `#include` directives to the `sudoers` table, making `sudoers` behave more like the actual `sudo` rule parser:

* When an `includefile` directive is encountered, the referenced file will be parsed using the same rules as the top-level sudoers file.
* When an `includedir` directive is encountered, the referenced directory will be listed and each valid file within (i.e., each file *not* containing a `.` and *not* ending with `~`) will be parsed using the same rules as the top-level sudoers file.
* An additional `source` column tracks the file that provides the row's rule.
* Like `sudoers(5)`, nesting is limited to 128 individual files, with directory inclusions being counted once for each file they contain.
Pull Request resolved: https://github.com/facebook/osquery/pull/5350

Differential Revision: D13717394

Pulled By: akindyakov

fbshipit-source-id: 9659526f21e82c712c495caa80775b15d7e47e37
2019-01-18 05:49:07 -08:00
Julia
039b40288b Fix plist.table description (#5242)
Summary:
The column "path" is a required column.  Fixed description.
Pull Request resolved: https://github.com/facebook/osquery/pull/5242

Reviewed By: guliashvili

Differential Revision: D13693342

Pulled By: fmanco

fbshipit-source-id: ba7bcb88a201cadaf913054900294c3b1d342ead
2019-01-18 03:11:46 -08:00
George Guliashvili
d498bcbd65 unique target names for xcode (#5328)
Summary:
Pull Request resolved: https://github.com/facebook/osquery/pull/5328

xcode needs unique target names to properly parse buck generated project

Reviewed By: marekcirkos

Differential Revision: D13487400

fbshipit-source-id: cf0c76145344d0873a0973e226d007597a06d17d
2019-01-16 12:28:04 -08:00
seph
637eb104b8 Spelling (#5256)
Summary:
While running `misspell` on a different codebase. I happened to notice that some misspellings in the osquery code base. So, I fixed them
Pull Request resolved: https://github.com/facebook/osquery/pull/5256

Reviewed By: guliashvili

Differential Revision: D13670897

Pulled By: fmanco

fbshipit-source-id: 5d33d858284955c376e8c3980acdf366d4edf3d3
2019-01-16 08:17:07 -08:00
Filip Hrenić
6d159d4046 Osquery support for atom packages
Summary:
Add support for listing atom packages on Linux and Mac. Shouldn't be a problem adding support for Windows, but have no way to test it right now.
Lists package name, version, description, package path, license and homepage (see test).

Reviewed By: fiorix

Differential Revision: D13636097

fbshipit-source-id: f38a57128cedde2d027a0205588c8b563e2b188c
2019-01-16 03:12:54 -08:00
micheal-o
6fe7b4cbc2 Epoch in rpm_packages table (#5248)
Summary:
code for issue: #5202
Pull Request resolved: https://github.com/facebook/osquery/pull/5248

Differential Revision: D13677333

Pulled By: fmanco

fbshipit-source-id: e245c3733bb73a1d4d6ab61e007c1cf274c29e59
2019-01-15 16:53:35 -08:00
Jonathan Keljo
5bb1ec75a0 Migrate processes to strongly-typed TableRows on macOS
Summary:
Continuing to march toward low-overhead, type-safe table rows, this commit
converts the Darwin `processes` table to using the generated row types.

My march concludes here, but there's a lot of work yet to be done with
migrating other tables.

(Adapted from https://github.com/facebook/osquery/pull/5199)

Reviewed By: guliashvili

Differential Revision: D13438014

fbshipit-source-id: 0e8365f26fe95131fe53ba3491cf07899600e997
2019-01-09 13:50:15 -08:00
Jonathan Keljo
898ed37dfb Table for OSX Running and Active Applications
Summary:
This is a manual port of https://github.com/facebook/osquery/pull/5216 to the new build system.

This table allows you to fetch a list of running applications on OSX. Contains PID, Bundle ID and whether or not the application is in focus. (The latter can be used to figure out what application was being used at a given moment.)

Reviewed By: guliashvili

Differential Revision: D13422150

fbshipit-source-id: 236b28d9140a9a9062fb913815d0c9f1da21c8b5
2018-12-12 09:17:19 -08:00
George Guliashvili
971bee4441 Move build system to BUCK
fbshipit-source-id: 8ffef5e6a393ac67ce56dcb74845402e43d964a0
2018-12-07 16:12:35 +00:00
Michael McGrew
e6302379fd Add per process performance data to windows processes table (#5224) 2018-09-18 20:59:35 -07:00
James Jerger
b8d7243aa9 Add InstallDate to os_version for Windows (#5226) 2018-09-14 16:07:37 -07:00
James Jerger
e10b243ecf Add NTDomain Table for Windows (#5152) 2018-09-14 11:25:49 -07:00
Adrien Schildknecht
bdf504f6b6 tables: netmask should be an integer (#5217) 2018-09-14 16:13:37 +01:00
Alessandro Gario
e2f1a11d75 Add a 'permission' field to the chrome_extensions table (#5193) 2018-09-12 01:03:36 +01:00
Adrien Schildknecht
0b686c4834 Add interface_ipv6 table (#4903) 2018-09-10 05:50:03 +02:00
Allan Liu
5457ef0ea9 tables: add pci_class_id and pci_subclass_id to pci_devices (#5183) 2018-09-06 01:05:11 +01:00
Allan Liu
37ae0ef4d5 tables: augment pci_devices table on linux with pci_subclass (#5175) 2018-09-05 20:20:27 +01:00
Alexander
2b24cf22de
[Table sanity check] sanity check for the table interface_addresses (#5142) 2018-08-31 14:28:26 +01:00
Jibola
e05be701ed Expand "opaque" values in system_controls table (#5082) 2018-08-28 11:52:06 +01:00
Allan Liu
a17d6b5963 SMBIOS oem_strings table (#4849) 2018-08-22 20:02:40 -04:00
Allan Liu
9091fd98a5 pci_devices: model and vendor information from system PCI db && add subsystem info (#4391) 2018-08-16 23:51:38 +01:00
Allan Liu
2081cf8e02 tables: fix cpu_physical_cores and cpu_logical_cores on linux (#4848) 2018-08-14 15:30:38 +01:00
Adrien Schildknecht
ba1bde1d8f Add hopcount entry to the 'routes' table (#4900) 2018-08-14 15:29:50 +01:00
Scott Lundgren
54a9ee8f35 querying of named objects in windows across terminal services sessions. even mutexes. (#4547) 2018-07-27 15:08:51 -07:00
Jared Atkinson
8d9332e6c7 tables: Added a new table for Windows Logon Sessions (#4660) 2018-07-27 11:56:01 -07:00
Julia
8435891f54 Update autoexec.table (#4769) 2018-07-27 16:47:24 +01:00
Mitchell Grenier
ce768dc40c
Add cpu architectures for running processes on macOS (#4702) 2018-07-26 10:32:57 -07:00
Teddy Reed
919219c551
tables: Add ELF-file related virtual tables (#4708) 2018-07-21 12:21:32 -04:00
James Jerger
182212330f Add socket_designation to CPU info (#4715) 2018-07-18 18:46:29 +01:00
Nate Felton
d74fa4033f Adding content_caching to sharing_preferences (#4699) 2018-07-16 12:13:14 +01:00
Rich5
352e3ff7f8 Windows file ops (#4613) 2018-07-15 14:12:46 -07:00
Daniel Roethlisberger
1ed050147a Support CDHash algorithms other than SHA-1 (#4679) 2018-07-13 12:00:43 -07:00
Jeremy Calvert
d6bebc8f81 Add support for getting ethernet link speeds for non-linux posix (#4675) 2018-07-13 10:09:35 -07:00
Allan Liu
8f4529d2a3 General SMART drive information virtual table (#4133) 2018-07-13 09:51:55 -04:00
Max Kareta
140f2bd72f
disk_encryption macOS, fix for issue #4479 (#4687) 2018-07-13 10:59:33 +01:00
Mitchell Grenier
978a3f82bb
Add unique pid field to the processes table on macOS (#4667) 2018-07-11 13:49:50 -07:00
Alessandro Gario
9497df67cc Add a new audit-based table to collect SELinux events (#4224) 2018-07-08 11:22:03 -04:00
uptycs-nishant
1cf5cb7dbc Fixing user_time, system_time bug and changing the cpu utilization logic (#4431) 2018-07-08 11:20:45 -04:00
Alessandro Gario
e622f62d8a macOS signature: Add a hash_resources parameter to the table (#4246) 2018-07-02 19:47:18 +01:00