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

ospfd: Solved crash in OSPF TE parsing #15431

Merged
merged 1 commit into from
Feb 27, 2024

Conversation

odd22
Copy link
Member

@odd22 odd22 commented Feb 26, 2024

Iggy Frankovic discovered an ospfd crash when perfomring fuzzing of OSPF LSA packets. The crash occurs in ospf_te_parse_te() function when attemping to create corresponding egde from TE Link parameters. If there is no local address, an edge is created but without any attributes. During parsing, the function try to access to this attribute fields which has not been created causing an ospfd crash.

The patch simply check if the te parser has found a valid local address. If not found, we stop the parser which avoid the crash.

@frrbot frrbot bot added the ospf label Feb 26, 2024
@ton31337 ton31337 added this to the 10.0 milestone Feb 27, 2024
@ton31337
Copy link
Member

@Mergifyio backport dev/10.0 stable/9.1 stable/9.0

Copy link

mergify bot commented Feb 27, 2024

backport dev/10.0 stable/9.1 stable/9.0

✅ Backports have been created

if (IPV4_NET0(attr.standard.local.s_addr)) {
ote_debug(" |- Found no valid TE Link local address. Abort!");
return -1;
}
edge = get_edge(ted, attr.adv, attr.standard.local);
Copy link
Contributor

Choose a reason for hiding this comment

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

can we validate the "edge" instead of the above added check?

Copy link
Member Author

Choose a reason for hiding this comment

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

No. In fact, the edge structure is correctly created. But, the unique identifier of the edge in the TED is based on the local address. Thus, if the local address is IPV4_NET0 (i.e. 0.0.0.0) we cannot correctly reference the edge in the TED. However, local ID is also a valid identifier. So, I need to check that both local address and local ID have not been found during TE parsing. I'll update the PR accordingly.

Iggy Frankovic discovered an ospfd crash when perfomring fuzzing of OSPF LSA
packets. The crash occurs in ospf_te_parse_te() function when attemping to
create corresponding egde from TE Link parameters. If there is no local
address, an edge is created but without any attributes. During parsing, the
function try to access to this attribute fields which has not been created
causing an ospfd crash.

The patch simply check if the te parser has found a valid local address. If not
found, we stop the parser which avoid the crash.

Signed-off-by: Olivier Dugeon <[email protected]>
@ton31337 ton31337 merged commit 541503e into FRRouting:master Feb 27, 2024
9 checks passed
riw777 added a commit that referenced this pull request Feb 27, 2024
ospfd: Solved crash in OSPF TE parsing (backport #15431)
riw777 added a commit that referenced this pull request Feb 27, 2024
ospfd: Solved crash in OSPF TE parsing (backport #15431)
riw777 added a commit that referenced this pull request Feb 27, 2024
ospfd: Solved crash in OSPF TE parsing (backport #15431)
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.

3 participants