osquery / osquery/osquery

readline_events table, capturing shell interaction in real time

Open
#6,226 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

blueprint bpf events virtual tables
Dominant language
C++
Stars
23.6k
Forks
2.6k
Avg merge
6d 7h
Merged PRs (30d)
14

Description

Blueprint

This table is able to capture the shell prompt and user input for any running bash instance on the system.

Querying the table would return something similar to this:

 timestamp = 8442831439641
   user_id = 1000
  group_id = 1000
process_id = 10822
 thread_id = 10822
    prompt = alessandro@ubuntu1910-beta:~/Projects/Public/linux$
user_input = git status
      time = 1580830272

How it works

Two BPF programs (one for the enter event, and another one for the exit) are generated at runtime to process data compatible with the function signature we are going to trace.

The programs are then attached to a pair of Uprobe/Uretprobe events that have been setup to perform system-wide tracing of the readline function.

Demo

https://asciinema.org/a/8Ud1Vm5MtfvxRRZUkVMGmuW65

Required dependencies

This new feature would make use of the ebpfpub library to implement function tracing capabilities within osquery using BPF.

The library itself has no dependencies other than the BPF architecture support in the osquery-toolchain. Kernel headers are not required, since this feature makes use of uprobes (the sample would apply to tracepoints).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the readline function tracing entry and exit points described in the issue, along with the ebpfpub dependency and its Uprobe/Uretprobe support. Done means a new readline_events table captures prompt and user input from running bash instances in real time and exposes the listed process, identity, prompt, input, timestamp, and time fields.

Written by the indexing model from the issue text.

Assessment

Tech stack
bash, cpp, linux
Domain
observability, operating-systems, security
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.