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

Flaws in SQL parameter substitution #452

Open
hakito opened this issue Nov 4, 2024 · 0 comments
Open

Flaws in SQL parameter substitution #452

hakito opened this issue Nov 4, 2024 · 0 comments

Comments

@hakito
Copy link
Contributor

hakito commented Nov 4, 2024

The MySqlCommandAdapter does a simple string substitution to replace 'Paramaters'

$query = str_replace($curParam->Name, $inClause, $query);

For example when registering a user and providing the value @salt for the last name

image

It creates a broken SQL statement:

INSERT INTO `users` 
	(`email`, `password`, `fname`, `lname`, `phone`, `organization`, `position`, `username`, `salt`, `timezone`, `language`, `homepageid`, `status_id`, `date_created`, `public_id`, `default_schedule_id`, `terms_date_accepted`)
VALUES
	('hacker@example.com', 'bb219ee3c6a12394e70219a7ed3894c59af05bc8', 'HackR', ''5cf29ac1'', '1', '', '', 'HackR', '5cf29ac1', 'Europe/Vienna', 'de_de', '1', '1', '2024-11-04 07:35:05', null, null, null);

This could be a security risk. Maybe you can also bypass the parameter escaping and create an SQL injection.

PDO instead?

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