←back to thread

698 points jgrahamc | 2 comments | | HN request time: 0.493s | source
1. minxomat ◴[] No.20423367[source]
> The Lua WAF uses PCRE internally and it uses backtracking for matching and has no mechanism to protect against a runaway expression. More on that and what we're doing about it below.

We run a WAF based on LuaJIT in resty. Just to be clear, the resty interface to PCRE does provide a DFA mode. Furthermore, Zhang actually ported RE2 (see other comments here) to C as sregex, which is usable from Lua as a c module regardless if it runs in resty or a custom Lua app.

> Switching to either the re2 or Rust regex engine which both have run-time guarantees. (ETA: July 31)

Not addressed at Cloudflare, since they had a defense in place. But just in case anyone else is running a similar thing in Lua.

And:

> In the longer term we are moving away from the Lua WAF that I wrote years ago.

Then sregex might be the perfect fit here. Though Rust is technically safer. Depends on what longer term means.

replies(1): >>20425507 #
2. ◴[] No.20425507[source]