Is a password in the clipboard vulnerable to attacks? I see situations where you may have to input the same password more than once. You may type it in a text editor and copy it to clipboard, to paste it two or more times.

In what scenarios this could be a bad idea?

The Windows clipboard is not secure.

This is a quote from a MSDN article.

  The Clipboard can be used to store data, such as text and images. Because the Clipboard is shared by all active processes, it can be used to transfer data between them.

This should probably apply to Linux machines as well.

Is this a concern? No. For someone to exploit this, he would have to have malware on your machine capable of reading data from the clipboard. If he has the capability of getting malware on your machine, you have much bigger things to worry about as there are plenty of other stuff he can do, including keyloggers and the like.


Can't execute shell i uploaded with cURL I uploaded a PHP web shell to a site, and to bypass the file upload restriction, I used a .php.jpg extension.
When I open my shell with a web browser, it doesn't execute (confirmed with a packet capture) but when I open it with curl, it returns my php web shell source code!
Where is the problem?

You get the file contents in curl because you are accessing the file directly without the server executing the contents.
You are not getting the shell in the browser because the PHP server is trying to show you a jpeg file that isn't a jpeg file.
It's not working because the server is not vulnerable to this problem...
Just because you can upload a file does not mean that the server will do what you want with it. It will handle the file based on its own rules.


Is this a good way to store passwords in a Web Application? I've been tasked with finding a better way to store passwords and came up with this Algorithm. My understanding of Crypto is not strong enough but can someone check this please?

Inputs:
Username
Passcode

Algorithm:

Pass Username through uuid (RFC 4122) to get hashed Username (this is mostly to generate a fixed length string so that the DB can index it tidily)

Select uuid from database to get ID.

Salt = md5(Hashed Username + db ID + Password)

Discard input variables.

sha512(password, salt, rounds)

Where rounds = 2 ^ ((days between now - 1st Jan 2008)) / 365) * factor (50000 perhaps).

Discard the hints in the resulting string about salt and rounds (they can be regenerated).

Store the hashed payload.

Output:

A string to be tested against the stored string, changes every login due to constantly increasing rounds.

Don't do this. Please don't. It will make those who come after you hate you. And may or may not be secure at all.

Just use an existing library for hashing passwords. Preferably one that uses the crypt(3) library underneath (depending on the language, I'd suggest one, but you didn't indicate a target language).

Your method of salt generation isn't horrible, but it isn't great either.

Just stick to existing algorithms. They exist and are recommended for a reason... Don't try to invent your own just to be clever. It may work, but usually it won't...


Risk of infecting the host OS if the guest OS is out of date I'd like to know how much the risk changes if I don't update the software on the guest OS in a VM (applications and the guest operating system itself), compared to the risk in case it's all kept up-to-date.

NOTE: The guest OS in the VM can potentially be used for any purpose, but in this case let's say the main purpose of a VM is to avoid infecting the host OS, and therefore the VM will be used to run untrusted applications, open untrusted files (pdf, doc, html, etc.), maybe visit untrusted websites, etc. So yeah, I'm not using a VM just to visit youtube, in that case the risk will probably be negligible in any case (whether the system is up-to-date or not). I'm thinking of VMs for more risky stuff.

I'm asking this question because I realized that it can be a pain to keep the software in a VM up-to-date, especially when you have several VMs, or when you only want to use disposable instances, or when you don't want the network to be available in VMs, or when you rely on snapshots (which will then be older and therefore out-of-date). I know that not keeping it up-to-date is likely to increase the risk, but I don't know how much, and for all I know the difference could even be negligible. It probably depends on the likelihood of escaping from a VM by exploiting a vulnerability in the VM itself without relying on any other vulnerability in the guest OS, compared to the probability that a vulnerability in the guest OS is needed in order to escape from the VM. So maybe only somebody with enough experience on VM vulnerabilities could be able to assess the likelihood of this risk.

Of course, the chances of malware being able to even attempt escaping without first exploiting a vulnerability in the Guest OS are next to none in most use cases. Therefore, it technically does increase the chances of you getting infected.

On the other hand, VMs are often used even for malware research, where the guest OS is intentionally infected and the VM used to protect the Host OS. In my opinion, it is safe enough to rely on a reliable up-to-date and well configured VM to protect your host OS.

Keep in mind however, that having the Guest OS infected may cause more trouble than just infecting your host OS. It may start acting as part of botnet, it may be used as stepping stone to breach your network, to mine crypto-currencies and in a variety of other annoying and potentially dangerous ways.


BlackBerry handheld penetration testing Are there any relevant resources, tools or documents about penetration testing of BlackBerry handhelds?

I recently did a Blackberry handheld security review and used this checklist from the DoD as my source information - http://web.nvd.nist.gov/view/ncp/repository/checklistDetail?id=252

This is also a useful list of resources from RIM http://docs.blackberry.com/en/admin/deliverables/7533/List_of_available_BB_AMT_tools_555278_11.jsp

This looked interesting to me as it is the commercial equivalent of the Autoberry Tool used by the US government - http://fixmo.com/products/sentinel There are no prices on the site though and I would guess it might be pricy.


What's the meaning of 'the some sort of race condition' here? I tried probably 50 different types of payloads there until I realized that the problem is actually with what appeared to be some sort of race condition with PhantomJS.

Source:escalating-xss-in-phantomjs-image-rendering-to-ssrflocal-file-read
I can't understand the meaning of 'some sort of race condition' here.

A race condition is a bug which only happens when a system executes multiple tasks in parallel and these parallel tasks get finished in a specific order.

In this specific case, the author wants an instance of phantom.js (a headless web browser) to execute a javascript payload and then take a screenshot of the result. This fails because sometimes the screenshot is taken before Phantom.JS is finished executing the javascript payload.


EAP-TLS vs EAP-TTLS vs EAP-PEAP I'm having troubles understanding the differences between the 3.

As far as I understand, with EAP-TLS, the client (peer) and the server (authenticator) both need a certificate. The authentication is done by performing basically a TLS handshake (which guarantees that the client is who he claims to be)

Whereas with EAP-TTLS, client authentication seems optional according to the RFC and the TLS handshake is only done to create a secure tunnel which can be used to perform other authentication methods. Is that right?

And how does PEAP now differ from EAP-TTLS? To my understanding, it does basically the same thing.

On EAP-TLS you are right, both sides require a certificate. With a client-side certificate, a compromised password is not enough to break into EAP-TLS enabled systems because the intruder still needs to have the client-side certificate.

On EAP-TTLS, you are right again. After the server is securely authenticated to the client via its CA certificate and optionally the client to the server, the server can then use the established secure connection ("tunnel") to authenticate the client.

PEAP is an encapsulation, is not a method, but you are almost right again. PEAP is similar in design to EAP-TTLS, requiring only a server-side PKI certificate to create a secure TLS tunnel to protect user authentication, and uses server-side public key certificates to authenticate the server. It then creates an encrypted TLS tunnel between the client and the authentication server.

The difference is: PEAP is a SSL wrapper around EAP carrying EAP. TTLS is a SSL wrapper around diameter TLVs (Type Length Values) carrying RADIUS authentication attributes.

All of this info available at Wikipedia


How does WPA2-PSK prevent evil twin password phishing? Let's say we have a WPA2-PSK secured AP and there are several clients like smartphones and notebooks that automatically connect to it.
Now if someone was to create another AP that looked completely the same from the outside (same channel, same encryption, same SSID, same BSSID etc...), but with a way stronger signal. Would it be possible for the software behind the AP to gather the information required to authenticate to the original AP just by letting clients try to authenticate to the evil twin?

From what I read and heard it is not possible. But I don't really understand why.
I understand there is some kind of handshake going back and forth between the client and the AP during the authentication process, but if the evil twin would simply play the man in the middle during that process, wouldn't it be able to get the the required data?

I suppose this question must have been asked before and I tried my best to find out if it has, but I couldn't find anything. So... my apologies in advance if this is a duplicate.

No password is ever sent during the 4-way handshake, therefore it cannot be phished.

When a client connects to an access point (AP) using WPA2-PSK, the password or pre-shared key (PSK) is, as the name suggests, already known by both parties. So there is no need to exchange it again.

Do not confuse this with other scenarios where no pre-shared secret is available. (Say, you're connecting to a website via SSL and need to perform a Diffie-Hellman key exchange beforehand.)

Naively, the client and AP could simply go along and use symmetric encryption (e.g. AES) to communicate confidentially. They would use the PSK as the only encryption key without any preceding handshakes or additional key exchanges. However, this approach is flawed since it uses the same key for evey message and neither party had to prove its identity, thus opening the door for replay attacks, etc.

So, the purpose of the 4-way handshake is not to exchange a passphrase, but to prove to the other party that you actually know the PSK (respectively, a PMK which you can consider equivalent here) and establish a pairwise transient key (PTK). This PTK combines the keys that will be finally used for the actual encrypted data transfer.

The proof of knowing the PSK happens when both parties use it to generate a message integrity code (MIC) that will be sent along with the random nonce values during the handshake. Therefore, a handshake between your evil twin and a legitimate client would look like this:

Your rogue AP generates a random nonce (ANonce) and sends it to the client.
The client chooses a nonce (SNonce) and is now able to compute the PTK. It sends the nonce along with a MIC generated from the key.
Now your AP has to send back a group temporal key (GTK) with the corresponding MIC. Since you can't generate the MIC without knowing the PSK, the client will reject your response and the authentication fails.


How can an IPS be fingerprinted? I'm not trying to solve a current technical problem but I came across this and have been wondering how it's done. Intrusion Prevention Systems are supposed to let all network traffic pass through and implement Intrusion Detection methods to detect and stop packets with malicious payloads. I would think that an IPS does not on it's own create any answer message (that could be used to fingerprint it) but rather either passes the packet or not. Then how can it be "fingerprinted"?

Perhaps a very first suggestion would be to send specifically crafted packets to a (e.g. web) server you know is connected beyond the IPS and based on the server's answers to infer on the IPS engine/rules. But is this practical? Is there a "proper" way to do it?

Cheers,

georgios

You probably would be interested in the research by Simple Nomad.  He has done lots of research in this area and has been fingerprinting IPS devices for a while now.

Any in-line proxy that makes changes to the traffic can be fingerprinted.  Understanding the signatures used by the IPS is important to create packets to thwart them or to validate an IPS is in stream modifying the packets.


How to store Oauth2 Access Token in a Cookie correctly? Im working on a small Custom Oauth2 Authorization Server.
I want to send the Access Token in a http only Cookie to the client.
According to 5.1 of the RFC6749 the token has to be in the entity-body of the HTTP Response in an "application/json" media type. Example

 HTTP/1.1 200 OK
 Content-Type: application/json;charset=UTF-8
 Cache-Control: no-store
 Pragma: no-cache

 {
   "access_token":"2YotnFZFEjr1zCsicMWpAA",
   "token_type":"example",
   "expires_in":3600,
   "refresh_token":"tGzv3JOkF0XG5Qx2TlKWIA",
   "example_parameter":"example_value"
 }

My Problem is there stand's nowhere how to do this in a cookie? If i store all those entries in a cookie then its not in the entity-body of the HTTP-Response as far as im understanding it. What part am i missing, how does the client recognize the access token correctly if its in a cookie? Im using cookies, because i want to prevent javascript access to the token.

You don't want to store access token in a cookie. Depending on the application, you want:

typical web application: store the tokens in your backend (database...)
native mobile application: store the refresh token in the Keychain / Keystore, and the access tokens in-memory
SPA (Single Page Application): store the access token in the localStorage or in the sessionStorage (beware of new risks involved)

And then, when requesting APIs, you insert the access token in the request, preferably in the Authorization header as specified in RFC6750. Example:

GET /api/somedata HTTP/1.1
Host: example.com
Authorization: Bearer NLdtYEY8Y4Q09kKBUnsYy9mExGQnBy


Full disk encryption vs targetted partition encryption for security experts? There are "Average Joes" answers here for "Full disk encryption vs home folder encryption".

I have three use cases in the frame of professional activities with customers wanting their data secured:

Laptop for sales people (with data such as business strategy and opportunities, tenders, propositions, company economic data, etc)
Workstations or laptops for developpers (with data such as customer project requirements and technical information, and all project deliveries)
Workstations for staff (with data such as invoices, purchase orders, wages, etc)

Our main threats are :

to be fired by our customers if we have security issues
data leaks
laptop stolen by unknown hands

What are the pros and cons for security experts who can for example on Linux:

have a granular partition schema with encrypted partitions for /home, /boot, /tmp, /var/tmp, /var/log, /etc, /var/lib/mysql, /swap, etc
audit all user applications to check where files are created and redirect them into /home with simlinks
want to maximize available performances

Is it relevant (answer per OS appreciated)? If not, what is missing? How much performance gain can be expected?

It's not clear how you're defining "security experts". That term can mean different things to different people. It seems more like you're asking about advanced Linux users who know how to create granular encryption schemes.

As with anything involving security, it at least partly depends on what threat you're trying to protect against.

If you have a laptop that you carry around everywhere, and for which you are the sole operator, you might choose to keep most or all of it encrypted. Whereas, your workstation at your place of employment, or your kodi box at home, might not demand the same level of security. And if you are up against state-level actors, that's a completely different game to just wanting to be able to protect against casual theft.

You also need to consider the hardware. Solid state drives don't play particularly nicely with encryption.

On several of my machines I have a mix of rotational drives and SSDs. I put /var, /home and swap in LUKS partitions on the larger rotational drives and put / on an SSD. Given my threat model, this seems like a good compromise between getting the most utility out of the SSDs while still keeping most important data reasonably secure.

You mention directories like /tmp. Depending on your configuration/distribution, this will often be a tmpfs, i.e. it will be kept in memory. In that case, it will be both fast and also no need for encryption. If you're up against an actor that can perform cold boot attacks and extract the contents of a tmpfs, well, I guess you'll need to think about how to protect against that.

If you're up against a state level actor and you ever don't have complete provenance over the physical components of the device for their entire lifetime then all bets are off.


SQLi with comment filter: dumping the database The following SQLi (MySQL) filter is from SQLi-Labs:

...
 $reg = "/#/"
 $reg1 ="/--/"
 $replace =""
 $id=preg_replace($reg,$replace,$id);
 $id=preg_replace($reg1,$replace,$id);
 ....
 $sql = "SELECT * FROM users where id='$id' LIMIT 0,1";

I know the filter can be evaded by something like 'or '1'='1.
However, I would like to see if it is possible to perform an outfile dump of the whole database, so I've tried things like:

 ' union select null,username,password from users into outfile "/tmp/file"...

however due to the ' LIMIT 0,1 at the end I'm having trouble figuring out how to end the payload. I've thought about doing multiple union queries, say:

 ' union all select null,username,password from users into outfile "/tmp/file" union all select null,username,password from users group by '

However, I get an error, because I believe the into outfile part has to be the last query. I also thought about using FIELDS TERMINATED BY ' but now the LIMIT 0,1 is in my way.

Is there anyway around this to perform a outfile dump of the database?
Is it possible to dump the database through the error instead?

I figured out that the following injection dumped the database(not through outfile though):

' union select null,group_concat(username),group_concat(password) from users group by '


Is there a HeartBleed Honeypot so that I can pentest it? I am looking to improve my skills, to do so I need a site with an old OpenSSL version, so that I can do a pentest on my own.

It should be easy to create one of your own, which is usually preferable. Fire up apache, install an old libssl (prior to 1.0.1f) and give your install a self-signed cert. Then, generate some traffic with curl.

You should be able to fire up your exploit and start reading memory.

It's probably best to do this in a VM, since you don't want anyone else exploiting your test bed.


Wi-Fi Protected Setup PIN method EAP Messages Let's look at this example: router (access point) has 8-digit PIN (printed on label) and laptop wants to connect to network using WPS PIN. So user give router's PIN into laptop and laptop sends PIN to router that verify is it correct or not. This way of configuration is named external registrar.

WPS PIN Configuration is based on EAP messages. There are 8 messages between registrar (laptop) and enrollee (AP).

In M4 registrar proves knowledge of 1st half of PIN. Then if it is wrong enrollee sends EAP-NACK. If it is correct in M5 enrollee proves knowledge of 1st half of PIN.

In M6 registrar proves knowledge of 2nd half of PIN. Then if it is wrong enrollee sends EAP-NACK. If it is correct in M7 enrollee proves knowledge of 2nd half of PIN and sends AP configuration to registrar.

You can see here (page 5) for more details:
https://sviehb.files.wordpress.com/2011/12/viehboeck_wps.pdf

Why in M5 and M7 enrollee proves knowledge of 1st and 2nd half of PIN? Is it necessary? Why enrollee just does not send confirmation message?

When the enrollee sends proof of knowledge of the PIN, then the registrar can be assured that it is registering with the enrollee it expects. It works as a form of dual authentication.

Imagine a malicious, rogue WiFi AP that is programmed to accept any PIN, and therefore send 'confirmation messages' to any supplied input. An unsuspecting user could be connecting to the malicious WiFi, thinking they are connecting to their trusted network. By proving that it knows the PIN, the AP shows that it is the expected AP.


can anybody explain error based sql injection attacks I practice about error based sql injection but there isn't any good reference for it ..

for example :) :

mysql> select count(*),floor(rand()*2) as a from users group by a;
ERROR 1062 (23000): Duplicate entry '0' for key 'group_key'
mysql> select count(*),floor(rand()*2) as a from users group by a;
ERROR 1062 (23000): Duplicate entry '1' for key 'group_key'
mysql> select count(*),floor(rand()*2) as a from users group by a;
+----------+---+
| count(*) | a |
+----------+---+
|       10 | 0 |
|        3 | 1 |
+----------+---+
2 rows in set (0.00 sec)

why first and second query isn't run?

it's mean the value of first or second row of equals with a column?

so why when I change the query to this can't see any error massage :

  mysql> select 1,floor(rand()*2) as a from users group by a;

+---+---+
| 1 | a |
+---+---+
| 1 | 0 |
| 1 | 1 |
+---+---+
2 rows in set (0.00 sec)

I can't underestand the error based sql injection vulnerability and also I see this link:http://bugs.mysql.com/bug.php?id=58081
but still I have a question !

How this vulnerability Occurs?

Thanks

Error based sql injection takes advantage of poor error handling in an application.

When the application is returning you the mysql error, you find a way (usually it's with group by) to have the interesting data returned by mysql in the error.

In your example I can't see what information you are trying to obtain but look at this site, there are good examples there.

As you can see in the examples, each request is made to trigger an error. This error will contain the value wanted by the attacker. For example, the mysql version will be retrieved with the error "Duplicate entry 'MySQL version here' for key 1".


How to store OTP seed securely at the validating server 'Everyone' knows when storing passwords in a database this should be done securely for example by using salts and an appropriate hashing algorithm.

Most OTP (One Time Password) solutions are based on a long secret random seed value. Somehow this needs to be stored at the validating server as well to be able to verify the submitted OTP value.

In a way these seeds have the same role as user supplied passwords and need to be stored equally secure. Salting & hashing will not work here as this will break the OTP algorithm.
Most small OTP-tokens are physically secured by being more or less tamper-proof but this does not apply to the server.

How can the seeds be stored in a proper way?

And if there is a solution for storing the seeds without hashing, why not apply the same method to regular passwords?

You can encrypt the OTP seed using a symmetric key derived from user's password. However, this requires the user to enter the password before entering the OTP, otherwise the server cannot decrypt the OTP seed.

Alternatively, you could have a highly secure server that gets passed the encrypted OTP seed and returns a currently valid OTP. Symmetric key for seeds is stored on this server. HSM could also help you here.


What are the security implications of homebrew and macports? macports

binaries are useable from /opt/local/bin/, i.e. for tesseract

bin$ which tesseract
/opt/local/bin/tesseract

bin$ ls /opt/local/bin/tesseract
-rwxr-xr-x  1 root  admin  28120 15 Sep  2016 /opt/local/bin/tesseract

bin$ ls /opt/local/ | grep bin
drwxr-xr-x  719 root  admin  24446  6 Aug 19:55 bin

install requires sudo

sudo port install tesseract

homebrew

bin$ which packer
/usr/local/bin/packer

bin$ ls /usr/local/bin/packer
lrwxr-xr-x  1 myuser  admin  33  7 Aug 14:28 /usr/local/bin/packer -> ../Cellar/packer/1.2.5/bin/packer

bin$ ls /usr/local | grep bin
drwxrwxr-x  41 myuser  admin  1394  7 Aug 14:28 bin

install does not require sudo

brew install packer

PATH

trimming out other software, this is my $PATH order:

/opt/local/bin  #macports
/usr/local/bin  #homebrew
/usr/bin        #Apple binaries

/usr/loca/bin permissions.

I believe, from https://apple.stackexchange.com/a/261710, that /usr/local/bin, before homebrew, starts out as root-writeable only:

drwxr-xr-x  26 root  wheel  -                 884 Oct 17 03:36 bin

Risks?

Is there a real difference between those 2 approaches?  What happens if either port or brew itself has been hacked?  What if the package you're installing has been hacked?

I realize that installing hacked stuff is going to end badly regardless, so, assuming brew/port are OK and the installed package isn't corrupted either, what about the implications of either approach when it comes to other malware trying to alter your system?

Looks to me as if /usr/local/bin is wide open and the binaries there can in effect take the place of any Apple programs.  Should I be concerned?

If I am understanding your question correctly, it boils down to:

  Homebrew changes the permissions of /usr/local/bin from the default drwxr-xr-x root wheel to the less secure drwxrwxr-x myuser admin. What are the risks?

As you point out, your user (or anyone in the admin group, or any virus that manages to run as you) can now install software, including over-writing default system stuff.

How big of a problem is this?

Multi-user system

On a multi-user system like a server where there are other users logged in, this would be a big problem. I don't have access to a Mac, but I assume my linux box is similar enough; /usr/local/bin is empty (nothing to replace) but

$ echo $PATH
/usr/local/bin:/usr/bin:/home/mike/bin:/usr/local/sbin:/usr/sbin

So assuming that other users have the same bash config as me, then it looks in /usr/local/bin first. Therefore I could put a malacious program called ls in /usr/local/bin and the next time someone tries to navigate the filesystem, my code will run inside their user account. The nefarious possibilities are endless.

So I would agree with you that this is a problem on a multi-user server.

Single-user personal computer

For all intents and purposes, there is only one user on your laptop. xkcd illustrates this quite well:

If an attacker / malware / etc has already gotten inside your account, then they have all your data, it's only a matter of time until they keylog you typing your sudo password, so do you really care whether they install further malware in /usr/local/bin or put it in /home/myuser and add that to your path? The end result is the same.


How to decrypt email with revoked key in enigmail? Is it possible to decrypt a message which is encrypted with a revoked PGP key? I still have the private key, but Enigmail doesn't show me revoked keys neither does automatic decryption.

Edit: I created a new key pair, but some people still use my old one. I want to be able to decrypt these messages of course.

Yes, after you revoke your key you can still decrypt messages sent to you encrypted with that key.

Note that you are also able to decrypt messages sent to you with the revoked key after the revocation.  In fact, even if people aren't supposed to use that key (GPG/Enigmail will not allow to use a revoked public key to encrypt a message to someone), many of them could still have your public key when it was still valid and haven't refreshed it since then.

You should send to these people your new public key and your revoked old public key so they can update their keyring; afterwards, they'll be able to use only your new key. Alternatively, if you've uploaded your keys to a keyserver, tell them to refresh their keyring from Enigmail Key Management: they have to select your public key and choose Keyserver -> Refresh selected public keys (or Refresh all public keys to refresh all keys in the keyring).

Enigmail should show you revoked keys as well. If it doesn't, open Enigmail Key Management, go to View and make sure Display invalid keys is ticked.


How to make the first request which used to create account safe? To authorize user, our application defined below steps:

Send user email and password (plain text) through HTTPS.
When server received it, generate a salt to hash password and store it.
When user wants to login, verify password with salt.

For revoking an user password easier, I choose to generate a salt on server. But my workmate thinks password should be hashed on client before it sends to server.

My question is if we hash password on client, it will make password more secure. But we still transmit salt to server or we can't verity it. If anyone get this salt, the password is still insecure. How can I protect this request?

Client-side hashing can be combined with server-side hashing if you want, but server-side hashing (using a slow, salted hash, typically one of - in descending order of strength/modernity) argon2, scrypt, bcrypt, or PBKDF2 - is essential. You can re-hash something that was already hashed on the client. However, if you were to just take the hashed password from the client and use it directly, not only would the hash probably not be as good (it's complicated to handle giving a user the right salt securely, among other problems), but the hash itself becomes password-equivalent; an attacker wouldn't even need to know what the original password was, if they captured the hash (either from the network, if you messed up your TLS somehow, or - more likely - just out of your auth database) they could just send it to the server and log in as the user.

It sounds like you're trying to roll your own authentication system without much understanding of the security risks around authentication. Is there some reason you can't just use an existing library? Many of them aren't great, but if you were seriously considering either only-client-side hashing or believe that a password passed over HTTPS is "insecure" in any way that a salt helps with, then almost any well-established auth framework will (no offense intended) be better than you would create. Don't re-invent the wheel without reason.


Nesting bcrypt + PHPass for improving the security of password storage in legacy software? I've been tasked with improving the security of the password storage of a site which currently uses Openwall's PHPass. All the hashes will be converted at once, i. e. we don't want to wait for the user to log in to re-hash their password.

To achieve this I thought we could use bcrypt over the existing PHPass hashes, this way: bcrypt(phpass(password))

But we need an important intermediate step: just like bcrypt, PHPass has its own salt embedded into the hash, so we have to "carry" that salt into bcrypt if we want the operation to be repeatable when verifying the hashes.

Luckily, PHPass' salt size is smaller (6 bytes) than bcrypt's (16 bytes), so we can "share" the first 6 bytes of the salt and adding 10 additional random bytes for bcrypt.

Imagine something like this in pseudo-PHP:

$password = 'somestring123';

$hash = phpass($password)

// $hash is now '$H$9Uvsrbh2Wxo3SebfGb4xVtODMmD2K70',
// where 'Uvsrbh2W' is an encoded, random salt of 6 'raw' bytes

$raw_salt = decode(substr($hash, 4, 8));

$hash = bcrypt_with_custom_salt($hash, $raw_salt . random_bytes(10));

// $hash is now '$2y$12$Uvsrbh2WzN9HrapVpnmu2OYOdJ2jnjHt2LTwIYQPJe.BUJQKezKuO'
// whose salt uses the first 6 bytes we had in phpass,
// so that we can repeat the process when veryfing the password
// since we have all the salts available in only one hash

Barring any implementation bugs and assuming the random sources are cryptographically secure, is this a theoretically secure way to use bcrypt in a legacy context? From my understanding the result should be as secure (if not more...?) as just doing bcrypt(password), but I'm not an expert and I might be missing some obscure detail.

I was initially going to close this as a duplicate of "why-is-hashing-a-password-with-multiple-hash-functions-useless" however you have a slightly more complex case in that you already have a database of hashed passwords.

If you consider your existing mechanism of hashing to be insufficient than you need to migrate to a better solution. That means you need to be able to discriminate between the old and new representation, run the verification mechanisms in parallel and convert the clear text from the old representation to the new. And the only time you get the clear text is when somebody logs in.

Although PHPPass is rather long in the tooth, it does use blowfish (and bcrypt is based on blowfish). So maybe you're not improving the security quite as much as you think.


Can we prevent DNS-based attacks with SSL/TLS? Consider the following scenario giving a hypothetical attack:

Crypto.com is selling cryptostocks and accepts payments using a payment processor PayEasy.com. The entire site pages (of crypto.com) are served using HTTPS.
While traveling in a foreign country, Bob visits crypto.com on his laptop from his hotel network and clicks on the “buy now” button for 10 cryptostocks. He is forwarded to PayEasy.com using a link

An attacker (such as the ISP) manages to redirect all traffic intended for PayEasy.com from Bob’s computer to a fake site he has set up called PayEazy.com. When Bob makes a DNS query for PayEasy.com, the attacker returns the IP address of PayEazy.com.This site also has an HTTPS connection using a genuine SSL obtained from a CA using "domain-validation". The certificate confirms that the site is served by payeazy.com. An attacker must do this, since otherwise Bob’s browser will give a warning and may fail the attack. Thus, Bob effectively clicks a link equivalent to
Bob never suspects anything because he sees the green bar and he has not even bothered to read on crypto.com’s site that it uses PayEasy.com. Even if Bob did know that PayEasy.com is crypto.com’s payment processor, he does not notice the slight difference in PayEazy.com. Bob makes the payment of $100 for 10 cryptostocks and waits but they never arrive.
Bob assumes Crypto.com is a scammer and sues them. As the case unfolds, Crypto.com’s lawyers ask Bob to prove that Crypto.com sent him to https://PayEazy.com instead of https://PayEasy.com. Bob cannot prove this and loses. The case could have gone either way since even Crypto.com could not have proved that they indeed sent Bob to  https://PayEasy.com and not https://PayEazy.com

Firstly, is this attack realistic. Secondly, how to prevent it?
(This is similar to the example given in the article Schneier's PalmPilot)

As an example of this attack: https://google.com is a secure link to google.com. Assuming that this site (security.stackexchange.com) is served over HTTPS. Now edit your 'hosts.file' so that the IP address of google.com points to yahoo.com and click the above link.

No.  This is exactly why we have PKI - to prevent this type of DNS poisoning attack that you are describing.

Here is what would happen in the case that you are describing (including the comments), after Bob clicks the link to https://PayEasy.com.  First, Bob's browser would do a lookup DNS lookup for PayEasy.com.

Let's assume that the attacker (Bob's ISP or his WiFi provider) managed to return a false IP address for PayEasy.com, and returns an IP address to a web server that the attacker controls.

OK, so now Bob's browser connects to the attacker's web server.  But - here lies the problem - the attacker's web server serves up a certificate for PayEazy.com.  At this point, Bob's browser knows that something is up, because the browser requested PayEasy.com, not PayEazy.com!  Bob's browser would show him a warning of the certificate mismatch, and Bob would be wise to cease connecting with the site.


Can data coming into my UDP server be sniffed? I have made a small tracking device. I am trying to reduce the data overhead as much as possible to make the device very cheap to run. We are working on the basis that 1MB = £0.01 (the data price at Three UK).

I wrote a simple UDP server in C++. The tracking device opens a socket connection to the UDP server and then sends GPS data through the socket every 5 seconds. This seems to work very well. The overhead is very small and in general seems reliable.

The tracking device has a 16 character string hardcoded into the microprocessor code. In order to reduce overhead, we pass values to the server as a comma separated string and in this string we include the hardcoded device ID. Each time the UDP server receives a request, it checks the ID against a database of valid IDs. If successful, the request is accepted and the GPS data is saved against that device. I have written brute force protection functions to ensure outsiders can't try and send spoof GPS data for a device.

I'm no expert on network security, but I know of terms like "packet sniffing". The data is being sent over an unencrypted connection in plain text, so I need to ensure there is no way that this data can be read. The tracking devices will be installed under the dashboard in vehicles so there's no way to find out a device code physically without reading serial data (i.e. plugging it in).

My worry, and where I'm clueless, is whether it's possible for a hacker to somehow detect incoming traffic to my UDP server and see the device ID and then use it to send spoof data? Am I worrying about something that is non-existent or do I need to ensure that the connection is encrypted (I assume TLS over TCP connection) at the cost of extra overhead?

It would be easy to sniff data using tools like WireShark from someone who can access the data path between your client and the server. This isn't something anyone on the Internet could do per se but if your device uses wireless and there are people nearby they could grab this data if they wanted it.

As for finding your UDP service on-line that is easy to find via simple scanning tools like nmap and zmap but depending on the port number you used it may already be publicly listed on sites that scan the entire Internet like scans.io. In all likelihood some third parties are already aware of your UDP listener and this will, hopefully, also be listed as other source addresses in your logs.

Security through obscurity no-longer exists on the Internet since people can use tools like zmap or massscan to scan the entire IPv4 address space in just a few minutes.

https://nmap.org/

https://scans.io/

https://github.com/robertdavidgraham/masscan

https://scans.io/

As per the encryption question I think it would be wise to encrypt your data and also wise to consider how each device authenticates to the server. Security of the Internet of Things (IoT) is a very hot item because so many of these devices have abysmal security and security researchers, and bad actors, can leverage these problems to get access to other networks very quickly. If nothing else I recommend using encryption because what you use the device for may change in the future and it's always easier to design security in at the beginning of a project rather than paying the high-cost of reengineering.


How does DigitalOcean DNS verify the owner of a domain? Say you purchase a domain on Namecheap, but want to host DNS on DigitalOcean.

DigitalOcean, says to simply tell your registrar to use DO's nameservers, then set up your DNS for that domain on DO. However, there doesn't seem to be any verification that the DO account that configures the DNS for that domain is actually the owner of the domain. It could very well be some 3rd party with no relation to the domain owner. Is this assumption correct?

In my mind, it wouldn't even have to be on purpose or malicious. If I register example.com and host DNS through DO, then let the domain expire but neglect to remove the DNS records, what happens when someone else registers the same domain later and decides that they too want to host DNS on DO?

This may very well apply to other hosts (Linode, AWS, etc.) though I'm unfamiliar with how they handle DNS at all.

If you think about how this scenario is set-up you can see that Digital Ocean aren't really in a position to need to verify the owner of the domain.

It's the domain registrar who will be pointing the DNS server records to Digital Oceans DNS servers and so it's up to them to validate that you have the authority to provide the IP addresses of those DNS servers.

For example if you set-up malicious DNS records on DO for example.com, how do you get the NS records for that domain to point to your malicious set-up?  The answer being you'd need to convince the registrar to change the NS records for the domain.


How bad is using date to generate a "random" password? I came across a post about generating random passwords.

Apparently the preferred way is

date | md5sum

I am aware that using the date for this is bad, but how bad is it?

How does it fare when compared to (what seems to me) a more reasonable one:

< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c32

Let's assume I know the day or week you created your password, but not the exact time. This assumption seems reasonable:

Many online services display account creation dates
Many online services publicly recommend changing passwords due to breaches (I can guess that you changed your password within a week of the service's last publicly disclosed breach)
Many people change passwords "just to be safe" if something fishy happens, send a spoofed email to the victim and there's a decent chance you'll get lucky
In the event of a database leak, many services store the date of last password change (for example to enforce the (now obsolete) 3 month password change type of requirement)

You're password from urandom has log2(6432) = 192 bits of entropy. As passwords go, this is excellent.

If we assume I know the day you generated your date | md5 password, you have log2(60*60*24) ≈ 16.4 bits of entropy (86,400 possible passwords); this is very bad. Even with unusually strong Argon2 parameters that require 1 second per attempt, it would only take 1 day (at most) to crack, and an MD5 hash could be cracked almost instantly. In the event of an online attack rate limiting may help, but I certainly wouldn't rely on it (the attacker could use many IPs and spread out guesses over several weeks).

If I only know what week you generated the password it's only 7 times better, which is still nearly instantaneous when cracking an MD5 hash.


Cannot execute program with Meterpreter on target OS I'm a uni student taking a course on cybersecurity and what I am attempting to do is solely for educational purposes and not malicious.

I used the eternalblue exploit to gain access to the victim's computer (a Windows Server 2008 R2 virtual machine). I uploaded a simple helloworld.exe program on their desktop. Now, I am trying to execute helloworld.exe on their computer using the two methods below.

meterpreter > execute -f helloworld.exe
meterpreter > execute -f helloworld.exe -i
meterpreter > execute -f helloworld.exe -i -H

and

meterpreter > shell
.
.
.
C:\users\username\desktop> start helloworld.exe

None of the above methods will run the helloworld program. I do not see the helloworld.exe running on the victim's computer task manager. But, sometimes the UI0detect.exe shows up and disappears in the task manager. The Interactive Services Detection window sometimes would show up as well.

Note that I am able to execute the helloworld.exe while on the target OS in the command prompt using start helloworld.exe or in powershell using ./helloworld

If you have access to the box, then check out the event viewer for any log statement that might give you more information.

If your executable is malware then I would substitute it with some benign executable and check if you can execute it, if this is the case either application whitelisting or some antivirus is blocking your execution.

If your executable is interactive then it might be executing but you are not seeing anything or if the meterpreter session is not an interactive Windows session logon you might not even be allowed to execute it.

Sometimes meterpreter gets confused with the paths. I've always found more reliable to start a shell and then execute cmd.exe /c "/path/to/helloworld.exe"

If nothing above works, try other ways of getting a revshell except meterpreter; use nc.exe or any powershell revshell (nishang is pretty good).

Also, always use an absolute path when executing custom executables in Windows. It will save you a lot of trouble.

Finally, make sure that the executable was compiled against the same architecture than the target computer and that you are using a Windows account that has enough privileges to execute that executable.


Is AWS Elastic Beanstalk traffic from load balancer to backend EC2 instances secure? AWS Elastic Beanstalk service routes traffic back to its EC2 instances through HTTP by default. I know this can be configured to achieve end to end encryption by adding SSL encryption from the load balancer back to its EC2 instance(s). I also know that by default everything created by Elastic Beanstalk is inside a VPC.

Is the default configuration (ELB <-- HTTP --> EC2) secure?

It depends on your risk model. Unencrypted communication between two servers in the Amazon cloud is 100% visible to Amazon, for instance. It is also visible (and modifiable) to anyone, be they disgruntled employee or successful attacker, that has administrative privileges on anything in between those two servers. If that is worrisome in your context, then it's not sufficiently secure for you.

Thanks to Amazon's security, it is substantially more secure against everyone else than the general internet, but it is also extremely vulnerable against Amazon.


Compact, inexpensive device to secure unsecured communication with field devices I have the following problem. Our product integrates with LED signs of a certain manufacturer. Communication with these devices is via HTTP (they contain a web server for admin UI and a web service). The device does not offer any authentication methods, which means if you can connect to the device via TCP network, you have full access to the device.

Our sales team and customers really like these signs due to their versatility and want them. The manufacturer is not much concerned about lack of security and not in a hurry to add any (HTTPS, user name + pw login, etc).

I am wondering if there are small devices that could be "added" to each LED sign to enforce encrypted and authenticated communication with those signs. Here is what I have in mind. The device is physically attached to a sign (inside or outside. The device has two Ethernet ports. One port gets connected to the LED sign's Ethernet port, the other to the Intranet ethernet port in the wall. The main server that controls the LED signs can now establish secure communication with those devices (VPN?) and all HTTP communication to and from the LED signs is securely tunneled through those devices.

I searched the Internet for quite a while and couldn't find any such device, possibly because I don't know what you would call such a device.

One more constraint: The main server that controls the LED signs runs Windows 2008 R2 and higher, so whatever software runs on the main server to enable those tunnels needs to run on Windows.

Thanks!

Any tiny, low-cost computers that run Linux and have 2 ethernet ports would let you do this. Use NGINX, HAProxy or similar on the computer to run a reverse proxy that terminates the HTTPS connection and passes onwards the unencrypted HTTP traffic. Remember that HTTPS is simply HTTP with TLS encryption added. The source server won't care.

If you cannot source a suitable low-cost computer (try looking for some of the Raspberry Pi clones, I'm sure one will have 2 ethernet ports), your alternative would be to put in a single computer at the network segment level - e.g. have the HTTPS terminating proxy running at the edge of the reasonably trusted local network. This is the same principle but simply reducing costs by aggregating traffic through a single PC - by building, floor or whatever security boundary makes sense for your customer. Better still use 2 PC's for resilience if the signs are important enough.

This is really the reverse of what you might do when running a large-scale internet web service. In that case, you may well terminate the HTTPS connections at the edge of your data centre using dedicated servers to reduce the load on your internal web servers. Same principle here but you are keeping the encrypted traffic as long as you can and decrypting at some convenient point close to the signs.

UPDATE: Regarding possible hardware, here are a few pointers.

You could use a Pi (or similar) with a USB Ethernet adapter as the second adapter.

You could review the OpenWRT compatibility database for suitable devices. OpenWRT is an open source router-specific version of Linux.

There are also some embedded linux devices with 2 ethernet ports built in.

Finally, depending on the topology of the buildings you need to support, it might be feasible to build a separate network just for the screens. This isn't as hard as it seems but the constraint may be the number of spare ports the buildings have. It is conceivable that all that is needed is some re-patching of the network. If your network staff are open to it, it might even be sufficient to logically set the screens to their own VLAN.

Sorry, I'm rambling now! What I'm trying to get across with this last point is that you might only need encryption between buildings and depending on the LAN hardware and configuration, you may be able to use a building's firewall to terminate the encryption (e.g. using a VPN - not even that if the WAN is a modern MPLS since that is already encrypted point-to-point). Then, once inside the building, you can either physically or logically segment the screen traffic.


Who "brands" vulnerabilities? It appears that every time there's a vulnerability discovered major enough to hit the news, its been assigned a brand name and often even a logo. Heartbleed, Spectre, Meltdown, Foreshadow, etc. Who decides and produces these? Is it typically the person / group who discovered the bug, the group with responsibility for the affected product, or someone else?

I understand malicious software is typically named / branded by its author, but it seems odd that someone is out there coming up with names and designing logos for vulnerabilities.

They are all branded by the people discovering them. There's even a note on the wiki for Heartbleed:

  Logo representing Heartbleed. Security company Codenomicon gave
  Heartbleed both a name and a logo, contributing to public awareness of
  the issue.

Spectre/Meltdown explains the branding on their site. As does Foreshadow (same artist).

Such publicity helps to make the issue mainstream and more shareable and suitable for pick-up by the general media. This helps to make the problem more well-known, as well as the people who created the brand. Just like any other marketing.

Given that it is relatively cheap to get a logo designed (welcome to the gig economy), the return on investment, even for an expensive logo, is huge if it gets picked up by the media.


Recommended length of password Why are we recommended to have at least 8 characters, and not 6 or 7 etc.? and the different set of character?. I only know that the longer the password is, the harder it is for brute force attack to take place. But why specifically 8 characters

You're right to state that password length recommendation is usually directly related to how hard it is to bruteforce attack it.  When you combine this with the understanding that sophistication of attacks as well as computing power are increasing, it should follow that at some point in the past, based on computing power available, 8 characters was the "right" recommendation, and prior to this it could have been 6 or 7.  Neither are the right recommendation today.

As computing power increases and sophistication of attacks increases, recommended password lengths will increase as well, to a point where it isn't feasible to use passwords which are any longer.


Best source(s) for security related news? What is the best place to go for security news? I am looking for everything from news updates to editorials to guides and research. Anywhere considered more reliable or particularly hard-hitting?

Also I am looking for good Twitter feeds!

For a site I would recommend the SANS Internet Storm Center at https://isc.sans.edu/.

I find the most useful for news for me is a twitter list of security professionals and researchers such as.

@sans_isc
@uscert_gov
@schneierblog
@gcluley
@duckblog
@markrussinovich
@jeremiahg
@briankrebs
@mikko
@hdmoore
@dakami

You can probably find other lists of security related twitter users that would be worthwhile to follow.


Is SQL Injection Possible without double and single quotes? Let's assume we're building a SQL query like this:
SELECT * FROM users WHERE username = 'Username' AND password='password'
If we blocked the characters " and ', will an attacker be able to hack into it at all?

Here's my regex statement /[\"\']/ and if there are any matches it will block the request. I'm also trying to avoid using MySQLi prepare.

Yes.

There are other ways to get data from a database, or just do something malicious. One way of doing this is to select all the records from the database, using either SELECT * FROM TABLE users or SELECT * FROM TABLE users WHERE True and then filtering through the returned data to find the user that the attacker wanted.

Further, statements like DROP TABLE users are not caught under the double quotes system, and have pretty nasty effects.


Can firewalls decrypt SSL packets? I was wondering if the firewall has the ability to decrypt the SSL traffic.

If so, the network admin is able to read the data in clear text at transit.

SSL/TLS is a protocol providing an end-to-end encrypted communication between two parties each having one of the keys in private/public key pair. Typically a browser and a web server.

In normal circumstances any device between the two endpoints cannot decrypt the communication. That includes firewalls.

It is however possible (and used in organizations) to use a proxy server that decrypts and re-encrypts communication thus allowing interception and decryption (for example for monitoring and filtering). It does however require adding an additional certificate to a trusted certificate store on a client machine (either automatically through a software management system or manually by users).


How can I verify if some data is truly the decrypted counterpart of a byte sequence? In more detail: I want to build a proxy that receives decrypted data from a client, and is able to verify that this data is what an origin server sent to the client.
For example, a client establishes a connection with an HTTPS server, proxying through this proxy. The client will send some web responses coming from the origin web server back to the proxy, which in turn has to decide whether those are really the unencrypted version of the stream that could observe previously (encrypted).

That's not possible.

The only known way to check if plaintext and ciphertext match (with a modern algo like AES) is to encrypt/decrypt, and for that the key is necessary. (Even more, there is no known way to decide if the ciphertext really is encrypted data (any data) or just random garbage.)


Using primary public-key to verify message signed by subkey Let's assume this scenario:

I sign a message using my subkey
I send the signed message to someone who has my master public key

Is recipient be able to verify my message? Or do I have to provide my public-subkey?

You have to provide the public subkey to the recipient in order for them to validate anything signed with the corresponding private subkey.

The Master key serves a purpose somewhat analogous to a Certificate Authority.  It represents your authority to bless all your personal subkeys as valid keys that were issued by you.  But just as having a root certificate doesn't mean you can use TLS to talk to any random server that was issued a public key - you still need that server's public key (which is delivered on the certificate.)


Is dedicating ips for each domain better than sharing one ip? Would sharing an ip for multiple domains cause any kind of security problems? Imagine there are multiple domains which should be hosted on a server. Which is more secure? Sharing one ip for all the domains or using a dedicated ip for each domain?

There is no security benefit to either approach.

The only security benefit that you would get is by running the sites on different servers, to separate their duties. That way if one gets compromised the others are left intact. In such a setup the number of IPs is still irrelevant; you could have separate internet-facing IPs for each server or you could have some sort of reverse proxy in front with one internet-facing IP. Neither has any particular security benefit over the other (although the latter does open up more options for high availability).


Seeking guidance on breaking in to InfoSec field I have been interested in Information Security and Forensics for a really long time and was the reason I decided to pursue a degree in CSE (Bachelors acquired), however, I am having a difficult time figuring out the best way to get involved while staying out of the blackhat side (as much fun as it could be), avoiding breaking the law, or, dishing out 10s of thousands of dollars that I don't have.

I have started looking in to the SANS institutes MSISE, but that is extremely expensive and my current employer will absolutely not pay for it as I'm a developer, and an MSISE has no clout in this side of things.

First, let me lay out what I am interested in (in order of most to least interesting), and then, what I have looked in to.

What I'm interested in:

Penetration Testing Everything listed here, with Adv. network pen testing as final course
Data Forensics - Recovering deleted or destroyed data for evidence gathering to prosecute the really bad bad guys (think pedophiles and the like)
Incident Response
Reverse Engineering - Is this a career or just a sub-domain of a discipline?

What I have looked in to (not in any particular order):

Coursera.org's Cyber Security courses
SANS MSISE (or various courses and certifications from this program)
CEH certification
CISSP (Lot's of learning before I get to this one)
Offensive Security training

What have I done to prepare myself?
I have a bit of experience in Kali and recently configured a set of VMs for a virtual home lab running Linux Mint 18, Kali, and Windows 7 and I can operate all three at the same time to work in multiple environments. I am familiar with the concepts of NMAP, Aircrack-ng, MITM tools, Metasploit, OllyDbg, and WireShark. I have programming experience in C/C++, C#, ASP.NET, ASM, JS, SQL, PHP, Python and some others.

My biggest questions

If I obtain a GWAPT, GPEN, GXPN, and CEH, will these allow me to get a foot in the door?
What if I just obtain a GPEN, GXPN, and CEH
Are Offensive Security certifications or SANS certifications more highly regarded?
Is there a particular order that certifications should be obtained?
Do I need certifications, or am I just going to blow my money?

I know this is a lot to read and is a lot to ask, but I am extremely interested in the field and I haven't found much guidance or information on what a decent approach would be (I know, it's subjective). Basically, what I am attempting to do, is learn the skills I need to get in the door without A) breaking the law, B) breaking the law, and C) breaking the law. Books can only impart so much knowledge before you have to actually get in and do the work to solidify the information and understand what it is really trying to get across. You can read 100 programming books on 100 different languages and in the end, you will still know 0 languages. I'm trying to get some real world experience without going in to the wild to get it, if that makes sense.

Where would I like to be in 5-10 years? I would really like to become a member of SANS Cyber Guardian Red team. How neat would that be?

Sorry if this is an incorrect location for such a question. I am fairly confident this isn't a duplicate; I looked at the ones that may be similar and nothing really stood out. Thank you for taking the time to read this and for your insights.

Any of the SANS certs are a great option and will get a hiring manager's attention. Practicing on vulnerable VMs in your lab will give you experience with the tools and techniques. There's no need to break the law with so many VM's available. (Check out vulnhub.com if you already haven't.) Ethicalhacker.net's forum has a lot of posts about people trying to break into the infosec field, you may find some good advice there.


Are cloud storage services a good strategy to protect against ransomware attacks? I have been reading a lot here about Ransomware attacks and I am wondering if my strategy for protecting myself is valid or not.

I have 10Gb of personal data and 90Gb of photos and videos. I have them in D:\ drive in two separate folders. Personal data folder is synced with Google Drive. Photos are synced with a similar tool (Hubic).
This way every new photo I copy to D:\ drive is soon sent to Cloud Storage. If my hard drive dies or is stolen I still have my online copy.

But in case I suffer a Ransomware attack, I am thinking it might not be good as possibly the data would be deleted/encrypted also in Google Drive.
So my question is:

Is my method of syncing my data to online storage services (Google Drive, Dropbox, etc.) a good way to protect myself against Ransomware?
Is there a better backup strategy for ensuring I can recover from Ransomware?

Note: There is a similar question here but it focuses on if the online storage vendor can be trusted or not. In my case I choose to trust them, so, given a successful Ransomware attack, would I have a backup to ignore Ransomware demands.

I'm not sure about Google Drive, but Dropbox provides a way to recover previous file versions, a feature that wouldn't be impacted by the ransomware, since it relies on a file copies on the Dropbox servers. So it'd certainly be a way of protecting your data.

However, recovering everything over your internet connection is a relatively slow process. Personally, I would use a NAS device, but wouldn't map it as a network drive (because those can - and will be influenced if a ransomware is activated on your computer). I would use it via FTP / SFTP, probably with a script that syncs the files on a regular basis. This way you have the files locally, which makes restoring from an attack less of a problem. It is probably cheaper too.

Also, if you prefer Dropbox-like experience, you might want to try ownCloud on your own device - it also keeps the previous versions of file, allowing you to roll back in case of file damage or corruption. Keep in mind that storing multiple old versions of a file takes space on your NAS's disk(s).


Why do banks still hack-up autocomplete=off functionality? With Bug #1025703 in the latest Firefox 38, Mozilla has finally decided to stand up for its users instead of catering to the banks that don't want the passwords remembered.

However, I've noticed about a year ago or so, that the remember-password bookmarklet has long as stopped working on oh-so-many sites, especially the bank ones, due to some extra javascript tricks, so, it's not really clear what the above change is for, perhaps just to remove and cleanup a feature that has long as been redundant and broken.

But the persistence of firms trying not to have the passwords remembered undoubtedly contributes to the easiness with which fishing attacks can performed -- if their users are accustomed to entering their passwords when returning to a tab after 15 minutes of inactivity in a given tab, on a whim's notice, fishing is just so much easier when they're all ready and willing.  Compare it with the Password Manager approach, which securely stores the passwords within, and is pretty much guaranteed by design to only reveal them to the correct web-sites.

So, why do the banks continue to do this, the mouse and cat game of preventing the passwords from being saved in the Password Manager?  Aren't password managers a good way to ensure no fishing can be performed on one's customers, since they don't even know their own passwords?

While there are aspects of truth in what you say, you have to look at the bigger picture and look at where banks have liabilities and risks. Banks look to minimise the risk down to a certain level (eg there is a fraud appetite that is accepted by banks, as to try and reduce it further costs more and more, rapidly becoming unworkable) and many of these drivers conflict with user experience requirements.

Additionally, technical requirements form a good part of the risk profile and appetite for a bank. So that also leads to trade-offs.

Allowing user devices to store credentials could be a way for attackers to gain even easier access than their current phishing success rate, so unless you have a strictly enforced set of standards by which all password managers work, that can also be audited and assessed by the banks, you are in a position where you may be improving security but you may be decreasing it.

The worst case for the banks there is that security becomes reduced, customer accounts are attacked, and the banks are held liable for it.

So keeping the onus on the customer to control their credentials is generally considered better for the majority of customers, and the bank as a whole, while for some customers it will be worse. And for those customers, they can improve their security through awareness training.


Is using WebAuthn alone considered as two factor authentication? Will using WebAuthn for an application make it two factor? I am specifically interested in using Ondevice biometrics and achieve passwordless authentication.

For a true two factor authentication you need one to use two of the three forms of authentication: "something you know", "something you have" and "something you are".

When using WebAuthn using on-device biometrics, can we call the device that I am using to access the portal as "something you have" and the biometric as "something you are"?

I think it depends if you are limiting access to your service by devices by some reasonable method.

If you have to use a domain joined laptop then probably yes. If you are using an app on a mobile device, then using the native biometrics capability to encrypt a secret then probably yes.


Are you aware of any CEO that went to jail because of Security Flaws? I need to make a real motivation for a security talk to a board of management.

I know that in case a company ships products ignoring (so knowing and on purpose not caring) then it is held liable. What I heard as well is that the CEO is the one made accountable.

Now, I am wondering if anyone had read or is aware of a real life example?

Legally speaking, a corporation is one of the best "liability shields" you can have. It is its own entity that is, for most purposes, the entity that the rest of the world is interacting with when they interact with anyone empowered to represent it and make decisions on its behalf. It, and not its agents, bears the full brunt of any legal liability for damages caused by actions or inactions of the company or its agents.

As such, you're probably not going to convince the executive team, or the board of directors, or even middle management that they would bear any general liability for a breach of security. To do this, you would have to prove specific intent to harm; that an executive saw a name on a list of customers, didn't like that person or company, and wanted to hurt them, which in turn led to their deliberate decision not to fix a known security flaw. This is next to impossible; you can show all the evidence you want, but even if you have a recording of the CEO saying they wanted to harm this person's interests, you cannot prove that a CEO's decision to fix or not fix a flaw was motivated by this; it's all circumstantial (though a recording would go a pretty long way towards "preponderance of evidence").

There are, however, some instances where specific people can be held liable independently from the company. My wife, for instance, works with healthcare records. If she ever told anyone, even me, any specifics of that data, and that became public, it's her tail on the line for the HIPAA violation, even if her boss told her it was OK or even ordered her to divulge the information. I work for an alarm monitoring company; our alarm center agents, if they make the wrong mistake (even in good faith), can be held liable independently from the company for damages and wrongful death. Unfortunately, it happens. But, this liability does not extend to anyone who was not aware of the events at the time, so you're going to have a very hard time proving that an action by an agent on the lowest rung of the corporate ladder implicates the CEO.

Where you can hurt an executive is where it matters most; their wallet. Executives typically own a significant stake in their own companies, which forms a relatively large chunk of their net worth. The company is their shield, but it's also their livelihood, and it will take a beating if a security flaw in their systems is found, exploited, and subsequently makes it into the press. Corporations cannot go to jail, but they can be fined and sued to "death", and the executives lose all the money they had in corporate stocks and options.

Want proof that companies have gone bankrupt over security breaches? DigiNotar, a Dutch company that was a globally-trusted SSL/TLS certificate authority, was hacked in July 2011 and apparently again in late August of that year. Several fraudulent certificates were created using DigiNotar's systems, identifying the certificate holder as being the valid domain of major sites like Google, Yahoo, Mozilla, WordPress and the TOR Project. Those certificates were subsequently used in MITM attacks and other hilarity. DigiNotar did not know how many certificates were issued (the tally quickly reached the hundreds; we now know that 531 fraudulent certificates were created in this attack) and so could not guarantee they had all been revoked. So, Microsoft and most of the major browser manufacturers responded by simply revoking trust in DigiNotar's own trusted root certificate in the Windows OS and major browsers. Apple's response was delayed, but it did also update OSX/Safari to revoke DigiNotar's root certificate.

In addition, DigiNotar was responsible for one of the intermediate CAs used in the security system of the Dutch Government. That certificate was also believed to be compromised and was revoked by many browser manufacturers, and in the ensuing hilarity of real government websites losing trust (imagine browsing to the IRS website and being told by your browser that the site may be fraudulent; THAT's a screenshot I'd pay money for, and it happened to the Dutch counterpart Tax and Customs Administration), the Dutch Government stepped in on September 3, took control of DigiNotar's certificate operations, transitioned all government websites off of DigiNotar-rooted certificates to ones signed by uncompromised CAs, and issued a statement saying that DigiNotar would no longer issue government SSL certificates. DigiNotar filed for bankruptcy the same day.


How is the server authenticated in ssh? The server does not know any secrets that can be used to authenticate itself.

Also, what good is a fingerprint if it is based on the public key if it is basically the hash of some known public key.

What protection is there from an "ssh server spoofing"?

SUMMARY AND REFLECTIONS: I have already seen the duplicate question before posting this one up. The part that for me was not clear, is that the server too has a private key. And when you attempt to connect to sshd, it will send you the fingerprint of the sshd public key (this will probably be found in the /etc/sshd, different that the ones found in the /home/<users>/.ssh).

This is why ssh keys asks about authorizing a fingerprint on first connect. This is also why the fingerprint changes if you do a new sshd install (new public-private key pair has been generated).

Typically, SSH clients will keep track of the fingerprint of the public key that they saw the first time you connect to the machine. In fact, often the first time you connect to a machine over SSH, the client will show you the fingerprint and ask you to validate that it is correct.

This validation should take place out of band. In other words, the system administrator should give you the correct fingerprint in a secure manner. Then you can compare the fingerprint the server is presenting you with and the known good fingerprint.

On subsequent connections, as long as the presented public key from the server has the same fingerprint, most SSH clients will accept it and let the connection proceed. On the other hand, if the fingerprint has changed, the SSH clients I've used will actually deny the connection, tell you that the fingerprint has changed and that you may be the victim of an attack.

If, you do not verify the initial fingerprint properly, and someone is actively attacking you on that first connection, they will be able to spoof the connection and possibly steal credentials (depending on the authentication mechanism being used).


Would the authorities in my college be able to see what websites I accessed through tunneling(SSH)? I study at a college where most social networking sites are banned(Including this one) and if someone is found using them somehow is heavily fined.I just want to know what all can the network admin find out

Depends on the way you use SSH. If you just do it the usual way of using the -D option to provide a SOCKS server and use this as the proxy at the browser, they will not see that you are accessing these sites but they might deduce the use of such sites from tracking DNS queries. ssh -D provides only a SOCKS4 server and for SOCKS4 the resolving of host names to IP addresses must be done outside the SOCKS4 tunnel, because SOCKS4 can only handle connections to IP addresses.

Edit: thanks to dr jimbob for pointing out, that SOCKS5 is available in ssh since 2003, but that have to make sure to use this version. With Firefox you have to explicitly choose the SOCKS version and you need also to explicitly enable RemoteDNS to make the DNS lookups through the SOCKS5 proxy.


Separation of devices for VPN / Firewall Our company has two separate firewall devices from different vendors (Checkpoint / Cisco) for firewall and VPN access.

We're currently evaluating the possibility of migrating to a newer, clustered solution (2 new devices) from a single vendor where both VPN and firewall services will be hosted.

Any thoughts/ideas on what the pros and cons of this solution would be?

I've read a few articles stating that it's a good idea to keep them separated due to potential performance penalty, but I really don't think that this is going to be an issue (based on the sizing we've already made).

Not really an useful  idea to keep them separate. Splitting FW and VPN rarely actually helps. The only possible scenario when this would be good for something would be a successful DoS attack that would affect your VPN. But if a DoS happens vs the firewall, the fact that the VPN device is working would not be of much help.

Now on the other way, if you have for example 2 ASAs in redundant mode, they support VPN so you have everything from 1 vendor + redundancy.

It is very easy to properly control access from the same device: practically, in your firewall you will also be able to configure what the VPN IPs can actually access. This can be a great advantage as it simplifies management and offers better security compared to having separate devices.


Secure AWS instance metadata against potential SSRF I am running a Windows instance on AWS.

The instance has an IIS service running on it.

The IIS service has a user associated to it and it has no need to access the AWS instance metadata.

I was reading up on
https://aws.amazon.com/answers/security/aws-securing-windows-instances/

  Centrally manage Windows Firewall settings with Group Policy Objects
  (GPO) to further enhance network controls. Customers often use the
  Windows Firewall for further visibility into network traffic and to
  complement security group filters, creating advanced rules to block
  specific applications from accessing the network or to filter traffic
  from a subset IP addresses. For example, the Windows Firewall can
  limit access to the EC2 metadata service IP address to specific
  whitelisted users or applications. Alternatively, a public-facing
  service might use security groups to restrict traffic to specific
  ports and the Windows Firewall to maintain a blacklist of explicitly
  blocked IP addresses.

The part in Bold got me curious in scenario where SSRF is used.

Can you restrict access to the AWS metadata just for the IIS service or the service user
without impacting the service availability?
How would the configuration look like?

Indeed, if you want to restrict access to the instance metadata service -- so that only a specific list of users can query it, you need to have an OS-level control instead of a network-level control.

The reason is simple, users are an OS concept, and packets from different users on a OS reaching out to the instance metadata service would look indistinguishable from each other at the network level.

This documentation from AWS, specify an identical use-case as yours, where they limit access to the instance metadata only to the root user (using PF on BSD).
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide//instancedata-data-retrieval.html#w328aac17c17c25c15c19b1

I'm no expert, but I guess Windows Firewall will perform the same functionality -- where network traffic to the Instance Metadata IP can be denied to your IIS user. You couldn't do this with security groups or NACLs, simply because you'll block the entire meta-data service from all users (including all your agents on the server).


What are some attacks to consider in a cloud deployment? I want to discuss the following scenario:

I use a cloud provider like Amazon where every instance of the OS is a VM. The hypervisor launches the VMs as needed. So let's assume there are two VMs running, mine and attacker's on the same box at the same time.

Scenario 1: The attacker has root access to his VM. But does not have physical access to the box. What attack vectors do I worry about?

Obviously any vulnerabilities in my VM (OS and services it provides).
  Let's assume this is out of scope for this discussion
Vulnerabilities in the hypervisor that lets the attacker intercept all data to and from my VM.
  Are there known vulnerabilities like this?
Any other scenarios like DMA attacks?

Scenario 2: The attacker has physical access to the box. He manages the box and is able to install custom hardware or use the peripherals like USB, HDMI etc?

I know that one can introspect the VM he wants to attack directly as software-based attacks are easier. Let's assume it's out of scope.

I'm not aware of any AWS hypervisor bypasses to date, then again I don't use AWS. Here's an article (admittedly from 2014) talking about the concerns you raise.

https://www.zdnet.com/article/hypervisors-the-clouds-potential-security-achilles-heel/

While the hypervisor doesn't seem like a likely attack vector, there's lots of ways AWS setuos can come under attack here's a pretty good list as well as a real world scenario of AWS vulnerabilities

https://rhinosecuritylabs.com/cloud-security/aws-security-vulnerabilities-perspective/

If an attacker has physical access to the system, it's safe to assume in all but the rarest if cases they can compromise the system in a potentially undetectable way.


Licensing/selling digital certificate to another company I recently stopped distributing my software, so I no longer use the digital certificate (AKA digital signature) I created for it.

A couple of days ago, a large software company offered to buy the digital certificate and use it to sign their products (I don't know what for, probably AV issues).
The thing is, my company is still officially operating (I still got some ongoing passive incomes from side projects) and I need to keep the company alive for at least a year.

I have a couple of questions regarding that:

What are the legal aspects of licensing/selling the digital certificate to be used by a 3rd party company?
What are the practical problems that might come up? (I can't think of anything at the moment)
At what price would you sell/license a digital certificate?

Thanks

NOTE: If this is not the right place to post, please leave a comment where I should ask this question and I'll erase it from here, please don't down vote.

Signing software with the cert means that you are certifying that you stand behind the software. This would no longer be true if you sold the cert to someone to use with their software. Therefore: don't do it unless they are buying your entire corporation.

Depending on your contract with the CA (Certificate Authority), there may also be contractual reasons why you shouldn't do it. But the primary reason is that selling the cert is the same as selling your reputation as a software developer. Why would you possibly want to do that?


Possible Phishing Attempt? I use an iPhone. Today I got a text from an unknown number starting from +65. The message was "your one-time Wifi password is xxxx and it’s valid for only 10 minutes". Thought it was a scam and deleted the text.

After an hour or so, my Wifi on my phone got disconnected followed by a pop up saying that password for Wifi is incorrect and asking for the password. I ignored it and immediately turned off Wifi on my phone. Then I used my laptop to login to my modem and changed the Wifi password, and then the phone got connected to Wifi again using the new password.

I’ve been checking my bank accounts and no suspicious activity so far (I’ve enabled Touch ID for banking apps) but I’m just thinking how my phone was disconnected from the Wifi and asking for the new password, when clearly the Wifi password hadn’t been changed (my laptop was able to connect to Wifi with the old password).

Did someone actually hack into my phone and changed the Wifi password and expected me to enter the password sent in the text?

Any advice would be appreciated as I’m concerned about my bank accounts now.

The guy was trying to get access to your WiFi.
He deauthenticated your device and sent you a phishing page asking you to login again. That's common thing... Keep your Wi-Fi mac filtered or hide your ssid


What are the major vulns that affect the Dalvik VM of Android? I frequently hear about the security risks of using Android. But few people who write articles on this subject ever identify what parts of Android are at fault, nor do they identify design flaws. Can someone please point me to any sober and level headed explanation of what is ultimately wrong with Android security at the lowest level e.g. Dalvik and libraries and the kernel? Thanks.

The majority of the time that you read or hear about android malware it is in reference to a legitimate android app (apk) that does not actually exploit the android OS. Instead the malware behaves in a malicious fashion. One example is a fake security application which would subscribe the victim to premium text messaging services.

Many other times you will find a cracked app that just has additional ad services placed in it. Cracked apps are typically premium apps that were pirated. These apps are often published on third party stores and not in Google Play.

There is some malware that does use a known exploit. One example is a recompiled version of Angry Birds that received instructions from a Command and Control server. This sample used the GingerBreak exploit. Note that GingerBreak is/was used intentionally by users that wanted to 'root' or unlock their phones.

For a list of known android security bugs see this list of CVEs.

Android malware is a mix of apps that utilize OS exploits and apps that use all legitimate API calls just in a malicious way. If you want to avoid them pay close attention to the permissions of the apps that you install, think about getting a (reputable) antivirus from Google Play and avoid third party app stores with pirated apps. Finally in newer versions of android select "Verify Apps" in the security settings. This will act as a basic anti virus.


What is the real function and use of a DMZ on a network? I read the article on Wikipedia describing what a DMZ (demilitarized zone) is on a network, but am still failing to grasp both how it is set up (ie: is it within the main network or sequestered away?) and what its benefits and uses are. Can anyone explain to me why I'd like to have a DMZ on my network, given the following setup:

I have around 10 client computer devices on the network, some of which host SSH.
I have a single server which hosts SSH, HTTP, and a few other publicly accessible services.

For this given use-case, how would I plug in a DMZ, and what would be the benefits?

Reasons why you want a DMZ and the benefits it offers.
The general idea is that you put your public faced servers in the "DMZ network" so that you can separate them from your private, trusted network.
The use case is that because your server has a public face, it can be remotely rooted. If that happens, and a malicious party gains access to your server, he should be isolated in the DMZ network and not have direct access to the private hosts (or to a database server for example that would be inside the private network and not on the DMZ).

How to do it:
There are several ways, but the 'book example' is by utilizing two firewalls (of course you can achieve the same result with one firewall and smart configuration, although hardware isolation is nicer). Your main firewall is between internet and the server and the second firewall between the server and the private network. On this second firewall, all access from the server to the private network ideally would be forbiden (of course it would be a statefull firewall so if you initiate a connection from the private network to the server it would work).

So, this is a fairly high level overview of DMZ. If you want more technical details please edit your question accordingly.


What are `dd` input blocks? I'm looking for a semi-technical explanation of "input blocks". When creating encrypted containers we use dd with "count=n", but I'm not sure of the difference between "count=0" and "count=1". The dd manpage simply states:

   count=N
          copy only N input blocks

What are input blocks?

The block size that dd will process count of is determined by the bs (ibs, obs) argument to dd:

bs=BYTES
      read and write up to BYTES bytes at a time (default: 512);
      overrides ibs and obs

That's per this new the man page; back when I learned on SunOS 4 it was more clear that "bs" stood for "block size":

bs=n
   Sets both input and output block sizes to n bytes, superseding ibs= and obs=. If
   no conversion other than sync,noerror , and notrunc is specified, each input
   block is copied to the output as a single block without aggregating short blocks.

And as you can see in this answer early versions of Unix used a 512 byte "block", or unit of allocation, in filesystems.  That's why the current default for dd bs is still 512 bytes!

You can also specify other size units; for example, bs=5M to have a block size of 5 Megabytes:

N and BYTES may be followed by the following multiplicative suffixes:
c =1, w =2, b =512, kB =1000, K =1024, MB =1000*1000, M =1024*1024,
xM =M, GB =1000*1000*1000, G =1024*1024*1024, and so on for T, P, E,
Z, Y.

In your case, no matter what the bs is set to, if you choose count=0 you won't write anything!  If you leave bs unset and choose count=1, you'll write 512 bytes.

This strict control over "block size" makes much more sense when you're dealing with tapes or other sequential, limited devices.  If you write 128k blocks of data to a tape drive with 64k block size, you just lost half your data!  Writing to a file(system), unlike an actual device, is far more forgiving about allocating space for whatever you want to give it.


Is cacert.org more harmful than self-signing? I don't understand the https security model attempted upon me by The OpenBSD Journal (undeadly.org).

Instead of using self-signed certificates for https like they did in the past, they for a while have had 6-month certificates signed by Root CA, which they do appear to change at least somewhat promptly.  I guess that cacert.org has some kind of a 6-month limit on certificates?

As an undeadly.org user, am I supposed to blindly accept a new cert every 6 months?

Import CA Cert Signing Authority Root CA from http://www.cacert.org into my browser?

Ask the admins to go self-signed route instead, making a cert for maybe 2 to 10 years, which I'd only have to accept once?

P.S. It looks like cacert.org used to be included in OpenBSD's cert.pem and ports/security/nss at one point, but was henceforth removed on 2014/04/09 and 2014/04/29, respectively, following a redistribution licence incompatibility review.

The PKI model works on the trust you can give to the initial third party. Namely, the root CA. If you trust the root CA, you should import their root certificate, so that any certificate they issue (sign) will be automatically accepted by your system.

If you do not trust the CA, well there is nothing more you can do. So why would you trust CAcert.org ? Well, you can take a look at their Web of Trust system, where you can get assurance about certificates (I won't go in details here). Another question is: why would you trust the other root certificates already on your machine more than cacert?

Then to the question of is it more reliable than a self-signed one? Well, you could argue that the process involves at least two people, the CA and the website. Unless they are accomplice, it's usually better than self-signed only. Of course, all is based on the trust you can grant the CA.


How can I block access to module for Firefox? (gmail accessing camera) I run the following command in the background constantly to check for camera access on Ubuntu Linux:

lsmod | grep ^uvcvideo

I noticed that every time I load into gmail my check is triggering my kernel's camera module. I assume this is just to test it, but I can't be sure. I want to block firefox (or any application of my choosing) from accessing the uvcvideo module.

To clarify what my command returns normally:

uvcvideo               86016  0

and what happens when I load into gmail:

uvcvideo               86016  1

I think it's just google hangouts asking firefox if I have a camera. Firefox then check if I have one. It happens in any browser.

How can I block a browser/application from using uvcvideo?

Here is a link to the source code for the tool I detected this with:

https://github.com/UniWrighte/Safe_Space

Firefox solution:

You can disable permissions for cameras by going to options -> privacy & security (or type about:preferences#privacy into the URL bar) and look under the permissions header. There you can disable for all website by default and whitelist etc.

Linux solution:

Disable the uvcvideo module by modprobe -r uvcvideo. This will disable until next bootup. If you want this to be disabled permanently you will have to add blacklist uvcvideo into the /etc/modprobe.d/blacklist.conf file.

I should also mention that using lsmod only shows if the module is open (doesn't necessarily mean it is capturing) at that point in time and you might not be able to detect cases where the camera opens, takes a picture and then closes over a short period of time.

Finer control:

If you need to sandbox just firefox then you'll probably need to look for a sandbox program or setup a virtual machine or some sort to run it in. I won't go into more detail here as I'm not that familiar with good choices.


Is there external service which can detect ransomware? I am thinking about ways of protecting against ransomware other than backing up all data. So i thought is there such service which could scan trough emails and find does email contains links or other ways to be infecter by ransomware?

Many mail providers scan by default for mails containing malicious code or links. Also browsers use blacklists like Google Safebrowsing to protect the user. And many enterprise firewalls try to protect their users as do local antivirus products. But, none of this is fully reliable so you should still use backups as an additional protection. Apart from that these backups also protect against hardware malfunctions (dead hard disk) or accidental data loss (i.e. delete the wrong file) so you should have such backups anyway.


how to separate arguments in sql query I have this query :

'UNION ALL SELECT group_concat(username,password) from users--

and I want to separate username and password because when I execute the code it prints it all in one long string.
I tried to separate them with : encoded:

'UNION ALL SELECT group_concat(username,0x3a,password) from users--

group_concat is the wrong function. Try this:

'UNION ALL SELECT CONCAT_WS(0x3a,username,password) FROM users--

(note also the order of the arguments. If you want more columns, you can just append them: CONCAT_WS(0x3a,username,password, moreColumns, canBeHere)).

This works for MySQL and PostgreSQL. SQL Server doesn't have CONCAT_WS, but it does have CONCAT (without separator) or you can manually concat: username + ':' + password. Oracle also does not have CONCAT_WS, but this should work: username || ':' || password. This is also how it would be done with SQLite, which also does not have CONCAT_WS.


Need a test vector for the putty ssh-2 file mac validation I'm trying to implement the putty file format in one of my dart packages. Implementing the actual key loading was ok, but I'm struggeling with the mac validation. I'm not shure what I'm doing wrong here
The putty code is quite clear about how to check it, but something is still wrong here. The putty code generates the validating mac like this:
hash = ssh_hash_new(&ssh_sha1);
put_data(hash, header, sizeof(header)-1);
if (cipher && passphrase)
put_data(hash, passphrase, passlen);
ssh_hash_final(hash, mackey);

mac = ssh2_mac_new(&ssh_hmac_sha1, NULL);
ssh2_mac_setkey(mac, make_ptrlen(mackey, 20));
ssh2_mac_start(mac);
put_data(mac, macdata->s, macdata->len);
ssh2_mac_genresult(mac, binary);
ssh2_mac_free(mac);

my dart code does it like this:
var sha1Hash = SHA1Digest()
               ..update(Uint8List.fromList("putty-private-key-file-mac-key".codeUnits), 0, "putty-private-key-file-mac-key".codeUnits.length);
if (password != null) {
    sha1Hash.update(Uint8List.fromList(password.codeUnits), 0, password.codeUnits.length);
}
var key = Uint8List(20);
sha1Hash.doFinal(key, 0);

var macResult = Uint8List(20);
var mac = HMac(SHA1Digest(), 64);
mac.init(KeyParameter(key));
mac.update(Uint8List.fromList(macData.codeUnits), 0, macData.codeUnits.length);
mac.doFinal(macResult, 0);

I'm pretty sure that the first part of creating the key for the mac is correct, because the same code is used to decrypt the private key and it works as expected. I'm not sure about the second part of creating the actual MAC.
Maybe my algorithm is right an I'm doing something else wrong? To check that in depth it would be nice if someone could provide me with a testvector containing:

ppkFileContent
password
macData
key


Alternatives for DNS resolution I was told it's a good idea not to use your ISP to resolve DNS, both for privacy issues and because it can be slow. So I wanted to change, but I've read criticism on using OpenDNS (who makes money on your mistyped domains) or Google (privacy).

So I wonder: are there better alternatives? Something with less privacy concerns, maybe a non-profit?

Some thoughts:

OpenDNS do not make any money from you if you mistype, in fact all that happens is you get sent to an OpenDNS search page. If they get advertising fees from organisations, who cares?
Many DNS providers do this, not just OpenDNS
I moved to OpenDNS 18 months or so ago and thus far they have been much more stable than my ISP, response is fast, and it just works