29 votes

How is my CMS design? Any security, design, or other issues?

Alright, I'll start off by answering the questions you've asked, and depending if it all get's covered, I might append more at the end. We'll see, I have yet to actually read your questions! So, let'...
user avatar
  • 5,707
27 votes

PHP mail form is being abused

Your script is vulnerable to a header-splitting attack. Due to the poor design of PHP's mail() function, it is actually quite easy to introduce that kind of ...
user avatar
25 votes
Accepted

Custom algorithm for hashing and un-hashing password

First of all, what you have is an encryption function, not a hashing function (encryption can be reversed by knowing the algorithm and optionally a password, hashing is one way). For passwords, you ...
user avatar
  • 24.9k
20 votes

Is my Java SQL connection secure from hackers?

Do not store the connection information in a file unencrypted Assuming that you are connecting to a database somewhere on the internet... If you plan on distributing this application, do not store the ...
user avatar
19 votes
Accepted

PHP mail form is being abused

I'm not a php expert, but from reading up on the documentation it appears that it may be possible to insert additional from/to addresses using the "Additional Headers" field on the ...
user avatar
  • 653
19 votes
Accepted

Generating a password to save to a .txt file

By making it more Pythonic for one: ...
user avatar
  • 306
19 votes
Accepted

Python password manager

Some general tips: The runner should use argparse to parse arguments. It most definitely should not hardcode passwords. (object) is redundant in Python 3 class ...
user avatar
  • 8,737
18 votes

Pretty way of keeping sensitive info out of a logged command string in Ruby?

I see two more security issues with this code. Executing a string rather than an array of command and parameters When building a command line programmatically, it is dangerous to build it as a ...
user avatar
18 votes
Accepted

Is this safe against major XSS attacks?

Is it safe? Maybe. Is it the right way to do it? No. Even if it were safe, there’s a big problem with the SQL, and that’s that you’re inserting the dots after escaping, rather than before. I ...
user avatar
  • 1,717
18 votes
Accepted

Preventing SQL injection by converting all characters to their ASCII values

There's a common credo believed when evaluating the security of software: If it's homemade, it's unlikely secure. Sec.SE has a Q&A about homemade algorithms, which is somewhat germane to your ...
user avatar
  • 5,707
18 votes
Accepted

Salt generation in C#

var You should use them with max_length and salt too. If the type is obvious from the right hand side of the assignment you ...
user avatar
  • 50k
18 votes
Accepted

Employing 3DES algorithm in Java

It's kind of secure, but it uses older algorithms. Although Benjamin correctly identifies 3DES, I would not call 3 key triple DES "broken". It still delivers a security of about 112 bits which nobody ...
user avatar
17 votes
Accepted

Password hashing and matching

However, there is a lot of talk about what implementations are secure and not secure. How does my method measure up? Is it secure? Are there more secure methods in PHP for hashing tokens and matching ...
user avatar
  • 12.7k
17 votes
Accepted

Hashing passwords in PHP

I understand it is best not to use functions such as SHA1 or MD5. That is true. But sha256 is not that much better. Problem: simple sha256 There are basically two problems with your approach: ...
user avatar
  • 24.9k
15 votes
Accepted

PHP login based on a password parameter

This is not secure at all. Apart from the GET issue (use POST) and the hashing issue (use bcrypt) already mentioned, and the ...
user avatar
  • 24.9k
15 votes
Accepted

Checking that a password contains a '$', a digit, and an uppercase letter

Design So the point of this program is to check a password, right? There are many problems with your approach to verifying a password. To list a few: Password could be brute-forced in a matter of ...
user avatar
  • 21.7k
15 votes
Accepted

Cryptographically Secure Password Generation in C

Overall, this is pretty well written. It's very easy to read and understand. I especially like that you annotated the usage() function with ...
user avatar
  • 11.5k
14 votes
Accepted

How is my CMS design? Any security, design, or other issues?

Developement oop & design-patterns tags you've used are already saying what needs to be done here. At this moment it's a structural code (with some class syntax) and it will be very difficult to ...
user avatar
  • 676
14 votes
Accepted

Cryptographically-secure super-secret government message transaction machine

Well, I don't know much about PHP; but I know a little about security so that is what I am going to review. First I am going to review your encryption algorithm: AES-192. In June 2003, the U.S. ...
user avatar
  • 21.7k
13 votes

Sandbox or safely execute eval

Yes, I can poke a few holes in this. Firstly, your eval() isn't actually doing much of anything here. From the perspective of the parser running the script, that ...
user avatar
  • 427
13 votes

Memory with a twist

Hmm, very nice! Nice exercise for memory (despite the bit, uhm, sadistic twist), and the code is nicely written and very hard to pick on: what can be final is final, arguments are validated, no magic ...
user avatar
  • 107k
13 votes

Salt generation in C#

If you are going to call getSalt() more than once while your application is running, you should keep a single static instance of RNGCryptoServiceProvider in your class instead of creating a new one in ...
user avatar
  • 131
13 votes

Custom algorithm for hashing and un-hashing password

Since this topic has come up more than once on Security SE, this answer is heavily based upon the answers there. The wrong way The number one rule of secure cryptograpy has to be: don't roll your ...
user avatar
13 votes

Employing 3DES algorithm in Java

No, it's not secure. Your code is using Random instead of SecureRandom, which limits the entropy of the salt to 48 bits. In ...
user avatar
12 votes
Accepted

Memory with a twist

YES The game is cheatable. Like most software, the game is cheatable whenever there is a debugger available. In this case, I have loaded up FireBug in Firefox, and learned a few tricks. Here's how the ...
user avatar
  • 96.7k
12 votes
Accepted

C# AES Encryption

You're obtaining more than 20 bytes from PBKDF2-HMAC-SHA-1 and the attacker doesn't need the data from the second block (12 IV bytes), so your code slows down defenders by a factor 2 without affecting ...
user avatar
  • 2,670
12 votes
Accepted

Preventing XSS attacks in a Spring MVC application controller

Don't use RegEx to prevent XSS attacks! Why? Regex is not a tool that can be used to correctly parse HTML. There are much better ways to prevent XSS attacks. An example, using your code, modified ...
user avatar
  • 20.3k
12 votes
Accepted

Avoiding shell injection when calling Git in Python

Your defense strategy is known as "enumerating badness". As a rule, any strategy based on enumerating badness is doomed to fail. For example, you prohibit rm -rf /...
user avatar
12 votes

Securing my password wallet

Avoid calling system() If possible, avoid calling system(). There are almost always issues doing this: It is slow: ...
user avatar
  • 33.4k
11 votes

User registration and login

Let us review! Why are you strip_slashing and strip_tagging the username and passwords before they enter the database? Why do you care? (You don't, I'll get to that in the end). Calling ...
user avatar

Only top scored, non community-wiki answers of a minimum length are eligible