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

OSSEC-HIDS Security Audit Findings #1821

Closed
cpu opened this issue Jan 15, 2020 · 5 comments
Closed

OSSEC-HIDS Security Audit Findings #1821

cpu opened this issue Jan 15, 2020 · 5 comments

Comments

@cpu
Copy link
Contributor

cpu commented Jan 15, 2020

Hi folks,

I spent some free time recently auditing OSSEC. I was primarily focused on a threat model where an OSSEC agent is compromised (e.g. the agent key and assoc. counters are known) and used to attack the OSSEC server (primarily ossec-remoted and ossec-analysisd). Given the problem domain of OSSEC and HIDS generally I think this is fair game. Since these are post-auth bugs and there isn't guidance on vulnerability disclosure in the README I thought it was acceptable to post information full-disclosure to the repo.

I found a handful of bugs and have done my best to address the root cause, the affected versions, the impact and potential fixes in the issues I've filed. I will request CVEs for the security relevant bugs later on.

In terms of rough risk levels I'd categorize the findings as follows:

Informational:

Low:

Med:

High:

Some caveats/context to add:

  1. I'm not a professional C coder, w.r.t suggested fixes YMMV!
  2. I don't write exploits for a living. My assessments of exploitability/risk should be considered lower bounds.
  3. This wasn't an extensive audit. I followed my nose and used some fuzzing.
  4. OSSEC 2.7 seems to be the earliest tag in the Github repo. I didn't dig deeper into history to see if any of these bugs affect older releases (some likely do).

If you would be interested in trying to adopt fuzzing as part of your CI (or as an integration with oss-fuzz, etc) I'd be happy to try and provide some notes but likely don't have the resources to implement it myself to a merge-able standard of work.

Thanks! You can close this top-level issue as you see appropriate.

@cpu
Copy link
Contributor Author

cpu commented Jan 15, 2020

Another note: I did not file bugs related to algorithmic complexity/DOS. There are a few places where ossec-analysisd is doing O(N) work for attacker controlled N and can be made to consume a lot of CPU/processing time. If you are interested in fixing this class of bug I can file an additional issue or two.

@cpu
Copy link
Contributor Author

cpu commented Jan 16, 2020

👋 Small update: I've opened pull requests to address the bugs I feel confident fixing myself.

As a bonus I opened another small PR to fix a Makefile bug I encountered: #1822

The ones I haven't addressed:

  • analysisd-OS_ReadMSG-use-after-free-ossecalert and analysisd-OS_ReadMSG-use-after-free-syscheck -> I left a comment about these two. My naive proposed fix would leak memory.
  • rootcheck-check-rc-if-shell-injection-risk -> This will be fairly intricate and I'm skeptical the value of the check merits the time needed to redesign/re-implement it.
  • analysisd-syscheck-decoder-msg-location-path-injection -> I'd like a second set of eyes on the bug before I assume my proposed fix is sensible.
  • analysisd-OS_CleanMSG-allows-control-chars-in-msg -> This may be somewhat intricate as well and I'm probably not a strong enough C coder to do it with expedience.

@cpu
Copy link
Contributor Author

cpu commented Jan 22, 2020

I've updated the issue description to reflect which of the bugs are fixed in master.

I will request CVEs for the security relevant bugs later on.

I completed the CVE request forms today and will update relevant issues when CVEs are assigned.

@atomicturtle
Copy link
Member

Looks like the CVE's are assigned now, I'd like to get the CVE's associated with the issue ID's here so I can align those up with the 3.6 changelog entries. Thanks for the hard work here!

@cpu
Copy link
Contributor Author

cpu commented Jan 30, 2020

I'd like to get the CVE's associated with the issue ID's here so I can align those up with the 3.6 changelog entries.

Done ☑️

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

No branches or pull requests

2 participants