Can I name a file .pl and run it as html on server? I want to know if it is possible to name file .file.pl and run it as HTML.

I want this to exploit CORS misconfiguration of a website which only checks origin header for .realwebsite.pl and we can add anything before the dot but not after pl.

It is possible, however it all depends on how the web server (Nginx, Apache, etc) is set up to serve those files back. For example, it is very much possible to have a web-server that knows nothing about PHP, and therefore if provided a .php file, it will simply return it as plain-text, i.e. the MIME type of text/plain.

If you have full control of the server, you could probably set it up so it serves files with .pl extensions as text/html... but then you're not really exploiting any vulnerability.

You can't "run something as HTML", since HTML is not a programming language, it is a markup language, hence "Hypertext Markup Language". It is a syntax that is then parsed by a web browser to display elements on a web page. You can think of HTML to being similar to Markdown, which is just another syntax that is then used by a Markdown parser (like you see on GitHub).


How to force nmap to check all the ports? I heard that nmap scans for only 1000 most common ports while we do server scan. Is it possible to force nmap to check all the ports for scanning? If yes,How?

You can pass in the -p- flag as specified in the nmap help page.

For example,

  nmap -p- 192.168.1.1

Another option would be to pass in the explicit range you want with the -p flag.

For example,

  nmap -p 1-65535 192.168.1.1


Doesn't the same string encrypted with the same key generate the same encrypted value? This is my page and class to encrypt the string entered and saved in database.
Each time, the Key__c is the same, as I take it from custom settings.
But when I enter abc and save two times, the entered value is different.
What is the reason?

<apex:page controller="encryptNewController">
    <apex:form >
         <apex:outPutLabel value="Encrypted by Code"/>
         <apex:inputsecret value="{!encryptedByCode}"/>

         <apex:commandButton value="Save" action="{!saveValues}"/>
         <apex:outputText value="{!decryptedDataString}"/>
    </apex:form>
</apex:page>

public with sharing class encryptNewController {

     Public Encrypt_Object__c encryptObject {get;set;}
     Public String encryptedByCode {get;set;}
     Public String decryptedDataString {get;set;}
     Blob cryptoKey;
     public encryptNewController(){
          encryptObject=new Encrypt_Object__c();
     }
     public void saveValues(){
            List<CryptoKey__c> keyValue = [SELECT  Key__c FROM CryptoKey__c where id != null];
                String cryptoKeyString;
                System.debug('000000000000000000000000000000000000000000keyValue'+keyValue);
                if(keyValue.size() > 0){
                    cryptoKeyString = keyValue[0].Key__c;
                    cryptoKey = EncodingUtil.base64Decode(cryptoKeyString);
                System.debug('000000000000000000000000000000000000000000cryptoKey'+cryptoKey);
            }
            encryptObject.Encrypted_by_Code__c = encryptToken(encryptedByCode);

            insert encryptObject;
            Encrypt_Object__c insertedencryptObject = [Select id,Encrypted_by_Code__c from Encrypt_Object__c where id=: encryptObject.id][0];
            decryptedDataString =decryptToken(insertedencryptObject.Encrypted_by_Code__c);
     }

     public String encryptToken(String strOriginal){
        Blob encryptedData;
        if(cryptoKey != null){
            String strUrlUTF8 = EncodingUtil.urlEncode(strOriginal, 'UTF-8');
            Blob b = Blob.valueOf(strUrlUTF8);
            System.debug('@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@cryptoKey'+cryptoKey);
            encryptedData = Crypto.encryptWithManagedIV('AES256', cryptoKey, b);
            return  EncodingUtil.base64Encode(encryptedData);
        }else{
            return null;
        }

      }

      public String decryptToken(String encryptedString){
        if(cryptoKey != null){
         Blob b = EncodingUtil.base64Decode(encryptedString);
         Blob decryptedData = Crypto.decryptWithManagedIV('AES256', cryptoKey, b);
         String strUrlUTF8 = decryptedData.toString();
         return EncodingUtil.urlDecode(strUrlUTF8, 'UTF-8');
        }else{
            return null;
        }
      }
}
================================================

Doesn't the same string encrypted with the same key generate the same encrypted value?

Most encryption schemes are designed so that encrypting the same value twice generates different encrypted values. This is a security property.

Encryption schemes such that encrypting the same value twice results in the same ciphertext are said to be deterministic. Deterministic encryption is necessary in some applications, but should be avoided by default.

Consider the following scenario: a server is willing to let me upload documents and encrypt them, but not to let me decrypt documents. Let's say I want to know the contents of someone else's document. I make some guesses and submit them to the server, to I get the ciphertext corresponding to my guesses. If the encryption scheme is determininstic, then I can compare the ciphertexts for my guesses against the ciphertext for the confidential document. With an encryption scheme that includes a random element, even if my guess is correct, the ciphertext will be different — thus a randomized encryption scheme can provide semantic security, but a deterministic scheme cannot.

Most symmetric encryption schemes include an initialization vector (IV) or other element that is different (often random, but the requirements vary depending on the algorithm) each time an encryption is performed. Many asymmetric encryption scheme include random padding for the same effect.

So it's normal that encrypting the same value twice produces different result. Indeed, unless you've established a need for deterministic encryption, getting the same value twice would be a sign that something is wrong. If you're testing your application, you can't test the ciphertext against a known value, you need to decrypt it independently.


Is sending only password (not username) by sms secure? Is it secure to send only password and not sending with username by sms?
Is there any risk?

Really your question needs a lot more context to answer fully.

The likelihood is that your answer will be: 'No, its not inherently terrible to send a user a password via SMS if done with careful consideration.'

SIM spoofing/cloning risks are not really worth considering for the majority of applications, although yeah... if you are designing a system which launches nuclear missiles, SMS would not be adequate.

The biggest realistic technical risk to using a phone number as a point of contact to deliver a password is that phone numbers get recycled. While email services typically haven't let you re-use a dead account since the early 90's, many phone operators still recycle numbers quite quickly and autonomously - with there not being much you can do about it.

Secondarily, you are obviously going to have to involve a third-party's infrastructure to physically deliver the SMSs for you, which adds and expands to the attack surface of your application.

There are some quirks you get via SMS also, such as how the message can spread to multiple devices (like from an iPhone to a Mac) and that technically increases the exposure/footprint of the password, although the same is true of email these days; with users have several devices all signed into the same email.

You could argue that more people have insecure phones than email inboxes. But its a bit of a thin argument as if you have the phone of a victim that has no password protection, that phone is probably authenticated to their email already anyway.

The fact that you are going down a road much less travelled with this design leads me to also speculate that you might be doing odd/bad things elsewhere in the application. While its not related to your question, you might want to consider (if you have not already):

After you send the password, are you storing it encrypted?
How are you generating it?
Does the user have to change it on first logon?


How to enable WiFi while using two wireless cards one in monitor mode and other in managed mode? I have two wireless adapters, one is internal PCI wireless adapter (wlan0) while other is USB wireless adapter (wlan1).
I put wlan0 in monitor mode and wlan1 is in managed mode. But, after running

ifconfig wlan0 down
iwconfig wlan0 mode Monitor
ifconfig wlan0 up
sudo airodump-ng wlan0       //???

wlan0 goes successfully in monitor mode but I lost internet connection. When I use

sudo service network-manager restart

then wlan0 switched back to managed mode.
Is there any way to put wlan0 in monitor mode while keeping wlan1 in managed mode and not loosing WiFi connection?

You could do it all more "manually" :

Set your wlan0 interface down :
ip link set wlan0 down.

Change the mode from managed to monitor :
iw dev wlan0 set type monitor.

And bring back up :
ip link set wlan0 up.

And you can check the result with a simple iw dev.

That shouldn't change anything on your other interface wlan1, at least it does it for me (Debian 8). I don't know why you lose connection when launching airmon-ng start but I never managed to use it correctly, hence these 3 commands above...


How do API's authenticate a user? I've read many documents about API's but they don't seem to mention API's for private accounts instead of publicly accessible information.

How does an API work to request private account data? How does it get the login details or session cookie?

For example:

The Facebook API to post to your timeline from a third party website.

If I'm already logged into Facebook and clicked the 'connect' button on a third party website, the API allows me to then post to this website.

How does it prove it is me who sent this, since it can't access the session cookie?

In the majority of cases, this kind of social authentication is based on some form of (hopefully) secret authentication token that is generated at the time you allow access and is stored on the 3rd party service.

When the 3rd party service makes a request from then on, they pass the authentication token they have stored and Facebook then allows them to post on your behalf.

You can read more about Facebook's "access tokens" here


L2TP/IPsec shared secret: Can it be public? My university provides a VPN service to gain access to internal services to all members. They are apparently using an L2TP/IPsec solution by Cisco.
I'm able to connect just fine, but I'm a bit worrying about the security:

In the configuration manual for various operating systems, they mention the "IPsec shared secret" in plaintext. These manuals, and this "secret", are publicly available on the internet. What significance does that secret have? Shouldn't it actually be secret?

Does that pose a security risk to the encryption of the VPN? Or is there an additional layer of security? I also have to provide my user credentials to connect (my user name and a password that is different from the shared secret).

So my question is: Would a (possibly active) attacker, for example the operator of an untrusted external network I'm visiting, be able to do a MITM attack on my VPN tunnel, and decrypt my traffic?

Good question. I'm not 100% sure about the answer, and of course it also depends on many aspects specific to the configuration of your L2TP/IPsec solution.

On the face of it, it does seem very likely that if the 'shared secret' is exposed in such a way, it would allow an attacker at the very least mount an active man-in-the-middle attack against you or your University. In such a case, the attacker should be able to observe / forward / modify any traffic passing through this tunnel. Depending on the type of traffic, this might include secure information such as your password. However, it might be that your personal password is protected via another layer(s) of security.

Depending on the IKE configuration, it might also be possible to mount a passive attack, whereas traffic is (either on-the-fly, or afterwards) analyzed and data is extracted from it without actually performing a MITM attack. This is obviously a more complex form of attack, and there are some IKE methods for perfect-forward-secrecy that might help mitigate it. However, I believe those methods won't be effective in case of a MITM attack.

That said, this might be an 'acceptable' risk from the University's perspective. In such an environment (typically involving wide physical campus area, with many network points which are almost impossible to control), it is usually assumed that gaining access to the network itself is easy/trivial. Therefore, the layers of protection for resouces are applied at a higher level, e.g. on the application stack, or via simple means such as SSL. It might be a legitimate decision therefore for the University to decide that the L2TP/IPSec connection is simply an extension to the (already open) network. As such, this connection itself is assumed to be insecure, but it should/does have additional layers of security to mitigate any such exposure.

In addition, in reference to publishing this 'shared secret': it might be technically difficult to keep a shared secret between many parties a secret for a long time, so it's best to not rely on its secrecy and assume it is already exposed. Or otherwise, technical or other problems prevent your University from applying a different (e.g. RSA keys) to protect such a network connection.

So whilst you have very good reasons for concern, you really need to see the bigger picture to know whether or not there's a real risk to yourself or your University. It's also good not to rely on an encrypted connection to provide all your security. I would recommend talking to the people in your University responsible for security and voicing this concern. You might have stumbled across a weakness and they should know about it. Otherwise, they might explain better why there is no reason for you to be concerned.


System prevents changing password too soon after previous change Today when trying to change my voicemail pin, I noticed the system has a rule in place which prevents users from changing their voicemail pin too soon after the previous pin change.

This was with a popular enterprise-level telephony system.

I can think of several drawbacks to any system imposing this type of restriction e.g. if I know my pin is compromised, I would want to change it right away, and this type of restriction could hinder that practice, depending on the timing.

What would be the reason(s) for implementing this type of "can't change your password too frequently" policy?

The main reason this type of policy is implemented is to be paired with a no/limited password reuse rule and password expiration and prevent user bypassing the reuse limitation by changing their password enough time in a row that they could continue to use their old one.

Say you have a policy that forbids to reuse the last 5 passwords but I want to keep my "p4ssw0rdverystronk", I could change it to "zxcvbn", "qwerty", "password1", "sefa_pass" "idonthaveanymoreidea" and back to "p4ssw0rdverystronk" in a few minutes.


Fake GSM mobile number? IMHO there was a Blackhat video about it, but cannot find it:

Is it an existing problem that a mobile phone number could be faked? I mean when using internet banking:

The attacker gained the password for the internet banking, but an SMS token is needed to log-in.

Q: Can someone create a "fake mobile number" - for my phone numer - and get the SMS from me?

UPDATE: I'm not asking how to do it, I just want to know that it could be done or not.

Yes.Its being done. And unfortunatelly it's a pretty scary answer: All you need it's the phone number . It's the SS7 protocol has been exploited since 2014 and remains vulnerable to this date.
https://thehackernews.com/2017/05/ss7-vulnerability-bank-hacking.html

Basically SS7 (Signaling System 7)  it's a 70's  protocol which lets telcos operate globally. It's used to signal on which cell tower a mobile station (with a given phone number) it's connected.

So , if you are in Hawai  and someone from the US calls you, his telco would use SS7 to ask where your number is (even on which specific Cell ID). Then, when it gets all the routing data needed to communicate with Hawai's network, with the basestation you are connected with, it proceds to connect and diverges your traffic there.

But , as it was designed on the 70s, it wasn't done with security in mind. Unfortunately , SS7 doesn't require authentication in any stage of it's communications. Instead, its a trust-based system, telcos relies on each others. In other words, if you access the SS7 network, then you are a trusted source.

So , all your adversary needs is an access to the SS7 network, a Global Title (similar to a IP)  with roaming license, which can be bought  from a legit source such as a telco (or from a not so legit one from the deepweb).

Then the attacker sends fake SS7 messages to the  network, registering your mobile station to it's own controlled basestation. Once he did this, he MiTM you, logging all your traffic and re-sending it afterwards.

Best part of this ? We can do nothing to protect ourselves. The SS7 protocol won't be modified soon , 'cause all the economic impact it would have on the operating networks. It would require that all telcos upgrades at the same time, so communications aren't interrupted.

EDIT : forgot to mention. This could be exploited from any part of the world. No need to be close to the target.


Does a maximum length of password mean non-hashed storage? When a system requires a password between say 6 and 20 characters in length, does it mean the password is stored without using a hashing function, and that the mysql-field (or similar) is 20 characters in length?

Is there any reason to have a maximum length if a hashing function is used?
I'm thinking maybe a DOS-vulnerability when hashing huge passwords. A ~100 character limit should be enough to stop this, without disturbing users. Maybe even cut the password at a specific length before hasing it?

There are a few reasons that limits might have been imposed:

Some developers feel that reasonable limits (e.g. 120 chars) help reduce server load for hashing ludicrously sized passwords. In reality, the transfer overheads are probably more intensive, as the data is reduced down to a fixed length state in the first round of most hashes, so it's a rather moot point.
Legacy advice. Really old systems used to have technical limits that required passwords to be short (e.g. 14 chars or less) and this has permeated into advice given to new developers. It's irritating and backwards, but it happens. It also ties into the "we've always done it that way" attitude that a lot of places have.
Reducing tech support calls and reset volume. This is by far the most legitimate reason, but it also comes with some caveats that make it largely a bad idea. Users are expected to forget their passwords every so often, and complex / long passwords are seen to increase this rate. However, if you happen to have a "structure" to your password, which involves a fixed length that is too large for this particular service, then it leads to a higher likelihood of resets.

All in all, it doesn't mean that hashing isn't being done. It just means that they're following bad advice and continuing a status quo of poor practices.

Some related questions:

What technical reasons are there to have low maximum password lengths?
Should I have a maximum password length?
Does bcrypt have a maximum password length?


Can someone hack through TeamViewer? I have been doing business with someone on Fiverr. The person's help was really good, but I have concerns that they could potentially hack through TeamViewer. I never leave sight of my PC and I follow every click that is made with the mouse.

However, is there a way that someone can hack without my knowledge? Is there a way for them to control my mouse on their end and make it appear as if my mouse pointer isn't moving on my end?

I make sure to completely log off and lock my PC after each session, however I am not sure how to check if my PC has been hacked without my knowledge.

TeamViewer has three built-in functionalities to let user access to remote computer. They are Remote Control, File Transfer and VPN (if driver is available). None of these functions have hidden mode and again none of them lets remote user view or manage your computer without you noticing it. I see three possible attacks here:

If required drivers are all installed (remote user can install that too) he can disable your screen and lock your keyboard to do dirty things without you seeing it but not without noticing it. All you have to do is plug out your network cable or power cord, that will stop him.
Remote user can connect your computer with File Transfer function. However when the connection is established, you will see a pop-up window that lets you see what remote user viewing, copying or deleting. If you are not careful he can install malware or change your teamviewer files with evil ones.
If TeamViewer VPN driver is installed and active, remote user can get in to your home network via using your computer as a bridge. If your network devices have default or weak passwords, attacker can change your DNS addresses (or worse, forward all traffic to its own network) to get and alter your DNS requests. He can use this technique to redirect you a phishing website and steal your information.

All of these techniques are useless if you are careful enough. First and second technique cannot be accomplished without you noticing it. If you haven't installed VPN driver for TeamViewer (that can disabled from your network and sharing center) there is nothing to worry about with the third one too.

If you are careful enough, no one can hack you with TeamViewer.


Is using a numbers station to transmit a one-time-pad as key actually insecure? We all know the two most important problems related to a “one-time-pad”:

The one-time-pad needs to be truly random (which I think is logic, as pseudo random generators are quick but predictable).
The practicability of being able to transmit the number of keys securely to the receiver.

When only having a numbers station available to transmit the keys to the receiver, my common sense says security is practically rendered near to void because the keys are broadcasted to whoever-listenes-to-the-numbers-station.

When someone has access to encrypted messages and can listen/intercept the public broadcast by the numbers station, isn't using a numbers station to transmit a one-time-pad actually insecure? And — if I'm correct that it is insecure — is there a way around this security problem under the described conditions?

"Pseudo random generators are quick but predictable": well, that's true only in an ethereal, mathematical sense. In practice, if your PRNG is cryptographically secure and seeded with some initial randomness of large enough entropy (128 bits are enough), then it won't be predictable. However, if a PRNG is involved, this is not true "One-Time Pad" but a mere "stream cipher".

OTP is a nice theoretical toy but it has no practical advantage over a properly used stream cipher. For some reason, a lot of people have fantasies of OTP being the ultimate answer for the Real World, and this leads to many misguided designs.

The main practical issue of OTP is that the key must be as large as the message, which is inconvenient: usually, we use cryptography to reduce problems: we apply encryption to reduce the problem of ensuring the confidentiality of a 10 GB file to the problem of ensuring the confidentiality of a 16-byte key, which can be managed much more easily (it can even be remembered and typed in by a human). If the key is as large as the data, then no reduction has occurred. At best, OTP can bring a time-based advantage: exchange the key in advance, when conditions allow for that, allowing for secure transmission later on. That's how the red phone worked: tapes full of random bits exchanged on a weekly basis (by special planes), so that immediate secure communication can be done at any time with no latency.

Of course, OTP relies on the key stream to be secret. There is no point in using public data as key stream. The whole security of OTP relies on secrecy of the key.

There is, however, a generic key exchange protocol which works with a public source of data similar to your "number stations".

It works like this:

Alice and Bob listen to the number stations, and write down, at random intervals, some of the numbers and the "index" of these numbers. For instance, Alice remembers "171th number was 40; 236th number was 91; 406th number was 38;..." while Bob does the same with some other randomly chosen numbers in the public sequence.
At the end of the day, Alice sends to Bob the list of indices that she remembered ("I have numbers 171, 236, 406...") and Bob responds with his own list of indices. With high probability, they have a few indices in common, so they will use the corresponding numbers as shared key.

An eavesdropper, however, would have to remember all, or at least most of the numbers, in order to also remember the same numbers. If the "number station" is sufficiently high-speed (say, it outputs 1 terabyte worth of data per second, and Alice and Bob gather randomly picked numbers during one whole day), then the storage requirement for the attacker can become prohibitive.

The Cachin-Maurer protocol is a fine example of a theoretically secure but grossly impractical cryptographic algorithm. Just like OTP.


Public Key Encryption vs HSM for storing encryption keys Let's say I have sensitive data in the database server that needs to be encrypted (i.e emails, etc..) and I want to make sure that in the event that the server is compromised, the attacker shouldn't be able to decrypt these data (at the very least make it harder).

I've read some solutions online, and it seems like I can either

Use Hardware Security Modules (i.e. Amazon KMS/Vault) such that a separate server handles encryption/decryption.
Use Public Key Encryption (where the public key in database server encrypts data, and a private key is stored in separate server that solely handles decryption)

Which one is a better solution?

There are two different, but related problems here.  One is the security of the key; the other is the security of the data decrypted by the key.

An HSM and "a separate server" are essentially the same thing from the point of view of your app server.  It's sending the encrypted data "elsewhere" for decryption, but the cleartext data will end up back in your app server.  The app server will always need enough protection to protect against an attacker inside it, siphoning off your secrets.  So you can ignore the security of the cleartext data in making this choice, because the cleartext problem is the same regardless of which option you choose.

Let's consider HSMs first.  It's usually true that protecting the key is more important than protecting any one single piece of data (unless leaking a single piece of data could result in a catastrophic loss); and that's where an HSM is a very good tool for the job.  The drawbacks of an HSM approach are that they're quite expensive to purchase, maintain, and operate.  They're usually priced on transaction throughput, so the more data you need to decrypt at a time, the more expensive the HSM.  Any accounting for the expense also needs to include the complexity needed to interact with it - you'll probably spend a lot of time learning how to use it, how to perform key ceremonies, integrating it into your existing systems, etc.  But you'll have the best protected keys money can offer.

On the other hand, if you build your own server to perform the decryption of the data, you'll have to spend time hardening it against attack, issuing certificates to authorized app servers, performing audits, etc.  And be aware that an admin on the machine will always have enough access to get to the key.  (This is not true of an HSM that requires a number of shares of a master key in order to access the keys, meaning a number of trusted people would have to collude to violate the security.)  So building your own server will cost less than buying an HSM, but it isn't cheap; and the key is at more risk than an HSM.  It's especially problematic if you don't know how to properly secure it.

Given all that, it becomes a matter of money vs risk. (Welcome to Security!)  How critical is it to your organization's continued existence that you secure those keys?  What security classification have you given to the data stored in those emails?  Will it store data in scope for PCI, HIPAA, SOX, GLBA, or some other regulated industry?  Does your data contain industrial secrets so valuable that a foreign government might bring all their resources to hack into it?  Does it protect so much money that you would go bankrupt if a hacker siphoned it off?  Will stealing from the database put your organization out of business?  Next, price out buying an HSM vs building and securing your own decryption server.

If the answers to the above add up to "it's not really worth all this", then you have to consider more affordable means of securing it.


Don't one-time recovery codes for 2FA introduce a backdoor? Although using multi-factor authentication is clearly a good move, I'm struggling with the 'one-time recovery codes' concept. It seems to me that if you choose to use them, what you're doing is putting extra security on the front door (like bolts and padlocks) making it harder to break in that way, but installing a paper-thin back door at the same time!
These 'one-time recovery codes':

act like master keys, but as they're just a few digits they aren't 'strong' passwords
must be stored 'provider' side, so you're vulnerable if the provider's systems are compromised
have to be stored locally in some fashion(1), introducing another vulnerability

(1) I see there are several threads on StackExchange that already discuss this point.
Isn't the best course of action to disable 'one-time recovery codes' entirely? (Assuming that the provider's system actually allows you to do so once they've been set up....).

tl/dr: One time recovery codes give account owners an option for regaining lost access.  People who consider this an additional risk
can always ignore it or destroy it, but people who are worried about
losing access to critical services can certainly come up with a secure
way to store it.  As a result, it's a good option to have for services
that may be critical to businesses and/or people.

There is no secure
In most of the systems I've seen that have one time recovery codes, they are an optional feature.  As a result, they give the account owner a way to mitigate competing risks.
When it comes to security, it's always important to remember that there is no such thing as "secure", only "secure enough for me".  Different companies and people have different risk tolerances, different threat models, and different concerns.
Mitigating denial of service vulnerabilities
From that perspective a one time recovery code is a mitigation against a very particular kind of denial of service vulnerability: faulty (human) memory.  In some services, if you lose your password, you are effectively locked out of your account permanently.  In some cases you may fix this by getting a new account and suffering the inconvenience of having to set it up again.  In some cases this may destroy your business.  If a particular account falls in the latter category then you probably don't want to risk forgetting the password and losing access.
One time recovery codes are obviously designed to address that (and other kinds of events that may cause you to lose access).  You may decide that printing a one time recovery code on a piece of paper and putting it in (for instance) a bank safety deposit box is a good way to mitigate the risk of lost account access without increasing the risk of account theft.
Then again, you may decide that you aren't worried about losing account access and so you may "print" the one time recovery code from the site and then immediately throw it away/burn it/never actually write it down/never actually request it in the first place.  After all, if you don't have it, then you don't have to worry about accidentally leaking it.  In this case, you are deciding that the increased risk of account theft via the recovery code is not worth having an alternate means of access.
From the service provider perspective
The whole point is that you get to decide whether or not you wish to make use of this feature.  Many sites I have seen it make it optional, but even if it isn't, you can destroy it easily enough.  However, as a service provider, if I provide the kind of service that may be critical to running a business, then I probably have some customers who want to have an alternate means of access in the event of account lock-out.  As a result, it makes perfect sense for me to provide this as an option.
Certainly, this will save me a lot of trouble when I start getting frantic emails from people who claim to have lost access to their account.  Telling the difference between "I lost access to my account" and "I'm trying to use social engineering to convince support staff to give me access to someone else's account" can be surprisingly tricky.  If I build options that give my customers the self-service options to recover their own account, then that gives me less support requests to handle and also decreases my legal liability (since if I accidentally give away an account to an attacker I will definitely be held liable for it).
Moreover, since these are features that will be used rarely, the provider can make extra protections around it.  You would certainly put in protections against people trying to brute force recovery codes, although I don't think that is a real concern anyway.  Every recovery code I have seen are long and random enough that they would be immune from brute force anyway.  In general though, the concept itself is perfectly valid.  Whether or not a particular provider may have implemented an insecure implementation of one time recovery codes is another matter.
Finally, adding recovery codes doesn't make it easier for a provider to access your data.  The provider can already do that anyway, and will do that if requested by law enforcement regardless of whether or not you have a recovery code.  In the case of services that are designed so that the provider cannot access your data (for example a password manager), then they would have designed the recovery codes so that they are also inaccessible to the provider.  As a result, recovery codes do not generally create an additional risk vector for internal attackers.


What's the rationale behind Ctrl-Alt-Del for login Why is Ctrl+Alt+Del required at login on certain Windows systems (I have not seen it elsewhere, but contradict me if I'm wrong) before the password can be typed in? From a usability point of view, it's a bad idea as it's adding an extra step in getting access.

Does it improve security in any way, and if so, how?

This combination is called a Secure attention key. The Windows kernel is "wired" to notify Winlogon and nobody else about this combination. In this way, when you press Ctrl+Alt+Del, you can be sure† that you're typing your password in the real login form and not some other fake process trying to steal your password. For example, an application which looks exactly like the windows login.

In Linux, there's a loosely-defined equivalent which is Ctrl+Alt+Pause. However, it doesn't exactly do the same thing. It kills everything except where you're trying to input your password. So far, there's no actual equivalent that would work when running X.

† This implies a trust in the integrity of the system itself, it's still possible to patch the kernel and override this behaviour for other purposes (malicious or completely legitimate)


Next steps to get rid of malware? My father in law just had a problem,He clicked on a link in an email (he was using gmail on the version 35.0.1916.114m of Chrome), and suddenly the computer sort of went black, and possibly something downloaded. He says he didn't input his password. Later on, a whole bunch of phishing emails got sent out to his address book.

One of the links were to
http://   107.183.4.211   /d/?xo=fe&mucoto=Z3VsYWJpc3JhbmlAZ21haWwuY29t   &id=c2hyYXlyYWdpQGdtYWlsLmNvbQ== &mesugomabeca=c2hyYXlyYWdp

He figured something was wrong and turned off the computer. When I turned it on, Windows 7 went into Safe Mode. I've since run a full scan using Microsoft Security Essentials - nothing shows up. There's nothing I found looking into Chrome history, or in the downloads folder. We've changed the important passwords and also moved to 2-factor authentication.

Any suggestions on what I should do next ?

Thanks
Rahul

Nuke It From Orbit - Your computer has been compromised, and even running an anti-virus program will not guarantee a clean computer. One of the first things most pieces of malware will do is install a backdoor into your system to ensure it can get back in once your computer thinks it's clean and re-execute itself.

Installing windows from scratch is the only way to reasonably ensure your computer is no longer infected.


Authentication without registration Let S be a server and C be a mobile client (iOS/Android App). Assume that the communication between S and C is ciphered with SSL (or any other standard protocol).

The system is a voting application, i.e., S sends some artices to C and C can upvote/downvote them, sending his vote back to S. The thing is that I don't want C to register/signup for this, but also I don't want him to vote more than once.

One could think of something like: when the app is first launched on C, S assigns a UUID to C and C stores it. Then everytime C wants to vote it sends the vote and its UUID and S checks if that UUID has already voted.

But in such case, what prevents someone to create a program that is always asking S for UUIDs and then voting the same article as many times as wanted?

All that comes to my mind is that S and C share a password that is hardcoded and then the system will work this way:

C asks S for a UUID,
S sends C a UUID,
C stores the UUID,
When C wants to vote, sends to S: {vote, crypt(UUID,sharedPwd) }

Of course the moment someone knew that password (and maybe it's easy to get it as it's actually in the client's code...) the system would be jeopardized...

So... How can my server know that the requests are indeed coming from the App? Or may be a different approach: how do some apps with no registration perform authentication?

I'm afraid what you're asking for is impossible. If you want new users to be able to use your app, someone will find a way to pose as a new user every time and falsifying the votes that way. The only solution is to have a trusted party certifying the identities of everyone, and that won't happen until every ID card out there is a standard smart card with a client certificate in it. As of right now you could in theory rely on a CA, but that would be a huge barrier of entry and nobody will ever use your app.

You could make it more difficult though. Using certificate pinning on the app's side so traffic analysis is more difficult, and obfuscating the binary will slow down potential attackers who want to replicate the behavior of your app, but even then, the attacker just has to uninstall/reinstall your app and it'll appear like a new install on most devices.

If possible on your target devices, you should rely on an identifier provided by the host OS or the app store - that is harder to replicate (or even impossible if your server is contacting the app store's servers to validate the installation of your app) than replicating an app as the OS has ways to access the hardware and get per-device IDs from that (MAC address, IMEI, etc) while your app can't access those directly.

You could also tie the unique device IDs to something harder to obtain, like phone numbers by requiring an SMS confirmation every time the app is installed. It won't stop fraud (and as such is unsuitable for "formal" voting like elections or anything where money is involved) but it will help. It's like DRM, it doesn't need to be bulletproof, it just needs to be stronger than the competitor's apps and attackers will go after the low hanging fruit, leaving your solution alone.

Finally if all you're looking to defend against is mass-voting by bots but don't care about occasional, manual voting then adding a captcha is enough. Of course, this will only work while money isn't involved - otherwise it may still be profitable for the attackers to hire humans to type the captchas and commit fraud that way.


Easy way to analyse my netstats for intrusions? I want to analyse my network traffic against intrusions or hackers. I looked at Snort but it seems difficult to install on Windows and overly complex anyway.

When I issue a netstat -a, I see various connections from unknown IP addresses, but I have no idea how to figure out what they are and if they pose any danger.

Is there any easy tool available for Windows?

Netstat isn't the tool to use to find malicious traffic. The reasons are:

It's done by machine. You'd have to be constantly checking every single system's netstat output to find anything. The more systems you have the harder it is to accomplish
If your machine has been hacked you may not see all traffic. Some malware is able to prevent connections from being seen in netstat

For these reasons it's better to use traffic analysis from your network by using port mirroring as you'll see all the traffic. As for what tools to use to find malicious traffic you do need an IDS/IPS like snort.

The fact is it isn't easy to do, it's hard and it takes skill. But if it was easy they wouldn't need us.


Does running a virtual machine provide a small layer of protection against an infected host in practice Obviously a host can modify a virtual machine in any way and has full control over it, but in practice perhaps most viruses wouldn't have the complexity to search for virtual machines and modify them. Although simple keyloggers I assume would still remain a threat.

Anything which is different from the attackers expectation increases the efforts needed by the attacker and thus slows down attacks. And if the additional costs are high enough it might also prevent attacks since they are no longer worth the efforts.  Running a VM inside a compromised host is no different to this.
But, if others are using the same kind of setup for added protection it will be no longer different from the attackers expectation: Attackers will catch up and consider this kind of setup too and invest time to efficiently handle this setup, since it would be worth the efforts. Thus, it might help in the short run but it will not help in the long run if others are doing this too.


Kippo graph Human Activity. What is it? So I was running a Kippo honeypot. In Kippo graph there is a diagram tilted "Human activity" (see attached photo). What does it mean? Does it mean that, for example, on 21-11-2014 90 real attackers tried to attack my honeypot?

Thanks.

Kippo attempts to guess if the session was automated or a human. So the graph is a little more like "there were 90 possibly human attacks."


Java org.xmlpull.v1.XmlPullParser and XML External Entity (XXE) Processing Attacks I'm evaluating the security of an Android application and the application is using the XmlPullParser included with Android.

I'm having some difficulty getting any common attacks to work, but I want to be sure I haven't missed any possibilities.  What are the minimum requirements/features this parser needs to have enabled for XXE processing attacks to be successful?

In particular I am looking at whether the features for XmlPullParser.FEATURE_PROCESS_NAMESPACES and XmlPullParser.FEATURE_PROCESS_DOCDECL are enabled or not.

Well I can answer my own question now, at least in part.

The application I was examining has a default instance of XmlPullParser with only FEATURE_PROCESS_NAMESPACES disabled.  I was able to get the Billion Laughs entity attack to work.  My issue what I was not putting the entity in the right child element of the expected XML response.


Communication between infected machines via listening to certain port Are there any detailed case-studies in which infected machines in a certain network or on the internet were communication with each other (I'm not interested in cases with only machine <-> C&C communications)?

E.g.: PC-A gets infected, then infects PC-B etc... PC-A and maybe others open a port and then the infected machines communicate with each other (and maybe with the C&C as well).

I don't know what you expect precisely when you ask for "detailed case-studies", but if PC-B has no Internet access, it is a well-known practice for the attacker to use PC-A as a relay between PC-B and the C&C:

PC-B <---> PC-A <---> C&C

To give a more concrete example:

PC-A belongs to the users LAN, this is the computer where people access to their emails and browse the Web. Sadly, one email or web page was infected, thus contaminating PC-A.
Once in running in the LAN, either in an autonomous way or remotely controlled by the C&C, the virus starts to scan the network and try to propagate itself. It reaches PC-B (unpatched vulnerability, poor password or whatever) and contaminates it.
PC-B belongs to another, restricted network with no access to the Internet (with chances that it has access to more interesting resources!). The virus can setup a way for PC-B to use PC-A as a relay to get new orders from the C&C and exfiltrate data.

This relay can take any form depending on the attacker fantasy and requirements. It can range from simple proxy-like features to a full fledged peer-to-peer network ensuring that the virus' network will remain functional even if some relay machines are being decontaminated.


Way to decode an encoded payload I am facing an XSS vulnerability in my ASP.Net Web application where the malicious code may be encrypted and html encoded
Bottomline: I am trying to prevent XSS via code obfuscation.
Question: I already know that I have to use HtmlDecode anyway.Is there a way to decrypt and then Html decode such data in ASP.Net?

First: Base64 is NOT an encryption algorithm. It's an encoding mechanism i.e: Anybody can decode your encoded data.

Secondly: If you're facing XSS in your ASP app that means you're not sanitizing a user-influenced input properly. You will need to provide us with more details about the piece of code that is influenced by the user, but generally. you need to encode all input in html. That is:

" ----> &quot;
' ----> &#39;
< ----> &lt;
> ----> &gt;

In ASP you can simply use Server.HTMLEncode(string) to HTML-encode your user-influenced input.

Remember XSS can also be triggered from stored input, so you will need to sanitize those too!


Why do I need to add intermediate CA certificates to JVM's cacerts file? My company uses its own PKI. The web browser which I use to access to code repository shows a certificate chain as follows:

Company Root CA
    Company Issuing CA Intranet Server
        Certificate to the code repository that I want to access

However, when I try to access to the repository using Gradle, I get a

sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

error.

Gradle uses JVM. I have exported the "Company Root CA" certificate and added it to the certificate store of the JVM with the following command:

"%JAVA_HOME%\bin\keytool.exe" -import -alias company_root_cacert -file "C:\path\to\company\root\cacert.cer" -keystore "%JAVA_HOME%\jre\lib\security\cacerts" -storepass changeit

However, this did not solve the issue. I additionally exported the "Company Issuing CA Intranet Server" certificate and added it to the certificate store of the JVM with the following command:

"%JAVA_HOME%\bin\keytool.exe" -import -alias company_intermediate_cacert -file "C:\path\to\company\intermediate\cacert.cer" -keystore "%JAVA_HOME%\jre\lib\security\cacerts" -storepass changeit

This has solved the issue.

My question is, why was the second step necessary? Since the "Company Issuing CA Intranet Server" is signed by "Company Root CA", and since I have "Company Root CA" in the list of certificates trusted by JVM, why did I need to additionally add the "Company Issuing CA Intranet Server" certificate to the certificate store of JVM?

The problem you describe happens usually if the server only sends its leaf certificate and does not add all the chain certificates needed to build the trust chain to the root CA. Unfortunately this is a common misconfiguration of servers.

Many desktop browser work around this problem if they already know the missing chain certificate from earlier visits or maybe download the missing certificate if the leaf certificate contains a URL for CA issuers in authority information access. But this behavior is usually restricted to desktop browsers and other tools simply fail because they cannot build the trust chain.


Security of setting access to S3 bucket only from a particular website I read about setting access to S3 bucket only from a particular website in Amazon Docs. And I quote :

  Suppose you have a website with domain name (www.example.com or
  example.com) with links to photos and videos stored in your S3 bucket,
  examplebucket. By default, all the S3 resources are private, so only
  the AWS account that created the resources can access them. To allow
  read access to these objects from your website, you can add a bucket
  policy that allows s3:GetObject permission with a condition, using the
  aws:referer key, that the get request must originate from specific
  webpages.

This is exactly my requirement.

But this doesn't look convincing to me from security point of view. Can't someone run some JavaScript from browser while keeping my website opened and access these objects or any other way this can be broken ?

In general, can I rest assure that these files will not be accessible any other way than being accessed using the web site ?

P.S. : Not really expert in security, just trying to absolutely confirm because I intuitively felt its not safe. I am assuming that intruder has somehow got the list of files (absolute keynames) stored in my bucket.

Your intuition is correct in the most important way -- this is not, in any meaningful sense, "secure."

But the way it's defeated is not quite what you envision.

When you click a link on a web page, or your browser loads an image embedded in a page, your browser connects to the web server and sends a request.  In the request are the HTTP headers, including one called Referer:.  While not always present (for various reasons that may be outside the scope of this answer), the accompanying value is the URL of the page you were looking at -- in the same browser tab -- when the link was clicked or the image was loaded.

Creating such a policy in S3 implements access control by string-matching this value, submitted by the browser, and almost entirely devoid of any value from a security perspectice.

So Javascript in another tab while your page is open isn't really the concern.  The concern is a malicious user crafting requests with a forged Referer: header -- easily done with test tools like curl (curl -v http://example-bucket.s3.amazonaws.com/secret-image.jpg -H 'Referer: http://example.com/good-guy.html') or browser plugins.  Now the bucket says "oh, you're on the Good Guy page from example.com? Here's that secret image file you asked for."

So with such an obvious limitation, what is this mechanism actually useful for?

Not securing your content.

It is, however, useful to prevent widespread hotlinking to your content, embedding links to your assets in third party sites, which amounts to theft of your bandwidth.  I once encountered a scam site where the creator had googled for pages showing pictures of gift cards.  He found such images on one of my sites, but he didn't download them... he embedded links to my images into his scammy HTML.  A configuration denying on referer significantly reduces such annoyances... but as it is  suitable for very little else.

With S3, you can generate signed URLs on the fly (assuming your site is dynamic) and embed them in the html.  This is perhaps the most effective solution, since you specify the period of time for which the URL is valid, and these URLs are immune to tampering to the point of computational infeasibility.  CloudFront, in conjunction with S3, allows you to create signed cookies that accomplish similar results but without needing to sign each individual link in each page you render, but individual signed URLs for objects with a very short expiration time, using HTTPS and delivered over HTTPS are an effective mechanism of access control, unlike referring page policies.


Why does my bank bother asking basic personal questions to log in to online banking? To log into my online banking, I have to answer a basic personal question such as "What is your mother's maiden name" or "What is your grandfather's middle name", as well as enter a one-time code from a code-generator device.

To me it seems that 99% if not all of the security comes from the one-time code-generator. The personal question is so basic and easy for someone to find out that it seems to add nothing to the process.

What makes me curious is that it almost seems intentionally basic and easy. The bank could have asked me to create a more secure password, but they didn't.

My guess is that they wanted to add two factors, but didn't want to confuse users with a requirement for a secure password as well as the code-generator device.

Is there a good reason for them to require a basic and insecure question instead?

I agree that this is bad practice. You can make it better practice by scrambling the answers in one of many ways -- making questions about your father refer to your first car and vice versa, and so on, or giving false answers, or given IRRELEVANT answers (if you can remember what your irrelevant answers were), would discourage/prevent social engineering attacks. There's nothing in their system which requires that you answer these honestly, just consistently.

Some systems will let you enter your own questions, which is a huge improvement since it encourages picking things that act as more-secure passwords.

However... I've only seen these used to secure one specific operation, that being password reset, which is additionally handshaked (handshook? checked, anyway) by interaction with the account owner's mailbox. Of course the mailbox may also have been cracked, but arguably this is a case of two less-secure mechanisms adding up to one that's almost tolerable.

It's still worth complaining to your bank, though. If enough people complain, they may improve it.


Android client side data encoding/encryption bypass I am working on Android application security project where Android application sends all data in encryption from client side only. I assume that there must be a file at client side which might be encrypting/encoding data from my end. No matter how many input fields are there in any single form, only two parameters pass through my end to the server those are as follows:

json_secure

Sample value of this parameter is as follows:

json_secure=5VuZ6sZ1GJac4IJYSiPqQo8y2mJvymHJcpJXIrN9x8pgwrGXUdKQzFfAVJzeTooBlXrQp9F2BqehKaTDHHL7%2BIdkE%2BBhCSUL67fBKAxFERb15Ptk0UNkNOhP2PkGbfKr%2FT%2BQ8hypg1x3AmA5zdESUiX6KQ1pwTt7D5qD%2Be3ONtfhdktmlT%2Bb21hvJBRLJcmqtVOc6soE2I2urIyvrRW8Bk7pzz6IMFx7J52baOyKwbnKRB6FI2m3M260jbtKptSQZuqVf34PPLKdCZpKRQH33rqhpjyCQm5lT3DUpmj1yvAbhBiifeu1DdiaLzEq%2BgIiLQAe9l2pQHhh6ru86H8Y7ULWU%2FWAjDW%2Bbw88Hc%2F4FFNTn9G3Q8wBTMowTJFdU2ZfFg%3D%3D

json_id

Sample value of this parameter is as follows:

json_id=568d72bbf4c022db488a3a7e087c8dca9a4d3f350230a44b762427f2a067f628

Kindly suggest me how to bypass this mechanism in order to tamper data through the Burp Suite.

I assume that there must be a file at client side which might be encrypting/encoding data from my end:
Yes if an extra layer of encryption is used apart from Transport Layer Protections(TLS/SSL) then encryption is done at client side.

No matter how many input fields are there in any single form, only two parameters pass through my end to the server those are as follows:
Maybe all the parameters are sent in Cipher Text as key value pairs seperated by some delimitters.

Kindly suggest me how to bypass this mechanism in order to tamper data through the Burp Suite:
You can reverse engineer the application and get the application source code(JADx, dex2jar&JD-GUI). Then through source code analysis, you can identify the classes that may be used for encryption.
For Ex: You can search manually for the instantiations of javax.crypto.Cipher class that can be used for encryption.
You can even use automated tools like MobSF that will make the task much easier for you.

Source code is obfuscated:
Obfuscated source code only created a hurdle for analyst/attacker it can still be read and understood.


Securing data on a server I have a server which has 'loose' physical security (somewhat easy for the entire server to get stolen).

For the sake of the question, let's assume that anyone can access the server physically, what precautions should I be using to keep the data secure?

My initial thought would be to keep all logs, databases, user content, etc. in an encrypted TrueCrypt container. This means that if the hard disk/server is stolen, they will be unable to access the private data. However, what if someone plugs a screen and keyboard into the server? If I am currently logged in via SSH, does that leave the server vulnerable locally? Can I trust Linux's standard "enter password" prompt or can that easily be bypassed?

I'd like to be able to boot and access my server remotely without being forced to enter a password locally (for example if the OS was encrypted)

Thanks for your help

Anyone having physical access to the server can plug a rogue PCI device in it, e.g. containing the Rakshasa malware which will infect the BIOS thus bypassing any full-disk encryption by logging your key's password (implement a rogue forged SSH server, phishing style). Attacker will then have a complete and remote access to the system, while remaining invisible to the OS because the malware runs in System Management Mode.
Rakshasa was developed by Jonathan Brossard and presented at Defcon 20 and Black Hat and is a sadly powerful framework.

This (capturing the encryption passphrase) is also known as the Evil Maid attack researched by Johanna Rutkoswka at Invisible Labs.

Johanna propose a mitigation through TPM.


Airmon-ng/Airodump-ng - Low Beacon Count on certain networks It's been a few years since I've played around with this so I'm not sure if times have changed.

When using AR7921 chipset (Alfa AWUS036NHA) on Ubuntu 20.04 I can see many networks using the following commands

airodump-ng start wlx00c0ca84d0f8

airodump-ng mon0

I've noticed all the VMxxxxx networks have a very low beacon count, perhaps 1 every 20 seconds (compared to e.g BT Broadband APs which seem to have a "normal" beacon count of several per second. The VMxxxx networks are Virgin Media home broadband networks- including the connection I'm legitimately using that is 6 feet away from me.

The rest of the networks have normal looking beacon counts. Has something changed/new technology in place that reduces the beacon count over the past few years or is the issue something else?

I can use the following command for half an hour on my VMxxxx network and find nothing connecting to it, even though I've got 4 different devices here using that access point (disconnected and reconnected them several times).

airodump-ng -d [APMACHERE] -c 6 mon0

Sample output after 45 minutes

 CH  6 ][ Elapsed: 46 mins ][ 2020-06-13 17:34 ][ fixed channel mon0: -1

 BSSID              PWR RXQ  Beacons    #Data, #/s  CH  MB   ENC  CIPHER AUTH ESSID

 xx:xx:xx:xx:xx:xx    0   0        79        0    0   6  54e. WPA2 CCMP   PSK  VMxxxxxxx

 BSSID              STATION            PWR   Rate    Lost    Frames  Probe

It is my understanding there should be a significant amount more beacons, especially from an AP in the same room. I'm also unsure if this is the reason I'm not seeing any devices authenticate against the AP or if that is another issue entirely.

Any idea what the problem might be?

EDIT: Really oddly, if I bring both the wifi card and it's associated monitor interface down via ifconfig while running airodump-ng, the beacons start jumping up on the AP. I tested this behaviour again after restarting at get the same thing. Still don't see any client's trying to connect however.

The majority of my issues cleared up when I passed the USB wifi adapter straight through to Kali. This leads me to suggest it's a driver issue with Ubuntu.

I'm still not picking up clients connecting to the AP but that wasn't the main question I was trying to resolve with this post.


How can Android encryption be so fast? Android uses full-disk encryption to encrypt files and decrypt them at startup. What I don't understand is that decrypting multiple gigabytes of files must take a lot of time, if nothing else then atleast the IO access time required to read all the contents of the storage, but android boots up in mere seconds. How is this possible?

Encryption happens in memory, not on the disk.
You are misunderstanding how disk encryption works. It does not read the entire disk and replace it with a decrypted version. Rather, when a file or sector of encrypted data is accessed, it is read into memory and decrypted in memory. Likewise, when writing to the disk, data is encrypted in memory before being saved to persistent storage. Operating systems keep copies of data that have been read or is to be written in memory (the filesystem buffer) as a performance optimization. It is in this memory that the encryption and decryption take place. This allows data to be read from the disk and decrypted once, but subsequently accessed many times from memory. Incidentally, using memory to store frequently-accessed files is why so many people mistakenly think Linux eats too much RAM.
I also want to point out that the bottleneck is often I/O, not encryption. You say that encrypting gigabytes of data takes a long time, but on most modern machines (including mobile devices), encrypting gigabytes of data can take only a few seconds (especially with hardware acceleration, encryption is really, really fast). However the solid-state drive in most modern Android devices is unable to read or write data at nearly those speeds. So no matter how fast you are trying to read or write data to the disk, the bottleneck will generally always be I/O, not encryption.
Older hardware often did suffer reduced performance when encryption was in use. This was because, at that time, storage speeds were improving faster than processor speeds. The lack of dedicated hardware acceleration for cryptography and the inefficient algorithms often caused a noticeable slowdown when accessing the disk. On modern systems, this is reversed. The processor is so fast that the storage device struggles to keep up. Any overhead is negligible.


The difference between jailing, sandboxing and interpretation In my IT security classes I frequently ran over these terms and had a hard time distinguishing between them, so I tried to figure their differences:

Sandboxing: Defense mechanism against mobile code, which runs in a separate runtime environment. Code and data are separated to prevent the program from modifying itself. This is used for small applications like applets in  the JVM.

Interpretation: Defense mechanism against mobile code. Direct access to hardware is prevented and all addresses and system calls are interpreted and analyzed. Web browsers use this technique at the expense of performance.

Jailing: Defense mechanism against an unknown program. All system calls of a supervised program prisoner are checked by another program jailer who can also intercept and block them.

Are these definitions valid or are there any more differences / similarities which I didn't see? Especially some real world scenarios would be helpful, for example I know that sandboxing is used in the JVM as part of Java security.

I hear in these terms an attempt to explain at a higher level of abstraction a continuum of ways to approach the problem of hosting executable code on a system you wish to protect.

Native: allow executable code to run normally on the target system with full rights and privileges of other code on the system
Jail: allow executable code to run normally on the target system except that access to sensitive resources- from specific syscalls to specific APIs to resources like disk or network i/o- whatever is appropriate for the context- is blocked in some fashion. Think of this as a blacklist- a policy of default allow with specific deny rules.
Sandbox: a more restrictive environment than a Jail. Executable code runs in an abstraction of the target system, though some limited direct access to sensitive resources is allowed. Think of this as a whitelist- a policy of default deny (well, default abstracted/faked) with some specific allow rules.
Interpret: is a poor term for the concept, which represents the other end of the spectrum from Native. Executable code is run in a completely abstracted environment with no direct interaction at all with resources on the target system. A better term may be "Simulated."

Hope that helps.


Is it possible to check if a USB's firmware is unmodified when plugged in? Let's say I have some USB stick that I know and trust. I can examine the firmware and generate a checksum for it.

Can I use this checksem to ensure that when the USB is next plugged in the firmware was not modified? Would it be possible to do this before and firmware ran?

Let's say I have some USB stick that I know and trust. I can examine
  the firmware and generate a checksum for it.

  Can I use this checksum to ensure that when the USB is next plugged in
  the firmware was not modified? Would it be possible to do this before
  and firmware ran?

I don't see why not. Since you already have some method to examine the firmware (apparently), why not just examine the firmware again when it is next plugged in, take the checksum, and compare to the known good checksum...

This seems obvious, so maybe that this is not what you are asking about. However, if this is not what you are asking then your question is not clear to me...


Reasons to place a time limit on entering login credentials? A service I use has a time limit (seemingly fairly short - 10-20 seconds maybe) on entering credentials at the login webpage.  Attempting to login after this period gives the below message:

[For security reasons, users are required to enter their credentials within a given period. This period has been exceeded. We’d like to ask you to log in again.]

The page then refreshes and I can log in without issue.

What security concerns might this service be trying to address by requiring the login within a 'given period'?

This seems like a solution geared toward backend session management.

I'm speculating anonymous users don't initiate any sort of session, but a session gets instantiated once you hit the login page. When you log in, it gets noted in your session and you get to use their site and services. If you don't log in within a certain time, they go ahead and terminate your session.

Given the market within which they operate (security) I could see them being a target for DDoSing via resource consumption so this would be more of a resource management solution than anything (prevents the number of open sessions from exceeding a certain threshold).

So it's security for their infrastructure, not any sort of security for your account.


Convert a DER encoded Certificate to PEM encoded Certificate I have a p7b certificate(DER encoded) which I need to convert to a PEM encoded certificate so that I can import it into my keystore.

I see that the openssl command below does the job of the conversion

openssl pkcs7 -in infile.p7b -inform DER -print_certs -outform PEM -out outfile.cer

Is there any equivalent keytool command or Java code for the same?

Your .p7b file is probably a PKCS#7 encoded certificate chain.

For Java code to pull a single public key from that file, see Extracting individual .cer certificate from a .p7b file in java.

To use keytool to import one or more of the public keys, try Import PKCS7 (Chained Certificate) using KeyTool command to JKS. As noted, you might have to separate the public keys into individual files and just loop through them.


Error on Proxychains + Tor I'm trying to connect through Proxychains and nc to a website but I get this error:

  myip.gelma.net:23: forward host lookup failed: Unknown host

Previously, I was reciving this error:

  |DNS-request| myip.gelma.net:23
  |D-chain|-<>-127.0.0.1:9050-<><>-***********-<><>-OK
  |DNS-response| myip.gelma.net:23 is 198.105.254.11
  Segmentation fault

But commenting proxy_dns option on configuration file, I fixed this problem.

I tried a lot of things like change from socks5 to socks4, play with dinamic_chain and strict_chain modes...

Now, I can't get the connection and I don't know why. How can I fix it?

Thanks.

I found the fix.

The problem was a bad network configuration of my virtual machine. When I recived this errors, the virtual machine network was configured as Bridge. When I changed from Bridge to NAT, this problem was solved.


Get information of phishing website owner I was a victim of a phishing scheme.

I clicked on a link that was sent to me and got to a site that impersonates a bitcoin site. I entered my credentials and the owner of the site used them to steal bitcoin from my account.

I used whoIs to find out where the website was registered, but that doesn't give me the owner's details.

Can I get the website's owner details from the registrar?
If so, will I be able to make legal action against them?
Will reporting to https://www.us-cert.gov/ help? (are there other places?)

Unfortunately, you just encounter a typical phishing page that steal you money and run away.

In most of the scenario, the phishing page is hosted under:

Free web hosting
hacked website
Using dynamic DNS(quite rare)

So site owner might be the victims themselves. Even though you can report this to the authority, but most of the time it is impossible to act, i.e. the command and control center might be shut down within days.

Reported phishing URL show in phishtank show you the similar story, many of them already offline.

Nevertheless, you should also send this phishing URL to sites like phishtank, virustotal, or your antivirus vendors. Because sometimes phishers might recycle/reactivate their command and control center, adding these URL into securities vendor database may stop those URL (if you use those tool) permanently.


Virtulization in cloud and security From a security perspective, which type of hyper-visor cloud is more secure - one that runs on bare-metal (using minimal boot strap build into hyper-visor) or one which is loaded as a part of the OS as an application or service? And why?

I would say as a generalization that bare-metal hypervisor is more secure.
As with any system when you add more software you add more attack surface.
So let's take any hosted hypervisor out there. Instead of just dealing with the hypervisor attack surface you also have the OS vulnerabilities to worry about.


Which MTA don't have antivirus check for outbound emails? I need to test whether MTA has antivirus check for inbound emails. To check this I need to send email with e.g. EICAR testfile from another MTA to this one. However, Gmail, Yahoo and other well-known MTAs have antivirus check.

Does anybody know about MTA that doesn't check for viruses in outbound emails? I can create MTA for test purposes but using existing one is easier

MTAs don't usually have AV built in, it's separate (though in some cases closely integrated, e.g. Exchange + Forefront).

I guess you're really asking which free webmail providers don't scan for viruses. No big provider is going to be that sloppy, and no small provider is likely to still be in business.

So you're probably out of luck with tis approach. Some alternatives:

You could deploy your own MTA, as per Jeff's answer. This is less work than you'd think, since you aren't doing anything clever, so won't need to do any configuration; out-of-the box postfix will send a mail for you.
You could fall back on the old messaging admin's trick and type SMTP commands by hand over telnet, but that's a little fiddly when you need to send an attachment.
You could try using SWAKS.

I think SWAKS will be the best option: they have your exact use case - sending EICAR into an MTA to check the AV is firing - as one of the examples in their documentation!


How do you socialize online and avoid facial recognition and other privacy breaching-tactics What are some techniques to socialize online, while still maintaining privacy, specifically avoiding facial recognition? The main goal here is to make it to where only humans can recognize/track you, while making it to where computers cannot analyze and mass track you.
For example, many social media sites and dating sites require that you upload a profile picture. While you can put something completely random (like a dog or soda can), it may come off creepy or maybe make people might not want to connect with you. I would like to know if there are any balanced options between anonymity, showing your real face, not being creepy, and socially connecting with people (through imagery of your face/body).
Perhaps techniques of taking a face profile picture and using software editing to blur, distort, or stretch the image. That, or do physical scene manipulations like a shadow effect, zooming, light effect, glass, water, gas, etc., or adjusting the camera.

Face detection software is ubiquitous. There's no way to put up an image of your face and allow humans to recognize it but not computers. If you're putting your image online, expect it to be mined.
You can make it a little more difficult for facial recognition software to know that it's looking at a face (which is sufficient to prevent it from knowing who it is looking at) by using certain techniques:

Avoid symmetry. Facial recognition software loves symmetry. Take up an asymmetric style.
If you're a woman, wear makeup that hides contours, sharp lines, and shadows.
If you're a man, grow a beard. It hides the facial features that are most recognizable.

None of this is bulletproof. It just slows down the inevitable. On the upside, consider just how big of a deal it is that this data is out there and whether or not it's already out there. If you're posting to a dating site, then it seems unavoidable that you'll be using your real name or providing personally identifiable information. That's a sacrifice you must make if you want the convenience of online dating.


Veracrypt: Which encryption algorithm + hash algorithm to use? Which between the two encryption algorithms AES(Twofish(Serpent)) and Serpent(Twofish(AES)) is most secure and which hash algorithm to use between SHA-512, Whirlpool, SHA-256 , and Streebog?

And what would you personally use?

I know this probably isn't a good question, but I ask anyway because I'm curious to know, please don't bash me too hard guys..

As Stephen Touset already answered: The Algorithm might not be as important as you think.

The only way you would want several algorithms at once is longterm security. So your bet is: One of them will be broken some day and the others maybe won't.
By theory thats a good way to go. But you might face several issues with it.
Some of them are possibly:

Size of the encrypted information
Runtime Performance

I suggest you have a look at 'cascade encryption' e.g. at wikipedia or read something Bruce Schneier wrote about it.
In case you decide to only have one layer of encryption:
Use AES ( at least if you encrypt your OS). Because AES is so widely used it has been implemented as an extension to the x86 instruction set architecture used in INTEL and AMD processors.
This means you can do it at almost no time cost and (assuming you wont change the number of rounds and so on) AES-256 is really a practically secure thing (afaik).

Just make sure you use a secure password ( > 30 chars, possibly random) and dont fiddle around with algorithm settings (but I'm not even sure veracrypt will let you).

Edit: Since @jondoe666 is pretty right in his criticism of my post this shall make it a little more complete:

Yes. For most of the things I wanted to do, AES was pretty sufficient. If your case requires some extra security feel free to apply as much extra layers as you want. Concerning the performance: Of course the tradeoff is performance for encryption. If you choose to encrypt using multiple layers your CPU will have to do more cycles for every de-/encryption than it has to cycle for just one layer. The question is not if it gets slower the question is: Will I notice. And for the poor thinkpad I am currently using the answer is: YES. I do notice.
But since you asked:

  And what would you personally use?

Thats it. I don't really care about the Hashes (unless you're trying to use SHA1 or MD5). I really prefer SHA-256 over SHA-512 but just because I think it is sufficient. Might really depend on your level of paranoia as well as what you have read about the other options.

Cheers


How do browsers get HSTS preload data? I recently wrote this answer, in which I explained the process of HSTS preloading. However, I noticed that I didn't actually know the exact mechanism for fetching preload information works. I have checked the Chromium Documentation, MDN Web Docs, hstspreload.org and others, but they all only explain what purpose preloading has, but not the technical details.
As such, I came up with two possible ways it could work:

Browsers regularly download the full preload list - This would be quite wasteful, depending on the size of the preload list. Given that roughly a million domains are registered every day, this list would continuously grow and become unmaintainable, especially given the fact that the vast majority of sites won't ever be visited by every individual user.
Browsers query HSTS status ad-hoc - This would be a simpler approach. If a browser wanted to go to example.com, and no HSTS information would be available, the preload list would be queried about whether or not HSTS preloading was enabled for that site. This would have several downsides, as the preload list would now have very heavy traffic, and would also have privacy implications for each user.

So my question now is: How is it actually implemented? And are the downsides mitigated in any way?

Some documentation points out that there is a list, which is distributed together with the browser. This list for Chromium can be seen here, and it includes a lot of high-profile domains, like Twitter, PayPal, etc...
However, I have reason to believe that this list is not the "full" preload list. First of all, the list only contains a bit more than 500 non-Google domains, which seems rather small. Secondly, according to hstspreload.org, the domain mechmk1.me is currently preloaded and has been so for several years already. However, this entry is absent from the list distributed together with Chromium.
As such, I believe that Chromium actually has two lists: One that is shipped together with the browser, that contains the most "important" domains, and one for the less important domains (anything that is submitted to hstspreload.org, but not present in that list).
My question is specifically about the latter list, i.e. not the list that is distributed together with the browser.

The entire list is shipped with the browser (atleast for chrome). This is made clear on hstspreload.org:

This is a list of sites that are hardcoded into Chrome as being HTTPS only. (emphasis mine)

The list is updated with the browser. The complete list can be found here and does include the domain mechmk1.me.


Is username and password needed to register and authenticate user in zero knowledge guillou quisquater? I want to make guillou quisquater authentication for a website with Laravel (PHP). The authentication is between server and client(user). In the references i've read (here and here) the registration scheme is:

The server selects 2 primes p and q large enough that factoring their product n = pq is infeasible.
Then the server select another large prime b (0 < b < n). The values b and n are published. p and q are kept secret from all provers and verifiers.
When generating new certificates, the server rolls new random private key u (0 < u < n) and public key its inverse u-1 obscured by the group key v = u-1 b. These values replace the private and public keys normally generated by the RSA scheme.

For the authentication scheme:

Alice rolls random r (0 < r < n) and sends to Bob.
Bob rolls random k (1 < k < n) and computes y = k ur mod n and x = kb mod n, then sends (y, hash(x)) to Alice.
Alice computes z = vr yb mod n and verifies hash(z) equals hash(x).

My questions are:

When user register to my website, the user has to choose username and
password. But the scheme not mentioning what the username and password for. Please explain to me what is the purpose of username and password in registering and the authentication scheme.
When the user register, the scheme said that the server select 2 primes p and q. Should I generate the 2 primes on each user registration? or should I generate the 2 prime numbers once and use those primes for every user?
Is there any PHP library that can compute z = vr yb mod n fast? because it takes up to 3 minutes when computing this equation (I tested with p=337 and q=357)
In the registration scheme (the bold sentence), should I save the p and q value in the server database?

Username and password is an authentication system where you would transmit the pair trough (encrypted) channel and use it to prove to the server that client is who it claims to be (knowledge of the password is the proof). In contrast, Zero Knowledge authentication protocols never transmit a password over the channel. They work on challenge-response scheme.

Since you are designing a zero knowledge solution based on Guillou Quisquater authentication protocol, having username and password will defeat the purpose. This would in turn answer your first question: no, you will not have username and password on the registration. The purpose of registration is to introduce the client to the server as a registered client. During registration, a user will provide some means for the server to verify the client in the future (authentication). In username and password authentication scheme, this would be the password. It would be later used to prove to the server that the client is the one who registered and the knowledge of the password is the proof of this. Registration in a zero knowledge authentication protocol would be a bit different.

On purely theoretical level, without going into details on any specific point, here are the steps needed to design such a scheme:

Registration

Client will generate public and private key pair
Client will present it's public key to the server (who also assumes trusted authority role)
Server will make the public key into a certificate and send it to client
Client is responsible for storing the certificate and private key corresponding to this certificate securely. Certificate is in turn the username and the private key would be the password even though it would never be transmitted over the wire.

Authentication

Client will present it's certificate to the server
Server will check the certificate and reject it if it is not valid (not issued by the server).
Taken directly from article you linked:

  Prover chooses random k ∈ Zn∗
  Prover sends verifier Cert(prover), γ = kb mod n
  Verifier checks certificate, rejecting if verTA(ID(prover) || v, s)≠true.

If check is successful, server will continue with the authentication scheme as you described in your question.

Answers to your questions

  When the user register, the scheme said that the server select 2
  primes p and q. Should I generate the 2 primes on each user
  registration? or should I generate the 2 prime numbers once and use
  those primes for every user?

These two numbers are not generated on user registration but on initial set up. You would generate them once and use them on every user registration.

  Is there any PHP library that can compute z = vr yb mod n fast?
  because it takes up to 3 minutes when computing this equation (I
  tested with p=337 and q=357)

You will need to ask this specific question on another SE, probably on stackoverflow.SE. You will also need to do mathematical (RSA) calculations on the client side and will need similar toolkit there. Even though all this is purely theoretical, please bear in mind doing cryptography in the browser is tricky at best. Also, you will need to solve the storage of the client credentials (certificate and private key) on the client side too. This is not trivial!

  In the registration scheme (the bold sentence), should I save the p
  and q value in the server database?

Since all of this is for your thesis, you need to decide the scope. If safe storage of these two numbers is out of scope, you can declare a database as a safe enough storage and save them there. The other extreme is to use HSM.


Level 4 merchants becoming PCI Compliant I was prompted recently to take a deeper look into some of the PCI requirement information, and I have found some pretty serious discrepancies with regard to the reporting obligations of Level 4 Merchants (less than 20,000 transactions per year).

Some suggest that Level 4 Merchants are not required to report on their PCI compliance (which does not mean that they aren't responsible for being compliant, only reporting on it annually) but others also suggests that Level 4 Merchants are required to annually scan their network in order to prove compliance. Also there are some websites that suggest Level 4 Merchants are required to undergo quarterly network scans, which is the same requirement for Level 3 Merchants:

I'm curious if anyone out there has any experience with this sort of thing. Again, I want to stress that ALL merchants that accept credit cards are obligated to maintain PCI compliance. However, the issue surrounds the reporting requirements for various merchants, as having scans and such is a service that a merchant will have to pay for.

You have to report on PCI compliance if you are a level 4 merchant. You need to complete a self assessment (SAQ). So to become compliant you need to:

Complete the Self-Assessment Questionnaire according to the
instructions it contains.
Complete and obtain evidence of a passing vulnerability scan with a
PCI SSC Approved Scanning Vendor (ASV). Note scanning does not apply
to all merchants. It is required for SAQ A-EP, SAQ B-IP, SAQ C, SAQ
D-Merchant and SAQ D-Service Provider.
Complete the relevant Attestation of Compliance in its entirety
(located in the SAQ tool).
Submit the SAQ, evidence of a passing scan (if applicable), and the
Attestation of Compliance, along with any other requested
documentation, to your acquirer.


Comparing the standard HTML form POST for user authentication vs Javascript/AJAX Are there any security implications with POSTing a authentication request with the use of javascript/ajax, as opposed to POSTing an HTML  element by pressing the submit button?

thus

<form method="POST" action="/login/">
  <input type="hidden" name="csrfToken" value="(...)"/>
  <input type="text" name="username" value="" maxlength="64" autocomplete="off"/>
  <input type="password" name="password" value="" maxlength="1024"/>
  <input type="submit" value="login"/>
</form>

example 1: login with HTML-form in pseudo-code

vs

<form method="POST" action="/login/">
    (... same as above ...)
    <input type="button"/> <!-- will trigger javascript method below -->
</form>

<script type="text/javascript"/>
$.ajax({
    type: "POST",
    url: "/login/",
    data: "(...)", // All form fields
    dataType: "json",
    success: function(data) {
        (...)
    }
});
</script/>

example 2: login with ajax in pseudo-code

This question is only about the javascript/ajax vs html form post, all other things such as TLS, passwords, etc are not my area of interest for this question.

Updated question
Added the for field becuase I introduced some confusion by mentioning the csrfToken.

There should be no difference in terms of security, since the POST is handled by the browser in the same way as a form. If you're running HTTPS, it'll go over HTTPS too.

However, keep in mind that complex ajax-based apps are statistically more likely to be vulnerable to XSS than flat HTML pages. This doesn't mean you definitely are, it's just something to watch out for.

Things to consider:

Ensure that your script is served via HTTPS. You'd be surprised how many people serve their scripts from a CDN over plaintext HTTP.
Proper cross-domain policy should be specified in crossdomain.xml
Consider enforcing strict transport security.
Configure your Content Security Policy properly.
Avoid eval, escape output using contextual escaping, etc.


Vulnerability of Java software The JAVA software provided by Oracle is a security mess.  But what exactly, in that software package is the most vulnerable. If someone install it and disables the Java plugin in the browser, will he still be vulnerable?

The most problematic part with Java is that it offers a way to sandbox code for restricted execution but that this protection could often be bypassed in the past. Thus the main problem is the use of Java in scenarios where this sandbox gets used, which is mainly in the browser. When used instead with standalone applications and not applets the security of Java is similar to that of other programming languages which mostly don't even offer such sandbox facility.

If you make sure that Java is not usable as a plugin by any browser on your system it is as safe to use as other languages, i.e.  similar to applications written in C/C++/C#/whatever these standalone Java applications will have full access to everything your user account has. This means you have to still watch out where you get your application from and what it does, but you don't have to take special precautions just because this is a Java application.

For further information you might look at the discussion Why do I hear about so many Java insecurities? Are other languages more secure?.


The difference between risk assessment and risk analysis I am a little confused about the difference between the risk assessment and risk analysis. Many people argued to conduct risk assessment during the requirement phase and risk analysis during the design phase.

Could you please explain to me the difference between them?

Risk analysis is part of the risk assessment. The risk assessment combines risk analysis and risk evaluation (the process used to determine risk management priorities by comparing the level of risk against predetermined standards).


Does HTTPS mean that packets can't be read by intermediaries (like listeners at a VPN node, for instance)? Say I'm using a VPN to talk with a server, and Bob is eavesdropping for packets at the VPN.
Basically a special kind of man-in-the-middle attack.
If I'm using HTTPS, how clever would Bob have to be to bypass HTTPS and get the data from my packets?
How about metadata (e.g. my IP, target IP, time sent)?

If Bob is just listening, he can not decrypt the HTTP message (encrypted with TLS to become HTTPS). The TCP/IP packet that holds the HTTPS packet is not encrypted though (it can’t be, it’s needed for the network to work).
In the TCP/IP packet you store target and source IP, TTL And some more flags. If you see a packet on the network you can track it’s time of seeing.
In short Bob needs to break HTTPS or do a specific attack on you, just listening is not enough. Some of the metadata of your connection is present in clear text for the systems to work, this part of it will be visible to Bob.


Protecting data on server from illegal physical access I am running Ubuntu (14.04) server and I saw this question:

How do I reset a lost administrative password?

I wondered, because my server virtual machine is on the ESXi server, I don't know if anybody having access to them can backup my VM and restore it somewhere and try to access the data stored.

I have no choices for moving VM to a safe server, because my agents forced me to this job.

As I do not trust people who have access to this server, I need to create a shell script and put in /etc/init.d/my_script to remove my data if unauthorized physical access is detected.

I need to create a shell script and put in /etc/init.d/my_script to remove my data if unauthorized physical access is detected.

In general, "Having a VM self-destruct if unauthorized physical access is detected on the host system" is almost impossible. Are there other details about your situation, beyond what's already in the question, that would make this problem easier (ie remotely possible)?

In fact, there is a set of industry standards that specifically address the problem of wiping data if physical access is detected. This is the FIPS 140-2 standards which apply to Hardware Security Modules (HSM). In particular, FIPS 140-2 Level 3 and Level 4 deal with detecting intrusion. Devices that meet this spec are purpose-built with specialized hardware to detect intrusion, you will not be able to do this on an arbitrary ESX VM.

Your best bet is A) to buy an HSM (they start at $500 and go up to tens of thousands of dollars) then B) use keys stored on the HSM to encrypt the sensitive data on the VM so that even if someone clones the VM they will not be able to access the data without the HSM being plugged in. As pointed out by @Neil Smithline, even this is defeated by cloning a running VM since the decryption keys and/or the decrypted data will be in memory.

If you really want a simple script-based solution there are some things you can do which will deter casual attackers. But I will not recommend any because they are basically pure security theater and will not stop anybody with even a little bit of hacking training.


Pop-ups in Private Browsing? The new Firefox private browsing mode allows for both non/private browsing windows
at the same time. So if a website pops up a new window (which will be in non
private mode) can it read stored data?

I know we can block pop-ups, but some websites seem to be able to bypass that. Wasn't it better the old way where private browsing mode was sticky and did not allow any regular mode windows?

You're starting with a wrong premise. Pop-ups originating from a Private-Browsing window (legitimate and illegitimate ones) are already started in private-browsing windows.


Anything wrong with using IMAP as authentication for a web app to achieve a kind of easy SSO? The idea would be to wrap a server-side IMAP client in a wrapper that transforms IMAP authentication into a web API for authentication (maybe OAuth?). When the back-end application receives credentials, it then passes them onto IMAP without storing them, waits to see if authentication was successful and if it was, it then returns the user's session key and identity information.

This could provide a simple form of SSO for authenticating users in an organization that lacks robust, formal identity management like Active Directory.

Does this already exist? Any serious security concerns with this setup given SSL/TLS are used for transporting credentials?

Edit: I want to clarify that I do have one implementation of this method, and it presents itself to the web application as OAuth, so at to avoid being proprietary/not-replaceable. I guess what I'm asking is: "Is wrapping IMAP so that it can present itself as OAuth to an application a valid, novel and secure approach to authentication for people with no other OAuth provider or for whom their email credential is their most important credential?" I'm playing with the idea of turning my wrapper into an open-source project so that small businesses can use this wrapper as an authentication provider for low-traffic web-apps instead of paying for huge identity solutions.

Does this already exist?

Checking login with one service in order to authenticate another one is kind of hackish but actually not that unusual. The Postfix mail server can be configured to check with an IMAP server the same way you describe via SASL instead of having its own authentication - http://www.postfix.org/SASL_README.html. And there is also the infamous POP before SMTP which also relies on successfully authenticating against one service before being able to use another.

And universal web mailers like Roundcube which work with any IMAP server basically use the same method when logging in a user, i.e. they rely on the IMAP server for authentication.

  Any serious security concerns with this setup given SSL/TLS are used for transporting credentials?

The main point I see is that a naive implementation could cause a possible denial of service against the mail server via web. IMAP servers are usually designed to handle several long living connections in parallel instead of handling many short lived connections in a short time. So some rate limiting might be appropriate. Such limits and the comparably slow authentication when using IMAP might also result in scalability issues for your web application.


Is there any way to log in with a hash? I've understood that the following steps are taken when I log in to a site:
1. My password is hashed
2. The hash is compared to what's stored in the database.
3. If the hashes are equal, I can log in.

I'm also quite certain that if attackers gain access to the password database, they can use brute force to find the clear-text passwords if the hashing algorithm is weak enough.

My question is, is there any way for an attacker to bypass step 1 above? I.e. if he/she has gained access to a list of hashed passwords, can the hacker present that hash to the server, thus circumventing the hashing step?

This is generally called 'Pass-the-hash' attack.

If authenticating party performs hashing itself and sends hash over the wire then system is likely susceptible to this attack.

Most web applications don't do this though. They instead send the password and server does hashing, so there's no way to send hash directly.