| ▲ | dinkelberg a day ago |
| What an awful fix. Does WordPress seriously still use basic string concatenation (edit: and sprintf) to build SQL queries? |
|
| ▲ | Yokohiii a day ago | parent | next [-] |
| To construct dynamic sql queries to have to string concatenate at least some parts, . User data should of course be passed via prepared statements. |
| |
| ▲ | codedokode a day ago | parent | next [-] | | One usually uses "query builder" pattern for that. Also, regarding placeholders, historically many DB and frameworks do not support passing lists for a value in a placeholder (like "WHERE id IN(?)") so users of such software fall back to string concatenation. | | | |
| ▲ | formerly_proven a day ago | parent | prev [-] | | Not user code, no. Someone eventually has to, but virtually every ORM under the sun allows you to construct dynamic queries without having to concatenate strings yourself or resort to string interpolation. | | |
| ▲ | winstonwinston a day ago | parent [-] | | Quick search shows this in Wordpress: > WordPress database access abstraction class. class wpdb {}
So this is some sort of ORM provided. $results = $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}options WHERE option_id = 1", OBJECT );
> Some of the methods in this class take an SQL statement as input. All untrusted values in an SQL statement must be escaped to prevent SQL injection attacks. Some methods will escape SQL for you; others will not. Check the documentation to be sure before you use any method in this class. For more on SQL escaping in WordPress, see the section entitled Protect Queries Against SQL Injection Attacks below.It does not however prevent $wpdb users from NOT binding query parameters, which leads to this vulnerability. | | |
| ▲ | codedokode a day ago | parent [-] | | It seems that wpdb doesn't support placeholders for comma-separated lists, like in "WHERE id IN (?)". So the developers have to fall back to string concatenation. |
|
|
|
|
| ▲ | reddalo a day ago | parent | prev [-] |
| WordPress source code is a mess. They should re-write it from scratch using modern technologies, or even a framework like Laravel. |
| |
| ▲ | mewpmewp2 a day ago | parent | next [-] | | That could as well just be a complete new product then, right? It would definitely be a breaking change and unmigratable. | |
| ▲ | mapmeld a day ago | parent | prev | next [-] | | A few months back, Cloudflare used AI to make a Rust rewrite of WordPress, but I doubt that they would have found or corrected issues like this on the way?
https://blog.cloudflare.com/emdash-wordpress/ | | | |
| ▲ | pluc a day ago | parent | prev | next [-] | | Mullenweg will never allow WP to slip away from his control. "He wrote it" so you can't have it. | | | |
| ▲ | sourcecodeplz a day ago | parent | prev | next [-] | | Who is they? automaticc? | |
| ▲ | dncornholio a day ago | parent | prev [-] | | Impossible. WordPress has had the PHP-group even considering writing new PHP features in a separate 7.4 branche and release them specifically for WP. |
|