Skip to content

packs: Update reverse shell query pack to check for a valid remote_port#7567

Merged
mike-myers-tob merged 1 commit intoosquery:masterfrom
raj3shp:refine_pack_osx_attacks
Apr 29, 2022
Merged

packs: Update reverse shell query pack to check for a valid remote_port#7567
mike-myers-tob merged 1 commit intoosquery:masterfrom
raj3shp:refine_pack_osx_attacks

Conversation

@raj3shp
Copy link
Copy Markdown
Contributor

@raj3shp raj3shp commented Apr 22, 2022

Hi,
I would like to make a minor improvement to avoid false positives for Behavioral_Reverse_Shell query in osx-attacks pack. Certain build processes are spawned by IDEs such as Xcode which do not have any open files, but have an open socket that is not a network socket which results in remote_port being 0 and remote_address empty.

In this PR, I basically add a check for process_open_sockets.remote_port > 0 to avoid all possible false positives which do not indicate a reverse shell. We can confirm it's safe considering port 0 is reserved and cannot be used for network sockets.

@raj3shp raj3shp requested review from a team as code owners April 22, 2022 22:26
@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla bot commented Apr 22, 2022

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: raj3shp / name: Rajesh Pangare (f8a367e)

@mike-myers-tob mike-myers-tob added macOS packs ready for review Pull requests that are ready to be reviewed by a maintainer labels Apr 25, 2022
@mike-myers-tob mike-myers-tob merged commit e312ee1 into osquery:master Apr 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

macOS packs ready for review Pull requests that are ready to be reviewed by a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants