9

I am trying to program a web interface for automated generation of calculus tests. The idea is to take some input from user, say number of problems and name of instructor, and then by means of php generate the latex file, process it with pdflatex and let user download it.

The procedure seems to be quite straightforward. But what if somebody enters for instructor name something like "Mr. Mackey \input{/etc/hosts}" ?

looks like one can retrieve any file accessible to web server.

How to prevent this? May be there are natural php ways? I am very new to php, and would appreciate any advice.

user1898918
  • 91
  • 1
  • 3

1 Answers1

4

As Paulo wrote, David's answer here is the right solution.

Here's a magazine article which talks about some of the risks. There's an associated research article as well.

TH.
  • 62,639
  • I am using at this point a simple routine that checks that the only latex expressions in the entered name are accents... I will use openin_any=p too. Thanks a lot. – user1898918 Dec 14 '12 at 20:54