Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rule Update - Adds npm support to pkg mgt processes #1866

Merged
merged 1 commit into from
Feb 11, 2022

Conversation

rileydakota
Copy link
Contributor

@rileydakota rileydakota commented Jan 25, 2022

Adds npm to package_mgmt_binaries for detection of "living off the land" style attacks that utilize NPM to pull down additional tooling/libraries

What type of PR is this?

Uncomment one (or more) /kind <> lines:

/kind bug

/kind cleanup

/kind design

/kind documentation

/kind failing-test

/kind feature

If contributing rules or changes to rules, please make sure to also uncomment one of the following line:

/kind rule-update

Any specific area of the project related to this PR?

Uncomment one (or more) /area <> lines:

/area build

/area engine

/area rules

/area tests

/area proposals

What this PR does / why we need it:

Adds npm to the list of package_management_binaries. NodeJS is one of the most popular development languages in the world - and the node base image comes packaged with npm. Like other package managers - npm installing packages in an already built container is a best practice violation at best, and a potential IoC at worst (attackers could potentially use it to pull down additional tooling/libraries without tripping the existing package management process alerts).

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

Yes

rule(list package_mgmt_binaries): `npm` added
rule(Launch Package Management Process in Container): support for detecting `npm` usage

@poiana
Copy link

poiana commented Jan 25, 2022

Welcome @rileydakota! It looks like this is your first PR to falcosecurity/falco 🎉

@poiana poiana added the size/XS label Jan 25, 2022
@jasondellaluce
Copy link
Contributor

Hi @rileydakota! Thanks for your contribution. Can you sign-off your commit?

Adds `npm` to `package_mgmt_binaries` for detection of "living off the land" style attacks that utilize NPM pull down additional tooling

Signed-off-by: rileydakota <dakotariley2@gmail.com>
@leogr
Copy link
Member

leogr commented Jan 26, 2022

/cc @Kaizhe

@poiana poiana requested a review from Kaizhe January 26, 2022 16:57
@leogr
Copy link
Member

leogr commented Feb 2, 2022

/milestone 0.32.0

@poiana poiana added this to the 0.32.0 milestone Feb 2, 2022
Copy link
Member

@leogr leogr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve

@poiana poiana added the lgtm label Feb 2, 2022
@poiana
Copy link

poiana commented Feb 2, 2022

LGTM label has been added.

Git tree hash: 568d596468083146e758fce93905961628a8c165

@poiana poiana added the approved label Feb 2, 2022
Copy link
Contributor

@jasondellaluce jasondellaluce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve

@poiana
Copy link

poiana commented Feb 11, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jasondellaluce, leogr, rileydakota

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@poiana poiana merged commit 7999e33 into falcosecurity:master Feb 11, 2022
@jasondellaluce jasondellaluce modified the milestones: 0.32.0, 0.31.1 Mar 7, 2022
@micheas
Copy link

micheas commented Oct 3, 2022

This was approved in error and generates false positives over 99% of the time.

npm start is the standard way of starting a node js application.

@micheas
Copy link

micheas commented Oct 3, 2022

Unless it can be rewritten to exclude npm start it should be backed out

@micheas
Copy link

micheas commented Oct 3, 2022

@rileydakota this is awful. 99% false positives in the real world.

Error Package management process launched in container (user=<NA> user_loginuid=-1 command=npm node /usr/local/bin/npm start container_id=7215a7d30edc container_name=<NA> image=<NA>:<NA>) k8s.ns=<NA> k8s.pod=<NA> container=7215a7d30edc

Is the most common log message. While the intention is good it resulted in all of the package management processes being ignored resulting in a net negative.

@rileydakota
Copy link
Contributor Author

rileydakota commented Oct 3, 2022

potentially could break it into a separate rule and rely on proc.args to only flag on instances of npm install which was the original intention/consistent with the spirit of the other rules. The current structure (having all package manager names grouped and then a macro that checks if proc.name is present in the list) wouldn't suffice however.

It may also be worth considering if other package managers have this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants