Commit Graph

5661 Commits

Author SHA1 Message Date
seph
f54d904b21
Update some sqlite types (#6392)
Correct SQL data types.
2020-04-28 14:01:39 -04:00
Stefano Bonicatti
a07140ad93
Build sleuthkit from source on macOS (#6416)
Also separated the C from the C++ source code in a different library,
so that the C code is not compiled as C with a C++ compiler.
This would make the macOS C++ compiler fail to compile sleuthkit
since it wasn't how the original build system of the library was building it.
2020-04-25 22:07:03 -04:00
Stefano Bonicatti
3d4102ce74
Build popt from source on macOS (#6409) 2020-04-25 22:04:36 -04:00
srikwit
3bdbdaf27f
Partial fix for md_devices issue (#6417) 2020-04-25 21:58:29 -04:00
Reed Loden
9e116e5453
audit: Add fields auid, fs{u,g}id, s{u,g}id (#6362) 2020-04-21 21:57:30 -04:00
Stefano Bonicatti
c84d288629
Build augeas from source on macOS (#6399) 2020-04-21 21:57:00 -04:00
Stefano Bonicatti
69f8877b5a
Build lldpd from source on macOS (#6406) 2020-04-21 21:56:04 -04:00
Stefano Bonicatti
0855a5f2c0
Build linenoise-ng from source on macOS and Windows (#6412) 2020-04-21 21:52:49 -04:00
Zachary Wasserman
499d775849
Add documentation for enabling socket_events on macOS (#6407) 2020-04-20 15:05:11 -04:00
Stefano Bonicatti
fd7cfbd4eb Add container access to the hash table
PR: osquery/osquery#6209
2020-04-20 17:49:57 +02:00
Stefano Bonicatti
d2c93001f3 Add container access to the file table
PR: osquery/osquery#6209
2020-04-20 17:49:57 +02:00
Stefano Bonicatti
46c1e6d8be Implement container access from tables on Linux
- Add the possibility of running table logic inside a container
  namespace, so that's possible to query it instead of the host.
  Needs minor modifications to each table logic and how they use logging.

  In practice it works by having a pid_with_namespace column, which should
  contain pids that are in the same mount namespace of the container one
  wants to query.
  The worker receives that column as a constraint, prepares two unnamed
  pipes for read/write communications with the future child, then forks
  into a new process.

  While the parent sends a query job to the just created child and then waits
  for results, the child receives the job, takes all the values given in the
  pid_with_namespace constraint, retrieves the fd of the mount namespace
  under "/proc/<constraint pid>/ns/mnt", then switches to it.
  Finally it runs the table logic, sending the results back to the parent
  through the pipe with a JSON message.

  Important to note that the logging in the table logic is not GLOG
  directly, because in the child this is in an unknown state; a custom
  logging system that resembles glog and that takes advantage of the
  existing communication channel is used to send the messages in JSON
  format to the parent, which will take care to forward to GLOG.

- Add FLAGS_keep_container_worker_open so that the process used for
  accessing a container is kept open, until the queries are for the same
  table; when the table changes, the process will be closed
  and a new one created.
  This is off by default, which means that a new process will be always
  created.

- Implemented a way to run tests that require root separated
  from the others.
  The OSQUERY_BUILD_ROOT_TESTS has been added to requests such tests to
  be built.
  To run only tests which require a normal user, one has to use
  `ctest -LE "root-required"`, while `sudo ctest -L "root-required"`
  to run those who need root.

PR: osquery/osquery#6209
2020-04-20 17:49:57 +02:00
Rich
a851d8531c
system_info table: add "board_" columns like "hardware_" (#6398) 2020-04-18 07:43:25 -04:00
Stefano Bonicatti
62f99383ca
Fix Userassist.test_sanity test sometimes failing (#6396)
The specific key the test checks for its existence,
which is Microsoft.Windows.Explorer,
might not be always present.
Use UEME_CTLSESSION key which should be always present since
it generically represents the start of a session.
2020-04-16 22:25:58 -04:00
Breakwell
bae089e9d8
Don't check logged in users in session 0 or non-active sessions (#6375) 2020-04-16 22:25:32 -04:00
Gaëtan
a9b5df4984
Add git-lfs as dep for macOS build (#6384) 2020-04-14 22:14:33 -04:00
Stefano Bonicatti
e5f9a8dd7a
release: updating changelog for 4.3.0 release (#6387) 2020-04-14 16:53:39 +02:00
Zachary Wasserman
4e17ede558
Build hvci_status table with CMake (#6378)
Build hvci_status table with CMake
2020-04-09 13:03:41 -04:00
Breakwell
fb6b5149f1
Change calls to debug log to verbose (#6369) 2020-04-09 09:06:34 -04:00
Teddy Reed
702a6e0490
iokit: Fix race when accessing port_ (#6380) 2020-04-08 20:14:07 -04:00
Breakwell
63a52f2e0b
Check extensions are registered with osquery core (#6374) 2020-04-08 19:57:47 -04:00
Stefano Bonicatti
52f310a5a8
First steps to remove the Buck build system (#6361)
* First steps to remove the Buck build system

* Azure Pipelines: Rename jobs for consistency
2020-04-09 01:56:21 +02:00
Breakwell
893744238b
Return error detaching table, only use primary database (#6373) 2020-04-08 19:47:53 -04:00
Breakwell
0e5b048438
Copy the parent environment when launching worker 2020-04-08 19:46:09 -04:00
Breakwell
29933213df
Change process table log errors to info and fix typo (#6370) 2020-04-08 19:41:42 -04:00
Breakwell
cd6ebcd672
Ensure the extension uuid is never 0 (#6377) 2020-04-08 19:40:59 -04:00
Breakwell
b35d968876
Remove errors when converting empty numeric rows (#6371) 2020-04-08 18:59:19 -04:00
Stefano Bonicatti
dcca9f1124
Do not force a specific path to install osquery on Windows (#6379)
Do not set CPACK_WIX_SKIP_PROGRAM_FOLDER to true and a specific install path,
this will break the Program Files folder drive resolution
to the system drive, and instead will enable the ROOTDRIVE logic
which chooses the disk with the most space available.

Fixes osquery/osquery#6314
Fixes osquery/osquery#6342
2020-04-08 18:56:49 -04:00
Stefano Bonicatti
10e69386d1
Fix readFile API doing blocking I/O with a non-blocking handle (#6368)
When a block size is passed to the readFile function
or a file has no size, the read is forced to be blocking,
even if the handle is opened as non-blocking.
The opposite can happen too, a blocking handle is opened
but since a block size of 0 is passed, and the file size is not 0,
the file is read with non-blocking I/O.

This change bases the decision of doing blocking
or non-blocking I/O mainly on the "blocking" parameter
of the readFile function and the file being a special file or not.
If a handle is opened in non-blocking mode but the file is special,
the handle is reopened as blocking.

Also give a different name to the overload that provides
a way to do a read file check via readFile.
2020-04-07 22:35:57 -04:00
Teddy Reed
a9770451c5
magic: Check return from magic_file (#6363) 2020-04-05 18:50:08 -04:00
Teddy Reed
ab8c1d8d4e
macos: Use -1 for missing ppid in process_events (#6339)
Use -1 for missing ppid in process_events
2020-04-04 20:50:26 -04:00
Stefano Bonicatti
5a2ad2636d
Update OpenSSL to version 1.1.1f and fix build (#6359)
- Add fallback url to download the openssl tar.gz from the "old" archives
- Add URL_HASH to the openssl external project,
  to avoid to redownload the archive if it has been alredy downloaded
  and the integrity is verified
- Update curl_certificate table to use the newer openssl API,
  so that it builds.
2020-04-03 18:58:53 -04:00
Stefano Bonicatti
c22ab5c404
Simplify how third party libraries formula work (#6303)
Remove a level of indirection when configuring and building formulas.
This should simplify working with them and also remove some issues
encountered when trying to build on Windows.
2020-03-31 15:45:20 +02:00
Christopher Bennett
c3e052c8be
Add socket_events table for socket auditing in MacOS (#6028)
Co-authored-by: Teddy Reed <teddy@casualhacking.io>
2020-03-31 09:38:31 -04:00
kumarak
58d0671271
Extend the fields of curl_certificate table (#6176)
Co-authored-by: Stefano Bonicatti <stefano.bonicatti@gmail.com>
2020-03-31 09:34:36 -04:00
Robbie Ostrow
3486bf3a67
add status column to deb_packages table (#6341) 2020-03-31 09:32:25 -04:00
Teddy Reed
7920c2ea7d
macos: Fix processes cmdline parsing (#6340) 2020-03-30 14:22:22 -04:00
Teddy Reed
46a46da051
Return after check/dump requests in init (#6334) 2020-03-29 19:59:55 -04:00
outSH
b428e4ea55
[Table sanity check] disk_info (#6323) 2020-03-29 13:26:23 -04:00
puffyCid
d974bb34f0
Add UserAssist table (#5539) 2020-03-29 13:25:26 -04:00
Teddy Reed
bb861fb9d1
tests: Keep proc instance for test_base and test_osqueryd (#6335) 2020-03-28 12:03:58 -04:00
Stefano Bonicatti
296c6d336e
Update openssl to 1.1.1d (#6302)
- Update libarchive to build from source on Windows and macOS

- Update yara to build from source on macOS

- Update librdkafka to build from source on macOS

- Build librdkafka with SSL and SASL_SCRAM support on Linux

- Update librpm to 4.15.1 to support the newer openssl

- Update libxml2 to build from source on Windows and macOS

- Update lzma to build from source on Windows and macOS

- Use ICU library not only for boost but libxml2 too

- Implement a workaround to have Buck builds still compile
  with the old openssl version
2020-03-27 17:11:43 +01:00
Stefano Bonicatti
ef2763afbc
Hotfix a use-after-free accessing rows data (#6328)
When a query triggers multiple xFilter calls
and there's an operation that has to work on the sum of rows
resulting from all those calls, we trigger a use-after-free
when such operation tries to access the rows data.

This happens because each xFilter call we clear the rows
resulting from the previous xFilter call, and because
when returning the values of a text column we don't copy it,
but return a pointer to it.

A contrived example of a query with the issue is:
SELECT path=count(*) FROM file WHERE path = '/' OR path = '1'

This changes the last sqlite3_result_text parameter
from SQLITE_STATIC to SQLITE_TRANSIENT.

Addresses https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=20833
2020-03-26 22:17:13 -04:00
Ateeq Sharfuddin
8ca769ce02
Fix: broken Unicode filename searches on Windows (#6291) 2020-03-26 20:29:37 -04:00
Stefano Bonicatti
e70de5b8a7
Fix stack overflow when parsing deeply nested configs (#6325)
Parsing a configuration file as a JSON document
which contains deeply nested elements can lead to a stack overflow
when using the recursive parser of RapidJSON.
Since the configuration isn't changed or parsed frequently,
use the slower iterative parser instead.

Copying the configuration JSON document
that contains deeply nested elements, using the CopyFrom API,
can lead to a stack overflow, due to the recursive nature
of the RapidJSON GenericValue construction.
Detect the depth/nesting level of a config document
and limit it to 32 levels.

Using an iterative parser, while it avoids stack overflows,
can cause memory exhaustion if the config size is too big.
Limit the maximum config size, stripped from its comments, to 1MiB.

Addresses https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=20779
2020-03-26 20:25:42 -04:00
Stefano Bonicatti
8b8462d021
Fix chromeExtensions.test_sanity failure (#6324)
Removed the columns "script" and "match" from the test
since they do not belong to the chrome_extensions table,
they belong to chrome_extension_content_scripts.

Added the missing integration test for the table
chrome_extension_content_scripts.
2020-03-26 20:23:12 -04:00
Stefano Bonicatti
29697f6ba8
Fix TLSConfigTests.test_runner_and_scheduler failing (#6308)
Do not close the http server after 10s if there are requests coming,
since some tests may take more than 10s to run.
Reset the timer each time a request is received by the server instead.
2020-03-26 20:22:02 -04:00
Stefano Bonicatti
7ff9cf5a3f
Update osquery-toolchain to the 1.1.0 version (#6315)
This new toolchain contains a newer LLVM version (9.0.1),
a fix for the scan-build scripts and it keeps the LLVM static libraries,
necessary to implement the new BPF framework and tables.
2020-03-24 16:19:32 +01:00
Stefano Bonicatti
2e84e8cdf1
Fix parsing an invalid decorators config (#6317)
The "decorators" configuration value must be a JSON object,
otherwise we try to search through its inexistent members
and dereference a null pointer.

Added also a regression test.

Addresses https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=19274
2020-03-20 08:39:08 -04:00
Stefano Bonicatti
0409360ace
Fix assert used to check the retcode in test_5_daemon_sigint (#6318)
Partially addresses #6300
2020-03-20 08:37:25 -04:00