r/PHPhelp • u/aliosayle • Feb 08 '25
Security issue with script to fetch data dynamically
Hi,
I'm working on a PHP script to serve as a unified script for all frontend table pages. It functions in a way that the frontend sends the table name and column names, and the backend script then retrieves the data. This approach avoids loading all the data at once, which can be time-consuming for large datasets. The script also supports search and conditional queries.
I posted this on r/php for assistance, but I was informed that the script has several security vulnerabilities. The post request can be intercepted, allowing users to query any table they desire. I'm hoping someone can help me address these issues.
Here's the GitHub repository for the project: https://github.com/aliosayle/php-datatable-with-backed-processing.git
View all comments
1
u/Aggressive_Ad_5454 Feb 08 '25
This is going to be really hard to make secure against determined cybercreeps. See this cartoon.
https://imgs.xkcd.com/comics/exploits_of_a_mom.png
Seriously. Please please don't do this. If you have other peoples' money or private data in that database, with respect, doing this is irresponsible.
If you must make this app available on the public web, do the following things.
Or you'll get the dreaded phone call from Brian Krebs of https://krebsonsecurity.com/