decode/ipv6: bound hop-by-hop option to the option area - #15695
Conversation
|
@uwezkhan please have a look at the CLA. If you're not able or willing to sign it, that is fine. In that case just file bug reports. But please no more PRs until this is cleared up. |
|
Hey @victorjulien i have signed CLA , looking forward for a review |
catenacyber
left a comment
There was a problem hiding this comment.
This work will need green CI, a redmine ticket, and we would prefer the test as a suricata-verify test
696a3b1 to
36e56dd
Compare
|
Closing this pull request: its branch was updated after the pull Per our workflow, a new pull request is required when changes are made If you wish to create an in progress pull request that you can push to, Please see our GitHub Pull Request Workflow. |
|
@catenacyber pushed an update.
Before: the option was bounded on |
|
Could you please open a new PR as per our workflow ? |
|
Opened a fresh one as per the workflow: #15796. Rebased onto current main, single one-line bounds fix, and the regression test moved to suricata-verify (OISF/suricata-verify#3215). Let's continue there. |
Contribution style:
https://docs.suricata.io/en/latest/devguide/contributing/contribution-process.html
Our Contribution agreements:
https://suricata.io/about/contribution-agreement/ (note: this is only required once)
Changes (if applicable):
(including schema descriptions)
https://redmine.openinfosecfoundation.org/projects/suricata/issues
Link to ticket: https://redmine.openinfosecfoundation.org/issues/
Describe changes:
The TLV loop for IPv6 hop-by-hop and destination option headers gates each option on
(offset + 1 + ip6_optlen) > optslen. An option is two header bytes (type, length) plusip6_optlendata bytes, so the value ends atoffset + 1 + ip6_optlenand the bound has to beoffset + 2 + ip6_optlen. Before: an option that declares its data running one byte past the option area is accepted, and the Router Alert / Jumbo / Home Addressmemcpythen copiessizeof(value)bytes ending one byte past the area; when the header sits at the tail of the IPv6 payload that read goes past the payload.After: the option is rejected with
IPV6_EXTHDR_INVALID_OPTLEN, matching how the IPv4 option loop already bounds a full option against the remaining length. The check stays next to the read so each option type does not need its own guard. AddedDecodeIPV6HopOptLenTest01, which fails on the current tree and passes with this change.