Skip to content

fix analysisd: release owned hostname before ossecalert location alias - #2368

Merged
atomicturtle merged 1 commit into
ossec:mainfrom
atomicturtle:fix/ant-2026-5zoe8cq9-ossecalert-hostname-double-free
Oct 20, 2026
Merged

atomicturtle merged 1 commit into
ossec:mainfrom
atomicturtle:fix/ant-2026-5zoe8cq9-ossecalert-hostname-double-free

Conversation

@atomicturtle

Copy link
Copy Markdown
Member

Since #1668, OS_CleanMSG_ex() can hand OSSECAlert_Decoder_Exec() an agent event whose hostname is a heap copy of the agent name with EF_FREE_HNAME set. The decoder then set lf->hostname = lf->location without clearing that ownership flag, so Free_Eventinfo() freed the same buffer twice and aborted analysisd.

Free the owned hostname and clear EF_FREE_HNAME immediately before the alias. The existing #1817 path then duplicates hostname on a full decode; early returns keep the unowned alias as before #1668. Add issue_1668_ossecalert_hostname regression.

Discovered by Anthropic's OSS Scanner, as vulnerability ANT-2026-5ZOE8CQ9.

Since ossec#1668, OS_CleanMSG_ex() can hand OSSECAlert_Decoder_Exec() an agent
event whose hostname is a heap copy of the agent name with EF_FREE_HNAME
set. The decoder then set lf->hostname = lf->location without clearing
that ownership flag, so Free_Eventinfo() freed the same buffer twice and
aborted analysisd.

Free the owned hostname and clear EF_FREE_HNAME immediately before the
alias. The existing ossec#1817 path then duplicates hostname on a full decode;
early returns keep the unowned alias as before ossec#1668. Add
issue_1668_ossecalert_hostname regression.

Discovered by Anthropic's OSS Scanner, as vulnerability ANT-2026-5ZOE8CQ9.

Signed-off-by: Scott R. Shinn <scott@atomicorp.com>
@atomicturtle
atomicturtle merged commit aa6c506 into ossec:main Oct 20, 2026
5 checks passed
atomicturtle added a commit to atomicturtle/ossec-hids that referenced this pull request Oct 20, 2026
Keep clean targets for both the new date-oob objects and the
ossecalert hostname objects from ossec#2368.
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

Successfully merging this pull request may close these issues.

1 participant