lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Mon, Mar 17, 2014 at 12:31 PM, Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:
> >The data mode patch defines a new mode 'd' for loadfile which raises
> >an error at the lexical stage if any loop construct or function
> >definition has been found when loading the file.  It's useful to have
> >if-statements, but for/while/repeat/goto/function are no go!
>
> An interesting idea.
>
> But those of a paranoid persuasion should probably combine it with
> other techniques (like, good old-fashioned sandboxing and such):

You do not need to be paranoic to be worried. A 12-line program like
this can trash many machines, without needing any reserved word:

a = "012345678901234567890123456789012345678901234567890123456789"
a = a .. a .. a .. a .. a .. a .. a .. a .. a .. a
a = a .. a .. a .. a .. a .. a .. a .. a .. a .. a
a = a .. a .. a .. a .. a .. a .. a .. a .. a .. a
a = a .. a .. a .. a .. a .. a .. a .. a .. a .. a
a = a .. a .. a .. a .. a .. a .. a .. a .. a .. a
a = a .. a .. a .. a .. a .. a .. a .. a .. a .. a
a = a .. a .. a .. a .. a .. a .. a .. a .. a .. a
a = a .. a .. a .. a .. a .. a .. a .. a .. a .. a
a = a .. a .. a .. a .. a .. a .. a .. a .. a .. a
a = a .. a .. a .. a .. a .. a .. a .. a .. a .. a
a = a .. a .. a .. a .. a .. a .. a .. a .. a .. a

Modestly, I would rather use my 'protect' module [1] (which does not
need any change to the language).


[1] http://lua-users.org/lists/lua-l/2013-12/msg00406.html

-- Roberto


The Billion Laughs Attack[1], simple and elegant. Quite a number of places you can slip such a construct into seemingly secure systems.

Of course you can combine this sort of patch with a custom allocator and a memory limit, but then it's not so simple anymore...

[1] https://en.wikipedia.org/wiki/Billion_laughs

--
Sent from my Game Boy.