Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7582299
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T18:24:07+00:00 2026-05-30T18:24:07+00:00

Note: This is a project with a made-up site inside a virtual machine. It

  • 0

Note: This is a project with a made-up site inside a virtual machine. It is a senior college project that I am working on. I am not trying to exploit an actual, real-world website. This is for educational purposes to understand how powerful such exploits can be, even with given functions.

I’m currently working on a project (under a safe and controlled environment, inside a VM) that involves exploiting vulnerabilities of a website. One part involves exploiting a SQL statement. The goal is to be able to just type in a username and an incorrect password and still be able to log in. I’ve been working on this for a few hours with no such luck, and I’ve done quite a bit of research on seeing what vulnerabilities are available.

When a person submits their username and a password (in this case, it can be anything), a function is run with the following prepared SQL statement:

$query = "SELECT Salt FROM Accounts WHERE Username = '$quoted'";

Where $quoted is:

$quoted = $this->db->quote($user);

This essentially adds an additional single/double quote for every single/double quote provided. Despite trying other possibilities (such as ' OR 1=1', etc), the closest thing I’ve come up with is this:

SELECT Salt FROM Accounts WHERE Username = '\'' OR 1=1 -- '

With the $user variable originally being \' OR 1=1 --. The first and last quotes are added automatically through the quote() function, along with the additional quote after the escaped single quote. This however doesn’t seem to be proper SQL syntax, probably because it is interpreting the entire $user input as a Username.

There is another prepared statement after this one, but it relies on an md5 hash of a password concatenated with a salt, and I don’t think there is really any way of making anything inject-able in the statement once md5 returns the hash. For curiosity, the statement is this:

$query = "SELECT * FROM Accounts WHERE Username = '$user' AND Password = '$hash';

With $hash = md5($pass.$salt).

Does anyone want to shed some light on any possibilities? Maybe I’m just really overlooking it, but I feel like I’ve tried everything.

EDIT: I solved this. It had to do with working around another function to exploit the injection. It ultimately added a username with the injection code (second-order injection), and then it would do a login. The login procedure quoted the username for the first query, but the second query did not; thus, the user would automatically log in.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T18:24:08+00:00Added an answer on May 30, 2026 at 6:24 pm

    Backslashes in SQL are a vexed subject, rather dependent on the DBMS in use.

    Standard SQL ascribes no meaning to them. To escape a quote in a string, you double up the quote. The quote method you’re using seems to follow that principle:

    • Input: \' OR 1=1 --
    • Output: '\'' OR 1=1 --'

    Some DBMS may actually define a meaning for backslashes. However, to complicate things further, you typically have an indeterminate number of intermediary languages (PHP, ODBC, etc) and these may modify strings too, and may apply meanings to backslashes that pure SQL does not.

    If you typed X' OR 1=1 --, (with X in place of the backslash), you would get the same mapped string with the backslash replaced by the X. So, if the attack is going to work, you need the quote() method to be confused about what the DBMS is going to do with the backslash, but that would amount to a bug in the quote() method.

    You might get more traction if you managed to embed a Unicode escape sequence. For example, U+0027 (decimal 39) is the single quote. This sort of trickery might get you past quote(), but it probably won’t. The idea behind the quote()-like methods is that you should not be able to wriggle text past them that means something other than what was expected. Non-minimal UTF-8 encodings for characters might manage to trigger problems because of a bug in the server, but it isn’t all that probable. The Unicode standard is clear that invalid UTF-8 encodings should not be accepted — that’s doubly true anywhere near security information.

    You’re right that the output of a hash, enclosed in quotes, is not going to be usefully injectable, especially if the attacker never sees the salt.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

System.Diagnostics.Contracts.ContractException is not accessible in my test project. Note this code is purely myself
Note: This is an Actionscript project, not a Flex project. I have class A
NOTE: This is a solution for Project Euler Problem 14 . If you still
(Note: This is for MySQL's SQL, not SQL Server.) I have a database column
Note This is not a REBOL-specific question. You can answer it in any language.
(NOTE: This question is not about escaping queries, it's about escaping results) I'm using
as a side project I am working on some home-baked prime generation problems, trying
The problem scienario is as follows (Note: this is not a cross-jar dependency issue,
I have a core project that does not run as an application, its only
I am working on a project for an online class I made the mistake

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.