To protect against possible supply chain attacks, disable Lua rules by
default. They can be enabled under the "security" section of
suricata.yaml.
Ticket: #6122
DetectLuaData *lua = NULL;
SigMatch *sm = NULL;
+ /* First check if Lua rules are enabled, by default Lua in rules
+ * is disabled. */
+ int enabled = 0;
+ (void)ConfGetBool("security.lua.allow-rules", &enabled);
+ if (!enabled) {
+ SCLogError("Lua rules disabled by security configuration: security.lua.allow-rules");
+ goto error;
+ }
+
lua = DetectLuaParse(de_ctx, str);
if (lua == NULL)
goto error;
/** \test http buffer */
static int LuaMatchTest01(void)
{
+ ConfSetFinal("security.lua.allow-rules", "true");
+
const char script[] =
"function init (args)\n"
" local needs = {}\n"
- /etc/
- @e_sysconfdir@
+ lua:
+ # Allow Lua rules. Disabled by default.
+ #allow-rules: false
+
# Some logging modules will use that name in event as identifier. The default
# value is the hostname
#sensor-name: suricata