Skip to content

Commit a02a459

Browse files
committed
DerefExpression: Add missing nullptr check
Due to this missing check, evaluating a DSL expression can result in a null dereference, crashing the Icinga 2 process. Given that API users can also provide DSL expression as filters, this can be triggered over the network as well. This issue was assigned CVE-2025-61908.
1 parent beddc3f commit a02a459

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

lib/config/expression.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,10 @@ bool DerefExpression::GetReference(ScriptFrame& frame, bool init_dict, Value *pa
185185

186186
Reference::Ptr ref = operand.GetValue();
187187

188+
if (!ref) {
189+
BOOST_THROW_EXCEPTION(ScriptError("Invalid reference specified.", GetDebugInfo()));
190+
}
191+
188192
*parent = ref->GetParent();
189193
*index = ref->GetIndex();
190194
return true;

test/config-ops.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,10 @@ BOOST_AUTO_TEST_CASE(advanced)
241241
expr = ConfigCompiler::CompileText("<test>", "{{ 3 }}");
242242
func = expr->Evaluate(frame).GetValue();
243243
BOOST_CHECK(func->Invoke() == 3);
244+
245+
// Regression test for CVE-2025-61908
246+
expr = ConfigCompiler::CompileText("<test>", "&*null");
247+
BOOST_CHECK_THROW(expr->Evaluate(frame).GetValue(), ScriptError);
244248
}
245249

246250
BOOST_AUTO_TEST_SUITE_END()

0 commit comments

Comments
 (0)