tl;dr: It all comes down to how good the users are at keeping their mails safe. But that are post cards rather than letters. Do not exclusively offer that option. Also, seems like an xy problem.
Here are some things to be considered about this:

You said

User is emailed an alpha numeric code (lets say 8 digits long and valid for 1 hour).

Let's rather say 20 bytes, valid for 10 minutes. Brute force of an 8 digit password is absolutely feasible.
This can be passed to the application/web app via a get request from a link in the email to make the life of the user easier.
That's what Slack is doing with it's "magic link" feature, by the way.

You listed as a negative

An email address is required. If you lose access to it you lose access to your account.

and

If you forget your email address you lose access to your account.

This is usually the case, at least with password resets.

You may still use session cookies in the web app to keep the user logged in longer - same as storing that token in a mobile application.
Hence this problem

It's inconvenient to check your email each time you log in.

is gone.

You list as a positive

Much of the security burden is shifted to the email provider.

while in fact a lot of the security burden is shifted to the user, too.
How sure are you that your users only check their mails through secure connections, without chances of eavesdropping? (Think: Open WiFi, regular POP on mobile. Happens every day.)
This makes the user's mail box a single point of failure.
Additionally, while have I been pwned is known by most IT-affine people, there are a lot of people out there that do not know their email is already breached because of password reuse.
Yet, the last point is also true for password reset emails - only do they occurr less often and usually trigger additional security measures.

For whatever reason you are trying to use mails and short lived passwords, there are better ways - for example UBS security tokens that do add a "somethis only you have" part to the equation, not removing a "something only you know" part.
I'd also advise you to think about if this might be an instance of a xy problem and ask a new question with the actual problem you are trying to solve.

Update for the modified question:
If the passwords are hashed correctly, there is nothing wrong with storing them in your database.
Yet, if we accept as a UX decission to have the user not have passwords, using email and requesting the users GPG key and/or S/MIME certificate and sending out short-lived password links to the user using mail on request would be fine.


SNI (Server Name Indication) is a TLS (Transport Layer Security) extension in which the client presents the server the domain name for the target it wants to access within the TLS handshake. It is used in cases where there are multiple virtual servers with different certificates on the same IP address, so that the server can present the correct certificate.

Insofar it is similar to the HTTP host header in the HTTP request, which is used to select the matching virtual host configuration - only the Host header cannot be used to select the certificate since it is sent inside the HTTP request. (i.e. after the TLS handshake is already done).

Since the SNI TLS extension is optional, some clients may not send this extension. This is the case with openssl s_client without the -servername argument, but also with many TLS libraries in different programming languages. And while all modern browsers use SNI, older browsers like IE8 on XP do not use it.

If such a client connects to a server which has multiple certificates, the server does not know which certificate the client actually needs, i.e. the client falls into the "SNI hole" by not using the SNI extension. In this case the server usually either sends an error back (or sometimes just closes the connection) or uses a default certificate explicitly or implicitly configured for this purpose.


Are encrypted Cookies vulnerable to Padding Oracle Attacks

Is it necessary to sign or will a modified encrypted string fail to
  decrypt?

In the cryptography world a modified message is called a tampered message. Encryption by itself does not provide protection against tampering, but block ciphers are not used alone. Block ciphers are used in different modes, f.e. ECB, CBC, CTR, GCM, etc. Different modes have different properties, some of them provide protection against tampering (a.k.a. Authenticated Encryption, f.e. GCM) and others not.

If you're using an Authenticated Encryption mode a tampered message will fail to decrypt. But, if you're using others modes like CBC or CTR (These are the most widespread in my experience) a tampered message will happily decrypt unless there is a padding error

  If it doesn't result in valid json which can be parsed into a session
  it will be empty in the same way that it would with an invalid
  signature.

This will depend on how your application handles an invalid json, and here is where a padding oracle may appear.

  My understanding is that padding oracle attacks work by getting
  feedback from the server. Would an encrypted empty json string be
  enough?

A padding oracle attack occurs when the attacker sends a tampered message and is able to distinguish if the padding is correct or is not. And this is why I said previously that how your application handles an invalid JSON may derive into a padding oracle

Imagine that an attacker sends a tampered message with a wrong padding, your application will try to decrypt the message but a wrong padding exception will throw. After that the attacker tampers the message again but this time he's able to forge a correct padding, your application will decrypt correctly the message but the content will be and invalid JSON, the application will attempt to parse the invalid JSON and throw an error as it can't be parsed

If the attacker is able to distinguish both scenarios cause the HTTP status returned is different, or a stacktrace shows the different error messages, or just by timing the response time. Then the attacker has a padding oracle and can recover the plaintext from the cookie

To prevent this you should always provide same error message when the message can't be decrypted and when the message decrypts but the content is invalid. Furthermore you should ensure that both scenarios require the same time to respond.

IMO the best approach would be to use an authenticated encryption mode that gives you encryption and signing together and let the encryption framework/library handle it

BTW, I mentioned an encryption mode that should never be used. It's ECB, if you're using this mode (Some libraries default to it) please change it as it's a weak mode


Does python's pip provide cryptographic authentication and integrity validation?

The short answer is: pip always uses TLS, which is actually fairly useful here. It means that as long as no-one's managed to compromise PyPI itself or steal the site certificate, then you can be certain that the packages you download are the ones that the PyPI admins think are correct. And it's hard to do better than that: after all, the PyPI admins are the only ones who know which users are allowed to upload which packages, so you kind of have to trust them.

As match mentions, there also used to be a way to upload PGP signatures for packages. However, that's been removed, since it was basically just security theater – complicated and makes it feel like you're being secure, but doesn't actually improve security. One of PyPI's main admins has an old post about this: https://caremad.io/posts/2013/07/packaging-signing-not-holy-grail/

What would be better is to use a framework like TUF that can provide guarantees like: "the person who uploaded this was trusted by the PyPI admins at the time of upload, and if PyPI is compromised afterwards then the attacker can't go back and change anything that happened before the compromise". TUF is roughly similar to the package signing used by linux distributions, but a bit more powerful. The PyPI maintainers got a grant to implement this and work is in progress now: https://wiki.python.org/psf/PackagingWG#Warehouse:_Facebook_gift

One challenge is that to bootstrap a cryptographic system like this, you need a key signing ceremony, which was going to take place in-person at PyCon this year... but, well. Please be patient :-)

In the mean time, you can get a similar effect locally by putting package hashes into your requirements.txt: this guarantees that if an attacker somehow sneaks in a fake package after you ran this command, it will be rejected. Or some dependency management tools like pipenv or poetry will do this for you automatically.


Root CA certificates are not trusted by the device simply by "browsing".

All browsers have a defined pre-trusted list of Root CA certificates (which is a poor security decision in my opinion). This list changes (certificates are added & removed) whenever the browser vendor wants to.

Chrome uses the OS local keystore as it's pre-trusted list of Root CA certificates, Firefox manages it's own list that differs from the OS.

You should either use a well known CA to sign the app's server certificate, or manage to import the app's Root CA Certificate in the keystore of all devices.

Install Certificate - Using Chrome on Windows

Install Certificate - Using Firefox on Windows

The answer to "Do you need the internet to verify a TLS Cert?" is: It depends. Most devices (Macs, Windows, smartphones) have a keystore with pre-trusted Root CA certificates.


Any "cleaned" virus that's been successfully re-released?

"Re-releases" happen by accident all the time, when an infected, mothballed system gets re-activated, or old, infected media gets pulled out of archive.  Case in point, my webserver has a log entry for a Code Red infection attempt in 2013, twelve years after the worm was originally released.

Because of this, antivirus software does not normally remove things from their virus lists.  I would not be surprised to find signatures for the Morris worm or Elk Cloner in modern antivirus software.


Is it safe to run online, multi-person game as administrator on Windows 10?

From the perspective of IT security there is no "being safe" or "being secure" 1.  There is only being more or less secure and the idea of being sufficiently secure by having most relevant risks mitigated. Deciding if a specific software is sufficiently secure would require a deep evaluation not only of the specific software but also of the environment where the software is run in, i.e. what impact problems can have. Such a deep evaluation is out of the scope of this site.
But what can be said is that running a software as administrator provides additional and powerful attack vectors compared to running as an unprivileged user. The impact of these new attack vectors can be small and the risks acceptable if the system does not contain any sensitive data and is not used for sensitive activity like online banking. Given the right environment it can be very dangerous though, for example when being inside the network of a nuclear power station.
It can also be said that already running a potential malicious or buggy software as a non-privileged user poses considerable risks. Many malicious actions like extorting the user by encrypted the users files (ransomware), spying on the user or impersonating the user do not actually require administrative privileges in the first place.

1 In the context of IT security the term security is typically used to describe harm against IT systems, compromise of information etc. Safety instead is used to describe more direct harm against humans, like when hacking a car and disabling the brakes.


Ethical question regarding accessible sensitive data at school

Although your intentions are good, schools and colleges are notorious for being heavy-handed with this kind of thing. They may well want to kick you out for (a) violating school policy and (b) making them look like idiots.

My advice would be to detail the problems you found in an anonymous letter, explain very clearly that you're not trying to be malicious or attack the network, and you just want them to know about the issue so that they can fix it. Explain that you're writing anonymously because your education is valuable to you, and you're worried about the number of cases where schools take things the wrong way, and you'd prefer not to become part of that statistic. Drop the letter in a mailbox, addressed to the head of school, at the school address.

Usual opsec applies here: don't tell anyone what you're doing, don't brag about it to your friends, don't include any details that might identify you (e.g. your year or any subject you study), and don't write the letter by hand (print it out!).


VPN to protect traffic from one server to a remote site

The idea of a VPN is that traffic between two endpoints is securely encrypted and that the endpoints are configured to know about each other, thus expanding the private network over the inherently untrusted Internet.

Secure encryption is not particularly special and no particular method is required to make a VPN.  The assumption is that data in the wild-west Internet is unbreakable.  This is true with other secure protocols like SSL and SSH, etc.

The VPN is special and convenient because it extends your private network resources and address space via an internet connection.  A client-server VPN (e.g. connection to a company network from home computer) puts the client (home computer) on the network as though it was plugged into the network directly.  A peer-to-peer VPN such as you describe makes the network at one end equally accessible to those at the other end.

Typically, a VPN endpoint is a feature of, or linked to the firewall and router.  Traffic is efficient because unlike one-time connections, it's persistent, so the security handshake and key exchange happens infrequently.  (Compare this to an SSL connection between a browser and website).

If your VPN is to a customer (as opposed, for example to another office of your company) each side will decide what traffic is allowed and how much access A has to B's resources, and B has to A's.  These become standard firewall rules -- the same that may isolate one subnet of your network from another.  The nice thing about the VPN is that once established, who has access to what can be changed independently of the VPN connection itself.

I think your scenario is a peer-to-peer VPN setup.  There are standard protocols that allow VPN Brand A to talk to VPN Brand B, and there's some good free VPN software out there (OpenVPN).  Cisco, Checkpoint and others make devices and software that will work in most configurations and may be easier to manage than setting up a server to run OpenVPN or other software-based VPN.


How do I secure my advertisement space against ad overlay browser attachments?

You can detect client-side modifications to your content by using javascript.

A very simple solution is to load a "base" page without useful content, but which contains your basic page layout, your ad, and some detection code. Once the base page is loaded, yout detection code checks to make sure that your ad is visible and displaying the expected content. Once that verification is complete, your client-side code fetches the "main" content via AJAX and inserts it into the page.

Obviously this is sub-optimal on so many different levels that I won't even go in to it, and obviously it can be circumvented by a determined attacker. But if your priority is ad traffic, and your a small enough target that you're not likely to attract the attention of someone who can circumvent your measures, then solutions (albeit less-than-perfect ones) exist.


Two factor authentication for web application under PCI DSS

What does the web application do?  Ask the following questions:

Does it "store, process, or transmit cardholder data"?
Is it on the same network as a server that does?
Can it connect to database(s) which store cardholder data for other applications?
If compromised, would it "impact the security of the CDE"?

If so, it's in your CDE "in scope" for your DSS assessment and is subject to 8.2.  If not, then not.

You're supposed to determine what's in and out of scope every year:

  the assessed entity should confirm the accuracy of their PCI DSS scope
  by identifying all locations and flows of cardholder data and ensuring
  they are included in the PCI DSS scope.

and

  The entity retains documentation that shows how PCI DSS scope was
  determined. The documentation is retained for assessor review and/or
  for reference during the next annual PCI DSS scope confirmation
  activity.

So, measure your web application server against the discussion on pages 10 and 11 of the PCI DSS 3.0.  If you don't think it's in scope, you aren't required to have 2FA under DSS 3.0 8.2.  Keep a record of you scope-determination for the audit, should you happen to qualify for one.

As to the implementation, I have seen other methods used for 2FA than those you mention; IP whitelisting and adaptive authentication specifically.  If you can convince your auditor it qualifies, you're all set.


You're missing a lot.

The space of things to generate hashes for is infinite, what you listed is the space of hashed values.  They are two very different things.
Even generating the list of hashes for the space you noted in your post would be extremely time consuming.  "All you'd have to do ..." doesn't come close to doing it justice.  It's sort of like saying "If you want to find a missing person, just go around the world until you find them."

In any case, getting back to your main question: Why are hash collisions a big deal?  Because many crypto related things depend on there not being collisions, at least not that can be readily found.  For example, digital signatures hash a document and then encrypt the hash.  If you can generate hash collisions you can make it appear that someone digitally signed a document that they did not in fact sign.  That's bad, very bad.

The irony is that hash collisions are inevitable, as a hash maps an infinite space to a finite space.  In fact, there must be an infinite number of collisions.  But being able to generate collisions is scary from a crypto perspective.


Two possibilities, with a few Ifs.

Possibility #1:

Take a look at the created timestamps on the malicious files (assuming they're separate files); or last-modified timestamps (if malware was injected into one of your files).

If you have access to your web server access logs (depending on your hosting plan and service provider, the location, name and method of getting them would be different); and

If you have those logs for the time-range when those files were created/modified; then

Search through those logs for PUT or POST messages targeting those files.

Since you already mentioned webalyzer - you probably did some form this already. Hopefully the narrowing down that I mentioned might help; or use of another tool (even a manual search through the logs) might identify what is being missed.

Possibility #2:

Some wordpress security plugins (not all) do create separate logs that you can dig into. I know that Sucuri's service does this; and probably WordFence too. I have a product that does this (ActiFend) too, though the logs are stored on our servers.

If you were using any such plugin -or- any other remote logging solution, either you or any security analyst would be able to dig through them to get some idea of the IP address (that is not the same as who did it, but it is still something).

For the future: Being prepared is the key. If you accept that you will be hacked at some time or the other, then you'd setup both remote monitoring and recovery.


How to add a malicious file scanner to live server?

A little bit of googling(after on access scan clamav) came up with Clamuko, it seems to let you enable on access scanning of files.

The question that remains is if clamav would have caught the threat. Another option could be to look into Sophos' Linux scanner, it can also be configured for on-access scanning

Quick little sysadmin edit: I wouldn't suggest having on-access scanning on a busy site since on-access scanning will block the io operation. Regular full system scans where you email the result to yourself(and any other admins) and read them


What type of malware can see my browsing activity?

Any application which can access your browser data can see your browsing history - the requirements for that depend on what browser you are using, and how you use your computer (if your day to day user is an administrator or not, for example). That may in turn reveal things you've searched for or Facebook activity through the presence of cache data or similar.

There are also programs which may be considered legitimate by tools like Malwarebytes, but which may be able to observe actions in this way. For example, if you use any VPN software to connect to a business network, or browser addins with all-site permissions, they can also see the activity, but may not be flagged as malicious since they need to be able to see the activity in order to work.


Locking access to remote DB from a freely downloadable app (that acces the DB)

From a security standpoint you should limit the attack surface you are exposing.
As with most security features you should use defense in depth and have several security features in place like:

A web based API (like REST with JSON), being server over a TLS connection.
Limit allows values to a small set. (highscore is only numbers between 0 and 999999 for example)
Use Client side Certificates to limit abuse through simple means. (A determent attacker still can of course)
Use nonce in your API to prevent replay attacks.

There are propably more out there but this should give you an idea.


Writing exploit code that bypasses IPS detection

It depends.  An IDS might detect the vulnerability, or it might not, depending upon whether it has the ability to detect exploitation of the vulnerability itself independent of the exploit payload.

In general, IDS systems can try to detect attacks either by trying to recognize the payload of an attack ("exploit code"), or by trying to recognize the exploitation of the vulnerability (the vector itself).  If you modify the payload, then you might avoid detection by the former style of signature, but not the latter.

You asked us to assume IDSs work by detecting only the former, but this is not an accurate representation of how IDSs actually work in real life.  In other words, you asked to make an assumption that is not actually accurate.

You might want to read about IDS evasion attacks.  See, e.g., the classic research papers:

Insertion, Evasion, and Denial of Service: Eluding Network Intrusion Detection, Ptacek and Newsham, 1998.
Bro: A System for Detecting Network Intruders in Real-Time, Paxson.  Computer Networks 31(23-24).  Originally published in Usenix Security 1998.  See especially Section 5.3.
Network Intrusion Detection: Evasion, Traffic Normalization, and End-to-End Protocol Semantics, Handley, Kreibich, and Paxson.  Usenix Security 2001.

Finally, in general, please remember that no IDS ever guarantees to detect all attacks.  They detect some attacks, but not all.  They are far from a perfect defense.  As always, if you have the option to fix the vulnerability itself, that is a more reliable defense than relying upon an IDS to detect exploitation of the vulnerability.

These comments all apply to IPS systems as well (thanks to @Everett for pointing this out).


You probably are well-aware that the providers can access the emails.

The 2 providers may or may not transfer emails between them over an encrypted channel. Some providers have agreements with others to only exchange emails between them over an encrypted channel.

About 50% to 60% of the emails Google exchanged with different providers in 2014 were encrypted, the other 40% to 50% weren't. (Source.)

An unencrypted email transported in plain text between email providers can be read by anyone who sits between their servers. Especially by secret services which have access to internet exchange points.

But against secret services, securing anything via HTTPS is flawed anyways. They can easily create certificates you trust and can easily read or manipulate your HTTPS traffic. Even antivirus companies can compromise HTTPS traffic and in fact do this all the time which I got a lot of downvotes for claiming it here until providing proof. So really, your 6th assumption is wrong. And this means your 3rd assumption is worthless.

We can kick out the 5th assumption, too, because either party is probably using a Windows or Mac OSX computer which have universal backdoors and are already compromised before they are shipped to you. If either party has an antivirus software installed ... well, I think I already discussed who can read then, too, in the previous paragraph.

Countries which don't feel like their secret services are powerful enough – like Germany – simply create a law which states that (in the case of Germany) email providers with at least 1 k email accounts and companies which don't provide email to others but only to themselves with at least 10 k email accounts have to buy hardware which delivers inbound as well as outbound email traffic to authorities. In the case of Germany, these emails are automatically checked and each year dozens of millions of emails are found suspicious and are directed to a human to read.


Locking IP addresses to try and improve security

Locking down access to a site is, in a lot of cases, a good defence-in-depth measure.  It shouldn't replace things like user authentication and good password policies but it can be a useful add-on.

In terms of it causing problems, you're right if the companies IP addresses change they it would cause an issue, however most companies will have static IP addresses assigned to them (tends to be a feature of business-grade Internet Access packages)

In terms of stopping that happening, I'd recommend speaking to your network manager and/or ISP to make sure that you're notified ahead of times if they are going to change the IP address. if it's integrated into the change management process, hopefully the chance of disruption would be minimal.


How to configure VPN + Tor + linux as a proxy server?

There is a much easier solution. One can use a tool like Proxifier to set up a proxy chain.

Add Tor as a proxy into the chain
Then add any other proxy

To hide Tor from your ISP, use VPN or add another proxy in front of the Tor proxy in the proxy chain.


How to extract data from hackyourself legal site with table and column information?

http://hackyourselffirst.troyhunt.com/CarsByCylinders?Cylinders=V12' AND 1=(select top 1 password from UserProfile where UserId=(select top 1 UserId from(select top 1 UserId from userprofile order by UserId) sq order by UserId DESC))--
http://hackyourselffirst.troyhunt.com/CarsByCylinders?Cylinders=V12' AND 1=(select top 1 Email from UserProfile where UserId=(select top 1 UserId from(select top 1 UserId from userprofile order by UserId) sq order by UserId DESC))--

I found the solution. Now I KNOW what error-based SQL Injection really is.


Storing password in sqlite vs asking user to type it in every time

There's quite a bit to unpack with this question, and I will do my best to answer the question noting that I am not an Android developer.

For starters, the essence of Two Factor Authentication in the traditional form, is something you have and something you know. If you allow storage of a password in the device you are more-or-less mitigating any security benefit you would have by implementing 2FA as simply possessing the device could lead to compromise. With that said, in my opinion, you should not provide the ability to store the password in the device.

  Password will be stored securely on a server(probably hash and salt)

If you want your application to be secure then you will definitely randomly salt and hash.

It may also be worth noting that NIST has recommended against using SMS for two-factor authentication. so perhaps you'd want to look into something like Google Authenticator.

I can't say whether or not SQLite databases can be dumped on un-rooted phones, but given the ubiquity of Android malware I would operate under the assumption that the phone could be compromised by the unintended installation of a malicious app.


How does bypassing HSTS with SSLSTRIP+ work exactly?

This is answered going off the available information you linked to.

  How exactly is the victim being redirected. Does the DNS packet
  contain some sort of redirect? Or is it something else that redirects
  the user to wwww.google.com?

When the user navigates to www.google.com, sslstrip acting as a MITM will redirect the user to wwww.google.com using HTTP. For example, via a Location HTTP response header:

Location: http://wwww.google.com/

  And another thing. Is this figure is still applicable to SSLSTRIP+

That image doesn't seem right for sslstrip or SSLstrip +. As it can't intercept actual HTTPS requests, the request from the client should not be using the HTTPS protocol for the request. It is more like

GET http://facebook.com  ----> sslstrip   ---> https://facebook.com

and it initially prevents HTTPS from the client by changing both links and redirects from HTTPS to HTTP that are returned in any HTTP responses.

  What exactly is being corrected here?

It appears that via the configuration of DNS2Proxy you can set how subdomains are resolved. So when www.google.com is redirected to wwww.google.com your *.google.com rule sets the resolved IP address which is returned. So in your config you set *.google.com to the A record for www.google.com.

Having said all this

My conclusion: It doesn't work.

If there is a HSTS rule on the browser already, the initial request to www.google.com will be over HTTPS anyway meaning that it can't be intercepted by sslstrip.

Additionally, if a site is in the HSTS preloaded list (like Google's domains will be in Chrome), it is required that includeSubdomains is specified. Therefore wwww.google.com will only be fetched over HTTPS too.


I do not see any evidence from the e-mail you posted that a viable scam could be operated from the message.  However, if you post full details maybe this will change.  But based on the screenshot, and the information provided I can't conclude there's malicious intent.

A check of the SPF records for email-2.microsoft.com shows:

v=spf1 include:customers.clickdimensions.com ~all

That means clickdimensions.com is known to handle the e-mail traffic out of Azure, and Microsoft themselves uses them.  However, the email was sent from email.clickdimensions.com instead of cusotmers.clickdimensions.com; which may explain why the message was marked as spam.    Alternatively it is possible someone else is using ClickDimensions CRM to try to masquerade as microsoft -- but the email lacks evidence saying that.

Because both the reply-to addresses and the from address are @microsoft.com, anyone operating a scam would have to work at Microsoft or have hacked someone with access to that address in order to receive replies.  Microsoft commonly uses group emails at microsoft.com for support so this seems pretty normal.

It makes sense that they would want VMs with no load on them, that they are giving you for free as part of MSDN, not to be left on because you logged in to play with it and never logged back to use the VM.  They probably have a lot of these "orphan" VMs and these e-mails may make it possible for them to reclaim a lot of CPU and Memory they're giving away for marketing reasons.

The question is: Are you an MSDN subscriber who has spun up an Azure instance? Is this e-mail completely out of left field or within your usage pattern?

If you do use Azure and MSDN, in the end this message is more likely than not legitimate, just poorly done by low-level likely outsourced support staff.


HTTP Public Key Pinning vs Certificate Transparency, which is better and why?

they won’t be able to use the app

If this is true, it means your application design is not good. One of solutions is that if you switch key you should also provide a new end point. For the transition phase you would support both end points, with the old and with the new keys.

When you switch they key, you would also release a new app version with the new key pinned. The old app will use the old end point and the old key. The new app version - new end point and new key.

After transition phase ended, you shut down the old end point. After this phase (1-3 months) only the users who refused to update the app will have problems. All other users will not even notice that you have switched the key.


How does ransomware get on people's computers?

According to the IBM X-Force Threat Intelligence Quarterly Report, fourth quarter 2015, the primary sources of ransomware attack are unpatched vulnerabilities, drive-by infections, and spear-phishing emails:

Source: IBM X-Force
How to prevent ransomware attacks
User education
Educate your users not to download files from unknown contacts. Usually ransomware is sent in emails claiming pending invoices with Word documents. When you open the document, ransomware will get installed and start doing its job.
Scanning and filtering mail servers
Scan your mail servers to stop phishing attempts reaching intended recipients.
Backup data regularly
Make sure to back up your critical data regularly and secure them. This will help you avoid paying the ransom, and reduce recovery time.
Vulnerability? Patch critical software and OS right away
Patch your critical software like your browser, browser plugins, email clients and operating systems right after you get a notification. Did you know that the Panama Papers leak (2.6 TB of data) happened because of vulnerable web servers and mail servers?
Look at the ransomware growth in the last three years:

Source: McAfee Labs, 2015.


Reinstalled Windows 8. Is the computer vulnerable during the wait for updates?

Short answer - yes it is.

Would I worry about it? No, not really. The chance of it being discovered and exploited within that timeframe is not very high.

However, if you're being targeted continuously or already have infected systems on your network, your chances just skyrocketed.


What do I need to be aware of to select a transfer method for digital forensic data?

When computers want to have fast access to hard disks, they use SATA. USB, Firewire... are fine for external disks, but given the choice (i.e. when we are talking about the disk which goes inside the computer), computers use SATA. Therefore, you want to use SATA.

So, for your analysis, you want to:

Copy the whole disk to inspect onto a new hard disk. Hard drive duplicators usually use SATA, so you will want to extract the source disk and plug it into the duplicator, along with the destination disk. Good mechanical hard drives top at about 100 to 150 MB/s, so for a 1 TB disk this will take at least two hours. SSD are faster, and make SATA even more important.
Plug the copy into the machine which will do the analysis (internal connection, SATA again).

I would recommend against booting the machine to analyze, even on a CDROM or USB key, because this entail fiddling with the BIOS settings, thus "polluting" the crime scene. Also, this would limit your options to USB, and USB-2.0 tops at 60 MB/s (theoretical limit, rarely achieved).

For even faster analysis, make the target disk an SSD (which will have to be big enough to accommodate a complete copy of the source disk, and large SSD are expensive -- but sooooo fast !).


The attacks you mention are real problems to threat model.

I like to think email is the master key to most online accounts. SMS is arguably better, but similar risk. They let you bypass the password to login. If I can access your email, then I can get into most of your accounts.

Sites that support MFA or 2factor should still ask for your second factor after a pw reset. If they don't then they are effectively only checking a single factor - that the user can access the associated email account.

If you have seen this, it's a vulnerability in the web app and you could report the vulnerable flow to the webmaster.


CA storing root key in a bank safe deposit box. Concern?

With the keys for a certificate authority, there needs to be a balance between confidentiality (they need to ensure that the keys aren't disclosed without authorisation) and availability (they need not to lose the key entirely otherwise they can't use it to sign certificates).

If they stored their key in an HSM with not way to extract it, then there's a real risk that the HSM would drop the key, and at that point they would be in a bit of a bind in terms of ever issuing more certificates.

From what I've seen of CA handling splitting the key up and then storing it in physically safe locations, is very common practice.


Parameterized queries are a good idea in almost every case.

All it takes is one mistake in the service which processes the uploaded file and you could have SQL injection issues.

Security is about defense in depth, meaning you use several layers of security in case there's a hole in another part of your system.  I would recommend following best practices for SQL queries.  In the end it's not strictly required, but it would present an unnecessary risk considering how little effort it takes to parameterize queries.

It can also improve code readability by eliminating the constant opening, closing, and appending of strings where it's easy to miss quotes for a string type parameter.


Can a Javascript - WebGL proof of work system prevent website spam?

Javascript's performance on computationally intensive tasks is... less than desirable. Which is why you talk of WebGL, but you are actually thinking of WebCL, an upcoming technology to give access to general computing features of GPU to Javascript code in Web browsers (à la OpenCL).

I see three main issues with such a proposal:

There is a large disparity in available computing power in client systems, especially for GPU. It will be hard to find an acceptable compromise between people with gaming PC and people with low-power tablets.
There is no WebGL, let alone WebCL, in Internet Explorer.
Proofs of work are good to deter spammers which are short on CPU. But spammers are not really short on CPU; any competent enough spammer will use a botnet with thousands of available processors.


Worthwhile from security standpoint to limit database server user for ASP.NET website to only EXECUTE on stored procedures?

There are two main (security) reasons to do this, above and beyond just using parameterized queries:

Parameter type enforcement
Least privilege.

The principle of Least Privilege requires you to allow any entity (user or application) access only to whatever it needs to do the defined task. If you don't restrict the webapp only to the SPs, the application could potentially execute any arbitrary query.
Note that this is relevant in two situations: preventing an attacker, that managed to find a vulnerability in your application (either SQL injection, or any other vuln that could allow him to execute code), from running malicious SQL queries; and, much lesser risk, developers that are looking for insecure, unapproved shortcuts (or even malicious developers).
Granting only EXECUTE privileges on the required SPs, will stop the application from running any query that was not predefined.

Wrt enforcing parameter types, while it is possible to implement this in other ways, this brings the type enforcement to the database, but before it hits the db server. I.e. using the types that are actually defined on the database, and without accidentally skipping a parameter.

Note that in order to do this properly, and avoid some common mistakes, you want to:

define a specific user account for the ASP.NET application
assign the account to a custom DB role
remove the account from all other roles, such as dbo.
grant EXECUTE privileges to the custom DB role you created
remove all other privileges on the SPs, tables, and other DB objects. This includes default "public" roles, and so forth.
ensure that the custom DB role has no other privileges.


I'm not sufficiently familiar with the tool to give a proper response to your question about the results, but in response to the generic question:
It's certainly possible, but it's quite unlikely. Ubuntu (like most Linux distros) defaults to file system formats that Windows doesn't natively support, such as EXT4. There exist EXT drivers for NT (Windows kernel), but unless you installed one, it's extremely unlikely that any malware even realized there was another OS installed, much less included the file system drivers needed to modify it.
The most likely exception for dual-boot systems would be some sort of "bootkit", which is malware that infects the boot sectors / UEFI system partition of your disk (where the bootloader is normally located). Such code runs before the OS (indeed, before the "real" bootloader) starts, and thus has full control over the hardware. This allows it to do any number of things, such as start a malicious hypervisor and "lift" the real OS into a VM, or overwrite integrity checks in the bootloader / kernel and replace important system files with malicious copies.
Of course, the first of those would have to be uncommonly complex malware both to do this undetected and to carry out any malicious activities against such "lifted" OSes (although simply using your machine to undetectably run the attacker's own software would be easier, just another thing running on the hypervisor, and it could "phone home" for additional actions to take / allow remote access), and most things the malware would want to do to your system would be OS-specific (though loading file system drivers to browse your volumes would be easy in a technical sense). The second approach is likely simpler - though it risks breaking when the system gets updated - but again assumes the malware has support for the file systems in question. A bootkit embedded in Windows code is almost certainly going to have NTFS, FAT32, and maybe EXFAT support - the common Windows file systems - but is less likely to support Linux file systems (though it could, especially if it's built from Linux code to begin with, and if it detects signs that you run Linux - like a GRUB bootloader - it might be smart enough to specifically fetch the needed drivers).
However, bootkits are rare in general, both because they're more complicated to write than most malware and because many systems now come with protections against them. "Secure Boot" prevents loading boot code not signed with a trusted certificate's private key (although it's often disabled on dual-boot systems, as that can be easier than signing and trusting the new bootloader). They're also usually detectable when booting from removable media... unless they went even lower than the disk, and instead infected the firmware. That's definitely a risk, but it's even less common (AFAIK) than classic bootkits. Modern motherboards should only allow trusted firmware to be installed / run (although I would be quite unsurprised if there were some boards without this protection, or with holes in it), and the malware would need to be more specific to the hardware than is typical for malware.
In theory malware could be installed in other devices, such hard disk / SSD firmware, but I'm not aware of any examples of such code in the wild (it would again be hardware-specific, and unlike the system firmware, most device firmware isn't even designed to be user-updatable).


Does CSRF prevention also prevent reflected XSS attack?

The answer is usually yes if the value is only reflected if a valid CSRF token is provided - the user can only "attack" themselves in this instance.

However, if there is a form generated that correctly encodes output to a page that contains a CSRF token but then that form submits to a page that does not correctly encode output then your site is still vulnerable.

e.g. Original page (a GET request, which is not normally subject to CSRF tokens due to lack of side effects - only POSTs should cause side effects):-

www.example.com/displayForm.php?name=<script>alert('xss')</script>

contains

<input type="hidden" name="csrfToken" value"123456" />
<input type="hidden" name="name" value="&lt;script&gt;alert(&#039;xss&#039;)&lt;/script&gt;" />

However, when this page is submitted by POST, name is output unencoded:

<body>

Hello <script>alert('xss')</script>.

</body>


How to know whether a RAM module is vulnerable to rowhammer before buying?

For DDR4:

One DRAM manufacturer, Micron, indicated that they are putting rowhammer mitigations into some of their DDR4 DRAM (see this data sheet).  Other manufacturers might be doing the same.

Note that it is not necessarily true that "DDR4 is OK".  There's nothing in the DDR4 standard that makes DDR4 memory safer than DDR3 memory -- the DDR4 standard does not contain any rowhammer mitigation features.  If DDR4 memory is safer, that would only be because manufacturers are being more careful about their newer memory, such as by implementing rowhammer mitigations internally within the DRAM modules.

For DDR3:

As far as I know, there are no public lists, either official or unofficial, of which DDR3 DRAM parts have the rowhammer fault and which don't.  The DRAM manufacturers haven't published any lists, and no-one has compiled any unofficial lists yet.

You could try asking DRAM manufacturers directly, but I don't know how helpful they would be.

If you pick a DRAM module that you're considering buying, you could try looking up the part number on the manufacturer's web site.  In some cases, you can get the SPD data for the module.  There's a "MAC" (Maximum Activation Count) field in the SPD data.  If MAC="Unlimited", that's supposed to mean "known to be rowhammer-free".  However, the status of this MAC field in the DDR standards is not really clear.  (For some background, see this post.)


What is the risk, giving users email addresses on a domain name?

I see the risk that people can pretend that they are from the example.org company.

Rfc2142 describes internet mail addresses to be used when contacting personnel at an organization, for example abuse@example.org to report inappropriate public behavior of your server like sending spam. Other special mail addresses are postmaster or webmaster.

If someone can take one of these addresses there is the risk that someone can impersonate as an administrative user. The resulting risk depends on how much someone trust these users. Therefore I would ensure that it is impossible to use the usernames definend in Rfc2142.


What is the relationship between Suite B and FIPS 140-2?

"NSA Suite B" is a definition of algorithms that shall be implemented to be able to... claim "Suite B" support. It is more guidelines than anything else, aimed at improving interoperability. Having support for Suite B algorithms can be a requirement to sell products to the US Federal Government; however, in general, there is no rule which makes implementation of these algorithms mandatory, and no certification system which formally guarantees that you implemented these algorithms correctly.

FIPS 140-2 is a formal definition of security requirements for cryptographic modules; it defines "levels". In order to claim a level, you not only have to do everything as specified in FIPS 140-2 for that level, but also to do a thorough audit which verifies your claims. Implemented algorithms are only a small part of FIPS 140-2; it also encompasses things like physical shielding and background checks on developers. For the algorithms, there is a list of approved algorithms; algorithms outside that list are simply ignored by FIPS 140-2 (your module can implement them, but they are out of scope).

Since the US government has not (yet) fallen to the Absurdity Circle of Hell, the "suite B" algorithms are a subset of the algorithms covered by FIPS 140-2.

As for OpenSSL:

It implements many cryptographic algorithms, including the "Suite B" algorithms but also many others.
OpenSSL is not, by itself, certified to comply with any level of FIPS 140-2, but it includes a "module" which has obtained some official stamp at some point, subject to some conditions, which are explained here and there.

Bottom-line: anybody can claim "Suite B" support; that's just a claim. A FIPS 140-2 certification for some level is considerably more formal, expensive, and restrictive. Compliance to FIPS 140-2 levels often creep up in big organizations as requirements; e.g. if you want to build and operate a PKI which complies to WebTrust (and is declared as such by an independent audit firm), then keeping CA keys in Hardware Security Modules which have been certified FIPS 140-2 level 3 will help a lot.


This key is a number,so how can a number encrypt a message?

A number is represented as a sequence of bits - this is the key.

  is AES a number obtained after calculation using discret logarithm?

AES is an encryption algorithm - see wikipedia:AES. The algorithm uses a key (sequence of bits, see last point) to encrypt some payload and the same payload is used for decryption. Think of something like XOR where the same "key" can be used to "encrypt" some message and "decrypt" it again - only much better than XOR.

  ... so what does RSA really add to the existent key exchange algorithm?

RSA in the context of SSH adds nothing to the key exchange algorithm itself. But it is used for authentication so that the client can be sure that it does the key exchange with the expected server and not with some man (attacker) in the middle (MITM).

  After doing ssh-keygen -t rsa command,a key pair has been generated,but when i open them in a text editor,i don't see nothing like prime numbers,it's a different format.

Again, a number is a sequence of bits. Such a sequence can be encoded in a variety of ways, like as a decimal number, as some hexadecimal number, as a sequence of 1 and 0 and much more. What you see there is a specific encoding of these numbers and also some additional packing information.

  Now i've got reall confusion about how all thoses maths are related to encrypt real data exchanged between 2 computers like,messages,photos,videos,etc.

It looks like you are confused because you think as numbers only as something written down as sequence of digits between 0 and 9. But this is just one specific encoding of how numbers can be represented. For the computer everything is just a sequence of bits - everything else (digits, characters, images ...) is just what a specific sequence of bits means for the human.


What alternative standard for ISO 27001 can be used in Australia?

Agree, it's kind of a broad question.  If you're looking for general principles, I wouldn't be looking past the ISM - https://www.cyber.gov.au/acsc/view-all-content/ism
If you're looking for specific hardened templates for servers as part of your framework / standards, then maybe CIS is worth a look.  CIS can be quite light touch depending on which level you choose to aspire towards - in theory.  I've found that there's no one-size solution - there's parts of CIS for example, that they'd mark as level 3 - or the highest level of maturity - but which for our business are no-brainers.  In other areas, we struggle to achieve level 1.
Documenting which standards you want to achieve, those standards you're excepting yourself from - that can be a pain.  I've used SAM for compliance, which seems to make it as easy as anything else I've come across.  https://www.samcompliance.co/
Not affiliated in any way, etc...
Good luck!


How reliable are Whois records? Can they be faked, and if so, how easily?

You could technically file false WHOIS data on your own, and so long as no one on the whole Internet has a reason to contact you, it could go unnoticed for a long while.
However, the moment someone makes a good-faith attempt to reach you via the fake info and fails, things get very interesting indeed. If the contact attempt was for legal (e.g. trademark infringement claim) or technical (e.g. you somehow managed to create a domain resolution loop or something similar) reasons, it's a safe bet your registrar may be compelled to de-register your domain immediately. Since such a situation could arise at any time, your domain would be perpetually at risk, and you'd have no recourse...because you were not contactable.


Security checklist for hosting a website on dedicated server - Linux

@Terry's advice is quite solid. Let me offer a more conceptual view.

Your server will be secure if everything that runs on it is accounted for and appropriately maintained. While this sounds like a tautology (it is), it points at some general principles:

Always apply security updates from the software vendor. Linux distributions have tools for that; let them run.
If possible, don't install software which does not come from the Linux distribution vendor, because extra software means extra work to apply security patches.
Don't run anything that you do not need. A new, blank OS installation tends to spawn quite a number of services which are not strictly necessary for your operations. In particular, use netstat -a to see what remotely reachable services are on your machine, and lsof to find the corresponding process.
Make sure that, at any time, there is a properly defined chain of responsibility. If something bad happens, people should know who to contact and how. A server without a clearly defined sysadmin is a server which will soon be part of a botnet, or already is. Make sure that when you go on holiday, there is someone else available to fill in for system administration tasks.
Make backups. Keep several successive backups instead of keeping just the last one. This helps a lot for recovery after an attack, if only for postmortem analysis. Remember that your server is meant to run a service: availability is a primary goal. Frequent and comprehensive backups can help you put the service online faster.


PKI - Security concerns when changing a certificate hash algorithm

Some CAs will not allow two certificates with the same SubjectDN, so the new one would supersede the old one. If there is no reason to believe the previous certificate had its PrKey compromised, it does not need to be revoked prior to signing and installing the replacement. Speak to the operators of your CA, especially the personnel acting as an RA, since they would be best apprised of their policy and the BCP.


Hashing request - What type of hash this?

This is most likely a hexadecimal representation of a 16 bytes (128 bit) hash output, which can be one of many hash functions, the most popular of them: MD5

But it can be so many other hashes for example md2, md4, Haval, RipeMD etc...

And it can also be some transformation of some other hash function, for example computing a Sha1 hash and taking only first/last 128 bits

If it would have been a popular hash of a popular password with no layering, you could have found it in rainbow tables... But with layering there is no way to tell


This depends on your split tunneling configuration.

Most split tunnels that I'm aware of are cases such as "road warriors": people who are working from outside the office.  In these cases, traffic to the company's network is tunneled over the VPN and other traffic is sent directly.

For example, say your company's LAN is on the 10.99.0.0/16 network.  The VPN would add a route, but rather than adding a default route, it would add a route only for 10.99.0.0/16 to send traffic via the VPN.  Anything not matching that would go directly to the internet via normal routing rules.

I've never seen a split tunnel VPN that was per-protocol or per-port, though I suppose you could do it via firewall rules or something.


Writing a Simple SHA256 Salted Hash Generator

I have read that it's not enough to hash a salted password once. You need to keep hashing it thousands of times to make brute forcing more difficult for attackers.

That is right. You want your password hash function to be slow, so that an offline brute-force attack would also be slow.

  hash = hashManager.ComputeHash(hash);

You really want to use the password within the iteration, to avoid the possibility of precomputation. If your algorithm does h=sha1(h) 10,000 times, I can create a table (or perhaps even an algorithm?) that applies sha1 10,000 times. I have to do this work only once for all passwords, and I can do it before your database is even leaked. So typically, the password is included in each iteration.

The HMAC primitive is typically used to hash multiple things together, but for learning purposes, simply concatenating values together is also acceptable.

  For the salt buffer size, is 10 a good number to use, or would a higher/lower number be more secure (e.g. 16)?

Preferably, each password has a unique salt. So your salt should be long enough to accomplish this. 10 bytes is sufficient, and making this longer doesn't really give better security.

  I'm taking this with a grain of salt, but I've read that SHA256 isn't a secure choice anymore because it's too fast, meaning brute forces are quicker to do.

SHA256 by itself is fast. That is why you iterate it many times, which makes it slow again.

  Does this mean that fast algorithyms like SHA are obsolete and need to be replaced with slower algorithms like bcrypt?

For password hashing, yes. For password hashing you should use PBKDF2, Argon2, bcrypt, or scrypt.

However, there are many other applications for hashes, and SHA256 is fine for many applications, so I wouldn't say that SHA256 is obsolete.

  I assume that Hex Strings are a secure way to store salted hashes. Is this correct?

Yes.

  After applying all changes from the above questions (if any), would the above code be secure enough to use in a production setting?

Since you don't seem to know what you are doing, and this is critical security code, I would not use it in production. Also, there would be no reason not to use the built-in Rfc2898DeriveBytes class, which does PBKDF2.

Also, I wrote a blog post about Requirements for iterative password hashing.


How does web site defacement monitoring actually work?

The problem here is with dynamic pages, because with static you could do a CHECKSUM comparison.

With dynamic you could:

Add HTML meta tag with validation code and checks if it's on page.
Track key elements that allow you to identify major changes, such as in defacements.

I found this website that taks more about some of the ways you can use.


What are the risks in specifying localhost as an "Authorized Javascript origin" in an OAuth configuration

Generally it means that one can trick Google (or another Authorization Server) to send a valid authentication token to localhost, from a client point of view.
Assuming that for that client "localhost" will always resolve to a 127/8 address, and those is handled on a local interface; if another process is listening on that port, it might be able to steal that token.

If, somehow, with a particular configuration your machine would try to append your domain (e.g .domain.com) to "localhost" query; someone could poison that, and you'd send your auth token to an arbitrary host.


Why is php not used for banking sites or for a banking transaction?

For banking sites or major transactional sites the risk management costs mean it is much easier and cheaper for a large corporate to feel confident with an application developed in .NET and uses the security framework provided with .NET than to use PHP.

At the end of the day organisations will use the cheapest environment they feel can provide the security they want based on their risk appetite, their threat profile and the size and type of development teams.

Developing a secure PHP application is likely to cost much more than a .NET application at enterprise level.


Study roadmap to write a crypter / backdoor

If you want to write a crypter, usually you take a certain shellcode and then load it into a script which generates another shellcode which contains an encrypted form of your shellcode. At runtime the shellcode will then be decrypted and run. To generate this encrypted form you will need to either use an existing crypter or create your own. In your python script you then encrypt your shellcode so it's decryptable from your new shellcode (which contains the encrypted shellcode).

I'm an avid Python user, others here use Ruby (in which Metasploit is written btw). In the end you should use the best tool for the job. However this is very diverse depending on your platform. So you should just try a few tools and then decide which is best for you. There is not a single good tool for doing this. (but you will need to learn some assembly if you want to write low level exploits)


How can I locate the device that log in my gmail account?

My answer:  Use gmail's "last account activity" function to see information on utilization of your account.

It is explained here:  https://support.google.com/mail/answer/45938?hl=en

Here is an excerpt:

  You can see the last 10 IP addresses and approximate locations  that
  accessed your Gmail account.

  If you got a warning about suspicious activity in your account, you
  might also see up to 3 additional IP addresses that have been labeled
  as suspicious.

  There are a few reasons you may see multiple IP addresses or locations
  in your activity:

  If you use POP or IMAP to read your mail on other services, like Apple
  Mail or Microsoft Outlook, this location information will be included,
  too.

  If you use Mail Fetcher, a Google IP will show up because your
  messages are being fetched through a Google server.

  If you use Gmail on a phone or tablet, your Internet service or mobile
  carrier's location may show up. This may be a location far from where
  you are. As long as the name of the carrier matches yours, this isn't
  unusual.

While on this topic, it is highly suggested you use 2FA security on gmail to prevent this from happening.  I use Google Authenticator on my Android phone so I can click Yes or No to any unknown logins.


Is it safe to store important data in an encrypted access token?

It depends on whether the encryption mechanism you're using provides confidentiality (like AES in bare CBC mode) or or confidentiality and integrity *like AES in CBC mode with an HMAC, or AES-GCM)

Just because your data is encrypted doesn't mean that it can't be tampered with in a way that you can't detect.   It must be both encrypted and authenticated, and the authentication is done with a MAC, or message authentication code.

If, in fact, you are using authenticated encryption and so you can verify via the MAC that the ciphertext has not, in fact, been tampered with before you attempt to decrypt it, then yes, this is a reasonably safe way to store and protect data, provided of course that you are as you stated using strong encryption and the implementation is otherwise sound.


How to find Windows version from the file on a remote system

Based on https://superuser.com/questions/363018/how-do-i-tell-what-version-and-edition-of-windows-is-on-the-filesystem you can find the Windows Version and Service pack in C:\Windows\System32\license.rtf for Windows 7. For Windows XP the information is in C:\Windows\System32\eula.txt. For Windows 10 licenses.rtf does not contain the version. Instead it contains the EULA code, which you can use to find the version online.

I tested this on XP SP3, 7, 7 SP1, and 10 and found that this works for each OS.

The current language pack is a little more tricky. You can find what appears to be the currently available languages in C:\Windows\System32. The folders are in  the format of xx-XX (xx = language, XX = country). For example en-US is English-United States, es-MX is Spanish-Mexico.

The packs that have been used are copied to C:\Windows.

To test this I switched my Windows 7 SP1 and Windows 10 Pro machines over to es-MX and, once I rebooted the computer, found that the es-MX folder was created in C:\Windows. Unfortunately the en-US was still there making the current language ambiguous. However you should be able to use the combination of active packs and the names of Documents, Photos, Music ect. to get the current language.

I was unable to test this in XP as I could not risk bricking my last running example of XP.


How to configure NAXSI to accept JSON format in REST APIs?

Try disabling the following rules from naxsi_core.rules:

id:1001 (double quotes)
id:1015 (comma)

That should work :)


Does IT policy apply to the Board of Directors? What policies do apply?

I work in healthcare and write the IT policies (among other things).  All of my policies are reviewed by the corporate compliance team and others before being finalized.  Once a policy is approved the first people I hold to the policy are the ones who asked for it or helped write it.

My thinking is that the people who helped create the policy should be the ones who have to deal with it first so that they know whether it works.  When I changed the password complexity requirements our CEO needed to get information off of his PC for a meeting.  Rather than accept a temporary exemption from the password policy change he insisted on being held to the same standard as everyone else.

If someone on our board is using a system connected to our network they can either use the guest wireless or they can abide by the policies.  All of the policies I write have an exception clause, but the exception must be in writing and reviewed.  All exceptions are sent to the compliance auditor within 30 days of the exception and annually the full list is sent.  Any exception expires no more than a year from the exception to force a review.

I'm okay with there being reason able exceptions, as long as it is documented and necessary.  When that happens I just require a compensating control to be demonstrated.


Confused about whether or not I'm infected

The BSOD and poweroff problem look more like hardware/driver issues than anything else, especially the latter.

  Malwarebytes anti-rootkit did something strange and I also emailed them to make sure the program might have bugs.

Your download may just be damaged due to a network error or similar, that's why you should check hashes to make sure your download isn't corrupt.

Now, we could ramble all day about whether it's compromised or not, so let's take the safe approach and assume it is, so a reinstall is mandatory.

First, do not create the reinstall media from the same (potentially compromised) machine, so you should download the ISO and burn it/create an USB stick from a separate, known clean machine.

To transfer your files, in theory any and all files could be modified by the potential malware to compromise other machines but I'd say the risk is pretty low for files that don't contain any executable code, so everything like photos, music and text documents should be safe. Only executable files and documents that contain executable code (Microsoft Office documents for example, as they can contain malicious macros, or PDFs) should be avoided.

To transfer the files the safest way would be to boot from a known good Linux live CD or USB and copy the files from there on a known good USB stick. That ensures that any running rootkit won't be able to tamper with the files or the USB stick as the files are copied, so this lowers the risk as now only files that were already compromised can be malicious. This also prevents the rootkit from turning your USB drive evil that will pretend to be a keyboard and enter malicious commands the next time you connect it to your newly reinstalled machine.

It seems that now it is possible to use some Windows 7, 8 and 8.1 product keys to activate Windows 10. You can download clean Windows 10 ISOs from Microsoft directly but make sure your User Agent doesn't mention Windows - otherwise it forces you to use their stupid Media Creation tool which is a piece of useless garbage. If you'd rather get Windows 7 you can get torrents from an unofficial source, just make sure the hashes match those found on MSDN to verify you're not downloading a compromised copy.


How to determine if JPG EXIF data has been changed by "OEM" software (without third party tools)?

This could be due to many reasons. I'll share the most likely:

The user has an app to randomize/change EXIF data/file property data. There's an app for that. Such a program is usually used by those who are paranoid and want some kind of plausible deniability, or maybe they're just bored and messing with you.
iMessage should allow you to send images with EXIF data intact, while standard MMS will not. This is a limitation of the MMS protocol. iMessage and MMS aren't the same. Note that you can remove GPS data by not allowing geotagging in the settings. Try another control picture with geotagging enabled in your iPhone. Settings > General > Location Services > On/Off.

  This is an idea but there shouldn't be any EXIF data on here if the picture 'started out' as an SMS picture...

Notice that this is from the iPhone 4. The iPhone 6S is the current phone. Things have changed. Your link is from nearly 4 years ago. Updates can add or remove features, even on older devices such as the iPhone 4s, your target machine.

Since we are talking about forensics, you might be working in law enforcement. If this is the case, then you should try to get a hold of an updated iPhone 4s. Take a picture of anything, and use iMessage to send it to another one of your devices. Verify that the EXIF data is either intact or missing. From there, you should be pointed in the right direction.

If you have already seized the iPhone in question, and you found the EXIF data on the iPhone, it's possible it didn't get transmitted via SMS. If you got the EXIF data from a phone that received the SMS, then you'll know it can be transmitted.

The article I linked seems to suggest that EXIF data is now included by default. Many other articles indexed by Google also suggest the same.


Are there significant problems with a password generation pattern using groups of alternating consonants/wovels?

Calculating entropy for the vapu-dapu-fato-sovu-gazi pattern

Let's do some math for the following kind of pattern:

  vapu-dapu-fato-sovu-gazi

Assuming there are five vowels, 'a', 'e', 'i', 'o', 'u', and 21 consonants, and you always start with a consonant, you can build 21 * 5 * 21 * 5 (11025) unique four-letter-words. Replacing the last group with a four-digit random number yields 10000 instead of 11025 possibilities for the last group.

If you paste 5 of these words together, you get 11025⁵ possible passwords (I'm ignoring the dashes because if the generator pattern is known, they don't add any security).

This gives you a password search space of size 162889462677744140625. That's equal to 67 bits of entropy, if you choose your consonants and vowels in a completely random fashion.

67 bits are not great, but they're much, much better than your average password entropy. Assuming a well-funded attacker who has the resources (botnets?) of one million computers available which can each check one million passwords a second, it will take four and a half years to exhaustively search the password space, and on average a bit more than 2 years to find the correct password.

If an attacker was ignorant of your password scheme and simply tried every possible string of 24 characters, it would take much longer.

Is 1012 guesses per second reasonable?

To give a bit of context to the above assumptions about the attacker: One million password guesses a second per machine is easily doable today on GPUs if the password is protected with a very weak hash function, such as MD5 (and the old Windows LM hash is so weak that you can reach a few billion guesses a second - hashcat parlance is 'Megahashes' and 'Gigahashes' per second...) . It's not feasible when the password is protected with strong password hash functions such as bcrypt, scrypt etc. Depending on the configuration, you might get anywhere between one hash  up to a few kilohashes per second. Botnet sizes of one million zombies are optimistic for an attacker (the very large Mirai botnet, which enslaved IoT devices which wouldn't work very well as password crackers, consisted of about 100'000 devices), most botnets are smaller. Finally, having a botnet run a million CPUs or GPUs at, say, 20% capacity cracking passwords for two years non-stop would probably get someone's attention sooner or later.

If you're not happy with these assumptions, I'd suggest the following: Imagine the attacker you want to protect against. See what resources he'd need to achieve his goal, and then make an educated guess about whether he can afford these resources. For example, coming up with the resources needed to do 1012 guesses a second (renting several large botnets for two years or buying and running the hardware yourself) is probably out of the reach of everyone but large corporations, organized crime and nation states.

What if you used real words?

  could it be simplified without losing significant security, or alternatively, could one just as well use a nonsense sequence of real words

Let's consider using real words instead of made-up ones. Random words are much harder to memorize, and if you used real words from a lexicon that contained, say, 7000 words, the resulting password would still contain 63 bits of entropy. That's 16 times weaker, but you could easily offset that by adding another word, which would yield 76 bits of entropy and, assuming the same attacker, protect you for over two millenia if technology didn't advance in that time. Again, it is absolutely crucial to choose the words randomly. Just thinking of a few words that come to your mind is not good enough. Also, you'd have to take care not to pick 5 very short words, because then you'd open yourself to a brute-force attack on the resulting short string.

Check out the obligatory xkcd, and Diceware for word lists. Or if you're too lazy, you can buy a password for two bucks from this girl in NYC :-)


How do I holistically protect a web service from network and MITM attacks?

TLS / SSL

The bare minimum of security a webservice should have is to be available over a HTTPS connections.  The certificate should be valid (not expired, not self signed).

Ideally the HTTP service is disabled.

Use HTTPSTS headers

The HTTP Strict Transport Security header should be added to ensure that all future requests to that host occur over HTTPS.  This technology helps prevent man in the middle attacks with attack tools such as SSLStrip.

Ensure TLS is correctly configured

Test the server's TLS configuration and resolve any critical warnings as appropriate.

Add cruft to JSON responses

Unparsable cruft is used by Google, Facebook and others to prevent certain javascript attacks.

Set the secure flag on all cookies

Setting the secure flag on all cookies prevents the inadvertent "leaking" of valuable data to would-be attackers.

Set HTTP Only for all authentication cookies

The HTTP Only flag is a misnomer and doesn't mean the cookie will be sent unsecurely, rather it means that the cookie is unavailable to Javascript and only available for consumption by the server.

Lock down usage by IP address

Depending on the target audience, restrict the usage of the service by source IP.

Monitor

Monitor the requests per second, per user, and failures per second, per user.


How does the side channel actually access the contents of kernel memory in Meltdown?

The part of the document you are interested in is :

  Based on the value of data in this toy example, a different part of the cache is accessed when executing the memory access out of order.  As data is multiplied by 4096, data accesses to probe array are scattered over the array with a distance of 4 kB (assuming an 1 B data type for probe array). Thus, there is an injective mapping from the value of data to a memory page, i.e.  , there are no two different values of data which result in an access to the same page. Consequently, if a cache line of a page is cached, we know the value of data . The spreading over different pages eliminates false positives due to the prefetcher, as the prefetcher cannot access data across page boundaries [14].

Also, 5.1 step 2.

In a nutshell, the value of the data you want to know is determined byte by byte. The unknown value is multiplied by the page size, hence each different possible byte value triggers the loading of a different page.

Then you can measure which page was loaded using the FLUSH+RELOAD method.


Which is more secure Yubikey + Keepass using Challenge/Response or Yubikey + Keepass using OTP?

One important difference between OTPs and challenge/response schemes is that the first can be spoofed, and the second cannot. Suppose somebody sets up a phishing UI for KeePass, and you enter your password into it without realizing that it's not the legit one. The attacker realizes that the password isn't enough, you have MFA enabled. So far, so good.

If you use OTP, though, all the attacker needs to do is show the usual OTP entry box. You tap your Yubikey, it sends the OTP to the attacker, attacker forwards it to KeePass, and boom they've got access to your KeePass vault. If you instead use Challenge/Response, then the Yubikey's response is based on the challenge from the app. The attacker doesn't know the correct challenge to send for KeePass, so they can't spoof it.

Note that this distinction probably doesn't matter that much for a thick-client local app like KeePass, but it definitely matters for anything that does remote authentication. For example, if you're logging into a web app like Gmail, a phishing page can spoof the login UI and the OTP UI just fine. However, a phishing page cannot spoof the challenge/response flow, because that's based on the actual site being visited, and your browser (and therefore the Yubikey) will send a different challenge even if it looks the same to you.

In fact, challenge-response systems like this are the only method I know of that provides pretty strong security against phishing attacks. Everything else involving a true second factor - OTP, SMS, even push notifications - can be spoofed, and you will take the approve the authentication check just like normal because, as far as you know, you are logging in just like normal.


Where is the best way to filter user input?

It depends on what you mean by "the best".
From the security point of view, server should not trust any data received from the client and should validate all the data. Why? Because you don't know who and why sent these data. May be user has modified your JavaScript and forced browser to send to the server the data, that you believed your script should have filtered. Or may be there is an attacker that created an application, that sends data that you have never expected from your script.
From the point of view of good user experience, the application (web site) should inform the user about incorrect input as soon as possible. That's why it makes sense to implement some validation and correction on the client, for instance, validation of telephone number or validation of date. On the server side you should still validate everything, including any data validated on the client.


Is there a grading standard for security that I can apply to my MVC3 web site?

It sounds like you might be looking for something like the OWASP ASVS.  It defines four levels of rigor, each of which has an associated set of verification activities.  Once a client has decided the level at which their application should reside, you will have a concrete list of security activities that should be performed to get to that level.


VLAN is by design not a security mechanism, but it can be used as such if the underlying network hardware (and its maintenance) is mutually trusted by all stakeholders. In that case, the provided isolation is reliable.

To my knowledge, server hosters ("cloud providers") use VLAN to provide isolated networks to their customers. ISPs also sell (non-cryptographic) MPLS as cheap/efficient VPN solutions. If the infrastructure is trusted and the perimeter is secure, this can be done.


Secure Login System Without SSL Through Google OAuth

If you don't have the budget to acquire an SSL certificate (even if a DV one is extremely cheap), you can always turn to free CAs:

Let's Encrypt gives you free DV certificates available for 90 days, with free renewal (I actually use Let's Encrypt for my blog, and I set up cron job to renew the certificate every 80 days, I left 10 days as a spare margin)
Cloudflare also provides free certificates


How to know somebody's IP? (Fraud victim)

If you can trick them into clicking something in an email, you can send them a link to any page that you have access to the webserver logs for and find the request in the log (along with their IP).  There are also a number of third party services to do this for you that are pretty easy to use (eg http://whatstheirip.com).

Now, that said, some of the scammers out there are highly dangerous individuals with organised crime connections.  Think twice before tangling with these people and consider the value of the money you've lost vs the potential cost to you and your family if they decide to try and hurt you.  These people may be quite comfortable resorting to murder or kidnap to get their way, do you really want to move out from behind a computer screen and face someone like this in person?


It certainly was in the past. See http://blog.ontoillogical.com/blog/2014/07/28/how-to-take-over-any-java-developer/

Maven Central supports HTTPS, as of July 2014.

Maven Central requires PGP signatures for artifacts. There's a plugin to verify the signatures: http://www.simplify4u.org/pgpverify-maven-plugin/index.html

Now, badguy can write a malicious program and sign it with PGP, and it would be verified, so you'll want to check that the PGP signature belongs to an organization / developer that you trust.


Personal Google search history appeared on work computer. Does this mean work can see my private search history from my personal iPhone?

No, your work would have no ability to see the contents of your personal Google account. Someone walking by or if the computer has screen monitoring software would see what you saw on the screen.


How do I hide files inside an image without using any steganography tools?

It is possible to hide files in other files. For pictures you can use the least significant bits of a RGB pixel definition.

A pixel has 3 bytes defining its color. Light Sea Green is defined by: 32,178,170 (R,G,B)

This translates to binary: 00100000,10101100,10101010

When we change the last bit of these, the color in an image does not change significantly. Therefor we can use the Least Significant bit of every color value of the pixel. This gives us 3 bits per pixel we can use.

So take a text, convert it to its binary representation and then write an algorithm that changes the LSB of every R,G and B value in the picture to the bit of that text. If you have a text of 128 bits long, you will need 128/3 pixels to hide that text.

Lets say I have a text who's binary representation is:

01001000 01100101 01101100 01101100 01101111 00100000 01010111 01101111 01110010 01101100 01100100 00100001 00100000

This text is 13 bytes long, meaning there are 13*8=104 bits. We know we can hide up to 3 bits in a pixel, so 104/3=  34.666, so we need 35 pixels.

So if we have a picture we'll use the first 35 pixels. To show you how it works, I'll give an example with two pixels. We can hide 6 bits in there, the first six bits of our text is 010010

Our pixels are:

pixel1,R: 00010101
pixel1,G: 01011111
pixel1,B: 10111100

pixel 2,R: 10010001
pixel 2,G: 00010101
pixel 2,B: 11011100

Now we can just change the last bit for every color value to the representative bit of the text:

pixel1,R: 00010101 ---> 00010100 (changes to 0)
pixel1,G: 01011111 ---> 01011111 (remains the same)
pixel1,B: 10111100 ---> 10111100 (remains the same)

pixel 2,R: 10010001 ---> 10010000 (changes to 0)
pixel 2,G: 00010101 ---> 00010101 (remains the same)
pixel 2,B: 11011100 ---> 11011100 (remains the same)

If we want to extract the text from the image, we just look at the LSB of the new pixels, we get:

P1 R: 0
P1 G: 1
p1 B: 0

P2 R: 0
P2 G: 1
P2 B: 0

This is our row: 010010


Why is there no option for separate sudo password?

First, not all attacks require to know the password. Many attacks against services (or daemons) target vulnerabilities in code and end in executing code on behalf of a user without knowing the password. In that case, the default sudo configuration adds security by requiring the knowledge of the password.

Another example in a multi-user environment is when a user leaves his terminal unattended (you and I know that it is bad and never do it ourselves, but...) an attacker can execute commands on behalf of the user but still cannot use sudo.

Finally, as you speak of ssh, the common use is to only use a (RSA) key for user authentication. That way, the ssh connection never use the password, which is only used for a direct local connection or to gain root access via sudo. It can even be forced by disabling the use of the password in sshd configuration. In the case of a remote server, the local user password is then indeed only used to gain root access.

But the real answer to your question is the option does exist! The /etc/sudoers file can be used to declare the boolean flag rootpw. If this flag is set, the password shall be the password for root instead of the password for the current user.

If the sudoers contains the line:

Defaults rootpw

then you will be asked for the root password. This flag is off by default and is seldom used because it is not really sudo philosophy but su one: if you do know the password for root, you can directly use su by-passing all additional sudo controls.

sudo is indeed a highly versatile command, and you really should read man sudoers


How can I be pwned if I'm not registered on the compromised site?

From the FAQ:

  Why do I see my email address as breached on a service I never signed up to?

  When you search for an email address, you may see that address appear against breaches of sites you don't recall ever signing up to. There are many possible reasons for this including your data having been acquired by another service, the service rebranding itself as something else or someone else signing you up. For a more comprehensive overview, see Why am I in a data breach for a site I never signed up to?

It's likely some services allow signing up without confirming an email address, or that accounts that haven't confirmed email addresses are still stored indefinitely but cannot be logged in to, or any number of similar issues.


TheHive has hooks to Cortex, which can you use for OSINT, but it does not have all of the integrations that you are asking for.

Active Directory, SCCM, and similar can be performed with WEF as Palantir maps out for you in their Github project.

AbuseHelper is the oft suggested platform to send email out. TheHive can definitely take email in, even Microsoft Exchange through Synapse.

For firewall automation from TheHive data, I’m not sure of your direction enough to make a specific recommendation. Typically, you will see one of 2 types of deny-level controls. The first is host isolation (aka host quarantine), such as seen using PowerShell here. The second would be using Suricata IPS rules that provide countermeasures to specific malicious logic, much more open-ended compared to a domain or IP block.

My thinking here is that instead of blocking everyone from accessing what could be a false positive, just block the single laptop that is reaching out to C2 or being social media / cloud cred phished or whatnot. If you have a firewall that can be configured for a list, then use blackbook or similar project as that list.


What will happen if my GnuPG passphrase is discovered?

Should I be concerned if someone has my public key and knows my passphrase?

The passphrase is used to encrypt the private key. An attacker cannot do anything with the passphrase and the public key; but make sure he cannot get hold of the encrypted private key. The private key's security is somewhat like two factor authentication: something you own (the private key file) and something you know (the passphrase).

Changing the passphrase might help preventing the attacker gets hold of a copy of your private key encrypted with the already known passphrase, also consider backups. If you're in doubt whether the attacker also got hold of the encrypted private key (which he's now able to decrypt), consider revoking your key.

  Will they be able to decrypt messages sent to me?

Absolutely not (without a private key as described above). All decryption operations are performed using the private key.


Malware: extract private keys from smartcard?

The weak link in most smartcard applications is PIN entry.  Extracting private keys directly from the card is nearly impossible.  With some acid package destruction and electron microscope work, a skilled team, and enough time, money, and luck you can in theory extract keys but it involves not only physical access but a scenario where the card will be physically destroyed.

However if the host system is compromised and the user's input of the PIN is keylogged and later replayed the smartcard will gladly work just as well for the attacker as it does for the user.  If you are concerned about the host system being compromised you should look at direct PIN entry.  Using a smartcard reader with a keypad the communication is directly between the keypad and the reader.  The PIN never travels to host and thus is unavailable for intercept.  While in theory the reader itself could be flawed I have never seen an exploit involving direct PIN entry and I would assume it would probably be hardware specific.  There are methods to harden PIN entry without a dedicated keypad using programmable smartcards and OTP instead of PIN only but not sure if that is an alternative you are interested in.

Also keep in mind a lot also depends on the use case.  Is the card being used for digital signatures?  What is the damage resulting from an attacker obtaining a fraudulent signature vs stealing the actual private key.  In some scenarios that is a significant mitigation in other scenarios it is a meaningless distinction.  The latter scenario is much tougher to defend against because protecting the keys is easier than protecting unauthorized use of the keys.


Strangely, if we install the Issuer (intermediate) cert on the server manually, the authentication goes through.

It looks like the client is not sending the necessary intermediate certificate but only the lead certificate or the leaf certificate and some older intermediate certificate.


Differences between brute forcing access versus decrypting password files or databases

If you go through how Rainbow Tables work, I believe you'll be able to answer some of your own questions. Almost all questions that you've asked require a understanding of how they work, what they are and how are they created.

However, I'll try to answer your questions.

  If you saved a hash, then they'd just try comparing the hash field to a rainbow table of different types of hashes of different words, right?

Yes, but not its not that straightforward and its not different types of hashes. Rainbow tables are hash algorithm specific. Essentially they are just a time-space trade off. You still compute hashes when you use rainbow tables - a lot of them. How many do you compute before you crack the password depends on how big (and exhaustive) the rainbow table is.

To explain it in a very simplistic way, a rainbow table gives you hints. Say your password hash is "XYZ", rainbow table requires you to hash 'XYZ' multiple times (can be millions). After each iteration, you are required to check if the resulting hash is present in the rainbow table. If found, it'll will tell you to hash another string (start of that chain) n number of times (where again n can be a in millions) to get the password.

So again, rainbow tables just help you crack faster, they don't make it as easy as just a lookup in a large database (which is in fact one extreme end of rainbow tables, when basically you've just pre-computed hashes of all possible passwords).

  What would happen if I stored the Hash of the Hash of the password? Are there rainbow tables for that?

If you save hash of a hash, it'll be just one single more step in the way passwords are looked up in the tables. However, the attacker has to know that you are storing hash of a hash to be able to crack it.

As a note - people do hash a password multiple times and then save the resultant hash and apply related techniques. However it is not to make it more difficult to use rainbow tables. The basic concepts of rainbow table can still be applied to it.

  This would obviously be against a file or database I'm guessing, not a live site (unless they hacked the server, got the website code, removed the account locking mechanism and mounted their own environment, would they even try that?

Yes, you'd not try password cracking live on a website. The network latency and other factors just make it impossible. Normally all you need is a file of password hashes.

  If they are doing this against a password file, does each hacker write their own program who will craft requests to bruce force or decrypt said password source?

You could write your own program once you understand how the rainbow table is constructed, but normally the rainbow table vendor will give you the program that goes with it.

  When they are trying to brute force decrypt a password file, do they try with every possible encryption/hashing method? Or what is the most average or common way?

You cannot use a MD5 rainbow table for SHA1 hashes. So tables are tied to their hash algorithm. Also, rainbow tables don't work with hashed passwords. When I say don't work, I mean that you cannot use a generic rainbow table to crack a salted password. You can create a rainbow table that will crack all passwords salted with that particular salt but then as you can imagine, you'll need as many rainbow tables as the number of salts - which already defeats the purpose as rainbow tables are expensive to compute.

Also I will not invest my time in cracking a password unless I know the algorithm used to hash it and if there is anything done to obscure the hash. Essentially I am saying that I'd want to see the code used to come up with the hash rather than trying to crack it with random tables and presumptions.


Kerberos: What is the structure for preauthentication with certificate (RFC 4556)

I'm addressing the question you added with your edit.

As documented by Microsoft, some Windows versions ("<2> Section 2.2: [RFC4556] message syntax is not supported in Windows 2000, Windows XP, and Windows Server 2003.") are based on an earlier draft of RFC 4556 that defined the following structure for PKAuthenticator (draft version 11 was the last to use this syntax for PKAuthenticator):

--
-- PK-AUTHENTICATOR - Different from [RFC4556]
-- Appendix A, PKAuthenticator.
--
PKAuthenticator::= SEQUENCE {
     kdc-name   [0] PRINCIPAL-NAME,
     kdc-realm  [1] REALM,
 -- name and realm of the KDC issuing the ticket
     cusec      [2] INTEGER,
     ctime      [3] KerberosTime,
     nonce      [4] INTEGER
 }

With the final RFC (draft version 22 actually) the identifier for PA-PK-AS-REP also changed from 15 to 17 to distinguish between the two format specifications (Microsoft mentions that too: "An earlier draft of [RFC4556] supported a different pre-authentication data identifier: PA-PK-AS-REP_OLD 15").


You're breaking one of the hashCode() taboos; you're using its output as a key identifier. That's wrong.

You see, the output of hashCode() (in its default implementation) is a 32-bit unsigned integer, that's roughly 4 billion unique hashCodes. Sounds quite a lot? Well, not so much. Applying the birthday problem in this case shows as that with about 77000 objects, you have about 50% chance of collision. 50% chance of two objects having the the same hashCode.

Another issue is that the implementation of hashCode() can change from one Java version to the other. It's not meant to be permanent identifier of an object, so there's nothing forcing it to be consistent across versions.

If you insist on using hashes as object identifiers, then it's much better to have your own method instead of hashCode() to use for your key identifiers (for example, getMySpecialHashKey(). You can uses something like MessageDigest.getInstance("SHA-256") to digest the object into a nice 256-bit key.

My recommendation: Ditch the whole idea of hashing the object and rather generate a random identifier for your object when you construct it. Something along the lines of (in Java)

SecureRandom secRand = new SecureRandom();
byte[] objIdBytes = new byte[16]; //128-bit
secRand.nextBytes(objIdBytes);
String objId = Base64.encodeBase64String(objIdBytes); //Here's your ID

You also seem to bind access to an object only to knowledge of its key. That's also wrong. A proper permission-based model with proper authentication and authorization is needed.


You'll never know.

I once happened to input a password. I immediately changed it once I realised this. If your information was a password, you better change it now.


In this case, does Virtualization gives more security?

Virtualization offers some layer of isolation. In your "B" case, if (for instance) there is a remotely exploitable hole in the SMTP server, then an attacker who exploits it may gain full control of the virtual machine which runs that SMTP server, but he will still be "outside" of the two other machines (the guest with the Web server, and the host). This may help contain breaches. However, this isolation is relative to the communication channels which you use between the systems: for instance, if the Web server code has the ability to send emails, then I suppose it has a way to talk to the other system. There may also be some shared file hierarchy. Also, it would be overly bold to claim that existing virtualization software offers "perfect" isolation: security holes allowing an escape from a guest, into another guest or into the host, have been found (and fixed, but found nonetheless) in all VM engines.

This is (as usual) a trade-off: VM bring extra containment, but nothing "perfect" (perfection cannot be achieved with concrete machines), and at the cost of some overhead: splitting the machine into three will imply somewhat more CPU usage (not a lot more), more RAM usage (in substantial amounts), and more disk usage (a little more or a lot more, depending on how much "sharing" is done between the systems). More importantly, with three systems instead of one, you have increased complexity, the well-known bane of security. Instead of one system to manage, you now have three. This increases cost of system administration.