Obviously, TeX can open and write files using the usual operation, which is a possible attack vector. Putting execution in a sandbox or jail should take care of this.
Be sure to disable \write18 , which allows the TeX source file to execute OS commands. There is no reason to allow this mechanism.
As for the TeX interpreter itself, I would say that there is little to worry about that it probably has the least significant number of errors of any full-featured interpreter ever written. The other part of your stack will be much more significant.
Jon ericson
source share