ssl_error_bad_certificate_domain, does Firefox still validate the certificate? I have a private NAS device. It uses a self-signed SSL certificate. I can import the cert into Firefox and everything works as long as I'm accessing the device from somewhere on the internet. SSL validation and encryption is working.

Now, if I try to access the device through my LAN, I'm getting an error from firefox: ssl_error_bad_certificate_domain. This happens, because I am accessing the device using its local IP address and not using the DDNS web address.

I may add the IP address to the to the Subject Alternative Names list in the Certificate, if it is static, to solve the problem. Let us consider the problem, when I cannot make it static, but it has to stay dynamic.

I read in the RFC 2818 that

  If the client has external information as to the expected identity of the server, the hostname check MAY be omitted. (For instance, a client may be connecting to a machine whose address and hostname are dynamic but the client knows the certificate that the server will present.)

I know exactly that this certificate is the correct one. So, if the server can identify with the private key, everything is good. But, how do I know, whether Firefox checks the certificate even if the hostname check fails?

It sounds like you haven't included a subjectAltName section in your self-signed certificate, listing all the domain names and IP addresses under which you'll access the NAS device.

Even though Firefox has been told to disregard that this certificate has no trusted issuer, it still can't confirm that the URL you're using is covered by your security exception.


Can employer retrieve file emailed over https from months previous? I sent an excel file over Hotmail to another hotmail account on my work computer around 5 months ago. This email has since been deleted by the sender and the receiver. Is it possible for my employer to go back and retrieve the email and file?

A few extra things to note:

the website was protected by https
when looking at the certificate authority of the browser it all looked legitimate (i.e. no mention of 'THECOMPANY - VA).

If my employer isn't using MITM would it be possible for them to retrieve it?

Even though the certificate authority looked legit, is it still possible there's a MITM used and if there is one used how easy would it be for them to go back and retrieve the file?

Edit: this is not a general quesion on whether a company can monitor employees on their server, it's a specific question on whether it's likely a MITM is used and if a file sent over personal email from months previous can be retrieved or is sitting on the server at all. Also to clarify the size of the company is around 600 people.

Yes, it could be possible for them to retrieve the contents of the email. There are two options:

They monitor the network, i.e. do MITM and TLS-intercept. The fact that you didn't find your company name in the certificate chain is no guarantee that there were no rouge certificates installed in your trust store. They could be named something much more innocent.
They monitor your computer, e.g. by saving files opened by browsers as suggested by Matthew.


prevent session hijacking in PHP I wrote the log In/log Out scripts of my web page and when the user logs in I store in the $_SESSION variable the user agent. Now each time a page is loaded I check if the user is logged in or not and if it is logged in I check if the user agent has changed or is still the same to prevent hijacking. In case it has changed I call my logOut() function:

function logOut($conn)
{
    $sql = "UPDATE Users SET logged='no' WHERE username='" . $_SESSION['username'] ."'";
    $conn->query($sql);

    // Unset all session values
    $_SESSION = array();

    // get session parameters
    $params = session_get_cookie_params();

    // Delete the actual cookie.
    setcookie(session_name(), '', time() - 42000,
    $params["path"],
    $params["domain"],
    $params["secure"],
    $params["httponly"]);

    // Destroy session
  session_destroy();
}

Now the problem is that the right user can still navigate my website as logged in while I would like to have it logged out. What could be the problem?

To test my code I logged in using Mozilla Firefox and I copied the value of the cookie in Chrome and reloaded the home page and as expected I am unable to log in with Chrome but if I reload the page in Mozilla it is still logged in.
If I remove the user agent check then I am able to access the page as logged in in Chrome so my code is half working.

Your scheme is problematic from a UX and Security standpoint.

Bad UX, If implemented properly a user who logs in on their phone will immediately be logged out on their computer, or whatever. There are several other problematic cases where users who shouldn't be logged out are logged out. That's not horrible, but depending on the use of your application is can be really annoying

Security - First, your code is vulnerable to SQL injection.

$sql = "UPDATE Users SET logged='no' WHERE username='" . $_SESSION['username'] ."'";

My username is USERNAME' or '1'='1

If this is allowed in your username policy, an attacker can force log off of all users (or whatever other SQL they want). Use parameterized queries or if you're stubborn, fix your password policy.

Finally UserAgent checks are probably not super effective. User Agent strings are not super unique. For example, if your website has 1million users get their session hijacked, the attacker will probably be using the same browser as a pretty large portion of them (without even trying to bypass your security solution).

To answer your actual question,  session_unset() or session_destroy() will do what you want, but only after you call session_start().


Can .ova file contain an exploit? Is it possible to prepare an .ova file for Oracle Virtualbox that will access NAT network when is set to use Whonix? There are preconfigured virtual machines like Windows to use in Whonix, but are they safe to import?

I wonder because there is a suspicious project published by someone in Tor community (if anyone is interested i can send a link to download). Guest Additions are also used by this VM.

Whether or not it contains an exploit, specifically, is irrelevant in the broader question of whether an OVA file can be malicious. The answer to the broader question is yes, absolutely.

The Open Virtualization Format specification gives you an idea of some of the potential vectors, but the obvious one is that it could map your entire OS disk to the VM and then, on VM boot, run code that exfiltrates it via the network or modifies files on disk to elevate privileges or drop malware (it doesn't have to adhere to your OS's security controls around filesystem access at that point). The VM could also map arbitrary USB devices to the VM (including inserted USB sticks) and use them however it likes.

If we want to go into more complex attack mechanisms, the VM could utilise platform vulnerabilities in the CPU, PCH, or memory (e.g. recent vPro/AMT bugs, or rowhammer) to effectively escape the VM environment and run arbitrary code on the host.

You absolutely should not run untrusted OVF VMs.


Safety of Encryption Keys I'm trying to figure out the best way to encrypt passwords for a forums site I'm working on.

I've decided I'm going to use an encryption such as blowfish. From my understanding, you have a key, and the text you want to encrypt. The encryption then uses the key to encrypt the text. When a user creates an account, I plan on generating a UUID for them. That will be the primary key when they're put in the database with their encrypted password.

Now, I don't plan on letting the users be able to find out their UUID, because it will only be stored in PHP sessions. But, let's say, somehow someone finds out the user's UUID.

Would it then be possible to decrypt their password? Would they even be able to find the UUID from a php session? If there is an issue with this concept, should I generate a key to use and store it in the database with their UUID and password?

Sorry if the question's confusing, I'm not very good at putting my thoughts into words. Thank you in advance.

Well, let's use proper terminology then.

You don't want to encrypt passwords. You want to hash password. This is something completely different. Read this. There is a good password hashing function called "bcrypt" which is internally derived from an encryption algorithm called "Blowfish"; from which came a lot of confusion with some software platforms claim to do "password encryption with Blowfish", when they really mean "password hashing with bcrypt".

Now there is also an overload on the meaning of key. In cryptography, a "key" is a piece of secret data that is used as part of a cryptographic algorithm. Password hashing does not use any key (precisely because it is not encryption, despite the widespread terminology abuse). In databases, a "key" is some value that is used to reference a row in some table. This is not at all the same kind of key.

UUID are values which are meant to be unique (worldwide), but that does not mean that they cannot be guessed. Only that when you generate UUID "properly", then you will not get the same UUID value as any other person in the World who also generates UUID properly. Thus, UUID can be good for database keys (although worldwide uniqueness is some overkill), but not for encryption keys (but password hashing needs no key). UUID can be good for salts, a component of password hashing.


Is it possible to detect OpenPGP mails in TLS encrypted connections? Regarding to the second point of 15 reasons not to start using PGP:

  Thanks to its easily detectable OpenPGP Message Format it is an easy exercise for any manufacturer of Deep Packet Inspection hardware to offer a detection capability for PGP-encrypted messages anywhere in the flow of Internet communications, not only within SMTP. So by using PGP you are making yourself visible. Stf has been suggesting to use a non-detectable wrapping format.

As far as I know, its not possible to detect the content of a mail, even just only if it is OpenPGP encrypted when the ways sender - mail server - mail server - receiver are TLS encrypted. Am I wrong? Of course it can be detected by the mail servers and if one of the ways is not TLS encrypted. But it is also possible to detect OpenPGP mails in TLS ways?

Being able to recognize OpenPGP messages is especially an issue as the recipient is included in the OpenPGP message's meta data by default (it can be hidden though, using the "hidden recipient" feature; which trades reduced meta data for more effort on the recipient's side, as he has to try all his secret keys instead being able to select the proper one from the beginning).

  As far as I know, its not possible to detect the content of a mail, even just only if it is OpenPGP encrypted when the ways sender - mail server - mail server - receiver are TLS encrypted. Am I wrong?

You're right, as long as there is no flaw in TLS and proper algorithms/parameters are chosen, contents transmitted through an encrypted channel cannot be recognized.

Statistical methods on the message size might be applied to guess the contents might be OpenPGP messages -- but then again, OpenPGP messages are generally hardly distinguishable from "normal" messages with respect to their size.

  Of course it can be detected by the mail servers and if one of the ways is not TLS encrypted.

You are also right about the mail servers being able to analyze whether a message is OpenPGP-encrypted, as they terminate the transport encryption through TLS. If you trust all servers in between (and there are often more than two), also be aware that you cannot make sure all mail servers on your message's route always communicate encrypted -- there is a rather larger portion of mail servers not encrypting connections between SMTP servers at all! This is especially valid for network-internal communication, which is rarely encrypted at all; but also an issue for cross-server-connections through the internet. Finally, even if servers have certificates, lots of them do not have a proper certificate, or do not bother to verify the other side at all.


How are signatures for IPS determined For example , how do Snort's VRT team or some one who gives us the signatures, determine them at all ?

I would be more interested to know , how are the traffic patterns analyzed against some known theoretical models( any  statistical / probablistic models ?) to determine the signatures ?

Sashank, That is a good question.

Writing rules is a fun research work. Often it takes lot of research and analysis, and sometimes for some threats its very easy to write a signature.

This is quick very high level overview of writing signatures. The things you should know before hand to perform analysis and to start writing rules -

Very good understanding of Protocols according to their RFCs - This includes all protocols (IP, ICMP, DHCP, TCP, UDP, SMTP, FTP, POP3, ssh, telnet etc.) in OSI layers (datalink, network, transport, session etc). The RFC is the guideline of how a protocol is designed, how it should behave. This is a very important reference in writing rules. RFC define the structure of the protocols, their headers, state, flags/attributes. On the network, any observed deviation from these RFCs standards is the key in writing rules.
Detailed understanding of the vulnerability - What do you want to write a signature for? Do you understand how the vulnerability works? Do you know what are you looking for in the network traffic? Where shall you concentrate on in the application/service? Trying to answer these questions will give you a path to understand the vulnerability. Example - if you are writing a rule for remote buffer overflow on port 80/http on IIS, then you must understand the web server architecture, how data get handled internally in the web server, how does the web server handle the requests and generates responses. This will clarify the vulnerability. If you understand this then it lead you to what exactly you should be looking for. This is applicable for any remote or local service/process/software you want to a vulnerability rule for.
Lot of lab work - Run the exploits over and over in different scenarios, get lot of packet captures or memory dumps. Analyse the timeline, analyse the packet headers and compare that with RFC standards, analyse the payloads. If you run an exploit 10 times, then the packet captures will give you the timeline, size of the payload/data, bit sequence (data) in the payload and most importantly it will clarify the conditions under which the exploitation is most likely to be successful. Putting all this together will bring good accuracy for the signature, then you know the exact bit patter to look for and when to look for, and where to look for.


Can I get a HTTPS certificate for mymachine.cs.superuniversity.ca from "Let's Encrypt" I'm trying to set up a HTTPS certificate for mymachine.cs.superuniversity.ca (free or paid).
Before I jump in, is it even possible to set up such a certificate using Let's Encrypt?

The domain is for a very simple http server to host some HTML, CSS, and Javascript.

Short answer: yes, if you control a web server under that domain name, and Let's Encrypt external bot can access the web server, or if you control DNS records for that domain.

The DNS validation may be tough (you probably do not control the DNS server, and it may be administratively challenging to obtain the necessary DNS records). So your other option is to use HTTP validation. Citing Let's Encrypt "How It Works" article:

  These are different ways that the agent can prove control of the
  domain. For example, the CA might give the agent a choice of either:

  Provisioning a DNS record under example.com, or Provisioning an HTTP
  resource under a well-known URI on https://example.com/

If you need to do so for an Intranet-only domain, you can setup a temporary/dummy web server for certificate generation purposes, and bring it up only when renewing the certificate. I suggest just buying a public domain and getting a certificate for that domain, and pointing it to the internal IP address. Please note that doing so may expose internal IP addresses, and you should do that only after a risk assessment and after getting an approval from the university.


How to completely clear an external hard drive from scratch I am currently wondering how to detect malware on an HDD, so trying to break apart the questions into smaller chunks.

For this question I am wondering how to completely clear an external hard drive (HDD) so it is guaranteed not to have any viruses, malware, or other software/programs running on it. I don't quite understand how you can detect this, like seeing if the bits are in some way, or what.

I am not sure if there is firmware on the HDD, in which case there are other ways a virus might stay on there. Would be interested to clarify if there is firmware on the HDD, which would mean there really is no way to write software code to clean the HDD completely, but not really part of the question.

Other than the firmware aspect, which is more of a tangent, the main question is about the kind of software that can be written to clear the external hard drive completely. I read about Disk formatting which I know very little about, still have to better understand that. But instead of answering "just install antivirus/cleaning software X and press "clean" and you're good", I would like to know the (theoretical) features these softwares have, so that I could better understand what it would take to implement the software from scratch.

An answer might just contain a list like:

You need to do disk reformatting, which does X to clear Y types of stuff.
You need to run ps ax and these other standard commands.
You need to restart your computer.
etc.

It doesn't need to be too comprehensive or detailed, I am just looking for an introduction to what needs to be done/implemented to properly clear a disk.

You don't have to clear the data, if it is not executed. No operating system will just read bytes from the hard drive and execute them if you don't instruct it to.
It is enough to clear the boot sector and partition table, create the new partition(s) you want and format them with any file system you want.

You can e.g. fill the drive with zeros to be absolutely sure, but that's not necessary.

The simplest way to achieve all that is to fill the first few sectors with zero.

e.g. dd if=/dev/zero of=/dev/sdX bs=1M count=2

Of course if the firmware of the drive contains malicious code, this is a whole different story.


Is it possible to detect if a trojan or program sends information by sniffing the network of a VM Explaining better, I was consulting on how I can ensure that the programs of an operating system does not perform any suspicious activity with my information, and I have been told that electronic devices come to monitor the network and know what happens in it.

Thinking of an alternative, it occurred to me that I could clone the current system and run it in virtualbox and sniff the network traffic of the virtual machine.

Could this be as effective as the electronic device for detecting backdoors or programs that can send our information?

  Please consider editing my question if it is poorly written in your language because I am native Spanish. Thank you.

Yes, traffic analysis is commonly used when evaluating programs, and their interaction with their environment.

There are a few caveats to consider

Encrypted traffic (TLS/SSL) - Unless you install a root certificate on the VM and actively perform a man in the middle attack to replace the certificate sent by the remote host, you won't be able to inspect encrypted traffic.  This may be detectable by the program if it's using certificate pinning, it may even prevent the program from running properly if pinning is strictly enforced.  If bidirectional certificates are used, then the server will also be aware of this.
Many programs and malware are able to detect that they are being run in a virtual environment due to the hardware emulation.  Things as simple as the MAC address being for a virtual vendor, or as complicated as specific quirks of the emulated hardware (CPU, memory, etc).  A program may alter it's behavior to not act maliciously in this scenario.  That can also be used to your advantage though, as some setups actively attempt to make their systems appear as a vitual machine in the hopes malware will not execute.


Why do Browsers in their TLS1.3 Client Hello do not request for CCM ciphers? As per TLS 1.3 RFC  8846, following 5 ciphers are supported.

TLS_AES_128_GCM_SHA256
TLS_AES_256_GCM_SHA384
TLS_CHACHA20_POLY1305_SHA256
TLS_AES_128_CCM_SHA256
TLS_AES_128_CCM_8_SHA256

But I noticed none of my tested browsers request for CCM ciphers in their ClientHello.
Why is that?
Under what condition these ciphers will be requested?.
As per this answer CCM can be good for embedded system.

Even openssl header file ssl.h didn't have  CCM cipher.

#  define TLS_DEFAULT_CIPHERSUITES "TLS_AES_256_GCM_SHA384:" \
                                   "TLS_CHACHA20_POLY1305_SHA256:" \
                                   "TLS_AES_128_GCM_SHA256:"

They will be requested if the client supports them and if they are enabled. Like you mentioned, for example, OpenSSL does not enable them by default. They don't seem to provide any justificative other than it's "rarely used". But consider that most desktop CPUs support instructions for accelerating GCM, making it probably faster than CCM.


How to determine if there is any SSL v2, SSL v3, TLS 1.0 or TLS 1.2 connections to the server? Environment: Windows 2008 R2, IIS, ASP.Net Website

I'm preparing to disable SSL v2,SSL v3 in my server.

How can I check whether my server receiving any connections via SSL v2 or SSL v3 ? (inorder to ensure no one is affected)

Is there any logs in server ? (To Determine the connections was via SSL v2, SSL v3, TLS 1.0 or TLS 1.2)

Use a sniffing tool (e.g. Wireshark) to inspect the traffic to your server. Run Wireshark on the server itself and select the interface on which requests are incoming. Consequently, filter SSL traffic and check the IP sources to find out whether or not these are legitimate request (difficult when its publicly facing though).

Although I'm not sure who your target audience is and the nature of the data on/transmitted from and to your site, I would probably not keep the server vulnerable for those folks who refuse to update their browsers. However, that's a personal decision of yours to make.


Can we detect other websites of a user on a shared hosting? I use a shared hosting plan which allows me to add multiple websites with one account/purchase. I have one website in the same plan for my work, and one for personal works. I can see both of them in my file manager and they seem to be related (in administration part).
I want to know if any random person on the internet can use WHOIS or other tools to connect these two websites to each other.
There are some tools that show domains of the same owner (using their email) or show other domains of the same DNS. I personally see no reasonable way to do this.

Most DNS providers provide "domain privacy" services, if you're using these then chances are you're fine.
However, it does go back to the age old thing of determining your threat model. There are more ways than technical tooling to link together two domains and who might own them. For example, analysing the types of content posted on each, the login/administration times, the language that is used, etc. Again, what's your threat?
You should also consider that hosting two separate things in the same place could be a risk. If you want to keep these things separate badly, I advise hosting them in different locations.
As you stated, WHOIS doesn't come back with any personal information such as an address, administrator email, etc. This suggests you're taking advantage of domain privacy services from your registrar and you're more than likely fine.


Need help understanding Windows Authentication mechanism Even if I enforce HTTPS and use anti-forgery tokens, it seems like Windows Authentication could be inherently insecure because it does not require that the user explicitly passes credentials from the client to the server.

In environments where folks are using older browsers that may not enforce CORS (and especially if these folks have disabled their browser's referrer header for whatever reason) - I'm not sure what would stop a malicious website from establishing a session on a user's behalf - the users don't even have to login!

The confusion, for me, all comes down to one point - the initial authentication:

If I have a website hosted on some local domain - for simplicity let's just refer to it as abc.com (although for an intranet application it's probably just an IP address).
A valid Active Directory user opens their browser and unwittingly goes to xyz.com (unwittingly because they don't know this is a malicious site setup by one of their former, but now laid-off and disgruntled co-workers)
xyz.com makes a valid request to abc.com

Windows Authentication is admittedly somewhat of a black box to me - my assumption here is that the request to abc.com will be considered valid and the response will provide the session cookie needed for future requests. At this point, here are my questions:

Will the browser have a valid session cookie for further requests to abc.com or will the browser drop the session cookie because there are no active tabs/windows open for abc.com?
Even if the cookie is marked with HttpOnly, can't the attacker still access the cookie via TRACE or does the browser have a way to notify the server that the cookie should no longer be valid?

If the malicious website can be prevented from accessing/hijacking a cookie, I can see how it might be possible to reasonably secure an intranet website that uses Windows Authentication by enforcing that a user, who does not yet have an anti-forgery token, could enter the website by accessing a specific page (landing page) which would first make a request that would not return any protected data, but instead would return the valid session cookie and an anti-forgery token in a custom header of the response. All future calls would need to include the anti-forgery token provided by the previous request and failure to do so would require the user to enter through the landing page again. Since this anti-forgery token would be held in memory (by something like a request interceptor), it should not be accessible to javascript running on other domains (and assuming due diligence has been taken to prevent XSS attacks from accessing the token). A new token would be issued with each response from the server, the interceptor would grab it and then include it in the appropriate header on the next request from the client to the server.

Note that this is, of course, all assuming there's not some malicious program running outside of the browser.

You initial request is likely to be a GET request, which if implemented as per standards will be a "safe method". That is, it doesn't make changes to any state.

Safe requests do not need to be protected because the Same Origin Policy prevents another origin (i.e. domain, protocol or port) from reading the response. Note that the request would still be made from the foreign domain, just that it has no way of reading the response in the request made through the user's browser.

Unsafe requests (which should be implemented as POSTs), should make use of a CSRF prevention method because even though the response can't be read in a cross-origin request, the requests is still made, and as it is "unsafe" it will have consequences (e.g. deleting an object that the user has permission to delete).

In this respect, "Windows Authentication" acts just the same as cookies in that it authenticates the user in their browser, but does not prevent cross-origin requests from making changes without some type of prevention mechanism (e.g. Synchronizer Token Pattern or X-Requested-With header to protect AJAX requests).


I was redirected to an infected site, what should I do? I always avoid suspicious links, but recently, in one of my google searches, I clicked the first link on google (looked just a normal site), but it immediately redirected me to a weird news site (the news was basically "How I won $$, blablabla"), with a very weird URL. I heard a strange 'bip' after entering the site and immediately closed it (the site brings that window asking to close or leave, btw), then I copied the link in the browsing history and cleared the data (cookies, etc). I tried to access the same link I clicked on google and it didn't redirect me again; it entered in the site I was supposed to access.

I use Firefox as my browser, and smart https and ublock origin (advanced mode) as privacy extensions, and Bitdefender free as antivirus. None detected anything weird, so the bip came from the site.

I scanned the URL in VirusTotal and according to it the site is infected with "Fortinet" and "Spamhaus"

Can this have infected me somehow? I'm currently running a virus scan with BitDefender.

What else should I do?

Later I tried accessing it again in a portable browser with ublock and noscript, and it also redirected to a fake google site with a survey, but this time I was not logged in to my email.

The beep comes from the un-completion notification - a thing that pops-up even in g-mail if you do not let it finish various in-progress actions.

The redirect may of been done even by a plugin or an active malicious script on your system. Fortinet is an e-mail security appliance and Spamhaus is an e-mail blocklist centralization system - they are not viruses.

Traditional anti-viruses often miss scripts that are designed to mimic normal functionality so I'd recommend you scanning your system with tools like HitmanPro Malware Removal Tool and Malwarebytes.


Should we trust online banks with our credit card information? I'm thinking of buying a product for someone using the steam platform. Being in Germany, the best (least expensive) option would be to use a local bank. Logging in, choosing a product and checking out lands you on the following page:

"Continue" redirects to the banking site and it contains two tokens. On the site itself the BIC and PIN number are required to finalize the transaction. The certificates of both the store and the bank are valid.

What keeps the bank from performing further, malicious transactions with the supplied information? What happens in case of compromise? as performing a transaction in this case does not require a PIN generated by a physical token (anyone can buy as long as they know the BIC, the PIN and there are sufficient funds on that account).

I work in the IT system of a banking company, and as such I know a bit about what happens.

Here is the sequence of events, as I understand it, when a payment goes through:

You send the payment information (BIC, PIN, etc.) to the seller's bank;
The seller's bank transmits the payment request to your bank;
Your bank receives the payment request, and decides to authorize the payment;
That authorization goes back up the chain to the seller's bank, and you get the page telling you that your payment was successful;

Now, what happens if someone in the chain initiates a payment without your consent?
Fundamentally, it relies on the fact that a payment that was authorized in that way is known as depending on an insecure payment request - and intra-bank agreements stipulate that in that case, any fraud costs must be borne by the beneficiary of the payment.

So:

You will see that you have been charged fraudulently;
Your bank will reimburse you;
The seller's bank will reimburse your bank - in the end, the seller's bank will have gained nothing, except being noted for having allowed a fraudulent payment;

At each step of the way, you see that there is a strong trust relationship - between you and your bank, between your bank and the seller's bank. If these trust relationships are broken, then it could very easily end before a court, with very dire consequences (you leaving your bank and outing it as untrustworthy, the seller's bank being outed as untrustworthy and sued by your bank).

In short: the seller's bank would not do that voluntarily, because that could easily mean the end of its business. And if your bank is trustworthy, you should not end up footing the bill anyway. That is true, whether the seller's bank is untrustworthy or compromised.

Now, I understand it very well if you do not wish to leave such information in the hands of a bank you do not personally trust - in that case, I would suggest asking your bank about it - for example, banks can generate a disposable Credit Card number, valid only for a limited time and amount of money.

Also, there are generally rules that stipulate that such information should not be kept any longer than necessary.


Is refreshing an expired JWT token a good strategy? If I understand best practices, JWT usually has an expiration date that is short-lived (~ 15 minutes). So if I don't want my user to log in every 15 minutes, I should refresh my token every 15 minutes.

I need to maintain a valid session for 7 days (UX point of view), so I have two solutions:

use long-lived json web token (1 week)--bad practice?
getting a new json web token after the old one expires (JWT 15min, refresh allowed during 1 week)

I'm forcing the use of HTTPS.

The JWT standard doesn't speak about refreshing tokens. Is refreshing an expired token a good strategy?

Refreshing a token is done to confirm with the authentication service that the holder of the token still has access rights. This is needed because validation of the token happens via cryptographic means, without the need to contact the authentication service. This makes the evaluation of the tokens more efficient, but makes it impossible to retract access rights for the life of a token.

Without frequent refreshing, it is very difficult to remove access rights once they've been granted to a token. If you make the lifetime of a token a week, you will likely need to implement another means to handle, for example, the deletion of a user account, changing of a password (or other event requiring relogin), and a change in access permissions for the user.

So stick with the frequent refresh intervals. Once every 15-minutes shouldn't be enough to hurt your authentication service's performance.

Edit 18 November 2019: Per @Rishabh Poddar's comment, you should generate a new refresh token every time the old one is used. See this in-depth discussion of session management for details.


What defines a 'defense contractor' and what is required to be reported in new US law? According to news articles (eg here) the 2013 National Defense Authorization Act, which was signed into US law 2-Jan-2012, apparently requires defense contractors to report intrusions. What defines a defense contractor? What defines an intrusion (or penetration as they call it)? What is required to reported to who?

I was asking because I was curious and wondered how it would affect the community at large. In general I'm a proponent of more sharing among the good guys and wondered how far reaching this would be. My experience has been that most companies dislike confessing to intrusions yet I'd be shocked of any company that hasn't had an intrusion of some sort (or at least an attempt).

If the definition of contractor is narrow (eg companies defined as members of the Defense Industrial Base and penetration is defined as access to Top Secret documents) it will have less an impact than if it more broad (eg companies are any companies with gov contracts, and penetrations are any outside access to any system).

The act itself is vague and I'm asking if anybody knows more about what is intended. I presume the law did not come out of this air and there is a back story as to what caused it and what is intended.

For a definitive answer, you'll want to look at three sources.

This is all set out in the act itself.
The Defence Department will be in touch with cleared defence contractors to provide their detailed requirements.
As ever, if you need to know if something is legal or not, don't ask random people on the Internet: ask a suitably qualified lawyer who specialises in that area.

Your updated question asks what is the effect of this on the broader InfoSec community. Probably minimal for those to whom the law does not apply. My company does not have to be PCI compliant, so PCI regulation troubles me hardly at all. We do have to be SOX compliant, and that troubles me a great deal. There are already breach disclosure requirements written into various laws (mostly centred around personally identifiable information).


How to secure my network and system setup? I have 2 severs and 12 systems (All having UBUNTU) connected to each other over LAN. The 12 systems use multiple databases (Redis/Postgres etc.) hosted on the 2 servers using LAN. Now, I need to connect the system to the internet as these systems and servers call some external APIs and cloud based databases etc. from time to time.

From outside world (over the internet) I only need SSH access to the systems for monitoring purpose etc.

My setup has all the 14 (2+12) system connected to LAN using static IP via a switch and 1 connection from switch to a router (which has connection to internet).

Inside the router, I have forwarded 14 ports, some obscure ones (range 20000 and above) and redirected them individually to port 22 of each LAN IP.

I have already enabled automatic silent security updates in the systems.

The questions are:

a) Do I need to block unused ports(apart from the ones used by them for internal use) in the 14 systems via UFW or it is not required given my situation?

b) Do I need to take care of anything else from security perspective, that I might have missed?

I am totally new to this security and setup part. Kindly advise.

A) I'd use ufw reverse technique by denying all ports as default and allow the ones you do use.

B)
Well, that you can always do...taking care of your system's security. I think you've got yourself a decent setup, perhaps installing and configuring Snort on the switch would be a great idea. I'd also recommend Tripwire but due to the Ubuntu's regular updates, you would have plenty of false positives.

The other thing you can always do is to test your setup with scanning and penetration tools, most of which you can get by installing Kali linux.


What's a free recommended anti-spyware program for Windows? Its been years since I installed an anti-spyware program. Keyloggers and other nasties might have gotten installed and so I'm looking for a program to flush them out. I used to use Spybot-S&D, but I think in the past it would slow the PC down. Which free anti-spyware program do you recommend/have used extensively?

Here's a direct link to Microsoft Security Essentials:

  Use Microsoft Security Essentials to guard against viruses, spyware,
  and other evil software. It provides real-time protection for your
  home or small business PCs.

  Microsoft Security Essentials is free * and we designed it to be simple
  to install and easy to use. It runs quietly and efficiently in the
  background so you don't have to worry about interruptions or making
  updates.

http://windows.microsoft.com/mse

Note (*): Your PC must run genuine Windows to install Microsoft Security Essentials.


Certificate identification that is renewal safe We currently use some certificates in our application and we identify them by using the certificate's thumbprint.

Like this:

<serviceCertificate>
    <certificateReference x509FindType="FindByThumbprint" findValue="xxxx" storeLocation="LocalMachine" storeName="My" />
  </serviceCertificate>

Unfortunately when the certificates are up for renewal, this thumbprint changes.

Is there any other way like the "SubjectName" that we safely can use to identify the certificate? And that, of course, stays the same when we renew the certificate?

Your certificate must be identified at least using his Common Name (CN), or at best using his Distinguished Name (DN).

The Distinguished Name is based upon X.500 directory service standard, and is actually a hierarchical set of property/value couples allowing a unique identification of a given certificate, independently of technical certificate properties (key, usages, serial number, validity period, issuer, etc.).

For instance, the Distinguished Name from the current Stack Exchange website is C = US, ST = CA, L = San Francisco, O = "CloudFlare, Inc.", CN = *.stackexchange.com, which can be decomposed the following way to clearly see the hierarchical relation between each properties (it goes from the more general to the more precise):

C = US                       // Country = United States
ST = CA                      // State = California
L = San Francisco            // Locality = San Francisco
O = "CloudFlare, Inc."       // Organization = CloudFlare, Inc
CN = *.stackexchange.com     // Common Name = matches the URL hostname

The details of the attributes composing your certificate will heavily depend on your application and needs (some attributes may even appear several times with different values, the most common example being the OU (Organization Unit) attribute).

Do not hesitate to check the other question given in the beginning of this answer to get more information on the subject.


What is the difference between antivirus and firewalls I need a brief explanation about the differences between antiviruses and firewalls

Firewall and antivirus software are two fundamentally different and complementary kinds of security applications.

Firewall :

Also known as a 'packet filter'. Basically, software which monitors network traffic and connection attempts into and out of a network or computer and determines whether or not to allow it to pass. Depending on the sophistication, this can be limited to simple IP/port combinations or do full content-aware scans.

A firewall can be thought of as a screen or sieve that categorically strains out potentially harmful data.

Antivirus:

A software which will find programs/files/software/etc that might compromise your computer, either by being executable or by exploiting a vulnerability in the program normally supposed to process them -- Rootkits, trojans, or other types of malware.

It detects these kinds of harmful programs that are already installed on your computer or about to be installed.

It can perform various protective measures (based on the security settings in the Anti-virus software) such as quarantine, permanent removal, fix, etc.,

It will also look for potentially harmful files that are downloaded from the internet or attached to an email and notifies/removes it to protect your computer.

NOTE: Antivirus software has to be updated frequently; each new strain of virus will likely have different signatures.


Does firewall count as a subnetwork? I need to design a network based on IP 10.1.1.0/24. I have three different subnetworks and a firewall. Does firewall count as a subnetwork? Do I need to assign some IP values to it?

No, firewall is not subnetwork. The only point is firewall should have on one (or more than one) network interface IP from each subnet. Otherwise will be not possible to serve those subnets
For example if you have networks:

10.1.1.0/25
10.1.1.128/26
10.1.1.192/26

you should assign to firewall (for example)
10.1.1.1, 10.1.1.129 and 10.1.1.192


Is it possible for OWASP ZAP to pass-through some requests without intercepting them, as if there were no proxy? I have an iOS app with certificate pinning to two different servers.

I want to test this certificate pinning with a MITM attack, so I did:

Set proxy at my PC, in macos wifi settings -> advanced -> proxies -> enabled http/https proxy.
Installed Dynamic SSL cert on simulator.
It works, I can see https data when I open some webpage in Safari.
Run the app. App doesn't work (because one of this two certificate pinnings did work).
I'm unable to test the second certificate pinning.

Is it possible to disable proxying for one URL and enable for second? Make some requests go straight to desired URL, with SSL certificate at that URL?

Yup we have an FAQ for that: https://www.zaproxy.org/faq/what-options-exist-for-selective-proxying/

Options include:

Via a Browser Add-on/Extension
Via Global Excludes
Via a PAC (Proxy Auto-Config) File
Set “No Proxy For” in Your Browser


Can a Keypass file theoretically be cracked offline? So you create a .kbdx file, protected by a password.
AFAIK in asymmetric key schemes and in WPA-AES brute-forcing consists of:

Trying a random password on the private key / on the router
If it doesn't log you in, try another.

So, you immediately know if you hit the correct password.
What about a password manager's database? If nothing is known about the content of the file, how would it be possible to crack it?

What about a password manager's database? You know nothing about the content of the file. How do you know you did manage to crack it?

This assumption is wrong. You don't know the entries, but in this case you know the software that created it. That software has a data format. It's even documented in the software project.
The format even contains data validation entries:

In KDBX 4, a data block is authenticated via a HMAC-SHA-256 of the ciphertext (an Encrypt-then-MAC scheme).

Thus you can easily validate the correct key.


How does Google track users in Incognito mode? There is a lawsuit claiming Google tracks users in private browsing mode. How exactly is Google achieving this?

There is a common misunderstanding of what "Private Browsing" or "Incognito Mode" actually does.
There is no anonymity or tracking protection provided. What these modes do is block persistence of information across sessions, preventing permanent storage of cookies or history after the browser has been closed.
Within a given browser session, meaning from start to stop, Incognito and similar works exactly the same (caveat) as a normal browsing session. The difference is that local storage is blocked so all of the session information is gone upon browser termination.
Some browsers (Firefox) proactively block writing to local storage in private mode. Some browsers (IE as of 2 years ago) wrote to local storage but cleared local storage upon start up.
Caveat:
Because protected browsing may not allow HTML5 local storage, many sites now complain about protected browsing. Some sites, like Netflix, will not work at all without the ability to write local storage.


Is OpenGL a security problem? Today, almost all desktop and most mobile operating systems and devices support some version of OpenGL. I'm wondering about the security implications of that:

In many cases, the GPU has complete and unrestricted access to the main memory (for integrated graphic devices) or at least the video RAM, where sensitive information might also be stored (think compositing window managers or hardware-accelerated web browsers).
In some implementations, OpenGL clients communicate with the GPU by directly writing data and commands to shared memory.
Only recent GPUs seem to support memory virtualization, and even then, only some driver implementations are currently using it.
WebGL requires newly allocated buffer objects to be zero-initialized; I suspect that this means that this is not required in standard OpenGL. Does that mean that it is theoretically possible to allocate a buffer in video memory and read potentially security sensitive data?

So who or what keeps me from writing a shader program that reads data in the video or even main memory that doesn't belong to me?

I've found a presentation on the current state of affairs in the Linux graphics system which mentions that either the commands to the GPU are verified by the kernel, or that virtual memory is used on the GPU to separate users.

Is that also true for other, especially mobile, operating systems like Android, where the individual applications are strongly sandboxed, but have almost unlimited OpenGL access? Tegra 2 is even specifically mentioned in that presentation for allowing potentially unlimited memory access to users of the driver.

I've performed a few experiments on Linux and various GPUs and drivers. I took a basic OpenGL tutorial for texture mapping and replaced the pointer to the texture data in the call to glTexImage2D with a null pointer.

With the nouveau driver on an Nvidia GPU, the results were pretty interesting:

The text on the cube seems to contain the previous contents of my terminal window, which is composited on the GPU by Compiz.

The Intel GMA driver showed only a black cube; it was the same on Android (tested with an Adreno and an Nvidia Tegra 3 GPU).

Of course that doesn't prove that either of those drivers/systems are safe; the OpenGL implementations might just as well initialize the memory only in the userspace component of the driver instead of in the kernel.


Where to find ransomware samples to make demonstrations? I'm looking for some ransomware samples that work on Linux so that I can show a proof of concept with Qubes OS on how one's other virtual machines can be safe from a ransom attack if a single virtual machine (or a disposable virtual machine) gets compromised.

But I don't know where I can find such samples. Can anyone help?

Perhaps you don't need ransomware to demonstrate what happens.  You could fake the output of the attack using openssl like this:

Encrypt:  openssl aes-256-cbc -pass pass:pwd -in victim -out victim.ransom && rm victim

Decrypt:  openssl aes-256-cbc -pass pass:pwd -d -in victim.ransom -out victim

However, it looks like you may be more interested in demonstrating the activity of the ransomware file system scanner, to prove that your isolated VM can't encrypt the files of the host system or of other guest systems.  That's rather like proving a negative.  The best demonstration might be to show how find works, because that's exactly what ransomware would have to do.

Create a file named /tmp/sacrificial_pic_<vmname>.jpg on each of the VMs, including the VM hosting the fake malware, substituting the machine name in the filename above.   Run the find command on the VM hosting the fake malware, like this:

find / -name \*.jpg -print

This will emulate the activity of malware searching for picture files to encrypt.  The only sacrificial JPG your find command should discover is the one on your local VM.


What impact are you expecting Windows 10 Forced Updates to have on your Penetration Testing? Unpatched Windows machines (even machines that are just a couple of updates behind) can greatly increase the chances of a successful penetration test (assuming your success criteria is gaining access and compromisation). Has there been anything written on the potential impact of the Windows 10 forced updates on penetration testing?

whilst obviously automatic updates will have an impact in reducing the window of vulnerability for OS level bugs in Windows 10, I'd say that realistically the OS itself is less often the target these days for client-side attacks, so the impact will be limited.

Usually for client-side attacks, the vector will either be social engineering (e.g. "hey you have a virus, install this") which isn't affected by patching or one of the commonly unpatched and Internet exposed pieces of software (e.g. Flash, Java, Adobe Reader) is attacked using either a patched or 0-day issue.

For external penetration testers, usually you'd go with something like a phishing campaign followed by either credential grabbing or social engineering to get the target to execute a piece of software which would give you access to their system.

For internal testers again the auto-updating will have limited impact I'd say, as usually testers once they've got access to one machine will make use of pass-the-hash / password cracking/tools like mimikatz to get credentials, none of which rely on missing Windows patches.  The days of finding things like MS08-067 missing and easily compromising systems based on that, are coming to an end for most organisation.

That's not to say that Windows 10 won't make things harder to exploit, but that I don't think that automatic updates will be the biggest differentiator.


Development-led security vs administration-led security in a software product? There are cases where you have the opportunity, as a developer, to enforce stricter security features and protections on a software, though they could very well be managed at an environmental level (ie, the operating system would take care of it).

Where would you say you draw the line, and what elements do you factor in your decision?

Concrete Examples

User Management is the OS's responsibility

Not exactly meant as a security feature, but in a similar case Google Chrome used to not allow separate profiles. The invoked reason (though it now supports multiple profiles for a same OS user) used to be that user management was the operating system's responsibility.

Disabling Web-Form Fields

A recurrent request I see addressed online is to have auto-completion be disabled on form fields. Auto-completion didn't exist in old browsers, and was a welcome feature at the time it was introduced for people who needed to fill in forms often. But it also brought in some security concerns, and so some browsers started to implement, on top of the (obviously needed) setting in their own preference/customization panel, an autocomplete attribute for form or input fields. And this has now been introduced into the upcoming HTML5 standard. For browsers that do not listen to this attribute, strange hacks* are offered, like generating unique IDs and names for fields to avoid them from being suggested in future forms (which comes with another herd of issues, like polluting your local auto-fill cache and not preventing a password from being stored in it, but instead probably duplicating its occurences).

In this particular case, and others, I'd argue that this is a user setting and that it's the user's desire and the user's responsibility to enable or disable auto-fill (by disabling the feature altogether). And if it is based on an internal policy and security requirement in a corporate environment, then substitute the user for the administrator in the above.

I assume it could be counter-argued that the user may want to access non-critical applications (or sites) with this handy feature enabled, and critical applications with this feature disabled. But then I'd think that's what security zones are for (in some browsers), or the sign that you need a more secure (and dedicated) environment / account to use these applications.

* I obviously don't deny the ingeniosity of the people who were forced to find workarounds, just the necessity of said workarounds.

Questions

That was a tad long-winded, so I guess my questions are:

Would you in general consider it to be the application's (hence, the developer's) responsiblity?
Where do you draw the line, if not in the "general" case?

This is cross-posted from Programmers StackExchange, based on a moderator's comment.

The dilemma is not specific to security, but security makes it easier to solve (although not in a philosophically satisfactory way).

Consider the Web browser Firefox. It is very self-contained. For instance, it has its own cryptographic layer, with its own storage of private keys and handling of certificates and SSL implementation and list of trust anchors. Similarly, Firefox has its own settings for proxies. On the other hand, both Internet Explorer and Chrome delegate quite a lot to the operating system in those areas. This is a trade-off: that which is delegated to the OS needs not be reimplemented, BUT this brings the OS configuration into the picture and can add constraints.

For instance, when we want to add some smartcard support to the browser, the relevant driver must be installed in the OS (in the Windows world, a "Cryptographic Service Provider") but this is not sufficient for Firefox, which also needs its own driver (a PKCS#11 DLL). The Firefox way then increases complexity and administration costs. On the other hand, if I set a proxy in Chrome, I set it system-wide and it impacts all other applications; whereas with Firefox, I can set it for Firefox only, which is more flexible; e.g. if I want to observe the behaviour of my Web server when connections come from distinct IP, I would like to run several browsers concurrently, some of which using SOCKS proxies -- I cannot do that with Chrome (unless I use VMs), I need Firefox for that.

So the dilemma is mostly about balancing flexibility with complexity. Firefox is an operating system in its own right, which makes it quite portable, but requires specific administration. Now how does security comes into that ? When we say "security", we often think "blame" (by this 'we' I mean 'most managers'). This solves the dilemma: if, as a developer, I have the choice between trusting the OS to do his job, or doing it myself, then I cannot be blamed for choosing the latter, even if it increases costs wildly.

As I said, this is highly unsatisfactory, but the dilemma is solved. It is even socially admitted that a hired developer refuses to do the job altogether if he feels it to be "unsafe". Whereas delegating to the OS, for security matters, is felt as bold and audacious, and somehow risky, and, as a developer, this had better work and never be hinted at introducing security issues, because otherwise the bold developer will become a bold scapegoat. Woe to him who dares not sharing the ambient paranoia !

(The argument above can be turned into an argument for the integration of the browser into the OS, which is what Microsoft does with IE.)


SAQ A-EP Requirements for VPS Hosting We are hosting a site on a self-managed Digital Ocean VPS ("Droplet") that will be taking payments via Stripe using their stripe.js API. According to PCI, we have determined that we fall under the SAQ A-EP.

However, the SAQ A-EP (Part 2g) states that:

  If merchant website is hosted by a third-party provider, the provider is validated to all applicable PCI DSS requirements (e.g., including PCI DSS Appendix A if the provider is a shared hosting provider)

What I am having trouble understanding is the following:

Since we are on a VPS provided by Digital Ocean, are we considered to be using "shared hosting" from a third-party provider? Or are we considered to be self-hosted, since the VPS is self-managed and Digital Ocean has no shell access to our box?
Does Appendix A need to be satisfied? If so, by whom?
If we are considered self-hosted, do we satisfy the following requirement (also in Part 2g), since our VPS has its own IP address and we are the only ones with access to the VPS?

  Merchant’s e-commerce website is not connected to any other systems within merchant’s environment (this can be achieved via network segmentation to isolate the website from all other systems)

First, let me say I agree with your assessment that the SAQ A-EP is what you should be using (assuming your volume qualifies you for Level 3 or 4, less than 1 million annual transactions). This is a huge change to PCI and I imagine it is going to cause some serious ripples in the payments space.

My understanding of the phrase "shared hosting" in terms of PCI does not apply to Digital Ocean or any VPS provider. However, they are still a hosting provider and as such have access to the cardholder data. They do say on their Security page that engineering team employees have access to the backend host servers. It is therefore entirely possible for them to access your Droplet if they wanted.

The way you can think of this is, if they hired a malicious person, could that person access and modify data on your Droplet. If they could modify something on your Droplet, they could add JavaScript to the page to siphon off cardholder data before it is sent to Stripe. Now, I think we would all expect that Digital Ocean has controls in place to monitor/audit these types of things and that is where PCI comes in. They should undergo a PCI Level 1 Service Provider assessment to validate their controls. It looks like this has come up before and they said they were not pursing any sort of PCI compliance at the time.


What harm can this bug in base32 implementation cause? There is a bug in Base32 implementation in Apache Commons Codecs:

  Example, there is no byte array value that can be encoded into the
  string "C5CYMIHWQUUZMKUGZHGEOSJSQDE4L===", but the existing Base32
  implementation would not reject it but decode it into an arbitrary
  value which if re-encoded again using the same implementation would
  result in the string "C5CYMIHWQUUZMKUGZHGEOSJSQDE4K===".

  Instead of blindly decoding the invalid string, the Base32 codec
  should reject it (eg by throwing IlleglArgumentException) to avoid
  security exploitation (such as tunneling additional information via
  seemingly valid base 32 strings).

What I do not understand is how can an attacker use this bug to tunnel additional information. The attacker sends invalid base32 string and obtains a slightly different base32 string back. What harm can it cause?

"such as tunneling additional information via seemingly valid base 32 strings"

This is the security concern expressed by whoever reported that bug. It is often called a covert channel. Covert channels are ways to exfiltrate information out of a security zone without being detected.

In all generality, covert channels are rarely an issue because:

They can be exploited in situations where the attacker is already inside the security zone, at which point most of security has already gone down the drain.
Tracking all possibilities of covert channels is an endless task. Most communication protocols allow for some variation that can be turned into covert channels. The bug in the Base32 decoder is just one more such way, but it would be overly optimistic to believe that this is the only one.


Can a DH param .pem file force the usage of only a single type of diffie-hellman exchange Is it possible to create a diffie-hellman param .pem file to force the openssl ctx to use only a certain type of dh exchange. For example, I know that it can be used to set the length of the dh key, but what about the type?

No. The type of exchange is set by the cipher suite, which agreed upon by the client and server during the handshake. As such you cannot specify, say, DHE vs. ECDHE in the DH parameters file. If you want to control that you should configure the supported cipher suites and the preferred cipher suite order on your server.


How is Instagram detecting me and blocking me each and every time I try to create a new account through different medium? I have two Instagram accounts, one is mine (Account A) and the other (Account B) is for random images with my pets and a lot of other stuff.

Account B is private and has been from start, recently I want some of my close friends to have access to it, the only way they can access is if they follow me, but to follow, one would need to create an Instagram account. Now it is a simple solution, but not all my friends who I want to share this account with are not so interested in Instagram, so I decided to create a Gmail account and use that to create an Instagram account.

So I went to Gmail to create an email account, I did successfully. After that, I tried to open Instagram in a new Chrome browser in which I had previously logged in with my previous two accounts. Everything was going smoothly, but in the very end, after creation, a message comes stating there was an error. I googled this error and it comes out that Instagram blocked this new account as it recognised I have multiple accounts.

So what I tried to do is, repeat the steps from a new incognito mode browser, but the same error came.

Now for the third trial, Google this time asked for a mobile number in order to successfully create, nothing worked to skip it, new browser, clearing history/cache, trying through Opera browser with inbuilt VPN.

So I tried creating a Gmail account from my mobile with cell network, I succeeded in creating a Gmail account, but when I tried the same with Instagram in the phone itself I received the same blocked error message.

In the end after creating 4 more Gmail accounts through use of two different cell phones with two separate network internet, and by entering my phone number after there was no other option I was still blocked from Instagram for each try I did with different email ids.

I tried with Instagram in both phones with different cell networks, when connected in WiFi, through Opera inbuilt VPN, tried in MacBook and a Windows PC, and was very curious what is the one thing that is being used to recognise me and block me, what could it be.

I would appreciate if anyone can share their thoughts on how Instagram was able to detect that I was creating multiple accounts.

Also if anyway I can skip past the blockage for new Instagram account creation (although this is not my motive for this question but is very much appreciated).

Instagram app sends the device id to its servers. So your devices are already known to them. Your best way would be:

A new device
A new email provider
Never connect to your wi-fi on this new device before registering

In other words, your new identity should not share even a single bit of the old identity.


Sniff packets of a wired computer in my home network my own PC is connected with a wire to the router. I want to do some analysis on the packets so I got an old laptop and tried to sniff my PC packets with the laptop (that is connected on WiFi).

Unfortunately I couldn't see my PC packets on the laptop with wireshark (even after enabling promiscuous mode)

I was wondering why?

With the infrastructure you're going to have sitting around your house, and your lack of advanced networking knowledge, you're not going to be able to sniff packets on your desktop using a laptop.

While your desktop is connected to your home router, traffic between your desktop and router will not be replicated over other router ports or over wifi. Traffic from your desktop gets routed exactly to where it needs to go.

While your desktop is connected to a home switch, the same logic applies--
 traffic between your desktop and switch will not be replicated over other ports either (unless you ARP flood it and your switch is susceptible to this attack).

What you're trying to do would have been possible 20 years ago if you connected a consumer hub between your desktop and router, since traffic on those got blasted to every port, but hubs don't support modern network speeds so they've fallen by the wayside. The modern replacement is a network tap but you can't just buy one of those at your local Best Buy ($$$)

Given your environment you'd be best off generating pcap files on the source box and shuttling those elsewhere for analysis. Use daemonlogger instead of Wireshark for this sort of task; Wireshark is way too bloated and doesn't handle file rotation.


Help me understand the relationship between GPG public keys, sub-keys and expiration dates Following best practices I'm now at the point where I have a non-expiring secret key stored in a save location and a set of sub-keys with an expiration date stored together with the public key on my local machine. However, what I want to do is to set an expiration date on the public key as well, while keeping the secret key non-expiring. How can I do this?

I'd also be interested in the exact relationship between the sub-keys and the public key. Looking at the some keys provided by the key server, I noticed that those will also include (the public part) of the sub-keys. This should be necessary to either validate messages that I signed using a sub-key and also to encrypt data in case an encryption sub-key is found for the recipient. What I don't understand at this point is what happens in case my sub-key expired, but the public key is still present and valid. Will gpg fall back to use the public key to encrypt and validate data? Does it still make sense to use an expiration date for the public key in case all sub-keys have an expiration date set?

I'm also not really sure about the exact role of the public key in case of the existence of sub-keys. My guess is that it's only used to validate the sub-keys before they are used to actually encrypt/validate, is that correct?

The Primary Key

The OpenPGP primary key holds your trust. If your key gets certified, those certifications will be issued on tuples of primary key and user ID. Outgoing certifications (on other keys) are also exclusively issued by your primary key. User IDs and subkeys are all coupled to a primary key. All in all, your primary key is the entity the glues everything together.

What capabilities your primary key has depends on the algorithm chosen and what capabilities are actually enabled (you can change this when running GnuPG in the --expert mode). All primary keys must have the certification capability C, but can have signature capability S (which must always be supported, as certifications are also signatures) and finally encryption capability E (which is not supported by all algorithms that fit a primary key, for example DSA can only be used for certifications/signatures, not for encryption).

Subkeys

  What I don't understand at this point is what happens in case my sub-key expired, but the public key is still present and valid. Will gpg fall back to use the public key to encrypt and validate data?

Which subkey is chosen is implementation dependent, usually they will choose the newest non-revoked key capable of what you want to perform. If you add another subkey, this will be chosen. If you remove all subkeys, the primary key will be used -- given it has the necessary capability bits set. If the primary key does not support the required capability, the key cannot be used at all!

In GnuPG, you can enforce a specific subkey: by specifying the key ID followed by !. For example, if you want to enforce usage of subkey DEADBEEFDEADBEEF as a recipient, use the option --recipient DEADBEEFDEAEDBEEF!.

Subkeys can be arbitrarily revoked and regenerated without losing reputation in the web of trust.

  I'm also not really sure about the exact role of the public key in case of the existence of sub-keys. My guess is that it's only used to validate the sub-keys before they are used to actually encrypt/validate, is that correct?

This is not necessary, but considered best practice. Lots of people even keep the primary (secret) key offline.

Expiration Dates

  Does it still make sense to use an expiration date for the public key in case all sub-keys have an expiration date set?

Expiration dates are a reasonable thing to use on subkeys, as they require the sending party to update your key after a given time. They can be changed arbitrarily, though. This is also the reason why expiration dates on primary keys are not a reasonable thing to use; if the attacker gets hold of your primary key, he can simply change or even completely remove it, even if your key already expired! See "Does OpenPGP key expiration add to security?" for a more in-depth discussion.

Instead, have a pre-generated revocation certificate at hand (and in your backup).

  However, what I want to do is to set an expiration date on the public key as well, while keeping the secret key non-expiring. How can I do this?

I think you're confusing public  and primary here. The expiration date is always set on a public, special "configuration" signature on your primary public key, but issued by your primary secret key (so it can be verified through the public primary key). If you really want to specify an expiration date on your primary key, you can still change it at any time anyway, the old expiration date is simply overwritten.

But as discussed above, an expiration date on primary keys is providing false security, anyway.


CSRF token in SPA login JSON response? Is it safe to include the CSRF token as part of an HTTPS successful login JSON response in an SPA? If not, is there a better mechanism for sending it which avoids the Double Submit Cookie pattern?
Some background:
I am building an SPA application (Node/React) which communicates HTTPS with a JSON API backend and I am trying to determine if sending the CSRF token from the server in the login response JSON is a safe thing to do.
I have researched OWASP's suggestions for sending a CSRF token from the server that states:

The CSRF token can be added through hidden fields, headers, and can be
used with forms, and AJAX calls

However this does not seem to address SPA concerns.  I have also found that the Angular framework uses the Double Submit Cookie pattern, but sources (including OWASP's) indicate this is a less secure approach.
OWASP has also suggested including it in the DOM in a meta tag, however since it should only be issued to authenticated users, I thought it made more sense to include it with the successful login JSON response.
Is this a safe approach to sending a CSRF token? Thanks in advance.

Yes. In CSRF attacks, the attacker can submit data but not read data. Normally, the CSRF value is contained in a HTML response, and including it in a JSON response it similar.
Make sure that the response can't be read by cross-origin hosts. This is the case by default, but if you have CORS headers (e.g. Access-Control-Allow-Origin response header) you may have disabled this.
You set the CSRF token as response to the login request. This makes me think that the login request itself does not have CSRF protection. You may want to consider protecting the login against CSRF.
Also, if you use cookie-based authentication I would recommend SameSite cookies, which solve CSRF and related problems. In addition, you may want to check the value of the Origin header if it's present in requests.


Why do web services keep asking me about my phone number? They say it's for my own safety and that somehow my account is more "secure" if I link it with my phone number, but I don't understand why - they already have my e-mail address through which I can reset passwords. Also, what is the impact on my privacy if I give a phone number to a web service? What can they use it for?

In other words - what do I gain, and what does the service provider gain from linking my phone number to my account?

EDIT: As this is still the accepted answer, I've made a number of changes to the below text to clarify that, while the "why" is still "probably for multi-factor authentication", this method is not trustworthy.

A phone number enables an easy way to set up two-factor authentication for things like password resets or other sensitive actions. By calling you or sending a text message, the service can confirm that [access to] the phone [number] is a thing you have. An email account is really just a thing you know, the same as a password, because you can access it without anything other than a password (and the identifier - in this case, the address itself - but identifiers are generally considered public). Thus, a two-factor password reset flow might go something like this:

Click on "Forgot my password" at login.
Enter your email address, and the site sends you a password reset link.
Open the password reset link (which contains a secret token), thus proving that the password to your email account is something you know.
Service sends you a text message with a short secret code in it (possibly after making you confirm your phone number).
You enter the code from the message, thus proving that your phone is a thing you have.
Two-factor authentication being completed, you can now set a new password, log into the site, etc.

The advantage to the service provider is that they are now much less likely to have to spend customer service time and possible customer goodwill walking the line between "I can't remember my password" and "somebody hacked my account". That kind of thing can be a significant cost sink, and if the site contains anything sensitive then it may lead to reputational harm to the site if they aren't paranoid enough.

Unfortunately, hijacking mobile numbers is not that hard to do. Even leaving aside technical attacks (faked cell towers or spoofing the phone or passively sniffing the radio traffic to catch the SMS that gets sent), phone companies have demonstrated that they are not trustworthy when it comes to authenticating people correctly before issuing them a new SIM with your number. As such, SMS or call-based second factors should be considered a weak additional protection, and should definitely not be trusted for single-factor authentication.

As for what the provider can do with a number, well, worst case would probably be to give or sell it to robocallers, the telephone equivalent of spam. Calling a mobile number in such a manner is actually illegal in the USA (since we're about the only place in the world that the recipient pays for incoming calls, either via prepaid credit or minutes of usage, so commercial messages without an existing business relationship are forbidden) but they happen anyhow. Realistically, though, any but the sketchiest of sites is unlikely to do anything like this (feel free to check their privacy policy, though of course there's no guarantee it's not a lie).

Second-worst thing would be to use it to send you unsolicited calls or messages, but I don't think I've ever seen this happen (do check for a "use your contact information for marketing or promotions..." option and make sure it's not selected).

In theory, the phone number might be useful to identify you personally (through a directory service / social network / phone book / whatever) and it's a lot easier to create throw-away email addresses than throw-away phone numbers. It's unlikely, though. If you're the kind of person who uses a fake name and a single-use email address when signing up for something, then putting your real phone number in there is obviously a risk. Otherwise, it's probably pretty harmless.


Can end-to-end encryption be securely implemented on a web application? There are a lot of arguments around whether web applications can implement end to end encryption. Most of the arguments against javascript based solutions are centered around the fact that the the communication under consideration is between two parties which uses that web application as a channel for communication. (Example: Webmail - Protonmail, Chat Clients - Whatsapp Web, Telegram Web). The argument says that the server can always serve a malicious javascript and the communicating parties cannot trust that it would not happen.

The question I have is slightly different. The communicating parties here are the end user who accesses the web application on a browser and a final downstream server behind multiple components such as load balancers and WAFs. The threat here is that I do not trust any of the intermediate systems as TLS do get terminated at each of those endpoints.

Is there any possible way I can achieve end to end encryption between the end user and the final backend server if the channel itself is not trusted?

I see potential opportunities for MITM in the key exchange even if we use DHE with signed public keys because the JS which is supposed to be performing the signature validation can be manipulated by one of the intermediary systems.

Is there any other way to at least partial end to end encryption? [perhaps by segregating the involved systems or by adding detective controls]

There are a lot of arguments around whether web applications can implement end to end encryption. Most of the arguments against javascript based solutions are centered around the fact that the the communication under consideration is between two parties which uses that web application as a channel for communication. (Example: Webmail - Protonmail, Chat Clients - Whatsapp Web, Telegram Web). The argument says that the server can always serve a malicious javascript and the communicating parties cannot trust that it would not happen.

There are ways to improve the trust you can have in the files being received from the service. (for example Subresource Integrity or SRI)
You could also add a service worker to validate the files before there loaded. (possibly through a wasm application). the main point is that this is really hard to do correctly and really easy to break if implemented incorrectly.

  The question I have is slightly different. The communicating parties here are the end user who accesses the web application on a browser and a final downstream server behind multiple components such as load balancers and WAFs. The threat here is that I do not trust any of the intermediate systems as TLS do get terminated at each of those endpoints.

This effectively means you are at the same point as the others.(you can not trust the chain)

  Is there any possible way I can achieve end to end encryption between the end user and the final backend server if the channel itself is not trusted?

Yes, but you need additional steps to make this happen. (for example the final fecrypt is handled outside the browser).

  I see potential opportunities for MITM in the key exchange even if we use DHE with signed public keys because the JS which is supposed to be performing the signature validation can be manipulated by one of the intermediary systems.

  Is there any other way to at least partial end to end encryption? [perhaps by segregating the involved systems or by adding detective controls]

It all boils done to what level of trust is sufficient in your use case.
And what steps do you actively use to control the complete system. (e.a. how do you validate, authenticate and check the integrity of all components at each end (and in the middle for the relevant parts).

Also how do you protect your key information?
(you have little to no way of ensuring that the key information will not leak out of the browser unless you take special care about it. Or do you employ something like a smart card?

Tl;Dr, Yes you could. but it takes special measures to do so. in general I would NOT recommend you do this in this manner. Use proper (vetted) tools that are already in use instead.


Who owns the gpg key 4AEE18F83AFDEB23 and how did it sign a commit in my GitHub repo? This commit in my GiHub repo is signed by a key I don't recognize: https://github.com/jonathancross/jc-docs/pull/2/commits/124672699991af75dd2454831670758f08bc74ab

What is going on here?

GitHub itself is signing commits made through the online editor using the key 0x4AEE18F83AFDEB23:

From: https://help.github.com/articles/about-gpg/

GitHub will automatically sign commits you make using the GitHub web interface. These commits will have a verified status on GitHub. You can verify the signature locally using the public key available at https://github.com/web-flow.gpg


Why is Windows Credential Guard secure, when Windows is able to "access" credentials using RPC? I've read some blogs that describe Windows Credential Guard: how it works and which  security benefits it provides.

However, some of them mention that Windows can "access" credentials using RPC calls to Virtual Secure Mode (VSM).

But if Windows OS is able to communicate with VSM (Credential Guard), both running on the hypervisor, why isn't an attacker with local administrative privileges not able to do the same?

NB: Please correct me, if some details regarding Windows Credential Guard are wrong.

First off, it's important to know what Windows Credential Guard does and does not protect. It does protect domain credentials that have been used to log onto the current system, so that tools such as Mimikatz can't just dump LSASS and obtain cached credentials in a format that can be used to pivot to other systems on the network. It also protects domain credentials that have been used for RDP. It does not protect local accounts, Kerberos service tickets (Kerberos TGT is protected though), digest credentials, or cached logon password verifiers (these are hashes, not usable credentials).

WCG is part of the new Virtualisation Based Security (VBS) feature in Windows 10. The way it works is to use the Hyper-V hypervisor to run both the primary operating system and a secure secondary operating system in tandem. The secure secondary operating system is known as Virtual Secure Mode (VSM) and it comprises of the Secure Kernel Mode (SKM) and Isolated User Mode (IUM). Effectively, you can think about VSM as a kind of isolated version of the LSA, running outside of the operating system.

One of the key security requirements of running VSM properly is to enable Secure Boot. When this is enabled, all pieces of code from the Windows boot loader to the Hyper-V hypervisor to the SKM and IUM are protected via a signed chain of trust. Since the secure VM has numerous security features enabled (SMEP, TPM, IOMMU/VT-d, SLAT) it becomes impossible to gain code execution on the secure VM without some kind of SMM or hardware vulnerability. As the normal OS (where an attacker would gain code execution) is itself virtualised separately by Hyper-V, it is entirely isolated from the secure VM and cannot influence it except via the exposed APIs.

As such, the only way to get access to the data stored within the VSM is via the exposed APIs. These APIs are exposed only to the kernel (ring0) in the normal operating system. The main operating principle of WCG is that it acts like an oracle. You ask it to generate a remote login token for a particular system using cached credentials, and it does so. You can't see the cached credentials, and you can't use the generated token to recover the cached credential or generate other login tokens. You also can't use it to generate malicious tokens, like a kerberos golden ticket, which was possible in the past via such tools as Mimikatz.

Future reading that you might find interesting:

Alex Ionescu's BH2015 talk on SKM and IUM
Video series on IUM on Microsoft's Channel 9
Windows 10 Device Guard and Credential Guard Demystified


What use does a TPM have for accurate timekeeping? I stumbled across this image and something immediately stood out to me. This is a photograph of a discrete TPM card. That silver cylinder on the left is a crystal oscillator, used to tell time with very high precision. At first I thought it must be used as a clock source, but if I recall correctly, TPMs and other tamper-resistant microcontrollers rarely, if ever, use external clock sources in order to make glitching attacks more difficult. What use would a TPM have for accurate timekeeping? If it actually is being used as an external clock source, what is done, if anything, to mitigate clock glitching?

EDIT: It seems I was incorrect claiming TPMs never using an external clock. According to the datasheet for SLB9635TT2.0, the LCLK pin provides an external clock typically driven by the PCI bus (normally 1-33 MHz). However, there is no explanation in the datasheet for the oscillator.

The oscillator is a mandatory component for the TPM system to function.

The TPM module has a 100 kHz SMBus which is synced using that oscillator.

If the TPM board also has a wireless sensor node, that one also gets synced by the same oscillator.

Here's a basic schematic for the Atmel AT97SC3203S-based TPM modules:


Is it not advisable to add a 2nd level of encryption to an already encrypted external hard drive? In a separate post regarding the security level of "WD My Passport 2TB" external hard drive's built-in password encryption, Tom Leek answered in incredible detail that left the enquirer of the sensible and cautious opinion that he should add a 2nd level of encryption using software (he mentioned Truecrypt).
I have just tried the same thing using the successor of Truecrypt being Veracrypt but am having severe problems in use. The file container created successfully and my data copied into the folder seamlessly. However, whenever I try to save a file from within Word it hangs any programs that are trying to access that double-encrypted drive and even Windows 7 Task Manager can't close the programs so I have to force a shutdown that risks corrupting data.
Does anyone know what could be wrong here please e.g. should this 2nd level not work with "WD My Passport" drives & Veracrypt?

Many thanks for any help.

Honestly, I would just use Veracrypt. It is far better than WD's built-in protection, and is less likely to screw everything up. The way you are looking at it is like "Should I let people have 2 million years or 1 million years to crack the encryption?". The answer is it doesn't matter, so just stick with the easiest option.


Why are countermeasures against control-flow hijacking attacks mostly implemented in software? I wonder why countermeasures against code-injection and control-flow hijacking attacks (e.g. stack-based buffer overflows and heap-based buffer overflows) are mostly implemented in software.

Examples of popular and widely deployed countermeasures are:
- ASLR
- Stack canaries
- Non-executable memory regions

But why exactly are these countermeasures not completely implemented in hardware, or at least supported by hardware? Since nowadays reconfigurable hardware (e.g. FPGA's) is affordable, this approach seems perfectly possible to me.

Or do hardware-based countermeasures exist? And if so, can anyone give me some examples?

Non-executable memory regions are an example of a hardware-based countermeasure: the non-executability of the memory is enforced by the memory management unit.  Heap overflow protection can also be implemented at the hardware level (by placing non-readable memory pages at the ends of a heap allocation), but usually isn't, because it greatly reduces the available address space and only works for allocations that are an exact multiple of the page size.

Most countermeasures are implemented at the software level because the concepts they involve (such as address space layout) only exist at the software level.


Is it possible to craft a certificate signing chain that thwarts MITM corporate VPNs? Some companies install software on corporate VPNs which also come with a root certificate installed on all employees' machines. This allows for encrypted traffic to be decrypted by technology installed on the VPN. Some companies even have to do this to meet certain auditing and compliance requirements.
Is it possible for a website to set up a certificate signing chain in a way that if the root cert that signed it was replaced by the MITM root cert, it would either fail to load the website, or prevent it from being overwritten by the root cert entirely in the first place?
Or, if there's a root cert installed on a machine, is it impossible to prevent TLS intercepting by a MITM party?

From my understanding you are essentially asking if a web server certificate can be setup in a way that the traffic cannot be transparently intercepted and decrypted by corporate MITM solution, which a new root CA is installed as trusted at the client. I.e. the question is not specific to VPN.

In a MITM setup the MITM proxy is basically the client to the original server and thus gets the servers certificate and chain. It then works as a server to the original client but sends a different certificate and chain. Since the client has no idea how the original certificate and chain looked like but trusts the CA for the new certificate, the client will trust the new certificate too. This means that simply with some magic on the certificate and chain it is not possible to protect against MITM.

Protection can instead be done if the client has more expectations to the server certificate than just being signed by a trusted CA. Such expectations can be achieved if the clients limits which certificates it accepts by certificate, the certificates public key or the certificates issuer (CA). Such pinning is implemented for  some commonly attacked domains in many browsers. But in order to facility legal SSL interception done in corporate proxies but also desktop Antivirus products, pinning is usually automatically switched off when the served certificate was issued by a root CA which was explicitly imported as trusted.

Another protection would be if the server has more expectations to the client. By requiring a client certificate issued by a specific CA the server can also make sure that the traffic cannot be successfully intercepted. Instead the TLS connection will usually just fail, unless there is an explicit exception for the target site in the MITM proxy. Of course, the client must actually have the client certificate installed in the first place to connect to the server without MITM which somehow limits this approach.

The target server could also try to detect interception by fingerprinting the TLS stack of the client and then block access if interception is detected - see Detect man-in-the-middle on server side for HTTPS for more on this. Note that this detection is not perfect, i.e. can have false positives and false negatives.


What free tools or techniques exist to discover anomalies in network flows? I have been using FlowMatrix.  What do others do on the cheap?

WireShark is a free tool you can use to monitor network traffic. Excellent tool to see if a hidden keylogger is trying to email and /or FTP logs because it usually has the address and password in the wireshark log.


Why is it so easy to pirate apps for Android, considering most have an internet connection and access to phone details? It seems so easy to pirate apps for Android it's as if no one even cares. It's as easy as google searching for the apk and then installing it. Isn't this surprising as some apps cost money?

Wouldn't it be easy for Google to stop piracy as the Google Play Store knows which apps are installed and it would raise a red flag if an app that cost money is installed but there was no history of it being downloaded through the app store?

Am I missing something? Is there a technical detail that makes it harder than I think to know if someone has pirated?

I'm not saying it's good, but consider how now many ISPs basically have an automated process to scrape IP addressees from a bit torrent tracker hosting some of their copyrighted work, and send them an official looking letter threatening law suits if they don't voluntarily pay them money. I'm a bit surprised no Android Apps are doing this, especially considering almost all apps connect to the internet and get the information of the device. Come to think of it, if an app is detected as pirated could the company call the phone and ask how you purchased the app and use it against you in court? I guess the thing is many people do this.

UPDATE: for example Pokemon Go can be downloaded for free in countries that aren't supposed to have it. It's as simple as google searching the download, so it's as if they aren't even trying to prevent piracy.

Wouldn't it be easy for Google to stop piracy as the Google Play Store knows which apps are installed and it would raise a red flag if an app that cost money is installed but there was no history of it being downloaded through the app store?

It's not as straightforward as that. There is no reliable, automated way to tell that a side loaded application is the same as an existing Play Store application. Simply changing the application's package names would make it really hard to compare one application with another. A more sophisticated attempt at hiding the application might be to recompile the application with an obfuscator. It is probably an Undecidable Problem.

It will also be an egregious privacy violation if Play Store uploads the names/signatures of side loaded applications to Google's server. That's more akin to what a spyware would do than a reputable application store. People generally don't like being treated like criminals; presumption of innocence is the principle.

Software DRM is most just for show, and can't really protect against piracy. If an application ships with DRM so it somehow cripples itself if it detects it is pirated, the pirates will simply modify the pirated application to disable such checks. The effect being that the DRM is only active on the systems of honest users, while the pirates got to have a DRM-free version.

There were a time in the 90s and early 2000s where softwares ships with various kind of DRM techniques. This leads to a sort of arms race between software developer and pirates; until software developers realized they are on a losing battle, as the DRM techniques used started becoming very invasive and becomes more like a malware than most real malware. Most software developers have since learned that most DRM is useless, and now protects their intellectual property thorough other means.


Benefits of secure code review in-IDE vs. fatapp vs. webapp For those of you who have worked with commercial secure code review tools such as:

Klocwork
Coverity
Armorize
Fortify
Checkmarx
Appscan Source Edition (formerly
Ounce)

Or perhaps a free or open-source equivalent such as:

CAT.NET
FindBugs
Klocwork Solo
Armorize demo
Fotify Teamserver demo (or the Audit
Workbench that comes with the book)
OWASP O2 (Ounce Open)

do you generally prefer the in-DE plugins/addons (e.g. Fortify Secure Coding Plugin for Eclipse), the standalone fat app (e.g. Audit Workbench), a web application (e.g. Armorize, Fortify Teamserver), a complete build server solution, et al? Why?

Not much of an answer, but I would say it depends more on the feature-set of each product, and the usablity of each interface.
E.g. Fortify's IDE plugin, fatapp, and webapp are not equivalent in supported features.  Even more, Fortify's Eclipse plugin is not equivalent to their own VisualStudio plugin!

In principle though, assuming all else being equal, my preference would be:

As an auditor / security consultant, I would prefer the standalone. Dont need to start messing with their environment, helps me focus more, etc.
As a developer (and for my clients/developers), I would prefer IDE plugin, so as to put everything right in front of them, thy dont need to open another tool, they wont forget about it, makes it part of their dev/compile, etc.
A web app for statistics (ala what Fortify tried to do with their 360 server, but not great IMO) is great for management and such.

A note, the above mostly depends on relying on automated code scanners, as opposed to manual code review. Sometimes that's what is needed, but in general usually not good enough.