Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There are a SQL inject at \admin\newpost.php #1

Open
wenfeiniubi opened this issue Aug 29, 2019 · 0 comments
Open

There are a SQL inject at \admin\newpost.php #1

wenfeiniubi opened this issue Aug 29, 2019 · 0 comments

Comments

@wenfeiniubi
Copy link

SQL inject start at line 6, $_POST['title']filtered by modify function cleanTitle(),but the problem is : filter rules are too simple(cleanTitle function at CONF_mysql.php line51):
function cleanTitle($str) { $str = cleanUser($str); $str = strtolower(str_replace(' ', '-', $str)); return $str; }
you can see it's just replace space to '-' ,it's simple to bypass this filter with change space to comment

here is sql inject position code:
$title = $_POST['title']; $safe_title = cleanTitle($_POST['title']); mysql_query("INSERT INTO newpk (title,safe-title, author, date, text, open) VALUES ('$title', '$safe_title', '$user', '$newdate', '$text', '$open')") or die("Query failed with error: ".mysql_error()); mysql_query("UPDATE newpk_users SET posts=posts+1 WHERE name='" . getUser() . "'"); $comments = mysql_query("SELECT * FROM newpk WHERE title='$title'"); $row = mysql_fetch_array($comments);

fix advice:
add more filter rules
or use addslashes() to protect your variable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant