Is PKCE really protecting public facing clients? Can't a rogue app steal the ClientID and Secret and make a AuthCode request of its own? From what I have understood, for public facing clients such as JavaScript apps that run on the browser or mobile apps which have no backend there is no secure place to store client id and secret. Therefore, the client will generate a random string code a.k.a code challenge (plain).
And then:
Client sends ClientID, secret, redirect URI and code challenge --> Authorization Server
--> Auth Server sends back Auth Code --> Client --> Sends the previously generated code challenge (string)
--> Auth Server --> Auth Server checks if the code challenge is same as the one that was sent earlier
 when it generated that particular Auth Code. --> Auth Server Sends back Access token.

How does this secure the client application? I mean that if someone can steal the ClientID and secret then it can also generate a random string and send all three to the Authorization server to generate Auth Code and then make another request to get the access token. Eventually the token would expire and then the person could repeat the process since it has the ClientID and Secret. It is just a matter of generating that random code challenge again.
I understand that Hacker App can not use the stolen AuthCode to get Access Token because of PKCE but - why can't Hacker app use the clientID of your app and generate a code verifier then ask Authorization Server for a Auth Code and then again for Access Code?
Is it impossible to steal ClientID?
When Authorization sever sends back the AuthCode to the client. Is that the only point which is vulnerable?
I have been through this post but I am still not clear on this.

Taking you to be asking two questions, what does pkce guard against, and how is client_id being random offering any protection to you if people can just lift it out of your source code, this is my understanding:
why does pkce even exist:
the whole reason for pkce is due to the nature that mutliple smartphone apps can register themselves to be "handlers" of specific url patterns, (this is a vulnerability that only exists in smartphones, if you're making a single page app this is not really a vulnerability for you though I think the advice is to use PKCE if you aren't using a client secret regardless, also it's harmless to use PKCE regardless because it won't ruin anything if you use it and the server doesn't support it)
why bad on smartphone:
when the oauth2 service redirects the user back to your app, following your apps pre-registered redirection url, the browser on the smartphone is going to attempt to navigate to that url, at that point the operating system detects this (both android and ios work this way) and notices that it matches with a few apps already registered at installation time to handle such urls, and it could automatically pass it to the wrong app, which could then maliciously act to get an access token with that and start doing bad stuff in the name of the user.
why should client id be random if it can easily be lifted:
from the docs here:
https://www.oauth.com/oauth2-servers/client-registration/client-id-secret/

"If the client ID is guessable, it makes it slightly easier to craft
phishing attacks against arbitrary applications."

So my guess is being random basically just adds another level of effort for a malware author to put in in order to write something that would affect your app. (you won't be protected from a malware author that targets your app, but you would be protected from a malware author that is blanket targeting all apps say on an appstore...)
The other part to the question, whats to stop an attacker from stealing your clientId and making a request to the auth server masquerading as your app. This won't work because of the redirection URL's.

it is critical that the service doesn’t redirect the user to arbitrary locations
https://www.oauth.com/oauth2-servers/redirect-uris/

If a user visits the attackers app, and is redirected to the auth server to authenticate but the redirect made use of your apps clientId, then the auth server would redirect the user back to your app, not the attackers,
see the security considerations of the docs:
https://www.oauth.com/oauth2-servers/single-page-apps/#security-considerations

The only way the authorization code grant with no client secret can be secure is by using the “state” parameter and restricting the redirect URL to trusted clients.

What they mean by using the state parameter is that your app can make use of local persistent storage (like local storage for a webpage) to generate a random string that it would include in the state param of the redirect request, and if the auth server redirects the user back to your app/web app after the user authenticates, it will echo back the state param and your app should verify that the value in that matches a recently previously stored state random string in said local storage or similar to have a confidence that the user being redirected back to your app was the result of an auth flow that was indeed kicked off by your app and not an attackers app, (if the redirection has no state param or a state param that doesn't match anything in the apps local storage then at that point your app should know that it wasn't itself that initiated that auth flow, and so should not consider the user as having completed the flow properly (should not proceed to trade the auth code for a token)


Is PSK-protected IKEv2 secure against MITMs? I've set up an IKEv2 VPN connection as an alternative to an HTTP proxy (since HTTP proxies' credentials fly in plaintext and iOS still can't correctly remember proxy credentials) and I'd like to know how hard it would be to capture the PSK for an MITM.

The person using the client device isn't much tech-savvy and I'd rather not give them extra headaches by requiring certificates for this particular connection (security is taken care of by HTTPS anyway, I'm only worried about some idiot cracking the PSK and them committing illegal activities through the VPN).

Here are the relevant parts of my Strongswan configuration :

connections {
 phone {
  version = 2
  local {
   auth = psk
   id = server
  }
  remote {
   auth = psk
   id = client
  }
  children {
   child {
    # is there a better option ?
    esp_proposals = aes256-sha256-modp4096
   }
  }
 }
}

secrets {
 ike {
  id = server
  id = client
  # the real PSK would have a similar length
  psk = c687a6b44304942b5a19257e50da5b45941f3756
 }
}

With the hypothesis there is already a MITM attack installed between your iPhone and your Linux VPN server, this attack won't be able to get your PSK, because this one is not exchanged during
the encryption tunnel building and during its use. Your IPsec tunnel will use your PSK from the beginning with the encryption schemes you configured (aes256).

This is the uniq advantage to use a PSK.

To settle in place a MITM attack once your tunnel is built, an attackant would need this PSK and to configure a fake VPN server configured with your PSK and located on the Internet route used.

The PSK biggest weaknesses are on the 2 ends of the crypted tunnel,
and next on the channel through which you exchange this PSK to configure it on the 2 ends of your crypted tunnel (here an iPhone and your Linux VPN server).

These are not at all light risks since most of the real attacks against
crypted tunnels are conducted by entering at one or the other end of the tunnel at the OSes or application levels. Most of common OSes (I mean on the mass consummer market) are running infected and compromised. My personnal estimate is that the see level of corrupted OSes is actually pretty high, above 90%.


Does this official "Enforce MFA" AWS policy make any sense? At https://aws.amazon.com/premiumsupport/knowledge-center/mfa-iam-user-aws-cli/ the AWS officially recommends to have this policy
{

            "Sid": "BlockMostAccessUnlessSignedInWithMFA",
            "Effect": "Deny",
            "NotAction": [
                "iam:CreateVirtualMFADevice",
                "iam:DeleteVirtualMFADevice",
                "iam:ListVirtualMFADevices",
                "iam:EnableMFADevice",
                "iam:ResyncMFADevice",
                "iam:ListAccountAliases",
                "iam:ListUsers",
                "iam:ListSSHPublicKeys",
                "iam:ListAccessKeys",
                "iam:ListServiceSpecificCredentials",
                "iam:ListMFADevices",
                "iam:GetAccountSummary",
                "sts:GetSessionToken"
            ],
            "Resource": "*",
            "Condition": {
                "Bool": {
                    "aws:MultiFactorAuthPresent": "false"
                }
            }
}

which presumably is supposed to enforce MFA requirement for the account.
But to me having "iam:DeleteVirtualMFADevice" makes it not very useful.
2FA to me is a second measure to protect authentication flow: you must know not only a password, but also a 2FA device.
Now with this policy - it allows to remove a virtual mfa as long as you have a valid access token.
And "iam:DeleteVirtualMFADevice" cannot be removed from there: if one removes it - then the aws console mfa setup page is broken (it says the MFA already exists, even if it wasn't set up yet).
Am I missing something or is it a security theatre happening here?

To delete an MFA device, you should first deactivate it. If it is deactivated, you cannot use it for MFA any more. Thus, it makes sense.


Does posting my computer name publicly make my system vulnerable? I am wondering if it is paranoia and/or privacy overkill to block out one's computer name when posting terminal output in public forums? I don't know enough about networking to know if it's possible that this information could make one's system vulnerable somehow (though I suspect not?) and was hoping someone could shed some light.

Generally, no. Your computer should not be reachable from outside your local network, with the name or without.

However, it can leak info like your real name, or allow people who know your computer name to match your online username to the real you. Whether this is a major concern is up to you.


Which is the correct algorithm while checksumming a portion of code? As part of my research, I came across a technique in a paper which applies checksumming on a portion of code. I want to implement it.
Here is the research paper which talks about the checksumming guard techqniue.

Here is the guard template:

guard:
      add ebp, -checksum
      mov eax, client_addr

for:
      cmp eax, client_end
      jg end
      mov ebx, dword[eax]
      add ebp, ebx
      add eax, 4
      jmp for
end:

As you can see, here just addition of opcodes is performed. Can someone suggest a stronger method of doing it?  Also, someone suggested Message Authentication techniques like MACs, digital signatures, authentic encryption? What would be the best method?

I hope you understand that this is security through obscurity and provides no meaningful level of integrity against an adversary who is attempting to modify your code in memory. For this to be effective in any way, the CPU's execution unit would have to be the one verifying the checksum, allowing modified code to simply refuse to execute. If the check is entirely in software, an attacker could quite trivially modify the checksum itself to match the modified code before it is executed.
With that said, the method to use would be a hash of some sort. There are three types of hashes:

Checksums involve the addition of a numerical representation of each component of the data, multiplied by a weight factor. Checksums are extremely fast, but are not cryptographically secure and can often miss modified data even under ideal circumstances.
An example is Fletcher-64.

Cyclic Redundancy Checks use the remainder of polynomial division of the contents as a digest. The polynomial is carefully selected to increase the chance of detecting modification. They are generally very fast, but a malicious actor can trivially "break" them.
An example is CRC32.

Cryptographically secure hash functions are much slower than the other options, but are designed to reduce the chance that two inputs with differing contents will resolve to the same digest, regardless of how they are generated. Non-collision-resistant functions can have any digest size. To be collision-resistant, they need larger digest size, such as 160 bits.
A collision-resistant example is SHA-256. A non-collision-resistant example is SipHash.

Given that you are only writing a proof of concept, you should use a simple and fast checksum or CRC. A proper implementation would use custom hardware verifying a cryptographically secure hash such as SHA-256 as part of a digitally-signed hash tree. If you have access to hardware with SSE4.2 (see page 61), you can use a hardware-accelerated implementation of CRC32c (using polynomial 0x11EDC6F41). This allows a digest to be generated using one instruction for every QWORD of data to be processed, using the crc32q instruction. Otherwise, you would want to use a very fast and extremely simple checksum such as CrapWow or Murmur. It will suffice for a proof-of-concept.


VPN / VPS and IP logs Here's the situation:

1) I rent a VPS at a hoster and install VPN on it.

2) Completely disable all logs. Those logs that can not be disabled - permanently delete.

3) I connect to my VPS via VPN (L2TP/IPSec) from my machine and go to some website.
The owners of this site will want to identify me. They define the IP and go to the server hosting company to get the data (let assume they will have order) .

There is no any logs on the server. But probably in the data center will log all who are connected to this server. Correspondingly, there can be seen IP’s who did connections to this server.
Is it possible?

And if the answer is yes, are there any ways to solve this problem?

You have no control over what the VPS is logging. They may be logging all communications, or none. There's no way for you to control it and no way for you to know what they are doing. The VPS provider is subject to all laws for its locale including search warrants.

If you are looking for anonymity, consider Tor.


How can I find out if someone has been on my home wifi network? I am aware of DCHP tables, and apps that can scan your network to see who is "currently" on your wifi network, but I am more interested in how to tell if someone has been on my wifi network at some point in the "past".  Or if that's not possible, what can I do today to keep a running log of all devices that will have ever connected to my wifi network in the future?

I ask because I have had 5-6 periodic instances when my virus scanner all of a sudden would stop working, and I can't seem to find the cause.  I want to rule out that my wifi is insecure.

It's not possible to find this out about past connections unless it has been logged by some device. The prime device for logging this would be your access point because this is the device that authenticated the request to connect to your wifi. Whether it is capable of logging such requests will depend on the capabilities of your wifi access point. It may already be logging this information, I'd look around in the web interface.

You could also setup a computer with a wifi card to listen in promiscuous mode with wireshark. This means it will listen to all frame also those not addressed to it and you should be able to see clients authenticate to the access point and also authentication failure. You could also be logging mac addresses via ARP or DHCP.

I think your virus scanner not working is completely unrelated to the security of your wifi network. Even if your wifi was compromised it'd be unlikely for your virus scanner to stop working. If you distrust your wifi do the following:

change the password into a complex long random string like "hXs0#/;W#y38!u0aIi$o65>Ra", you only have to input it once anyway.
change the admin password that allows you to change these settings into a proper one too.
update the firmware on your wifi access point / router
make sure WPS is disabled
make sure you're using WPA2


Can malware be installed on my mobile considering it has MDM? I have mobile iron on my mobile phone which is used to access company data on my phone. Does MDM also help in detecting and keeping away the malware from my phone?

Yes:

I don't have experience with Mobile Iron, but I have used other MDM clients like AirWatch.  They do not inherently give more protection or scanning for malware.  MDMs are simply management solutions and remote administration (very limited in some cases) for devices the provider would like to issue resources and connections to.  Some things may help, like requiring a password to install anything, and restricting the app stores - but, unpatched exploits like Quadrooter would still have an impact on you.  Secure AV deployment would aid a bit in security, but as always is not a bulletproof methodology.


How do proxy servers sniff data? I live in a country which most website on the internet is blocked by government so we mostly use wide variety of proxies such Web proxies, VPN, SOCKS and most of them are free.

My question is: Is there any way, those proxy servers sniff our data even we use SSL on the webpage ? if there is , How ?

When a Web browser uses an HTTP proxy, things go the following way. Let's assume that the target URL is http://www.example.com/index.html. The browser then connects to the proxy and says to it: "I want to get the page at http://www.example.com/index.html". The proxy complies, get the data, and sends it back to the browser. By construction, the proxy sees all the data. The connection between proxy and browser could be encrypted, but the proxy still sees everything.

If the target URL uses SSL (https://www.example.com/index.html: mind the s in https), then the browser connects to the proxy, and tells it: "I want to connect to port 443 of www.example.com; do it and then relay all bytes in both directions". Section 5.2 of RFC 2817 describes this mechanism. The proxy then acts as relay for all the bytes between the browser and the Web server, these bytes encoding whatever the browser and Web server wish them to be, i.e. in practice a SSL handshake and subsequent data. In that case, the proxy is outside of the SSL tunnel and cannot see the exchange data. The SSL tunnel is still between the Web server and the browser, and the proxy is a purely transport mechanism.

The proxy is still in ideal position to attempt Man-in-the-Middle attacks, since all communications go through it; but SSL is protected against that, namely by virtue of the Web server certificate being validated by the client. This of course relies on the human user not to click through warnings about invalid certificates. In some organizations, local sysadmins install extra "rogue" root CA certificates in desktop systems so that they may create fake server certificate on the proxy, and do the MitM attack, granting them access to the exchanged data (so that they can apply antivirus filters even on HTTPS traffic, or so they say at least).

Barring such a rogue CA installation (which is, basically, a breach into the security of the client machine), the proxy won't be able to peek at the data exchanged between the browser and the HTTPS server. The proxy will still be able to know which server was contacted, and to observe the size of the data exchanges: encryption hides the contents, not the size.

Situation for SOCKS is conceptually similar. The dialog between browser and proxy is different, but the basics remain the same: the proxy will be able to see all the HTTP traffic, and none of the HTTPS traffic.

Edit: apparently, some other kinds of "proxies" exist, in which your browser contacts a dedicated server, which itself runs a browser, does your browsing for you, and returns the pages to you. Unfortunately, some people call that "Web proxies", a terminology which has been in use for two decades to designate what is, technically, a HTTP proxy. Confusion ensues.

Such "browsing proxies" are similar, in concept, with opening a session on the server with a remote desktop protocol and running your browser from there. This grants all conceivable power to the proxy administrators on your browsing activities. You don't want to do that if you don't absolutely trust the proxy sysadmins.

And you'd prefer not use the "Web proxy" expression if there is any risk of ambiguity.


Blackphone - Silentcircle - mobile apps i have question about blackphone (silent circle).
Is there any advantage over other mobile phones if i want to use third party mobile apps?

So if I agree with terms of use of some applications, does that mean - blackphone will become insecure?

In general, does the whole silent circle project make phones that are more secure than most?

Assuming you trust Silent Circle (and all their manufacturers and suppliers), then it could be considered secure as it comes in the box (Assuming the box is sealed, and hasn't been tampered with).

As soon as you add any third party software, you have to be sure that you trust the developers of it, and the distributors of it, to the same level. They are able to run software on the device, which might be able to do things which seem required, but actually allow for unintended data to be exfiltrated. For example, if applications can access the motion sensor, they may be able to work out any PIN entry made whilst they are running, even if not currently active. There have been a couple of research investigations into this.

If you don't trust the application to the same level, you are effectively reducing the trust in the whole device to the weakest part. This isn't specific to the Blackphone, but to any device where you introduce software which isn't trusted to the same level.

There isn't any reason to think that installing third party software will definitely compromise the device, just that you should be prepared to perform the same level of due diligence on any software as you are on the device itself.


Is it possible for my employer to replace the root CA on my phone? I've read about corporate MITM 'attacks' where they replace the root CA on company hardware in order to monitor traffic over SSL that takes place on their network, but is it possible for them to do the same on my personal phone if I connect to the wifi?

I would think that since they do not have administrator access to the phone they would not be able to decrypt https traffic but I would also think that this might be something the network administrator would be interested in trying to see.

First, it is not about replacing the CA's but about adding another CA, i.e. the proxy CA used for intercepting the SSL connections. They will not be able to add the CA to your private phone just when you connect to the Wifi.

But, as long as you don't have the proxy CA installed SSL connections will simply not work for you inside the company networks, because the certificates cannot be validated any more. It is not that they simply stop intercepting the SSL connections if the client does not have the proxy CA installed but instead they still intercept and leave the resulting problems to the client.

And it is usually perfectly legit that companies do SSL interception inside their own network to protect their infrastructure. SSL does not make web sites magically secure but only protects the transport. Malware can still be delivered by websites using SSL, either deliberately or more common because the site was hacked. If you don't like that your private phone is being monitored within the companies network simply don't connect to it. This would be probably more secure for the company too since this is one possible attack vector less to care about.


How to Secure a Stream from DDoSers? I conduct a weekly live-stream using Google Hangouts that streams over YouTube. Recently, the stream has been attacked by DDoSers. In an attempt to thwart such attacks, I have tried to keep my IP address secret [by not running Skype] and have even tried entry-level firewalls.

Are there any firewalls that would work well to protect a livestream? Are there any other security measures I could take? Ideally, the total solution would cost no more than $2500.

How effective do you think these countermeasures would be against determined DDoSers?

There are a couple of possibilities, the more effective ones being more expensive.  I'll rate them from best to worst.

1) Get a DDoS mitigation service such as akami.  They will provide you will a lot of bandwidth and will block any DDoS attacks from getting to the lesser bandwidth of your own connection to your ISP.

2) Get a server hosted at a nearby datacenter to use as a VPN/Proxy.  They may be able to provide you with some help against the DDoS or may simply have good enough bandwidth to mitigate the DDoS

3) Get a VPN/Proxy from an existing company.  This will give you bad latency and bandwidth without even getting DDoS'd and may not hold against the DDoS.

*) Get two VPNs, one for your public address (skype or whatever) and one as your hangouts proxy.  Then if the skype vpn goes down your hangout one will still be up.  This is assuming they can't get your IP directly from the hangout.

akami ddos defender


What security issues will I face with outsourced VPS server? Our small comapny wants to launch a paid service, hosted on the outsourced VPS server.
The obvious risk is that the machine is physically not in our office and that possibly the database could be accessed by the stuff of the host.
Are there any obvious security problems with VPS that I should consider?
Second question would be: How to protect DB on the VPS server so I could be sure the host will not read data there?
Thank you

As you have said, any VPS will be accessible by the hosting staff. You should also bear in mind that not all VPS providers will physically host their own servers so there may be a second set of staff who might gain access. This is why it is important to choose a VPS provider you trust and to test out their processes and understand them well.

Of course, your main driver for using a VPS will be cost and the lower the cost the fewer the processes and security certifications they will maintain.

Depending on the type of VPS host, there may be a level of shared resources as well that should be thought about.

In general though, this is rarely a problem unless you are working in a regulated area such as health or finance. In such cases you are unlikely to get away with the use of a VPS and you need to look for alternatives at least for part of your solution. For example, it is typical when taking payments to hand off to a secure payments service for the actual payment (e.g. PayPal or Worldpay).

When using a database with a web front end, you will have to embed the id and password somewhere on the system so a knowledgeable person with access to the hardware will certainly be able to gain access should they wish to.


Token based API security over repeated username/password requests What are the security benefits over a token based API security model versus sending the username & password every time?

The process of the token based approach is:

Send a 'login' request with username and password
Receive a token
Use the token instead of username/password for all subsequent requests

The benefits of a token based system (according to this http://bitoftech.net/2014/06/01/token-based-authentication-asp-net-web-api-2-owin-asp-net-identity/ ) are:

Scalability
Loosely coupled technology
Mobile friendly

However, I'm not sure why these advantages are specific to a token based approach rather than sending the username/password each time? Is it not just as easy to add subsequent web-servers to a cluster either way? The password verification is still performed in both cases, so the client-side is just as loosely coupled?

Advantages?
Is it simply that the username/password does not need to be 'checked' every time and we can do a more simple lookup based on a list of session keys?  While this is a performance improvement it does add increased complexity on the client application, and further complexities if there is a timeout on the token where the client would need to check if the token is still valid?

Disadvantages?
Are the downsides with a username/password sent with every request that with more and more transmissions of this data it becomes more likely that it could be discovered? If so, is HTTPS not robust enough to counter this threat?

EDIT:
I have read this potential duplicate: Why use an authentication token instead of the username/password per request?
 but I am a little unsure why point #2 states that the username/password would be stored as a cookie.  Why would the client machine keep the username/password as a cookie and not include it in the post content itself?

Why would the client machine keep the username/password as a cookie and not include it in the post content itself?

Keeping username/password (or token for that matter) in a post content, localStorage or sessionStorage exposes this content to a XSS attack. Please see this article. Even though the article is about a token, the same principle applies for any credentials (including username/password). Some more references about this here. If you store such information in a httpOnly cookie, the content is not available to JavaScript and thus theoretically imune to an XSS attack. Once you have your credentials in a cookie, you are open to a CSRF attack and you need to handle it.

Answer on your linked question is correct.

I would add another benefit for token: expiration. If username/password credentials are stolen, it might be difficult to detect it. Tokens will expire at some point and the user will need to relogin to be allowed new one. This limits the timeframe where a stolen token can be used to authenticate on the server. In case of username/password credentials, there is no such limit or it is larger (password expiration policy is usually a month or more where a token can be set to expire in minutes or day(s))


What is the difference between EDE and EDE3? I was going through the OpenSSL cipher algorithms list. I found these two:

des-ede-cbc
des-ede3-ofb

What does that exactly mean? What is the difference between EDE and EDE3? What are the key-size and blocksize of the algorithms?

I checked https://www.openssl.org/docs/man1.0.2/man1/enc.html and found the following:

des-ede-cbc        Two key triple DES EDE in CBC mode
des-ede3-ofb       Three key triple DES EDE in OFB mode

So, EDE is two-key triple DES, and EDE3 is three-key triple DES.  See https://crypto.stackexchange.com/questions/63449/what-is-the-keyspace-of-2-key-3des for the differences between two-key triple DES and three-key triple DES.


Password History/Password policy I'm referring to "remembered" password that the domain keeps so a user cannot reuse that password until it has expired in what was set at Password Policy on DC (W2003/W2008).

Where is password history stored?

The historical password hashes are stored in the SAM along with your current one, so are certainly equally breakable.

I used to run password strength audits for large financials, and part of the output would be analysis of the number of individuals who reused passwords with just a change to the final digit (guess how large a percentage does it!) PWDump and John the Ripper zapped through them quite happily:-) In fact you could get some benefits from the password history that could help you break ones the brute forcer wouldn't get to easily.

To flush these historical hashes, you could try to set history to 0 in security settings and enforce a password change. That might do it, but I don't honestly know. In any case this totally defeats your password history policy if you're hoping to maintain one.


Additional virtual security? Besides following VMware's security best practices, are there any other recommended security technologies that are aimed at security and compliance in virtual environments? Vormetric comes to mind, but are there other recommended third party solutions?

"Security Best Practice" depends on many factors since your control environment (e.g. Health Care, Payment Systems, etc.) will have different regulations and standards that must be followed. (e.g. HIPAA, PCI-DSS, etc.)

  Besides following VMware's security best practices

I'm assuming that you mean the hardening guides available here: https://www.vmware.com/security/hardening-guides

If that is the case, those are mainly technical controls - very good controls to implement if you can -  and do not cover many of the controls outlined in something like ISO 27001/2 or COBIT. Again, how far and deep you need to go with security and compliance depends on your control environment.

  are there any other recommended security technologies that are aimed
  at security and compliance in virtual environments?

VMware offers some free compliance checkers for things like the Hardening Guide (mentioned above), DISA, and HIPAA - I recommend these to get started. There is a PCI checker tool but it is a bit outdated:

https://my.vmware.com/web/vmware/evalcenter?p=compliance-chk

In order to narrow down what is best for your control environment, I would suggest looking for white papers in your industry. I did a quick search for "vmware security partners" and saw that Symantec has an offering to help with security and compliance - Control Compliance Suite - http://www.symantec.com/control-compliance-suite

For specific security improvements there are products like McAfee MOVE that moves the antivirus scanning load to the hypervisor instead of the virtual machine.

http://www.mcafee.com/us/products/move-anti-virus.aspx

Also note that what you can do with VMware and 3rd party offerings depends on the type of licensing you have as well - if you are not using Enterprise for example there might be some "gotchas" along the way. For example if you need a distributed switch, which is required for something like NSX, then you must have an enterprise license. The Symantec Control Compliance Suite that I mentioned above also requires a VMware Enterprise license.

I don't think you will find an all encompassing solution but a good strategy would be to understand your threats and control environment, perform a gap assessment, analyze the amount of effort required to remediate (i.e. mitigate, accept, transfer the risks) the gaps, and then see if there is a 3rd party solution that can help save you time and money in remediating the risks that must be mitigated.


Could “receive SMS online” site be a scam? There is a site that allows you to see all SMS received by a certain set of phone numbers (owned by the site). This seems to be meant for services that require two-factor authentication using SMS, when you're unable (or unwilling) to provide your phone number for that SMS. Instead, you enter a phone number provided by that site and then use that site to view your authentication SMS.

Obviously, this decreases security, because it basically turns the two-factor authentication back to one-factor (because that phone number is not “something you own”). But apart from that, is such site safe to use? Could they somehow use the received SMS to get access to my account, or for some other nefarious purpose?

For the record, the site I'm talking about is http://receive-sms-online.org/.

The service makes all SMS they receive available to any internet user. That means any confidential information you receive via SMS is compromised.

Many websites which use two-factor authentication via SMS also use SMS to communicate other confidential information to you. This information isn't confidential anymore in this case. They might, for example, also use SMS for password recovery. That means it might be possible to hijack your account by clicking on "forgot password" which might offer a "send new password to my cellphone" option. The attacker could then monitor the online sms service for the new password.

Looking at the SMS one of their numbers received in the last hours, most of the messages allow to guess the website they came from, but they lack the context necessary to find out to which account they belong. To abuse the information one would have to link them to some account somewhere. However, you can not know what the service you want to register on sends you. When the message includes a username, the account is pretty much compromised.

You asked about what the sms service could do should they be evil. The website you registered to using their number believes that their number is your number, so they might regard some commands they receive from that number as authentic. What options this gives them depends on the website.


Cisco IOS question - password management, service password encryption types I'm university student studying for my certification exam, and I was doing some reviewing today when I found a question that I can't find an answer to.
Basically, in the CCNA3 2.4.1 Cisco Netacademy online materials, it talks about encrypting passwords in the config. To quote the materials:

  The encryption standard used by the service password-encryption
  command is referred to as type 7. This encryption standard is very
  weak and there are easily accessible tools on the Internet for
  decrypting passwords encrypted with this standard. Type 5 is more
  secure but must be invoked manually for each password configured.

This is what confuses me. It says that you can manually invoke Type 5 security (which is MD5 hashing, also used with enable secret) for each password configured. But by default, it uses Type 7 encryption which is a basic and weak encryption method usually used to guard against over the shoulder snooping at running-configs etc.

I've done some looking around and I can't find any commands that would allow a user to use the enable password command yet encrypt it using Type 5 instead of Type 7.
Furthermore, when I looked at Cisco reference pages on the Internet seen here it says the following:

  enable password [level level] {password | [encryption-type]
  encrypted-password}  Encryption-Type: (Optional) Cisco-proprietary
  algorithm used to encrypt the password. Currently, the only encryption
  type available is 5. If you specify encryption-type, the next argument
  you supply must be an encrypted password (a password already encrypted
  by a Cisco router).

This is for the enable password command and it says default encryption type is 5 using IOS version 12.2. But when I use service password-encryption on a switch that has 12.2 IOS the running-config shows: enable password 7 121AOC041104 the 7 meaning Type 7.

So, as you can see. I'm confused. There are contradictions concerning the default Type of encryption used with enable password. Although the netacademy resources are a few years old, actual testing with switches and using the service password-encryption command support the netacademy materials. Whereas the Cisco site quotes type 5 being the default using one of the latest IOS versions.

Basically, my question is, despite all of these confusions, is it possible to use enable password to get a Type 5 encryption (and this would be evident in the running-config) or do I have to stick with enable secret to get my Type 5 encryption?

I can't help with your basic problem, but this should help motivate folks to get it right, as your question asks.  It is depressing hearing over and over how badly broken password storage is on important platforms.

A bit of googling yields this information on how bad "type 7" password storage is.  Note that tt uses "Vigenère obfuscation" (not really encryption): Deobfuscating Cisco IOS Passwords - CT3

I'm still puzzled as to why Cisco wanted the server to have access to cleartext passwords, as noted in that link.

Update: As described at Cisco IOS Password Encryption Facts - Cisco Systems:

  In order to support certain authentication protocols (notably CHAP), the system needs access to the clear text of user passwords, and therefore must store them using a reversible algorithm.

The requirement for plain-text password storage on the server side is a good reason that CHAP (Challenge-handshake authentication protocol - Wikipedia) is a bad idea.


Can a browser extension (Chrome, Firefox, etc.) read the web console log? I realized that my bank handles sensitive information in the web console log, so my concern is if any browser extension could read the log?

Any extension that has access to the DOM can read whatever is written to the console by intercepting calls. The console is a JavaScript object; it is simple to proxy calls to console.log, like this example from zzzzBov on Stack Overflow:

(function () {
  var log = console.log;
  console.log = function () {
    log.call(this, 'My Console!!!');
    log.apply(this, Array.prototype.slice.call(arguments));
  };
}());

However I should note that intercepting console.log is not necessarily what you should be worried about. If an attacker is able to run their own code within your browser, they can do a lot of bad stuff whether or not the bank uses console.log. For more on that, see this question: Worst case scenario what can a Chrome extension do with "Your data on all websites"

But that said, if they've left console.log statements in their production site, that's a code smell.


Why does layer 2 IDS seem underdeveloped compared to layer 3 IDS, for wireless network? I understand that there are many applications such as Snort that do the job for network layer 3 IDS.

From what I have researched, layer 2 wireless IDS seems like a field that is very slow in development? Snort-wireless and Openwids-ng seem like dead projects.

The most up-to-date and stable opensource software for WIDS that I can see is Kismet. But I still feels like it's not as good as it should be.

Questions: (Assuming that my previous statements are true)

What are the causes that make wireless IDS to be under slow development generally? Is it a technological factor?
What are possible attacks that wireless IDS these days can detect and prevent?
If I'd like to develop a hobby project on an IDS, is it possible to still contribute to wireless layer 2 IDS development? How difficult is this going to be?
Are there any other decent Wireless IDSs in the market/opensource communities?

Thank you.

I'll answer this as best I can, since some of it is subjective or subject to change.

As I mentioned in a comment, the barrier to entry in terms of development is higher for layer 2 than it is layer 3, and cables are easier to interface with than radio waves. Most wireless technology involves firmware on a hardware device in order to translate the RF signals into data packets that can be interpreted by software drivers. In order to manage the full spectrum of wifi attacks, you need to be able to handle the full spectrum of communications.

This means that you probably need:

Some experience with 802.11 protocols, including the crypto side of things.
A wifi dongle that supports full promiscuous mode.
A wifi AP running an open framework such as DD-WRT.
A way to access the raw wireless frames (not just Ethernet frames) on the system. This means you'll probably need to have some kind of specialised wifi driver.
A way to test your code with corrupt signals and other tricks at the RF layer, which probably means you need an SDR that can handle 2.4GHz.

In general, right now the primary attacks that wifi IDS/IPS systems are looking at are based around detection and prevention of password cracking on the AP, but also detection of various deauth attacks. The biggest problem, though, is that most interesting wifi attacks are targeting clients rather than the AP. This means that building an IPS is near impossible, since you can't get inline with radio waves; the best you can do is detect that an attack is happening.


Mysterious Device on network, need some suggestions I just did a quick scan of my home network and I found this mysterious Intel desktop, looks like its an intel ethernet chipset but I just thought the name "QMDL" was sketchy and was wondering if anyone has ever seen something like this? I was wondering if it could be malicious or someone trying to look at my network traffic.

There is only one way to know for sure that whether it is a rogue device - verify that it is a device you own or not. While you do that, consider the following scenarios.

Verify if it was a machine connected by the people who installed the router.
Verify if it is a VM running on one of your machines in bridged mode.
Verify if it is a mobile device like a surface tablet.

If the above three cases are invalid and the device isn't your own machines, it is likely to be rogue. If it is still online you can perform a port scan and see the results and try if you can fingerprint the same.

To make sure that it isn't snooping your network, use wireshark and see the packets from that particular IP and your router. If there are ARP responses which binds the rogue machine's MAC and your router's IP, there is a  man-in-the-middle attempt and you are being snooped.

Comment below if you need the specifics on how to perform any of these.


How big is a canary word on Linux, typically? A canary word is a sequence of bits placed at the boundary between a buffer (such as a stack) and control data in a program, as a way of detecting and reacting to buffer overflows.

How many bits long are these canaries on Linux, usually?

Let's try it out! Here is a very simple example program.

int test(int a)
{
    return a;
}

Compile it with GCC and intercept the compilation at the assembly stage. (The -S flag will do this.) Rename the assembly file (so it won't be overwritten) and compile again, this time also adding the -fstack-protector-all and -mstack-protector-guard=global flags. The first flag enables stack canaries for all functions, the second selects a global canary instead of a thread-local one. (The thread-local default is probably more useful in practice but the assembly for the global version is easier to understand.)

Comparing the two generated assembly files, we spot the following addition (comments are mine).

        movl %edi, -20(%rbp)                 ; save function parameter onto stack (unrelated to canary)
        movq __stack_chk_guard(%rip), %rax   ; load magic value into RAX register
        movq %rax, -8(%rbp)                  ; save RAX register onto stack (place the canary)
        movl -20(%rbp), %eax                 ; load function parameter into EAX register for return (unrelated to canary)
        movq -8(%rbp), %rcx                  ; load canary value into RCX register
        movq __stack_chk_guard(%rip), %rdx   ; load magic value into RDX register
        cmpq %rdx, %rcx                      ; compare canary value to expected value
        je .L3                               ; if they are the same, jump to label .L3 (continue)
        call __stack_chk_fail                ; otherwise (stack corruption detected), call the handler
.L3:
        leave

We can see that the canary is handled in the RAX, RCX and RDX registers which are all 64 bit wide. (Their 32 bit counterparts would be named EAX, EBX and EDX. The 16 bit versions are named AX, BX and CX. The 8 bit variants AL, BL and CL.) Another clue is that the operations to store, load and compare the canary (MOVQ and CMPQ) have a 'Q' suffix which identifies a 64 bit instruction. (32 bit instructions have an 'L' suffix, 16 bit instructions a 'W' and 8 bit versions a 'B'.)

Hence, we conclude that the canary is a 64 bit value, which makes sense on a 64 bit architecture (x86_64 GNU/Linux in my case). I expect that they'll always use the native word size as it makes the most sense to me. You can try the same experiment on your machines and see what you'll get.


Hydra: Brute force an http form, all arguments are supplied but the login error has other string formats and is too big I am using Hydra to brute force a login http form (Method: post), but I'm getting false positives (passwords that aren't valid)

I believe I know the reason, I just don't know how to handle it:
The failure of the request produces the following failed message containing strings as "é":

(the error is only printed on the screen, nothing in the url.)
"Desolé: Vos détails de connexion n'ont pas été réconnus, réessayer." (this is the error you get when submititng invalide credentials.

So I have read that the string lenght and format affects how Hydra responds.
This is the how command I execute:

hydra -l 588455 -P passwords.txt site.com http-post-form "/auth/login:username=^USER^&password=^PASS^:Désolé : Vos détails de connexion n'ont pas été reconnus, réessayer."

So my questions are like this:

1) Am I doing anything wrong regarding the command above?

2) Since the failed error is too long and contains chars as "é , :" Can I adapt Hydra to recognise only part of the error string, such as "Désolé" only?

3) When the login attempt is valid, no success/failure are retuned, just the user is redirected from site.com/auth to site.com/home
 .so can I make Hydra notice when the user is redirected to /home and upon that decides if a password is valid or not? If yes, how can I do so?

4) I have read in Hydra docs that I can use the cookie arg to check if the login is a success on not, any idea or example oh how to do so?
Much thanks and apprecation in advance everyone, I hope I get some insights.

A success login does the following:
redirects to http://site.com/profile
 ans sets the Cookie: ci_session=e6971c0d444819e261cbfa89182f5da10ccc8bb0

Typically you'd want your match string to just be long enough to prevent any false negatives/positives and nothing more.  Given that your string includes accented characters, I would also strongly recommend checking how the landing page renders them.  Hydra will be looking at the HTML source, not how a browser would render it.  It's possible that é is written as &eacute; in the HTML source code.

Furthermore, given that your login only redirects on successful logins, it may be worth checking for the positive case (login successful) instead of the negative case (login failed).  Hydra will follow redirects, so you could match text that only appears on the landing page (e.g. the presence of a "log out" button).  You can find details on using a positive test case here.

As for cookie matching, Hydra appears to search the entire HTTP response, headers included.  That said, the cookie value you posted is unlikely to be useful.  It's a session cookie which is meant to be unique to each visitor of the website.  Most websites will set a session cookie even if the visitor isn't logged in.  While it may be the session cookie assigned to your successful test login, it's astronomically unlikely that it'll ever be that same value again.


How can a rootkit infect Windows without signed driver file? Windows 7 64 bit and newer versions feature Driver Signature Enforcement, which prevents loading an unsigned driver. Then how can some kernel-mode rootkits infect Windows? I rea

Lets say, some user downloaded and ran some rootkit dropper. What exactly will the rootkit do?

Thanks.

TL;DR: Privilege escalation or bypassing

Generally, these droppers will exploit bugs in the OS. While it should not be possible for this dropper to write into parts of the kernel, there are ways bugs allow them to do so. For example buffer overflows can be exploited to increase privileges to the point, where you can do almost anything.


What is validity in terms of PGP 6.5.8? In PGP 6.5.8, there is a concept of "validity" for a key, and it shows in the user interface for each key on the keyring.

What is this concept, and how to you set it so a key is considered valid?

PGP (and also GnuPG) uses the concept of a web of trust to allow you to validate the ownership of other's keys, also if you didn't meet them in person.

PGP's Trust Model

A long explanation is in PGP's manual, starting from checking trust. The short version:

In PGP, a key is valid, if

it is not revoked or expired
it is your own key (which is also implicitly trusted) or
it is certified (signed) by other valid and trusted keys, requiring at least either

one certification by a fully trusted key or
two certifications by different marginally trusted keys.

Certifications are shared on key servers and show that the issuer is sure about the signee's identity. Trust is only locally (by yourself) and not shared, and defines whose certifications you trust for validating other's keys.

Trust example

Alice certified Bob's key, and fully trusts Bob. Bob certified Carol. As Alice key is valid (it's her own key), Bob's key is also valid (signed by another valid, trusted key), so keys certified by him are again considered valid for Alice, here Carol's key.

GnuPG's Trust Model

GnuPG has a very similar trust model, but by default requires certifications by three marginally trusted participants (or like PGP one by a fully trusted key), and limits the length of trust paths to five (allowing a maximum of four intermediate certifications).


Wildcard certificate generated for local CA do not work for the subdomains I have created Makefile to simplify generation certificates for local development:

DOMAIN   ?= localhost
NAME     ?= ${DOMAIN}

CAKEY    ?= CAkey.key
CACERT   ?= CAcert.pem

SIGN_REQ ?= ${NAME}.csr
CERT     ?= ${NAME}.crt
PEM      ?= ${NAME}.pem
KEY      ?= ${NAME}.key

CA = "/C=US/ST=NY/O=/localityName=City/CN=Hauleth/emailAddress="

SUBJECT = "/CN=*.${DOMAIN}"

verify: ${PEM} ${CACERT}
    openssl version
    openssl x509 -noout -text -in "$<"
    openssl verify -verify_hostname ${DOMAIN} -CAfile ${CACERT} $<
    openssl verify -verify_hostname test.${DOMAIN} -CAfile ${CACERT} $<

clean:
    $(RM) -f "${CERT}" "${SIGN_REQ}" "${PEM}" "${KEY}"

${CAKEY}:
    openssl genrsa -out "$@" 2048

${CACERT}: ${CAKEY}
    openssl req -subj ${CA} -x509 -new -nodes -key "$<" -sha256 -days 1825 -out "$@"

installCA: ${CACERT}
    security import "$<"
    security add-trusted-cert "$<"

cleanCA:
    security remove-trusted-cert "${CACERT}"
    $(RM) -f "${CACERT}" "${CAKEY}"

config.conf:
    echo 'subjectAltName=$${ENV::SAN}' > "$@"

${KEY}:
    openssl genrsa -out "$@" 2048

${SIGN_REQ}: ${KEY}
    openssl req -new -sha256 -subj $(SUBJECT) -key "$<" -out "$@" \
        -addext "subjectAltName=DNS:${DOMAIN},DNS:*.${DOMAIN}"

${CERT}: ${SIGN_REQ} ${CACERT} ${CAKEY} config.conf
    SAN="DNS:${DOMAIN},DNS:*.${DOMAIN}" \
        openssl x509 -req -out "$@" -in ${SIGN_REQ} \
        -CA ${CACERT} -CAkey ${CAKEY} -CAcreateserial \
        -days 1825 -sha256 \
        -extfile config.conf

${PEM}: ${CERT} ${KEY}
    cat ${CERT} ${KEY} > "$@"

.PHONY: clean verify install installCA cleanCA

Which in short creates local CA certificate and key and then generate certificate signed by that CA.

It works when I want to connect to the server with the certificate via localhost, but when I try test.localhost then it states that the certificate do not match.

$ openssl verify -verify_hostname test.localhost -CAfile CAcert.pem localhost.pem
CN = *.localhost
error 62 at 0 depth lookup: Hostname mismatch
error localhost.pem: verification failed

The checking of the hostname is done in X509_check_host. This function calls the internal function valid_star to make sure that the given wildcard in CN or SAN can actually be used.

This function checks that wildcard-CN/SAN  like  * or *.com are treated as invalid since they are too broad. *.example.com is instead acceptable. Thus check is done by counting the dots inside the name and make sure that at least two dots are in there:

/*
 * The final label must not end in a hyphen or ".", and
 * there must be at least two dots after the star.
 */
if ((state & (LABEL_START | LABEL_HYPHEN)) != 0 || dots < 2)
    return NULL;

Based on this *.localhost is treated as a too broad wildcard specification and will not be used for the wildcard match. If you instead run your Makefile with DOMAIN=example.com it should be fine since this will result in a name of *.example.com which has two dots.


Adblocker versus denied hosts list? I came across the idea of adding many domain names to an hosts list to prevent "malvertising" (malware hidden in ads). How does this compare to using an adblocker?

Using an host files seems better to me at first sight, but are there performance concerns with a very large list? Is there a reason why adblocker might be better?

It's most a tradeoff between management effort and easy of use.

An adblocker will usually run inside the browser, and have some performance impact. They will use memory and CPU time to parse the incoming HTML data, search his internal database to match ads, and remove them from the page. All that incurs some performance penalty. The biggest benefit is that it is a fire-and-forget approach: you choose the adblocker, install it, and it's done.

On the other hand, a hosts file (or DNS server like PiHole) will work on network level. All requests from the blacklisted domains will return an invalid or unreachable address (configurable), so the client will not spend any resources blocking anything. As it works at network level, every program on your computer, and every computer on your network will be protected.

On the downside, it needs more administration. If you install PiHole, you need to be comfortable with installing Linux services, will probably need a dedicated device, and will need to manage this device to keep it running.

If you keep a hosts file, you will need a script or program to manage it and keep it updated. Performance impact will be way less than running a program inside the browser to parse HTML using regex.


Is Bluetooth low energy (BLE) still secure? Some time ago, Bluetooth was hit by a severe exploit (KNOB attack) that rendered its encryption pretty much useless. Publishers like the German Heise summarized it in an article* as an issue in the firmware of Bluetooth radio affecting BR/EDR only. Therefore, BLE appears to be still secure. My question is if that's really the case and can I assume data-stream connections using BLE's L2CAP to be a secure communication channel (working encryption)? Moreover, is such a connection secured against typical MITM attack like replay attacks etc.?
*https://www.heise.de/newsticker/meldung/KNOB-Attack-Schwerer-Konzeptfehler-in-Bluetooth-4499499.html

I found the answer. It's insecure. Both classic and LE are affected by KNOB attack and the session key can be downgraded. See  https://francozappa.github.io/publication/knob-ble/
So, make sure to use another extra TLS layer ...


Is posting Windows dumpfiles online a privacy or security threat? I have a Windows 10 machine that keeps crashing. I am thinking of posting the dump files (.dmp) publicly online for help. Can this be a security or privacy concern, and if yes, how can I censor the information to mitigate the threat?

Please consider: Microsoft collects such files via Windows Error Reporting and companies can get access to those files collected by Microsoft by signing an NDA. Microsoft takes actions to only make the crash dumps available to companies who can prove that it's their driver that causes the crash. It requires a digital certificate to do so.

You would post that information for everyone publically, so I'm glad you care. Personally I'd not post such a file on the Internet.

It requires only a few commands to get the most important information out of it, if you have an Internet connection. The output of

.symfix c:\symbols
.reload /f
!analyze -v

and removing the line that contains ANALYSIS_SESSION_HOST should suffice for someone to either solve the problem or give more instructions on what is needed. It may take a few moments longer for asking and answering, but using above steps gives you human readable text that you can check for sensitive data.

The most important data is such a line:

BugCheck 117, {fffffa80188fb4e0, fffff88004248e9c, 0, 0}

If you still consider posting it, here's what it may contain: An OS crash (bluescreen) will generate a kernel dump. Such a dump contains

crash information (exception information),
processor information,
the executables that are running,
crash time and uptime of your PC,
the drivers you loaded and
potentially all contents of physical RAM (everything what is in memory at the time of the crash).

This may give hackers an attack vector: given they find your IP address and they know the version of a vulnerable driver you have in use, they might start attacking.

However, it heavily depends on the settings with which the crash dump was captured. By default it will be "Small memory dump (256 kb)" (on Windows 7 at least), so it does not contain all information from RAM but only a very small subset which is related to the crash. This may still include drivers and version numbers. Usually the small crash dump is sufficient to solve problems.

If you have a full kernel crash dump, you can convert it into a small one using WinDbg and the .dump command, so you'll finally have the original full dump and a small dump.

Example information contained in a small kernel dump:

Windows 7 Kernel Version 7601 (Service Pack 1) MP (4 procs) Free x64
Product: WinNt, suite: TerminalServer SingleUserTS
Built by: 7601.23418.amd64fre.win7sp1_ldr.160408-2045

Debug session time: Sun Jul  3 15:37:39.242 2016 (UTC + 1:00)
System Uptime: 0 days 6:59:28.965

0: kd> lmDvmAtihdW76
start             end                 module name
fffff880`04f5f000 fffff880`04f7b000   AtihdW76   (deferred)
    Image path: AtihdW76.sys
    Image name: AtihdW76.sys
    Browse all global symbols  functions  data
    Timestamp:        Wed Feb 24 19:28:17 2016 (56CDF641)
    CheckSum:         000201BA
    ImageSize:        0001C000
    Translations:     0000.04b0 0000.04e4 0409.04b0 0409.04e4

So I can find out that in July I was using the ATI graphics card with a driver AtihdW76.sys from February. That might already suffice for an attack, if I leave other traces, e.g. your IP.

Note that this information is not included in the textual output of !analyze -v, so it seems not relevant for the analysis:

0: kd> !analyze -v
*******************************************************************************
*                                                                             *
*                        Bugcheck Analysis                                    *
*                                                                             *
*******************************************************************************

VIDEO_TDR_TIMEOUT_DETECTED (117)
The display driver failed to respond in timely fashion.
(This code can never be used for a real bugcheck.)
Arguments:
Arg1: fffffa80188fb4e0, Optional pointer to internal TDR recovery context (TDR_RECOVERY_CONTEXT).
Arg2: fffff88004248e9c, The pointer into responsible device driver module (e.g owner tag).
Arg3: 0000000000000000, The secondary driver specific bucketing key.
Arg4: 0000000000000000, Optional internal context dependent data.

Debugging Details:
------------------

DUMP_CLASS: 1
DUMP_QUALIFIER: 400
BUILD_VERSION_STRING:  7601.23418.amd64fre.win7sp1_ldr.160408-2045
DUMP_TYPE:  2
BUGCHECK_P1: fffffa80188fb4e0
BUGCHECK_P2: fffff88004248e9c
BUGCHECK_P3: 0
BUGCHECK_P4: 0

FAULTING_IP:
atikmpag+ce9c
fffff880`04248e9c ??              ???

DEFAULT_BUCKET_ID:  GRAPHICS_DRIVER_TDR_TIMEOUT
TAG_NOT_DEFINED_202b:  *** Unknown TAG in analysis list 202b

CPU_COUNT: 4
CPU_MHZ: c25
CPU_VENDOR:  GenuineIntel
CPU_FAMILY: 6
CPU_MODEL: 2a
CPU_STEPPING: 7
BUGCHECK_STR:  0x117
PROCESS_NAME:  System
CURRENT_IRQL:  0
ANALYSIS_SESSION_HOST:  REMOVETHIS
ANALYSIS_SESSION_TIME:  12-09-2016 19:03:01.0993
ANALYSIS_VERSION: 10.0.14321.1024 amd64fre

STACK_TEXT:
fffff880`05bad2c0 fffff880`044b27e7 : fffffa80`188fb4e0 00000000`00000024 fffffa80`182fc800 fffff880`044b2488 : watchdog!WdDbgReportRecreate+0xa3
fffff880`05bad7e0 fffff880`044b2c1e : 00000000`00001000 fffff8a0`3dd1c8e0 00000000`00000008 00000000`00004000 : dxgkrnl!TdrUpdateDbgReport+0xcb
fffff880`05bad830 fffff880`044b3ed2 : fffffa80`188fb4e0 fffffa80`188fb4e0 fffffa80`182fc800 fffffa80`0dd73410 : dxgkrnl!TdrCollectDbgInfoStage1+0x2e6
fffff880`05bad8d0 fffff880`0455bfbf : fffffa80`188fb4e0 00000000`00000000 fffffa80`182fc800 fffffa80`0dd73410 : dxgkrnl!TdrIsRecoveryRequired+0x17a
fffff880`05bad900 fffff880`04585d09 : 00000000`ffffffff 00000000`00189d69 00000000`00000000 00000000`00000002 : dxgmms1!VidSchiReportHwHang+0x40b
fffff880`05bad9e0 fffff880`0458444f : 00000000`00000102 00000000`00000000 00000000`00189d69 00000000`00000000 : dxgmms1!VidSchiCheckHwProgress+0x71
fffff880`05bada10 fffff880`045572e6 : ffffffff`ff676980 fffffa80`0dd73410 00000000`00000000 00000000`00000000 : dxgmms1!VidSchiWaitForSchedulerEvents+0x1fb
fffff880`05badab0 fffff880`0458400e : 00000000`00000000 fffffa80`182fc800 00000000`00000080 fffffa80`0dd73410 : dxgmms1!VidSchiScheduleCommandToRun+0x1da
fffff880`05badbc0 fffff800`03713bc6 : 00000000`02c4d1a9 fffffa80`0ddb5060 fffffa80`0ca00720 fffffa80`0ddb5060 : dxgmms1!VidSchiWorkerThread+0xba
fffff880`05badc00 fffff800`0346d6a6 : fffff800`035fae80 fffffa80`0ddb5060 fffff800`03608cc0 fffffa80`0da82d90 : nt!PspSystemThreadStartup+0x5a
fffff880`05badc40 00000000`00000000 : fffff880`05bae000 fffff880`05ba8000 fffff880`05bac2b0 00000000`00000000 : nt!KxStartSystemThread+0x16

STACK_COMMAND:  kb
THREAD_SHA1_HASH_MOD_FUNC:  711770ee3782c8990d4679145cf9108ec8a862f4
THREAD_SHA1_HASH_MOD_FUNC_OFFSET:  cc3ee750d9914b4f5449ea07474e889f95552a7e
THREAD_SHA1_HASH_MOD:  36a574ce8074060aba5fc87a076613c500071d03

FOLLOWUP_IP:
atikmpag+ce9c
fffff880`04248e9c ??              ???

SYMBOL_NAME:  atikmpag+ce9c
FOLLOWUP_NAME:  MachineOwner
MODULE_NAME: atikmpag
IMAGE_NAME:  atikmpag.sys
DEBUG_FLR_IMAGE_TIMESTAMP:  56effafd
FAILURE_BUCKET_ID:  X64_0x117_IMAGE_atikmpag.sys
BUCKET_ID:  X64_0x117_IMAGE_atikmpag.sys
PRIMARY_PROBLEM_CLASS:  X64_0x117_IMAGE_atikmpag.sys
TARGET_TIME:  2016-07-03T14:37:39.000Z
OSBUILD:  7601
OSSERVICEPACK:  1000
SERVICEPACK_NUMBER: 0
OS_REVISION: 0
SUITE_MASK:  272
PRODUCT_TYPE:  1
OSPLATFORM_TYPE:  x64
OSNAME:  Windows 7
OSEDITION:  Windows 7 WinNt (Service Pack 1) TerminalServer SingleUserTS
OS_LOCALE:
USER_LCID:  0
OSBUILD_TIMESTAMP:  2016-04-09 07:46:22
BUILDDATESTAMP_STR:  160408-2045
BUILDLAB_STR:  win7sp1_ldr
BUILDOSVER_STR:  6.1.7601.23418.amd64fre.win7sp1_ldr.160408-2045
ANALYSIS_SESSION_ELAPSED_TIME: 493
ANALYSIS_SOURCE:  KM
FAILURE_ID_HASH_STRING:  km:x64_0x117_image_atikmpag.sys
FAILURE_ID_HASH:  {fa4b6286-8c4a-e9c2-c89f-5612619e000e}
Followup:     MachineOwner
---------


Are weak passwords acceptable for internal development? We have a number of internal development environments that use weak passwords in the Auth and SQL components; particularly using passwords such as "password" or "Password1".

These are obviously changed for UAT and Production environments but how guilty should we feel about relaxing our habits for the sake of ease while developing solutions?

It is all a matter of trust and/or accountability. If your internal environment is completely secure/separated from the internet you can, but it is not generally a good idea.

Example: What happens if an employee is let go? Can you trust that person then? If attached to the internet that is very bad and I have seen it happen in companies I have worked for in the past.

-

Response to comments for clarity:

Stronger than 'password' or 'Password1' does not necessarily mean extremist. For production environments I ask my people to do better than that but not requiring codes bordering on extreme or ridiculous unless it is banking data or there is a high security risk.


Can a weak password generate the same hash as a strong password? Conventional password advice encourages the use of long passwords with the rationale being hashing the entire password space (rainbow table or brute force) takes longer with each character added.

With current/secure hashing algorithms, bcrypt or similar, and dynamic salts, is it even remotely possible that "A super long passphrase, and easy to remember!" could be cracked by brute force because "Rand0m" coincidentally produces the same hash?

I'm aware this is statistically beyond having the same hash as a coworker. I am wondering if any password hashing algorithms have ever been shown to produce the same hash for different levels of entropy, therefore making a very strong password potentially breakable by brute force via a weaker one, and if the modern algorithms actively protect against this.

A bcrypt hash is 184 bits, so there are 2^184 possible hashes. That is way more than the number of atoms in the earth. You picking a password with a hash that matches another hash is like me picking a random atom in the earth, and then you by accident picking that exact same atom! You are literally more likely to die from a comet hitting earth tomorrow.


How do you remotely BOF without knowing source code? I have two questions.

Note that I have very basic understanding of how BOF works, but don't know the exact mechanism or anything beyond what an ordinary computer user knows.

My understanding of BOF is that for every program there's a bucket that can hold memories. Like, let's say there is an input A, and it can hold 16 letters.

And if you put 16 A's in there and then put a command after like:
A = AAAAAAAAAAAAAAAAsudo poweroff
and the computer should shutdown if it is found vulnerable. (or something similar, don't try to go too deep since I won't understand)

However, you don't know how much the bucket can hold. You should be able to know the size of the bucket if you've seen the source code, but if you intend to attack an unknown remote server, you shouldn't know anything about it, or even anything about what programs the server uses.

How do you find out how you should BOF without knowing the source code or any knowledge about the server?

And another question. How do you find inputs and send inputs to remote PC's? I've heard of famous worms like sasser or conficker, and apparently it sends some kind of codes to other PC's, but regular PC's shouldn't have any servers running. If they run servers, there might be some inputs that can be vulnerable to BOF, but how does regular PC's take malicious codes from online and get pwned?

I only want to understand how things work.

Your understanding of BOF is not accurate, i would suggest reading the exploitation chapter in The Art of Exploitation to get better understanding .

Now regarding exploiting an application without knowing the source code , you can do this with a process called "Fuzzing" which involves sending variable length arbitrary data to where the application is expecting an input and monitor the app's reaction -using a debugger - (you will have to deploy the vulnerable
app on a local machine first so you can develop your exploit )
Once you're exploitation code is finished, you can deploy the attack against the remote machine (assuming it's not protected with some protection mechanism such as ASLR )  .


Wayback machine downloading a file called default.exe? When I look up a site on wayback machine, I click through a couple of links on the site, and then instead of loading the page, it downloads a file called "default.exe".
Since I was expecting a page to load, not an .exe to download, it roused suspicions.
Is this a common thing, and is there any way to figure out what's going on?
I'm 99% sure the site that wayback machine indexed wouldn't have tried to download an exe, although I could be wrong. The archived site is ~20 years old and was running on free hosting at the time (perhaps serving exe's was common back then)

That might also be a snapshot of a misconfigured web server -- back then it was normal to generate web pages from CGI programs, which would be addressed as if they were regular files, and only their location or an "executable" bit set on the binary would indicate to the web server that the file should be executed and its output sent instead of the file itself.
It could also be a twenty years old virus.


Computer decryption algorithms and knowing the solution This is a general question about using computers to decrypt information. It has puzzled me for a while.

The question is really two parts:

How does a computer check if a "guessed" key is the correct key? A human could do it because the result is readable - to humans. SO what does it mean to say the computer is checking a key?
How does the alogirthm know it has found the correct key? For example if  the computer just brute force checks possible keys one-by-one (if it uses a better algorithm for this it isn't so relevent), at what point does it stop and say "this is the key and message!"?

Taking your two questions:

If the expected plaintext is ordinary text, then the computer will look at letter frequencies for the expected language.  If the plaintext is some sort of file, say a spreadsheet, then the computer will look to match the format of such a file, usually the header.  Again, frequency statistics may help; a bitmap file with lots of white space will contain many more 0x00 bytes than a random file would.
It doesn't.  It finds a decryption that seems to fit the expected pattern, or one that deviates significantly from random.  It would be up to a human to determine if this was correct, or just a false positive.


gpg - Cannot import public key from asc file I'm using Windows 10 Home with GPG version 2.2.19.

Whenever I try to import the asc file for Tor Browser using the command gpg --import torbrowser-install-win64-9.0.7_en-US.exe.asc, I get this fancy error:

gpg: no valid OpenPGP data found.

Likewise, this also happens when trying to verify the installer itself with the key file by using the command gpg --verify torbrowser-install-win64-9.0.7_en-US.exe.asc torbrowser-install-win64-9.0.7_en-US.exe:

gpg: Signature made 03/22/20 10:42:09 Eastern Daylight Time
gpg:                using RSA key EB774491D9FF06E2
gpg: Can't check signature: No public key

Trying the answers in the tons of other guides here haven't helped whatsoever. Can I get some help?

The .asc file contains the signature. To verify it, you need three things:

The signed file (your tor browser download)
The public key it was signed with
The .asc file itself

You do already have the signed .exe file and the signature. Next you must fetch the public key. You can do this automatically with the following command:

gpg --auto-key-locate nodefault,wkd --locate-keys torbrowser@torproject.org

This is the output of the command on my machine:

gpg: key 4E2C6E8793298290: public key "Tor Browser Developers (signing key) <torbrowser@torproject.org>" imported
gpg: Total number processed: 1
gpg:              imported: 1
pub  rsa4096 2014-12-15 [C] [expires: 2020-08-24]
     EF6E286DDA85EA2A4BA7DE684E2C6E8793298290 uid
          [ unknown] Tor Browser Developers (signing key) <torbrowser@torproject.org
sub  rsa4096 2018-05-26 [S] [expires: 2020-09-12]

Comparing the fingerprint with the fingerprint posted on the tor website is a good idea at that point.

Next you export the public key to a keyring:

gpg --output tor.kr --export 0xEF6E286DDA85EA2A4BA7DE684E2C6E8793298290

This command uses the currently valid fingerprint to identify the key, which it needs to export. A future reader might have to use another one, if the key has changed in the meantime.

Finally you can verify the signature with the following command:

gpgv --keyring tor.kr torbrowser-install-win64-9.0.7_en-US.exe.asc torbrowser-install-win64-9.0.7_en-US.exe

The output will tell you, if the signature verification worked. Hopefully you see something like this:

gpgv: Signature made So 22 Mar 2020 10:37:51 EDT
gpgv:                using RSA key EB774491D9FF06E2
gpgv: Good signature from "Tor Browser Developers (signing key) <torbrowser@torproject.org>"

In case it failed, it will look something like this instead:

gpgv: Signature made So 22 Mar 2020 10:37:51 EDT
gpgv:                using RSA key EB774491D9FF06E2
gpgv: BAD signature from "Tor Browser Developers (signing key) <torbrowser@torproject.org>"


Self-signed certificate for a IdP-initiated SAML SSO We act as a Service Provider in a SAML SSO integration with our customers. During the dev and stage testing, we usually exchange metadata files and SSO endpoints.

When forming our metadata we use the openssl command-line tool to generate a self-signed certificate which we set the value of the X509Certificate node to:

openssl genrsa -out server.pem 1024
openssl req -new -key server.pem -out server.csr
openssl x509 -req -days 365 -in server.csr -signkey server.pem -out server.crt

Now, the question is, when going to production, should we obtain a legit certificate from a third-party, or we can simply regenerate a new self-signed certificate? What potential security or other implications could we have if use a self-signed one?

Note: we, as a service provider, don't send SAML messages in this kind of IdP-initiated setup.

Using Python, Django and djangosaml2 package (if this is relevant).

TL;DR: Self-signed certificates are fine, and even recommended at least in some contexts. Use long validity times to avoid key rollover problems, and if RSA, use at least 2048-bit keys.

SAML 2.0 includes the certificate that should be used for signature validation and as an encryption recipient as a part of the SAML metadata (technically, within the EntityDescriptor).

The entity that uses the metadata is supposed to validate the metadata in a "known good" way. This could, for example, be by only downloading it over a trusted channel (for example through HTTPS with normal certificate validation), or by storing a copy of the metadata locally having obtained and verified it in some other trusted manner.

In practice, metadata tends to also be XML signed, which provides an additional layer of integrity validation above and beyond the protection afforded by for example HTTPS. (This is a good thing particularly given how many implementations appear to require actually manually downloading and storing metadata in places where it could easily be modified, accidentally or maliciously. At least then the XML signature fails to validate, causing the metadata to be rejected rather than potentially incorrect metadata to be used.)

If you are unable to exchange SAML metadata while ensuring the integrity of said metadata, then you have a significant bootstrapping problem, to the point that I'm not even sure it's possible to use SAML in a secure manner. If you can't trust the certificate that is part of the metadata, that implies that you cannot trust anything else in the metadata either, including for example the endpoint URIs.

If you are able to exchange SAML metadata while ensuring its integrity, then by definition it contains a trusted certificate blob, which is intended (subject to restrictions stated in the metadata) to be used to:

Validate the signature on any incoming SAML data, including authentication requests and authentication responses, from the entity for which the metadata is generated
Serve as a recipient key for encrypted SAML data to the entity for which the metadata is generated (note that encrypted SAML XML is not supported by all implementations)

As that certificate (from the trusted metadata) is by definition trusted, using a CA-signed certificate provides no significant benefit over using a self-signed certificate. There is thus no reason to use a CA-signed certificate, and some reason not to (for example, on Internet2 it is recommended to use certificates with at least 10 years validity; I'm not aware of any commercial CA providing certificates with that long validity).

To mention but one admittedly somewhat anecdotal example, Microsoft's Active Directory Federation Services (ADFS) appears to be perfectly happy about self-signed certificates in SAML metadata; I have done on the SP side pretty much exactly the same that you have, in testing, with ADFS acting as the IdP.


User name and password is passed in custom headers Is it safe to pass username and password in two separate custom header tags in Web services/Web application Post request over https.

How is it different from using from Authorization header.

Which is more safe and what is the difference between passing credentials in header or in the POST body request?

Can is be considered safe to pass sensitive information in the custom header.

The Authorization header is often treated specially by reverse proxies, IDS/IPS, firewalls, web caches, web servers, etc. in regard to information disclosure. The primary concern here is that headers may be logged or cached by intermediate systems if your architecture is more complex than just a single web server running over HTTPS.

If you're just running something simple like an Apache or nginx server with no special logging then I wouldn't consider using an alternative header to be a security issue. In such a setup it's no different to using Authorization or Cookie headers in terms of security.

In general if you have the option to pass sensitive data in a POST request instead of in a header, do so. POST bodies are almost never logged except in debugging scenarios. You also have the benefit of the browser's automatic prompts to avoid accidental resubmission of a form using the browsing history buttons (back, forward), whereas a GET with an authentication header will not trigger this mechanism.


Storing passwords for personal app I am currently writing a script on a raspberryPi (in python) to automate some tasks in online accounts. While some of these online accounts have nice APIs I can use, others do not and I have to resort to using mechanize to scrape them. This presents the problem of having to store login information. I don't want to store them as plaintext, and storing in RAM would be tedious to type in every password every time I boot the pi.

My question then is, what is the best way to go about this? Searching through previous posts indicates that hashing it would be best. However, there is then no way to actually recover the passwords from the hash to login to each website. The passwords must be submitted to the web form as plaintext (just like a normal login). Any help would be appreciated.

The idea of password storage is to make it as hard as possible for an attacker to get it because you can't ever stop them from getting it altogether. You are correct that hashing is not what you want because hashing is making sure that 2 inputs are the same (i.e. useful for verifying that a user knows the password), not for storing passwords in the way you are talking about it.

What I would do in your situation is one of two things:

Try to remove the need of the passwords, can you log in manually and then keep the session key alive or have it so the program looks at a password file that you then delete (remember saved files leave ghosts of themselves, so maybe have the file on a usb stick that can be destroyed if you are that security conscious)
Protect the password file, this can be done using the user access
stuff on Linux (make it read only for only the user who is running
the program and then have good password on that user account) but
you should also have some encryption over the file too because user
access can be gotten around by manipulating the storage media
directly. I can't help you with suggesting encryption methods but it
would be something you would enter a password to decrypt so the
program can read it and put it into memory. An SQLite database would be one way to get access control and encryption with (relatively) little setup.


SSH MITM attack underway UPDATE: The source of this problem has thankfully turned out to be a buggy mobile SSH client used on 2 different devices not a MITM attack. However, I'd still appreciate a full answer to the original question: Namely, in the event of a genuine MITM attack, what steps should an administrator take after detecting it? Does the presence of a genuine MITM attacker effectively make SSH access to that server impossible for as long as they attempt to intercept traffic? Is changing the sshd port sufficient as a response?

ORIGINAL QUESTION:
I'd appreciate some advice on what steps I should take in dealing with this.

On attempting to connect to my home server today over SSH using pub key auth (password access is disabled), I received the 'fingerprint has changed' message. As I have a copy of the server's public key fingerprint on me, I can see they don't match.

Does this mean I am unable to connect to the server over SSH indefinitely without jeopardising security? Can I combat the attack in any way? While I've always been aware of the potential for SSH MITM attacks, and there is plenty of reading available on detecting such an attack, I cannot find any advice on countering / dealing with it once it's underway.

Thank you in advance.

UPDATE: The SSH host's public key and the copy I have are identical. But when connecting remotely (using either DDNS or direct IP), the 'Authenticity of host can't be established' message shows a different fingerprint to the server's. I need advice on how I connect to the server via SSH from now on in light of somebody potentially doing something nefarious. Do I simply change the SSH server port? Should I generate new keys?

If you have physical access to the server, then log on its console and see if the server's public key has indeed changed. If it has changed, then try to work out why; if it has not, then this means that when you try to connect to your server with SSH you are actually talking to another machine, possibly because of an ongoing attack attempt, but more probably because of some routing or DNS misconfiguration.

For hosted servers, the provider should offer some IP-based KVM or rescue system which would be equivalent to physical access (in that context).


Bypassing WS.Reputation.1 (Norton) So, I tried to create a backdoor on my own using python (for a course), as veil kept getting detected. All went well on my windows 10 VM and my old windows 7 laptop. However, when I copied the .exe file to my windows 10 machine, Symantec detected it using "WS.Reputation.1" and moved it to quarantine.

Can someone tell me what exactly causes this to get triggered? Is there any way that I can increase its "reputation score"? Or maybe bypass this through code or pyinstaller arguments?

Thanks in advance!

WS.Reputation.1 detects files and performs analysis on with data from Norton community of users (If you've installed Norton product, there is a checkbox requesting if you like to opt in to Norton community watch program'), the analysis are matched against the crowd data and a scoring are placed. If there's a low reputation score then therefore are likely to be security risks. The tech behind it are Norton's reputation-based security technology.

Excerpt from Norton:

  The reputation-based system uses "the wisdom of crowds" (Symantec’s tens of millions of end users) connected to cloud-based intelligence
  to compute a reputation score for an application, and in the process
  identify malicious software in an entirely new way beyond traditional
  signatures and behavior-based detection techniques.

As for in depth explanation of how the technology works and how it gets triggered. It relies on a number of factors (based on what I know so far.)

1. Newness
How new is the file observed in the community.

2. Digital Signature
It looks for signed files. Custom or home grown application should be digitally signed with class three digital certificates.

3. Heuristic
What exactly does the file procedure calls. Does it write to registry? Start parent-child processes? Accessing windows protected folder?

Something you want to consider for reducing the chance of being detected. That said I believe over here is not a place to discuss in detail about "bypassing" any technologies.  :)

What can you do as a tester or developer.
You might want to reduce Norton protection level settings to allow FP-averse conditions or test environment. And also Age & Prevalence settings to allow "new" unknown files.

Secondly as you're developing a test file there's no need to submit to the AV team as a false positive. Plus you're testing a backdoor so no way they are adding that to a whitelist. But of course you may do your part in perhaps providing better detections for future AV detections.


If malware does not run in a VM why not make everything a VM? There is a lot of malware that can detect whether it is running inside a VM or sandboxed environment and if such environment is detected it can conceal it self and not execute. So why not make everything a VM? Now all systems are safe!
I know not all malware does this but considering that there are many cloud services these days that run on VMs in remote servers does that mean that they are all immune to these types of malware?
I am aware that not all cybersecurity threats involve malware but the focus of this question is mainly on malware attacks.

One has to take into account why the malware is doing this distinction in the first place.
Some malware does not run in the VM because the chance is high that this VM is used for inspecting the malware (i.e. some security researcher) since most normal users don't use a VM. But if everybody is using a VM then the chance is low that the VM is used for inspecting. This means there is no real reason anymore to use this kind of simple heuristic to distinguish between a potential security researcher and a victim. Therefore this heuristic will be considered useless and a different one will be used in the future. Which means that future malware will also run inside a VM.
Note that there are also other heuristics, like checking if specific tools often used by researchers are installed on the system. Now, why not just let everybody install such tools in order to disable malware? Same reason: the heuristic will be no longer used by the malware authors since it no longer works reliably enough.


Building access card that has an identification role The main question is should a building access card have the corporate logo on it?

In this organization, the employee ID card is separate from building access card.
We currently do not have the logo on it, nor a "drop in any mailbox" message.
All that is on it, is a photo, first, last, color-coded frame and the manufacturer's serial number of the card. The manufacturer's logo is on there, but very small with the copyright symbol.

Most people do not think the cardholder is an employee of HID.

I do not see an issue with not having a corporate logo on your access card  nor do I see an issue with not having  "a drop in any mailbox" message on them. The reason being that if someone loses their card, it will be impossible or very hard to find out for which building the card is used.

Also in the event someone wants to perform a targeted attack, forging a logo on a key card will be the easiest thing to do.

There are other points which are more important. For instance if someone loses a card, can you block it? Normally these cards just hold a token which is checked at the door against a list of authorized tokens.  It is imperative that you can track all cards and block them immediately in case of theft or when someone loses them. So when a card goes missing you need to immediately remove the token from the authorized tokens list.

I think people thinking you aren't an employee if you only have the key card isn't necessarily a bad thing if you are supposed to have two forms of id on you (employee and key card).


How to get public prime from DHE from TLS v1 DHE-RSA x.509 certificate? I can view the certificate using

  openssl s_client -showcerts -connect www.masaood.com:443 </dev/null

I can view the public key of a RSA, but cannot find any information for DHE:

  openssl s_client -showcerts -connect www.masaood.com:443  </dev/null | openssl x509 -pubkey -noout

How do I view the prime number and base g of the DHE protocol in the certificate with OpenSSL or any information of the DHE shared key exchange?

I don't think you can do this with any openssl command line program. At most you might use -debug option with openssl s_client so that it shows you all the transferred data as hex and then you can try to figure out what this means. It is far easier to use Wireshark to sniff the connection and then look at all the handshake details. This gives you also the DH parameters you want to know:


Link to download the ISO 27002 clauses Which link is authentic to download ISO 27002 clauses. I am not seeing a web page / PDF for the list of 133 controls to go through

You can buy the standard in PDF at http://www.iso.org/iso/catalogue_detail?csnumber=54533 for CHF 178
or
Check the below link for entire toolkit containing all you need. For just list of Controls look for SoA document.  http://www.iso27001security.com/html/iso27k_toolkit.html

Also please note that now there are 114 controls in 14 groups; the old standard had 133 controls in 11 groups. Refer https://en.wikipedia.org/wiki/ISO/IEC_27001:2013


Starting a secure php session I have been looking into creating secure php sessions for use in a login script for a week or so now. So far I have not found a concrete resource to base my work off, reading StackOverflow all I have seen is mixed views and opinions.

I decided to dive in and give writing a function to begin the session a go.

With extensive reading and watching Samy Kamkar's presentation from DEFCON on Youtube I am fairly confident and pleased with the first piece of this system I have written.

$session_name = 'sec_session_id'; // Set a custom session name
$secure = false; // Set to true if using https else leave as false
$httponly = true; // This stops javascript being able to access the session id
ini_set('session.use_only_cookies', 1); // Forces sessions to only use cookies.
ini_set('session.entropy_file', '/dev/urandom'); // better session id's
ini_set('session.entropy_length', '512'); // and going overkill with entropy length for maximum security

$cookieParams = session_get_cookie_params(); // Gets current cookies params.
session_set_cookie_params($cookieParams["lifetime"], $cookieParams["path"], $cookieParams["domain"], $secure, $httponly);
session_name($session_name); // Sets the session name to the one set above.
session_start(); // Start the php session

This will be used with SSL for the sake of development it's not...

So my question is where can I improve on this script, have I missed anything, what should I look into next...

This looks pretty good. I can't see any glaring holes, except for the fact that SSL (https only) is switched off - though you mentioned that it'll be switched on in production.

You may also want to look into HTTP Strict Transport Security (HSTS) and Content Security Policy (CSP) (details / intro) for increased security.


Security of NoSQL databases Hopefully this isn't too broad.

I've got little experience with NoSQL databases, but I know that they are rising in popularity.  As a developer that is extremely concerned with security, I'm wondering, in general, what the pros and cons are from a security perspective when it comes to using NoSQL databases.

For example, are they safe in general? Are they vulnerable to the same types of attacks that are a threat to traditional Relational databases?  Are there new vulnerabilities associated with them that someone like me - with only relational DB experience - might never have heard of? And are there best practices/recommendations for NoSQL databases like those you can easily find for relational databases?

NoSQL is vulnerable the same way SQL databases or LDAP databases are vulnerable like. When a language is used to program an application and you interface to a database, you will need to put information into the database.

The danger with any of the products is that a user can include code instead of information. This is not dependent on the type of database or language used.

When you get user-input you need to make sure that you sanitize it to prevent code inclusion from happening. The problem with NoSQL databases is that often there are not yet or not deeply enough tested API's for your language available. This means that you will need to write it yourself. This is dangerous as there might always be something you look over the head. I want to refer you to OWASP - Insecure Direct Object References

I know there have been concerns about, for instance MongoDB, on the standard authentication mechanism that is being used towards the database itself. This is more an issue of not exposing your database itself to untrusted sources directly. For instance this is as if you would allow a user of your website to directly connect to your MySQL database. While this may still have a great impact, the likelihood of getting your database compromised like this is low and does not depend on your webapplication.


XMLHttpRequest CSRF fails with allowed CORS I'm currently working on a PoC for a CSRF attack, which should be possible due to the lax CORS configuration. I have a permission to attack.

Now the following code should send a OPTIONS request, which includes all the details required by the browser to send the actual CSRF.

<html>
<head>
</head>
<body>
    <script>

    function createCORSRequest(method, url){
    var xhr = new XMLHttpRequest();
    if ("withCredentials" in xhr){
        xhr.open(method, url, true);
    } else if (typeof XDomainRequest != "undefined"){
        xhr = new XDomainRequest();
        xhr.open(method, url);
    } else {
        xhr = null;
    }
    return xhr;
    }

    var url = 'https://api.example.com/path';
    var xhr = createCORSRequest('POST', url);
    xhr.withCredentials = true;
    xhr.setRequestHeader('Content-Type', "application/json");
    xhr.send("EXAMPLE");

    </script>
</body>
</html>

The browser sends a OPTIONS request and the server answers accordingly:

OPTIONS request:

OPTIONS /path HTTP/1.1
Host: api.example.com
User-Agent: Agent
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Access-Control-Request-Method: POST
Access-Control-Request-Headers: content-type
origin: null
Connection: close
Cache-Control: max-age=0

Response:

HTTP/1.1 200 OK
Access-Control-Allow-Headers: Accept, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization
Access-Control-Allow-Methods: POST, GET, OPTIONS, PUT, PATCH, DELETE
Access-Control-Allow-Origin: *
Date: Fri, 21 Sep 2018 07:25:06 GMT
Content-Length: 0
Connection: close

But the actual POST request is never sent.
I'm not very good with JS and stitched the XHR part together from different StackExchange posts. A variation of this worked for me for a different web-application.

Why doesn't the browser send the CSRF POST request?

I've identified the issue. The CORS settings don't allow "withCredentials" as the server doesn't respond with Access-Control-Allow-Credentials: true, which is why the POST request isn't made.

Furthermore, as stated by @Matthew, with a wildcard for Access-Control-Allow-Origin, the Authorization header can't be sent.