SShortSingh.
Back to feed

One Quote Character Can Bypass a PHP Login: SQL Injection and the Fix

0
·2 views

A single quote typed into a login form can let an attacker log in as an administrator without knowing the password, because user input is pasted directly into the SQL query. The author demonstrated this on a local PHP 8.1 test database using two classic payloads, one commenting out the password check and one making the WHERE clause match every row. Escaping quotes with addslashes() is unreliable because escaping rules depend on the database and connection, so it is not a real fix. The recommended remedy is prepared statements with bound parameters via PDO, plus hashing passwords with password_hash() and verifying them with password_verify(). The article also warns that Laravel's raw query methods are vulnerable unless bindings are used, and urges developers to audit their code for unsafe string-built queries.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

Guide Shows How to Scrape LinkedIn Job Postings Without Logging In

A developer tutorial explains how to collect LinkedIn job listings using public pages that are visible to logged-out visitors. It describes two sources: a paginated search endpoint that returns job cards with IDs, titles, companies, locations and posting dates, and individual job pages that include descriptions, criteria, applicant counts and sometimes salary. The author notes that some fields, such as external apply links, workplace type, job function and the poster, are only available to signed-in users or must be inferred from the text. The piece includes Python code using requests and BeautifulSoup, and the author discloses that they maintain a commercial LinkedIn jobs scraper on Apify. The approach was tested in November 2026.

0
ProgrammingDEV Community ·

dol8: A Python CI/CD gate that blocks pull requests with energy regressions

dol8 is an open-source CI/CD gate that stops pull requests from increasing a Python program's CPU energy use. It reads real RAPL energy measurements on bare-metal Linux and falls back to perf counters on virtual machines or CPU-time estimates on Windows. Its measurement core is written in Rust via PyO3, keeping the measurement separate from Python's own overhead, while Python handles statistics and orchestration. Every result is labeled with its measurement source and confidence, the gate avoids failing builds on noisy data, and comparisons across measurement types are blocked. The project is at v0.4-alpha under the MIT license, validated on AMD Ryzen, with Intel validation still in progress.

0
ProgrammingDEV Community ·

Kaze: A Go Terminal Client That Searches Multiple Sources and Drives mpv Over IPC

After repeated gaps in ani-cli, the developer built Kaze v4.3.0, a single static Go binary for Windows, macOS, and Linux that searches several sources at once. Queries run concurrently under a 3-second timeout, with results streamed into a Bubble Tea UI, and AUTO mode switches to another mirror when a CDN fails. The app controls mpv through IPC, using Unix sockets on Linux and macOS and Windows Named Pipes on Windows, which avoids shell injection and enables live shader swaps and skip-chapter controls. A security audit also removed an unsafe mpv TLS-bypass flag and added IP checks at dial time to block SSRF and DNS rebinding attacks.

0
ProgrammingDEV Community ·

A Single Line Made a Python Queue 2,500 Times Slower: Why list.pop(0) Is Costly

A developer found that processing one million tasks from a Python list took about 58 seconds because each pop(0) call shifted every remaining element. Replacing the list with collections.deque and using popleft() cut the runtime to roughly 0.023 seconds on Python 3.15.2 on an Apple M4. The article explains that list removal and insertion at the front cost O(n), so total work grows quadratically as data increases. It also covers related slowdowns, such as repeatedly building lists with out = out + [x] and string concatenation with += when the string has extra references. The author recommends deque for queues, append or += for lists, and str.join for building strings.