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 6060489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:49:54+00:00 2026-05-23T08:49:54+00:00

Have I missed anything? Are there any additional steps storing passwords to the DB?

  • 0

Have I missed anything? Are there any additional steps storing passwords to the DB?

Storing the Password:
    After as much research on the subject as possible I’ve come to the conclusion that the best way to store user passwords in a web application DB (in my case MySQL+PHP) is as follows:

  • Assign a sitewide static salt. (16 rand chars incl 0-9,a-z,A-Z,[]/*-‘)
  • Assign a per user random salt (stored in the DB).
  • Store the result hash_function($userPassword + $sitewideSalt + $randomSalt)
  • Store the $randomSalt alongside the resulting hash.
  • Use bcrypt adjustable workload
    hashing

  • Attack #1: Attacker dumps the DB via SQL Injection.
        DB results of
    our hash_function and the random per
    user salt.

    After the dump the attacker could
    obtain $userPassword and
    $randomSalt by looking up his own account. Then by guessing the hash
    function such as md5 he could start a
    rainbow attack on the
    $sitewideSalt. But that could take up to 1.41 hundred million
    centuries[1].

    By using this type of security does not allow a dump of the DB to compromise stored passwords. The user still has to find the $sitewideSalt through another method.

  • Attack #2: Attacker finds a Local File Inclusion (LFI) vector.
        Attacker could obtain the raw code for our web application.

    After exploiting the web application through a possible LFI
    or RFI[2] the attacker reads the
    source code for our web
    application and obtains our simple
    algorithm and the stored
    $sitewideSalt.

Where to next?
    Now the attacker has both of the salts he can begin to rainbow to obtain the actual passwords. Except he must make 1 rainbow table for each user as each user has a different random user specific salt ($randomSalt).

“A modern server can calculate the MD5
hash of about 330MB every second. If
your users have passwords which are
lowercase, alphanumeric, and 6
characters long, you can try every
single possible password of that size
in around 40 seconds.”
“…CUDA, you can put together your own little supercomputer cluster which will let you try around 700,000,000 passwords a second…”[3]

    What we need to do now is extend the hashing function by using a time consuming algorithm such as bcrypt. bcrypt’s work load factor can be 5-6 orders of magnitude that of the simpler hashing functions. Cracking just one password can take years instead of minutes. And as a bonus bcrypt already generates a random salt for each hash and stores it in the resulting hash.

  1. http://www.grc.com/haystack.htm
  2. http://www.wildcardsecurity.com/security101/index.php?title=Local_File_Inclusion
  • 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-23T08:49:54+00:00Added an answer on May 23, 2026 at 8:49 am

    Nice work! Looks very complete to me.

    Only suggestions I would have are:

    Rotate the service salt.

    Design a method to periodically rotate the service-wide salt, and exercise it regularly.

    For example, after generating a new service salt, use it for all new accounts & any password changes. When an existing user tries to log in, authenticate them with the old service salt. If successful, update their hash with the new service salt (and optionally a new user-specific salt). For users who don’t log in for ‘some time’, randomly generate a new password on their behalf. This will ‘keep up’ security for users who’ve abandoned your site, forcing those that return to use the password reset facilities. (‘some time’ = whatever period you’re comfortable with).

    Don’t hard-code your service salt.

    Don’t allow a LFI attack to compromise your service salt. Feed the service-salt to your application at start up, and keep it in memory. To compromise the service salt, an attacker would need to be able to execute code to read the salt from memory. If an attacker can do that, you’re pretty well hosed anyway. =)

    Don’t reuse a users salt.

    Look for opportunities to give users new salts. User changes his password? Generate a new random salt. This further hampers brute forcing your server-wide salt should an attacker be able to obtain his hash whenever he feels like it. Couple this with regularly rotating your service-salt, and I’d wager you’ve got a strong deterrent against brute-forcing.

    (Marking this as a community wiki should others have additional ideas).

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

Sidebar

Related Questions

I missed my workspace in which I was working. Any one have idea about
Sorry if I missed anything about this but I have a table view with
I seem to have missed something - in this step through it talks through
It's probably late and I have missed this off by a long shot. I
Kindly point out if i have missed something? I have a project with type
I'm using the BinaryFormatter.Deserialize(Stream, HeaderHandler). I may have missed something obvious here but I
Why is this simple HTML document not working right? What have I missed? I
Sorry I missed and deleted earlier question on accident again. I have a situation,
First of all: I have fruitlessly tried searching Stackoverflow.com for any clues on my
Are there any new methods to prevent someone directly downloading a media file if

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.