Website knows that I'm connected via OpenVPN When I'm connected to a OpenVPN server and visit http://ip-api.com/ I get this:

OpenVPN UDP bs128 SHA256

Can somebody explain to me how this is possible and how can I stop this information leak?

It is possible to infer the usage of a VPN from patterns in the communication.

If you are using a tunnelling technology like IPsec, L2TP, or PPTP, your packets are incapsulated inside other packets, so the useful part of the packet might be smaller than in a classic network. MTU and MSS are two important pieces of data about the sizes of the incapsulated packet and the final packet.

Maximum Transmission Unit (MTU) is the maximum data that can be transmitted in one packet. Every network has a MTU value, be it a local network or the internet backbone. The most common value is 1500, but there are some exceptions. When using a VPN, your OS sends smaller packets by setting lower MTU values in order to prevent fragmentation in the network that might reduce bandwidth and latency.

When a web browser or any other software that communicates on the network creates TCP connections, it sets Maximum Segment Size (MSS) value in the TCP header, which informs the receiver of the maximum TCP data size the transmitter can receive without packet fragmentation. This is very similar to MTU.

OpenVPN is a VPN software suite that is more specifically detected because it works in a different way than other VPN software. OpenVPN decreases MSS instead of interface MTU. By decreasing MSS like this, it is possible to further detect the encryption being used because a certain combination of protocol, block size (bs), MAC and compression will generate specific MSS sizes.

Fix this information leak in OpenVPN by changing the mssfix directive in the OpenVPN config file to different values like 1420, 1360 or 0 (experimental).


PCI Compliance : Capture Credit Card, make ajax call to save address, then post of Payment Provider Say on the guest checkout page of an e-commerce website, if the user enters the delivery address, payment details (Credit card details) and clicks Submit button - and if

an ajax request is made to the hosted e-commerce website (to update the delivery address - note that the credit card information is not sent)
and on success of ajax response, the credit card form is submitted (http POST) to the payment provider

does performing the ajax in step 1 make the site non PCI compliant?

First of all, I'm not a QSA.

That said, because you're accepting credit card information directly on your site (even though you don't send it to your server), you need to fill out SAQ A-EP.  Among the things you certify with that SAQ are:

  All processing of cardholder data is outsourced to a PCI DSS validated third-party payment processor
  Your e-commerce website does not receive cardholder data but controls how consumers, or their cardholder data, are redirected to a PCI DSS validated third-party payment processor
  Your company does not electronically store, process, or transmit any cardholder data on your systems or premises, but relies entirely on a third party(s) to handle all these functions

Do note that "cardholder data" does not include the billing address, even though it's data about the cardholder.  In this context, it means:

  At a minimum, cardholder data consists of the full PAN. Cardholder data may also appear in the form of the full PAN plus any of the following: cardholder name, expiration date and/or service code.

So there's no issue with posting the address back to your own site, so long as the card information doesn't go with it.


Does hash solve passwords in parts? From an answer this earlier question: Does adding dictionary words to passwords weaken them?

  "...you have no way to recognize it as a password before testing it
  (against a hash or an online service)"

This raises my question, for clarification: Can dictionary attacks and related tools get feedback about words or patterns, in order to solve in parts? If a cracking tool extracts the user's name elsewhere (say "Kim" for example) and tries it in a 20-character phrase, doesn't it still have to solve the exact 20-char phrase before gaining confirmation of the 3-char sequence and location? Do the hash analyses find patterns to explore?

Proper cryptographic hash functions are all-or-nothing: you either get the exact correct input, to the last bit, or you get nothing. No patterns, no partial solving, no Mastermind-like cracking. That's why it is called brute force: there is no finesse whatsoever in password cracking.

Being able to solve passwords "partially" only happens in Hollywood movies, or in cases of blatant incompetence.


Right way to draw a VPN behind/in front of firewall Among the two image links that generally describe about the VPN being placed behind / in front of the firewall,

how do i know which one is placed first in each image? (VPN behind or in front of the firewall).

This is a little confusing because i can be either talking about the VPN client outside the internet or within the VPN server.

I do understand the description of each slides but i'm confused about between which image shows that the VPN is behind or in front of the firewall because of 2 different perspective.

Trace the line from the Client box to the VPN Client box.
If you pass through the Firewall box first, then the firewall is behind the VPN.
If you pass through the VPN server first, then the server is behind the firewall.

In general, when it comes to networking, "behind" is from the point of view of the outside network looking in.  When we say something is "behind the firewall", we mean the firewall is between you and it.


Setting up Knockd issues So i'm busy setting up a knockd service on a VM to enable SSH login when the correct sequence of ports are "knocked on" using knockd and ufw.

The issue that I am currently having is that when the correct sequence of ports are selected, the user.rules for ufw is not able to write the new rule to a file.

I have tried using chmod 777 on all files within /etc/ufw as a test, however the file is still not writable.

The output for /etc/ufw/user.rules is as follows:

Jun 14 13:13:31 Pop knockd[4780]: WARN: /etc/ufw/after6.rules is world writable!
Jun 14 13:13:31 Pop knockd[4780]: WARN: /etc/ufw/after6.rules is group writable!
Jun 14 13:13:31 Pop knockd[4780]: WARN: /etc/ufw/user6.rules is world writable!
Jun 14 13:13:31 Pop knockd[4780]: WARN: /etc/ufw/user6.rules is group writable!
Jun 14 13:13:31 Pop knockd[4780]: WARN: /etc/ufw/applications.d is world writable!
Jun 14 13:13:31 Pop knockd[4780]: WARN: /etc/ufw/applications.d is group writable!
Jun 14 13:13:31 Pop knockd[4780]: WARN: /etc/ufw/user.rules is world writable!
Jun 14 13:13:31 Pop knockd[4780]: WARN: /etc/ufw/user.rules is group writable!
Jun 14 13:13:31 Pop knockd[4780]: ERROR: '/etc/ufw/user.rules' is not writable
Jun 14 13:13:31 Pop knockd[4780]: openSSH: command returned non-zero status code (1)

The knockd file is shown in the code block below:

[options]
        logfile = /var/log/knockd.log

[openSSH]
        sequence    = 7000,8000,9000
        seq_timeout = 5
        command     = ufw allow 22/tcp
        tcpflags    = syn

[closeSSH]
        sequence    = 9000,8000,7000
        seq_timeout = 5
        command     = ufw delete allow 22/tcp
        tcpflags    = syn

The output for /etc/default/knockd is shown below:

# control if we start knockd at init or not
# 1 = start
# anything else = don't start
# PLEASE EDIT /etc/knockd.conf BEFORE ENABLING
START_KNOCKD=1

# command line options
KNOCKD_OPTS="-i enp0s3"

Any advice would be greatly appreciated.

In case you're using systemd disable (comment out or set explicit to off) ProtectSystem directive at knockd.service file (found in /lib/systemd/system/ folder).

If this works, reset it to full and put below it

ReadWritePaths=-/etc/ufw/

ProtectSystem=full mounts ro /usr, /boot and /etc for processes invoked by the unit excluding directories specified in ReadWritePaths.

If running, before restarting the service do

systemctl daemon-reload


Using a special user to manage web server? I just rented a VPS, in order to run a web server. I installed LAMP utilities and everything work.

I have actually only 1 user (root). This means everytime I want to connect to my server to modify files under /var/www/, I'm using the root account. This does not seem good to me (even if I use sFTP).

I would like to know if I have to use special user to manage my web files.
For example, create jsmith and run chown jsmith /var/www/index.html ?

Using root as a general purpose user account is just generally unsafe. Bad things can happen too easily (I once did rm -rf ~ when I was in a root shell). So, you are correct, create a user.

Using chown, if there is only one user messing with the server data files, seems fine. The answer to this question goes into some details on how to set it up. It does a nice job discussing the security ramifications that come from making web server data files writable by the web server.


IPV6 Cryptographically Generated Address implementation I am looking to an Cryptographically Generated Address (CGA) implementation in Java or in C++.
Would be glad if someone can help.

http://www.thc.org/thc-ipv6/   a whole suite if ipv6 utilities, but sendpees6 has great examples of how to do CGA against SEND.


Infect Android device from inside the network without target knowing? Is it possible to malicious some device in the same network without the user knowing?

there some people use malicious apps but the problem is the user have to see the dialog box application permissions and install it

is there any other option like use another type file this still malicious android soon is download or soon he is in the network?

I have read in WannaCry attack they say that could be exploited with just access to the same network

As schroeder already said, it depends on what exactly you are attacking. What you describe is essentially "Remote Code Execution". You want remote access to a device, without user interaction being neccessary. In this case, you need some kind of bug in a component which can be reached from outside, allowing you to send malicious data and cause unintended behaviour.

Take a look at Stagefright for example. It was a flaw in the way Android handles MMS. Sending a specific forged MMS could exploit this flaw and gain access to the device.

WannaCry was a little bit different. Afaik it used two ways of distribution. Either simple mechanisms like executing an .exe file, unconsciously activating Word macros, etc. OR by exploiting a bug in the Windows OS, which was unknown until then, as the NSA held it back. This bug allowed it to spread on its own by scanning reachable hosts for the vulnerability and installing itself on them, using an exploit for said bug.

Unknown bugs which can be used to gain remote code execution are extremely dangerous. Here in Germany, the company "Deutsche Bahn" was neraly shut down due to many many machines being infected (even the screens in the train station telling about delays and plans).


Should a server be considered compromised simply because a port was open? Earlier today I received a notification of a security incident at Mandrill. At first I was concerned, but then after I dove into the details I became confused as to why they considered this noteworthy at all.

To summarize, it appears that Mandrill made some changes to their EC2 security groups, which resulted in some ports on their logging servers being accessible to the Internet for a few weeks.

  On March 10, we discovered evidence that automated attempts were made against Mandrill's internal logging servers in an effort to use them in a botnet. Analysis of the servers that were impacted, including network traffic logs and files present on the servers, indicates that these attempts were unsuccessful. There are no signs that the servers were targeted to access the data stored on them.

  We investigated the issue and found that the opportunity for this attack stemmed from a firewall change we made on February 20 in order to more granularly control access to some of Mandrill's servers. Parts of Mandrill's infrastructure are hosted with Amazon Web Services (AWS), and we use EC2 Security Groups to control access. One change was made to a security group that contained more servers than we intended to affect. As a result, a cluster of servers hosting Mandrill's internal application logs was made publicly accessible instead of allowing internal-only access.

Now, we all deal with botnets all the time and how to keep your machines reasonably safe from them is pretty well known. Especially since nearly all of what I run is public facing and I see millions of botnet attempts, none of which ever succeed at doing anything but generating log entries.

But because of this they are recommending that everyone invalidate and change all of their API keys. I personally have close to a dozen active API keys and it will take me most of an afternoon to change all of these where they need to be changed.

My personal thought is that they have massively overreacted to this. But I don't know everything. Is there some reason that simply having open ports would be considered a potential compromise here?

From reading the disclosure, it seems what happens is that the open port isn't actually just a random port, but rather it is a port where a certain internal service that had never been designed to be exposed directly to the external world was listening on. If there is a vulnerability in that internal service, that might have allowed a possible attacker to obtain the API key of users that uses their service within the specified period of time.

While they do note that the attack looks like an automated attack rather than a targeted attack, it should be considered that sophisticated attackers often uses a highly visible automated attack to divert the server's and the sysadmin's attention away from another covert, targeted attack that are happening at the same time, i.e. the big DDoS that causes a lot of attention is just a diversion.

A sophisticated attacker could have erased their tracks if they managed to gain privilege into the system to make it look like nobody has compromised important data. This is why they recommend changing your API keys, even though they found no evidence of the data being actually queried. Especially since this is a logging server that was compromised, and since sysadmin would usually use logs to detect compromise, a compromised logging server can hide what's truly happening.

A sophisticated attacker could also have left a backdoor/rootkit on the system to allow themselves to reenter the system at later date when everyone thought things have settled down, so they can do their actual attack at a more leisurely pace from inside the security boundary, which could be highly dangerous. This is why they are decommissioning the machine involved.

Or it could be that they may be doing this as a show to some potential security-conscious customers that are on the fence on buying decisions due to doubts about their security. This might shift the attitude of those potentials customers to decide to take up their service, since they're now reassured that the company wouldn't be keeping mum when there are vulnerabilities that might affect them.

  Is there some reason that simply having open ports would be considered a potential compromise here?

Yes, the open port exposes an internal service that wasn't designed for external use. Services intended for internal use often lacks the security hardening that public facing services would get, because the assumption was that the service is only accessible from trusted machines. For example, an internal service might not use SSL to communicate within the trusted network, or they might not validate their inputs as thoroughly as they assume the trusted senders already does any necessary validations, or they might have administrative commands that can be used without authentication, because it assumed that any necessary authentications have been done by the public facing services.


Protocol to identify individuals by personal SSL certificates and personal DNS addresses Are you familiar with a protocol that allows private individuals to identify themselves by their own DNS address and SSL certificate? I know about client side certificates but I'm talking about something that would be simpler to use than carrying around a private key.

For example, in order to authenticate myself and login to a website I will just provide my "ID" site: https://my-first-name.last-name.my-private-domain.com where a server would be available with a valid SSL certificate for my specific subdomain. The DNS address can also include a whois record and phone/email address etc. Or any data in the TXT record for that matter.

The site could then identify me in several ways, it can email me, text me or simply encrypt my data with my own public key.

Did someone do this anywhere? Research it?

You need more than just a URL or whois record which publishes information about you. What's to stop me asserting that I am Amir Mehler simply by providing the URL or DNS name to a site requiring authentication?

That means there has to be some negotiation between the the user, device, the authenticating site and the URL offered as a proof of identity. That's what openid does

  The site could then identify me in several ways, it can email me, text me or simply encrypt my data with my own public key.

Those are different services than authentication. And available elsewhere.


Does SSL/TLS (https) reveals your IP address? Because the NSA monitors traffic going through the major nodes of
the internet, they can know which IP address does what on your
website, even if you are using HTTPS.

Is this true or false?

Any website owner can see what IP address is doing things on their website. This applies whether HTTPS is in use or not.

Any node operator (ISP, CDN provider, gateway operator) can see traffic passing through the nodes they operate. They can see both the apparent source of traffic, and the destination - they need to in order to be able to correctly route the data to the destination. This applies whether HTTPS is in use or not. They can't see the specific pages you visit, if HTTPS is in use.

Therefore, if the NSA wanted to see what a given IP address was doing, they could look at the data on a node which all the data from that IP passes through, and see what server you are connecting to. In order to find out precisely what pages you visited, they would need to look at the data on the web server, or on your machine. They could do this whether HTTPS was in use or not.


Is a smartcard single or multi-factor authentication Since it is only something you have, that makes it single factor authentication right?

Factors refer to the three different modes of authentication (although there are more - geographic, time of day, etc, but they're less typically referenced)

The 3 main factors are

1) Something you have

2) Something you are

3) Something you know

You are correct that a smart card is single factor on its own - anyone with it can authenticate to the system.

It becomes multi-factor when it's paired with an element from 2 or 3. If I have a password and a smartcard, I have two factor. If I have a password and a smartcard and a fingerprint scan I have three factor.

As an aside - If I have two smart cards and a password I still have two factor. You can't use two passwords, smart cards, or two fingerprints to make two factor.


Is there value to signing microservice calls with an HMAC derived from the same private key? I had a friend say:

  We're securing our microservice with an HMAC derived from the private key in the jks file. [Where client and server shared the same private key]

I can understand the situation where you have an HMAC from a secret that is short lived - such as one derived from Hashicorp Vault.

But if the HMAC has the same lifetime as the private keys - why not just secure the microservice using SSL based on the private keys you've already installed?

My question is: Is there value to signing microservice calls with an HMAC derived from the same private key?

If client and server share the same private key, private key basically turns into as a symmetric secret, thus nullifying any use-case relevant for SSL, or, FWIW, any signing scheme.

It's basically integrity without authenticity.


what are some instances of compromises due to email sniffing? Since emails are usually sent in plain text and bounced through a bunch of SMTP relays it is potentially possible for a well placed attacker to sniff for these and read emails without being able actually log into the email account.

I would like to read about real world instances of this attack being used, what well known attacks of this form have been written about?

Once an attacker is on a network, they can sniff all traffic moving around it. Let's take, for example, a home WiFi setup that uses WEP.

Attacker breaches WEP, because it's insecure.
Attacker uses promiscuous mode to sniff frames on the network, and steals all traffic.
You send an email via SMTP.
Attacker dumps traffic a file and analyses with Wireshark or a similar tool, and extracts the emails.

It's as simple as that, and it can be performed with free software and off-the-shelf hardware.

Looking at SMTP relays, what you've really got to worry about is state-sponsored attacks. It'd be rather silly to assume that no government is sniffing SMTP traffic on these relays as part of their standard communications intelligence program. However, this doesn't mean that private individuals don't have access - the relays are just computers like any other, and they can be breached.

Furthermore, the traffic between SMTP relays bounces through several other machines and routers on its way, since there's no direct network path. Any one of these might be compromised.

In short, you have to assume that everything travelling over the internet is unsafe. It's an untrusted and hostile network, so you must enforce security.


How can I watch porn, safely, and not get a virus on my machine or infect corporate data I'm part of a small office in the middle of nowhere, and we just got absorbed into a large mega corporation.
Sometimes we watch porn, at the office, on company computers, using the company Internet. It makes good for a good background distraction. (I know I'm not the only one who does this so don't judge me.)
No, there are no filters or blocks in place. (No Websense, etc.)
I like this situation and don't want to screw it up by inadvertently getting a virus, spreading throughout the company and forcing them to solve the "problem" by blocking the sites.
So my question is: How can I watch porn safely, and not infect corporate data?
(Hint: saying, "No, don't surf porn at work" isn't an answer. I'm asking on behalf of colleagues that won't change their ways.)
Full disclosure
This story above is inspired by a person who approached me during a company acquisition of a branch office. I added humor and nuance to describe their desired ways of working so that I can use this knowledge to protect the truly vulnerable victims of indulgent and destructive behavior.  I was the guy who worked at the acquirer.

The same way you shop online without getting your CC details stolen.  Buy from reliable vendors that have established reputations as legitimate businesses.  Don't go places where they are trying to bait people in to generate bot nets and steal personal info.  If a deal is too good to be true, chances are good that it is.

That said, security also involves considering the other risks and there are other major potential issues that may arise, including legal issues that may actually make the situation illegal.  It could very easily result in what would be considered a hostile work environment and could potentially run afoul of sexual harassment laws depending on where you are, so that should also be considered.  (Even excessive crude joking can get companies in trouble in some locations.)

This is generally not a good idea for multiple reasons regardless of if you can do it securely or what you feel about porn personally.


Can google hangouts be read over corporate wifi if your using your phone ? Tls1.2 Google hangouts uses e2e encryption via https using tls 1.2. Now assuming one is using their own phone but they are using the corporate wifi can their employeer read the messages.

I'm sure with enough resources they can brute force decrypt the messages but I was wondering how the keys are exhanged? Ie how easy is it to read the messages?

I switched from group text messages to google hangouts to coordinate team sports and sometimes the blue collar workers on our team will share or say things that might be frowned upon at other organizations.

So if your running google hangouts on your own phone but connecting to an organizations wifi do they have a leg up to decrypted the messages?

What I have read is if they administer the machine they obviously have a leg up in cracking it and it seems very easy based on the posts here. But they don't administer my phone so how difficult is it for them to read the content?

If your employer asked you to install a Certificate Authority (CA) certificate on your phone, then they can read all your encrypted data to any HTTPS website. This can be done by the network admin acting as the man-in-the-middle. When you connect to an HTTPS website, the browser will see if the (fake) certificate presented is trusted or not, by checking the trust store of certificate signers. The certificate that you were made to  install is the one used for signing the certificate of the website being MITMed. Hence, the MITM terminates the SSL connection between you and itself, and can then establish a new connection to the end server, thereby being able to read data.


How can systems recognize different wifi AP with the same SSID and MAC address I'm testing, for studying purpose, an evil twin attack. In my scenario I have both the rogue AP made by my laptop and the real AP with the same SSID and MAC address, but with different security protocols (the rogue one is open, while the real one has WPA2) and optionally different channels.

Now, with both APs working on the same channel, it seems that different systems have different capabilities of recognizing both of them, or only one. I have 3 systems:

-on Windows and Android I can see and connect to both

-on Linux Slackware, networkmanager can only see the real one, and even if that is shut down, it starts seeing the rogue one, but can't connect to it

How is this possible? What parameters are used to know that there are two different networks, and not only one with two APs?

It's the Security parameter.

From experience, if you make the rogue AP's security protocol  as same as the real AP with the same key, the clients will connect to the rogue AP when the real AP shuts down.


Can I trust a security hash implementation after testing it with random inputs against another implementation? Let's say I want to use a security hashing algorithm, like bcrypt, and I want to use a young bcrypt implementation, e.g. called libfancybcrypt, instead of an well established implementation.

Of course, I can simply generate a few thousand or millions of random strings, hash them with libfancybcrypt and with the old, well established library, and compare the hashes in the end. So assume, I've done that and the new library in question produces the same result as the well established one for all random inputs.

My question has two parts:

Assume the library author can be trusted. Given my random input test above: how likely is it, that the author accidentally introduces a bug with the effect that there are inputs for which a wrong hash is calculated?
Assuming the library author cannot be trusted. Given my random input test above: how likely is it, that the author has purposely introduced a backdoor of some kind?

Related but still different:

How much can we trust open source implementations of crypto (security) libraries?

Assume the library author can be trusted. Given my random input test above: how likely is it, that the author accidentally introduces a bug with the effect that there are inputs for which a wrong hash is calculated?

Being trusted does not imply that the author of the software is a competent programmer which knows all possible pitfalls. This means if you rely only on trust you cannot know the likeliness of introducing a bug. And since such bug might only occur in rare cases like a race condition or some integer overflow there is no guarantee that you will trigger the bug with your random test cases.

  Assuming the library author cannot be trusted. Given my random input test above: how likely is it, that the author has purposely introduced a backdoor of some kind?

If the backdoor gets only activated with a specific input you will never find out without thoroughly inspecting the code. And even code inspection might not help, see the examples from the Underhanded C Contest. This means it is possible to introduce such a stealth backdoor. But again, you cannot give a specific likeliness for this solely based on the information that the author is not trusted.

  Can I trust a security hash implementation after testing it ...

Based on the previous observations this question can not be definitely answered. Apart from that it depends a lot on what you use the library for: if it is just for getting some checksums in order to detect accidentally corrupted data your tests might be enough. If is used instead for purposes where software failure might lead to death, leakage of top secrets or malware infection of critical infrastructures than such tests are probably not sufficient, especially if you don't trust the author.


Is my mongodb data safe given that by mistake I left the default port 127017 open on firewall? A few months ago I started production mongodb server on ubuntu 18.04 secured with SSL (https access) with following UFW rules setup

ufw allow 127017
ufw allow 127017/tcp

No user authentication configured for mongodb. Also no change was made to mongod.conf. This is the line in mongo.conf:

# network interfaces
net:
  port: 27017
  bindIp: 127.0.0.1

that I am betting on saved me from data hack. This line says only connections from localhost are allowed to mongodb server.

Assume that hacker is not able to login to my remote server and the only thing he came to know that I have mongodb running and port 127017 is open, is it safe to assume that my mongo data was safe?

I have now changed UFW rules to allow access to 127017 only tfrom my desktop IP address and updated mongod.conf to allow access from my desktop as well as from localhost.

If mongodb only binds to 127.0.0.1 as shown for your config then the ufw rule you've accidentally enabled will not cause mongodb to be accessible from outside either. But to make sure that no kind of additional forwarding or binding etc was setup you might enable the ufw rule again and then do a telnet your-ip 127017 from outside the machine.  You should get Connection refused or similar which shows that the database is not reachable from outside even if the ufw rule might in theory allow it.


Should I reverse the TLS client and server roles to perform client authentication in my protocol? I'm working with a program with a networking protocol that is using RSA keys to authenticate clients. I am looking to replace the custom authentication protocol with TLS (as it's a vetted protocol). I can use self-signed certificates or RFC 7250 for client authentication. The problem is that there are some use cases for the program where the standard PKI system (i.e. trusted root certificates) isn't viable for authenticating the server. (The program needs to be able to connect to servers on a LAN and it's not reasonable to have users setup their own roots to do it). Looking into "client-only authentication", I found questions like this one where the answer suggests reversing the TLS client and server roles. However, I'm not sure that's the right answer for my use case. I could also just have the server use its own cert/key as its identity and have the client accept any identity when it doesn't know what to expect. I have problems/questions about both solutions:
Using the server identities seems like the most sensible solution to me. Most connections will be able to use an authority to know what the server identity should be, the one case where an un-authenticated client needs to be able to connect will be simpler, and using the protocol in the correct direction might have some optimization advantages. The issue is that I don't know if client authentication is secure when the server authentication may not be. Looking at the specifications, the client and server authentication protocols are similar enough that it should still be secure, but since the spec doesn't allow for "client-only authentication", it's clearly not an intended use case. Is there any reason/evidence to believe that client authentication would or would not be secure when ignoring the server's authentication identity?
Having the client act as the TLS server, being a method suggested multiple times here, seems to be the method with the most guarunteed security, but would be a little tricker to implement. The main thing I'm interested in with this method is what other effects of switching the TLS roles would be. TLS is obviously an asymmetric protocol, but what other asymmetries are there other than authentication? The one I know of is that, while the server ultimately chooses the cipher suite, it's the client that indicates its cipher suite preference that the server normally considers. I found SSL_OP_CIPHER_SERVER_PREFERENCE to correct this in OpenSSL. What other effects of switching the TLS roles should I consider?
Which method would you reccomend in the end? To add a few points, I'm not worried about the server sometimes not being authenticated. Confidentiality isn't a high priority (just a side effect of authentication), and the protocol is mostly the client sending "commands" to the server, so someone impersonating a server isn't going to be able to do much. The only thing that server authentication could reasonably protect would be an optional password authentication, but I'm looking into implementing a PAKE for that, so it shouldn't be a concern.

Server authentication is done to protect against active man in the middle attacks by knowing that one is doing the key exchange directly with the expected server. Client authentication is done so that the server knows what client connected. It is best to stay within these roles when using the protocol, because these use cases are properly cared for by TLS.
This does not mean though that other cases of using TLS are inherently insecure, but there might be weaknesses. If not validating the server certificate in theory an active man in the middle could hijack the connection starting with the TLS handshake and thus change the parameters inside the TLS handshake. This includes protocol downgrades for using weak ciphers, weak protocol versions or switching off the requirement for a client certificate etc.
As long as client and server insist on strong ciphers and protocol version such downgrade will fail though. And as long the server enforces the use of a client certificate and has strict requirements on the client certificate (i.e. will not accept a fake one by the attacker) the active MITM attack will not work - see Do client certificates provide protection against MITM? for the details.
But again, it is best to use TLS for how it was designed. Because these use cases are focused on in terms of security and focused on in security research. Thus if server authentication is optional but client authentication required in your case then better switch the roles.


How can I stop someone from displaying my website on his domain? I just discovered that someone is pointing their domain name to the server I use for a website, which results in traffic to their domain displaying the content of my website.

How can I stop this illegitimate use of content?

The answer depends on the web-server you are using. For example, apache allows for the creation of multiple virtual hosts, of which the first described is considered the default one.

What I suggest to do, is to create this default "catch-all" virtual-host with a global deny rule on it. Then configure your own web-site with a virtual-host identified with your domain name.

Therefore, any request coming in with a domain not matching your shall be denied access (404 I suppose).

An other thing you could do is get the "whois" information on said domain, ISP usually list in the records an email address to report abuse. Collect some information from your logs and ask the provider to terminate this.


Detecting Malcode in Excel and Word Documents There are a bunch of tricks to circumvent potentially malicious macros in office documents you receive. My question is how do I [forensically] detect if there are malicious macros in the documents?

Are there sub-strings I can look for?
Any host-side tools I can use (without having to install a virus scanner)
Any tell-tale signs within the raw-file that would tip off something isn't quite right with the file?

Detecting malware in Office documents works like everywhere else too: You might use a pattern-based approach for known malware and you shall use heuristic to detect potentially malicious behavior.

There is no “common pattern“ for malware. Some might write text files, some might download binaries, some might delete registry settings, some might copy themselves onto network shares.

Detecting such malicious actions require you to understand what is legitimate within a macro. Everything else is potentially harmful. Keep in mind: Running macros from untrusted sources is like executing a binary.


GlobalSign Domain Validation CA revocation issue in all browsers I don't know where to dig in to solve this. Hope for some advice

Today suddenly soundcloud.com stopped working, with error "The certificate has and invalide issuer". The issue persists across all browsers. and only on my Mac(10.12) machine.

Here are the errors I am getting

Here it says certificate has been revoked

Any idea what happened?
I am getting paranoid already :)

EDIT:
I tried to clean cache sudo rm /var/db/crls/*cache.db, that didn't help

From their twitter : https://twitter.com/globalsign/status/786505261842247680

"We are currently experiencing issues with our OCSP which is causing certificate warning messages. We aim to fix this as soon as possible."

The OCSP is the certificate status protocol - their server is potentially flagging certificates as revoked when they are not supposed to be.  This would be a big issue for them, but from follow up tweets, it appears they may have this resolved.

The OCSP status info may be cached for awhile, though, so it may be awhile before certificate errors go away.


Email activation string with MD5'd random number and email secure? For the registration on my PHP powered website, I require email confirmation. After a user registers, a string is generated with the following code and sent to their email address.

$key = md5(mt_rand(1000,999999).$_POST['email']);

That string is also stored in the database, and if the user pastes the correct key in to my confirm page, their account is validated.

Is the key generation code I used secure? As in, is there any way one could ascertain the original email string if they obtained the key?

Short answers: No, your key generation isn't secure. Yes, the attacker can find the email from the code.

An attacker can obtain the activation code for any email address due to the extremely weak random number generation. mt_rand() isn't suitable for this purpose, add to that the advantage gained by knowing some information about the state of your system (time of generation, for example). That can severely lower the space for the potential keys for each email.

As for the other point, I don't think it's such a big concern that the email can be brute-forced from the key. That's should be the least of your concerns. The key is, presumably, short-lived and only sent to the email address. Having the owner of the email address finding out their email address is.. well, you get the point.

However, yes, it's not very difficult to brute-force the email from the key. Mainly because emails are most certainly not randomly generated and will very likely exist in dictionaries with some other combinations. Your random number gives you about 1 million combinations, that's very low.

"How can I do it better?", you ask. It's very simple. Use a secure random number generating method/API offered by your language of choice. In your case, in PHP, you can utilize openssl_random_pseudo_bytes(). Here's an example for your convenience:

$activationKey = bin2hex(openssl_random_pseudo_bytes(16)); //128-bit

After generating the key and sending it to the user, store a hash of the key in the database. Almost any hash function will do, I recommend SHA-1. When the activation link/key is used, you simply hash it and compare it to the entry in the database. After that, you can activate the account and invalidate the key.


MySQL Authentication Hash Cracking I'm currently conducting research regarding MySQL server remote authentication. I've captured unencrypted, uncompressed authentication packets between the client and the server where the username is in plain text but the password is hashed using two salts which are also visible in the "server greeting" packet sent to the client, right after TCP connection is established.

I've ran Hash-Identifier on the password hash and it says that the hash was hashed using SHA-1 or MySQL5 algorithm, however I can't crack it using MySQL5 or even with different SHA-1 variations offered by Hashcat. The password that is hashed is "password" so it shouldn't be a problem to crack utilising basic wordlists. That leaves me with the possibility that I'm using a wrong hashing algorithm in my cracking session or more likely I'm using the salts incorrectly during the session.

What am I doing wrong? Do you know what algorithm is applied for authentication between a client and MySQL server? How do I apply the salts correctly? Can you recommend a different hash cracking software that has the capability to do these?

If you want, I can send you the Wireshark session with captured packets for you to have a closer look at the salt exchange, the hash itself, or even if you want a proof that this was done in a controlled virtual environment.

The various authentication methods of MySQL are publicly documented in the manual:

http://dev.mysql.com/doc/internals/en/authentication-method.html

What you describe might be a method called Secure Password Authentication.


Does storing your files as single compressed archives compromise integrity? Compressing your files as tar.gz or zip for storage or backup saves space and is faster than handling thousands of files. But it looks like small corruptions in the archive, for example because of damaged media, may make irretrievable many more files than the one damaged by a single bad block.

Is that true and should it be of any concern?

it is true that having 1 file for several files may mean (depending on the algorithm) that having that file corrupted could induce that all (or several) of the embedded files are corrupted.
however the concern should be on avoiding corruption :

have several backups of the archive, stored on several locations, to avoid losing them all at the same time (theft/angry employee/earthquake).
and to detect if corruption occurs at the time of making the archive, it should be tested : always test backups in some way : for example, once you have archived things on several medias  (or locations), use a method to test the archived media againt the originals. Preferably using another machine, to avoid having a "reversible" problem making the archive look like the original even if corrupted.


Can a WAF block or detect crafted html file and obfuscated PHP script/shell What happened was, a friend's company is using dated dot net nuke framework. A html page with 'hacked by xxxx' was found uploaded onto the web server.

Upon investigating, it is determined that a webshell was uploaded through exploiting a vulnerability and the 'hacked by xxxx' html page was 'created' using the web shell.

So technically the html file was created and not uploaded. The only thing uploaded was the web shell.

The website has WAF in place. Possibly a CDN(can't remember details).

Thing is, can WAF block/detect the file creation/upload through the web shell or does it just treat it like any other day to day upload/download activities.

Additionally I understand that WAF can block and detect web shell. But how about obfuscated ones?

It all depends on the WAF configuration and the WAF technology. As several web applications have upload features by nature (for example, to upload your CV in a recruitment website), the WAF need to be tuned to ensure only the file types you want are being uploaded. I've seen a lot of system administrators just disabling the file check option instead of fine tuning it, leaving the application vulnerable to malicious file upload.

Most of the WAF solutions are signature based, meaning that if the attacker code it's own reverse shell file or do a very good obfuscation job, probably the WAF will not detect it. For this reason, it is important to not trust only on the WAF, but also adopt secure coding.

If you really need to have file upload features on your website I do recommend you checking this guide which explains how to properly code your application.


Do you need to know the filename to conduct a Directory traversal If my websites has a directory traversal vulnerability (linux) and my other php pages have complicated filenames (e.g. efj93ehdsijgdij3g.php), could an attacker still access other files? Or an attacker strictly needs the right filename in order to successfuly conduct a directory traversal?

Directory traversal is a rather broad vulnerability that can lead to a variety of attacks, depending on context.

On its own, it only means that an attacker supplies a file or directory name, and can travers to files or directories outside of the expected directory. This can facilitate attacks such as:

LFI
Reading of files outside of the desired directory
Uploading files outside of the desired directory, possibly leading to code execution (for example if the only thing preventing code execution is securing the desired directory)
moving files outside of the desired directory
Viewing directories outside of the desired directory, which may help an attacker gather information about the target system
etc

Giving your files complicated filenames could only possibly help in the case of reading out files outside of the directory, and only if you do not provide the ability to list files.

Renaming your files may seem like a good idea as defense in depth - security by obscurity should never be your only line of defense -, but it's not really worth it, as there are larger attack surfaces than reading out your PHP files.

In the case of LFI, an attacker can still read out system files which can have severe consequences. Depending on your configuration, they may be able to:

read out /etc/shadow, crack the passwords, and gain access to the system
inject code into various log files and include them, leading to code execution
inject code into proc/self/environ and include it, leading to code execution
etc

So renaming files may prevent an attacker from reading out those specific files, but doesn't really limit the damage of LFI. It also leads to reduced maintainability, making it not worth the trouble.


Is it safe to sign in to Google with password from desktop app like BlueStacks? BlueStacks is an android simulator for desktop. After installation it will ask you to login with your Google account to download and install android app from play-store.

My question is "Is it safe to sign in to Google account with password from a desktop app"?

Anything you type your password into has the theoretical capability to mis-use it. That includes everything you're already using your google account with, such as your PC and smartphone.

To answer your question you would need to make a risk assessment of all the things that could go wrong, and work out what to do about it.

We can't really do that for you, because we don't know what sort of information you might put through this app or have protected by your Google password; and we don't know what your risk tolerance is.


Why do some web servers still provide information on vendor and version in the HTTP response headers I think in the security field it is a well-known fact that its not a good idea to let the web server vendor (e.g. Apache) and the version be visible to the outside as this can be used to launch targeted attacks against a specific server implementation.

I launched an Apache 2.4 Docker container to see whether that is still the case - and yes, it is.

I thought a bit about it. Wouldn't it be great to have a standard that web servers can implement against which defines a standard feature set that is versioned using semantic versioning?

This way, applications can still handle different server versions (which seems as the only reason why I would want to see the version from the outside) - but at least the vendor of the web server could be hidden. That would be at least one more hurdle an attacker has to deal with.

What do you think?

Yes, in theory by advertising vendor and version in the banner makes an attacker's job easier, but like only a little bit.

Even if you don't advertise it, it can be figured out from the behaviour of the app. Take for example, the network scanning tool nmap:

  Nmap provides a number of features for probing computer networks, including host discovery and service and operating system detection. These features are extensible by scripts that provide more advanced service detection, vulnerability detection, and other features.

Source: wikipedia

  After TCP and/or UDP ports are discovered using one of the other scan methods, version detection interrogates those ports to determine more about what is actually running. The nmap-service-probes database contains probes for querying various services and match expressions to recognize and parse responses.

Source: nmap documentation.

Basically, nmap will start by trying to decide if it's apache / nginx / IIS, etc, which it will do by sending a specific packet to which it knows that the different web servers will respond differently. Then, once it knows that it's apache, it will send packets that target behaviours that have changed between one version and another, possibly because of a bug fix or because of a new feature.

As noted by @paj28 in comments, nmap is quite good at detecting the vendor, but hit-and-miss with version, when nmap displays detailed version info, that's probably because there was a banner. Of course, if you're trying to hack in, why bother trying to figure out version at all; once you know it's apache, why not just run all the apache exploit scripts from metasploit at it and see if any of them stick?

So yes, in theory it's possible to write a specification for "Here's how all web servers MUST behave", but that means that you're not allowing web servers to ever innovate, or fix bugs.  Moreover, web servers will want to differentiate themselves with features that other servers don't have.

As pointed out by @TripeHound, version banners can be considered a win for security as they allow sysadmins to easily inventory their systems and keep them up to date.

TL;DR: Banner or not, you can figure out what web server and OS you're talking to.

Nmap Example

Since this post got popular, I'll add and some examples:

Apache httpd puts version info right in an HTTP header:

HTTP/1.1 200 OK
Date: Thu, 17 Oct 2019 14:26:10 GMT
Server: Apache/2.4.6 (CentOS)

and unsurprisingly, nmap picks this up:

 ~ nmap 192.168.56.107 -p 80 -A --version-all

Starting Nmap 7.60 ( https://nmap.org ) at 2019-10-17 07:58 EDT
Nmap scan report for 192.168.56.107
Host is up (0.0020s latency).

PORT   STATE SERVICE VERSION
80/tcp open  http    Apache httpd 2.4.6 ((CentOS))
| http-methods:
|_  Potentially risky methods: TRACE
|_http-server-header: Apache/2.4.6 (CentOS)
|_http-title: Apache HTTP Server Test Page powered by CentOS

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 14.23 seconds

If we try something a bit trickier, Apache Tomcat does not give an obvious banner:

HTTP/1.1 200
Accept-Ranges: bytes
ETag: W/"1896-1527518937672"
Last-Modified: Mon, 28 May 2018 14:48:57 GMT
Content-Type: text/html
Content-Length: 1896
Date: Thu, 17 Oct 2019 14:35:05 GMT
Connection: close

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>Apache Tomcat</title>
</head>
...

we see that nmap gets the vendor right, but does not have a guess at the version:

~ nmap -A -p 8080 192.168.56.1

Starting Nmap 7.60 ( https://nmap.org ) at 2019-10-17 10:34 EDT
Nmap scan report for 192.168.56.1
Host is up (0.0013s latency).

PORT     STATE SERVICE VERSION
8080/tcp open  http    Apache Tomcat
| http-methods:
|_  Potentially risky methods: PUT DELETE
|_http-open-proxy: Proxy might be redirecting requests
|_http-title: Apache Tomcat

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 21.71 seconds


Site preventing user from closing tab/closing browser I've come across the following website

hxxp://politie.nl.id169787298-7128265115.e2418.com/ [Possible malware]

Whenever I open it in Firefox it prevents me from closing it, I can't even close the browser without using the task manager. The site asks for money for an unlock and I can imagine some people could fall for it. How can this happen? I thought Firefox was a more or less secure browser?

I haven't checked it on other browsers.

Update: this is no longer a concern on Firefox (29+) and Chrome (version? not sure if it was ever an issue there). Firefox will only display a single dialog now.

Firefox 31 additionally makes the dialog non-modal, and will also close the window if you press the close button a second time.

Unfortunately, IE11 still shows multiple dialogs. I'm not sure if Microsoft is aware of this issue.

The method is pretty simple, actually. If you inspect the source, you'll see a lot of repetition of this line:

<iframe test="test" srcdoc="<script> window.onbeforeunload=function(env){ return 'YОUR BRОWSЕR HAS BЕЕN LОCKЕD. АLL PC DАTА WILL BЕ DЕTАINЕD АND CRIMINАL PRОCЕDURЕS WILL BЕ INITIАTЕD АGАINST YОU IF THЕ FINЕ WILL NОT BЕ PАID.';} </script>" src="au/close.php"></iframe>

Basically, they have a whole bunch of iframes and each iframe can trigger the 'are you sure you want to leave' message once. It's not infinite by any means (as Braiam said, you can just hold down enter on the leave page), but it's probably enough to trick some people.

This is arguably behaving as intended - though it may be better to add one of those "don't show again" checkboxes, much like they do for alert popups.

Another way to prevent this kind of thing is to disable JavaScript on sites you don't trust. NoScript works well. This can, however, be somewhat annoying and/or break sites at times.

For the interested: Chrome actually displays one long dialog. That comes with its own problems - and this is a browser bug - the buttons get pushed out of the bottom of the page (happens with any too-long Chrome popup). You can still hit enter. The Chrome dialog seems to be initiated by a different alert popup, and it actually doesn't seem to display the iframe unload text at all - it's likely they added this specifically to trap Chrome users:

<script type="text/javascript">window.onbeforeunload = function(env){var str = '\n\nUw br' + 'оws' + 'еr is gе' + 'blо' + 'kkе' + 'еrd.\n\nAl' + 'le P' + 'C dа' + 'tа zu' + 'lle' + 'n wо' + 'rde' + 'n vа' + 'stgе' + 'hou' + 'den e' + 'n st' + 'rаf' + 'rес' + 'htе' + 'li' + 'jk' + 'е pr' + 'ocе' + 'dur' + 'es zu' + 'lle' + 'n wо' + 'rd' + 'en ing' + 'еlе' + 'id te' + 'ge' + 'n u al' + 's d' + 'e bo' + 'еt' + 'е ni' + 'et wo' + 'rd' + 't be' + 'taa' + 'ld.\n\n';
        alert(str);
    return str;
}
</script>

Again, it's nothing more than a scary popup that seems to be impossible to get rid of. Malicious? Yes. Actually dangerous? Not really. As long as you don't fall for the scam.

Also of potential interest is that they do display your public IP and approximate location. This is a fairly standard scare tactic on these scam sites and really isn't anything special - any site you connect to can get your public IP, and public GeoIP databases can usually provide the approximate location. If you're really worried, go get a VPN or anonymous proxy to connect through.


Security of PGP for Long-Term Storage How secure are PGP/GPG encrypted mails?

I realize that it's probably fine for regular e-mail scenarios, but what about the security over longer time periods (>30 years)? Is the 4096 bit limit for RSA keys of GPG going to be an issue (given that there is no way to use symmetric-only encryption)? Also, if I'm not misunderstanding anything, GPG does not authenticate the ciphertext (it only RSA-signs the plain text)?

The usage scenario here is that I want to store passwords in my mail account (as PGP-encrypted mails to myself), in order to have them accessible everywhere. I already use Firefox Sync for most accounts (which uses a rather advanced scheme), but that only stores username/password combinations for one URL. Sometimes I need to save some additional details with that too, and hence can't use FF Sync, despite it being awesome otherwise.

As far as I can see, there's also no other alternative to PGP and S/MIME for mail encryption, is this correct? (S/MIME isn't an option, seeing how poorly supported it is by Thunderbird currently)

The 4096-bit limit on RSA keys for GPG won't be an issue for security, unless a new, better, faster algorithm for cracking RSA keys is discovered, and then any assertion about strength provided by some specific key sizes would be overly speculative. New algorithms for cracking RSA don't happen often; last time was circa 1989 for the General Number Field Sieve (most of the scientific advances on GNFS since the late eighties' are about practical implementations of GNFS and a lot of small-scale optimizations, but the core algorithm has not changed since that time).

Note that asymmetric encryption does not solve the confidentiality issue; it just moves it around: you still have to store the private key somewhere. Ultimately, for your problem of storing passwords, you will protect your private key with a "master passphrase" and that's symmetric encryption. You could make the whole process simpler by applying symmetric encryption directly on your file full of passwords (GnuPG supports it). Going fully asymmetric is interesting (in your context) only if you want to store a new password from a machine from which you do not have access to the private key and on which you do not want to type your passphrase.

Either way, a tricky point is when it comes to using your stored passwords. You have to perform decryption on some system. That system had better be free of any malware, because a keylogger would then grab your passphrase and/or your private key (if you use asymmetric encryption). Ideally, you should do that only from your own device(s). That's what I do when travelling:

My own device is a Linux-powered netbook.
The /tmp directory is a memory-based filesystem (so what I write in it never makes it to the SSD).
No swap has been configured (so what is in RAM is never written to the SSD either).
I decrypt (symmetrically) my file-of-passwords in /tmp, read the password, then type it, and then I delete the decrypted file.

Of course, if you have your own device at that point, why would you need to store the encrypted file in your email ? You could keep it directly on your device.

(Speaking of which, since emails can store arbitrary files as attachments, you do not need to restrict yourself to the email-specific formats OpenPGP and S/MIME. Using these only makes things simpler in that you may hope for your mail application to perform the decryption, instead of having to resort to some command-line tools. However, I may argue that command-line tools give you more control about where your data goes, e.g. in a RAM-backed /tmp filesystem.)


What legitimate uses do browser proxies have? The only time I've used my browser's proxy settings is when setting up Burp Pro, which makes me wonder:

What was the original use-case for these settings? Other than testing / debugging, what was this feature designed for? Do people actually use this in the wild for corporate content filtering, access control, etc?

(Note: I'm less interested in Tor or other anonymization technologies; I'm more interested in traditional infrastructure / original design intent)

For reference, I'm talking about these settings:

One of the early uses of HTTP proxies was caching proxies in order to make better use of the expensive bandwidth and to speed up surfing by caching heavily used content near the user. I remember a time when ISPs employed explicit mandatory proxies for the users. This was at a time when most content on the internet was static and not user-specific and thus caching was very effective. But even many years later transparent proxies (i.e. no explicit configuration needed) were still used in mobile networks.

Another major and early use case is proxies in companies. These are used to restrict access and also still used for caching content. While many perimeter firewalls employ transparent proxies where no configuration is needed, classic secure web gateways usually have at least the ability to require explicit (non-transparent) proxy access. Usually not all traffic is send through the proxy, i.e. internal traffic is usually excluded with some explicit configuration or using a PAC file which defines the proxy depending on the target URL. A commonly used proxy in this area is the free Squid proxy which provides extensive ACL's, distributed caching, authentication, content inspection, SSL interception etc.

Using an explicit proxy for filtering has the advantage that in-band authentication against the proxy can be required, i.e. identifying the user by username instead of source IP address. Another advantage  is that the connection from the client ends at the proxy, and the proxy then only forwards the request to the server given in the HTTP proxy request if the ACL check is fine and maybe after rewriting parts of the request (like making sure that the Host header actually matches the target host). Contrary to this in inline-IDS/IPS (which is the basic technology in many NGFW) the connection setup from the client is already forwarded to the final server and ACL checks are done based on the Host header, which might or might not match the IP address the client is connecting to. This is actually used by some malware C2 communication to bypass blocking or detection by claiming a whitelisted host in the Host header but having actually a different target as IP address.


Risks of Mullions in High Security Areas I have a storage space full of information assets. The room itself is sound; there are no windows, the walls go all the ceiling, and there is only a single entrance with two good stout doors and high precision locks. At the risk of sounding purposefully cagey, assume a 7+-pin master key system with anti-pick features.

My biggest concern is the mullion, the bolted in steel vertical as illustrated in this picture, separating the doors. I feel that it is better than he doors latching to each other, however it also seems like a weakness. Does the mullion present an undue risk? If so, is there a commonly accepted mitigation path?

It depends on the construction of the mullion. Some are bolted on, some frames come as a solid piece including the mullion, and some mullions are a cosmetic fascia. If it is bolted on as long as the bolts are good quality and bolt into a metal frame then it's as good as a one-piece metal frame for most purposes, it's when it's a cosmetic piece that you have a problem.

Some mullions are simply a piece of 2x4 covered in drywall and plaster. These won't keep out anyone with a crowbar for very long.


Is there a way to access PKCS5 or 7 padding in OpenSSL without encrypting something? As the title asks. OpenSSL will pad stuff with PKCS5 if you encrypt something, however is there a way to access this feature without encrypting something?

PKCS#5 padding is defined relatively to the block size of the underlying block cipher. If there is no block cipher, then there is no block size, and thus the padding is ill-defined.

Nevertheless, if you take as extra input the block size s to use, then the padding is not hard to implement. If the data length is n, then the padding adds exactly k bytes, such that:

1 ≤ k ≤ s
n + k is a multiple of s
the k bytes all have numerical value k

These rules make the padding unambiguous. There is exactly one solution for k, given by the equation: k = s - (n mod s). Here is an ugly shell script (for Linux) which adds the padding to an input file:

#!/bin/sh

input="$1"
s="$2"
n=$(wc -c < "$input")
k=$(expr "$s" - "$n" "%" "$s")
sk=""
for i in $(seq "$k") ; do
        sk="${sk}$(/usr/bin/printf "\\\x%02X" "$k")"
done
cat "$input" ; /usr/bin/printf "%b" "$sk"

(use the input file name as first parameter and the block size as second parameter; the padded file is written on the standard output.)

The reverse operation is left as an exercise (shell programming is not very adequate for this sort of treatment).


referrer checking as a defence for XSS attack After reading the question about referrer and the answer of @D.W., I did not understand the following part:

  XSS defense. Strict referer checking can make reflective XSS attacks
  harder, because other sites can't trick the victim's browser into
  visiting the vulnerable URL.

I did not get it. So if on my site I implemented the referrer checker and it redirects me to a specific page if I am coming from anything else outside of my site, how does it helps me with XSS attacks.

May be I misunderstood something, and also sorry if it is obvious for someone.

Many of the cross-site request forgery countermeasures will make reflective XSS more difficult to exploit but not impossible.  It may still be possible to exploit one of these flaws with clickjacking or other methods.  Clickjacking and other vectors should also be fixed, but its not a simple or foolproof solution when compared to input validation/sanitation.

There are problems with the referer header as a security measure.  If the request originates from an HTTPS page going to an HTTP page then Referer will be absent.  The origin header was created to address this issue.  An OWASP A10: Unvalidated redirects and forwards could also be used to bypass a referer check.


CSRF protection for unauthenticated requests, actions, searches or comments? I have gone through the example of CSRF funds transfer from a bank where the user is logged in. Similarly I have looked at CSRF in case of email updating. I think I understood it but I am not quite sure if it extends to unauthenticated  requests/ form submissions as well. I am now trying to figure out the impact of CSRF particularly in reference to given below context.

Suppose a shopping website where both authenticated and unauthenticated users can browse and shop. Imagine a scenario where an unauthenticated user browsers and adds a item to his cart(still unauthenticated). He later decides to checkout and is redirected to the checkout page without logging in(access escalated to Guest user from unauthenticated user or something similar).The user now enters his personal information(over SSL) like email, address, telephone, credit card information, etc. His shopping is complete and he closes the application. He is able track/update order using link sent to his email or order number.

Since the user is/might never authenticate in this application, do All forms/requests still need to be protected against CSRF? If not, in what case CSRF protection need to be implemented?
Additionally should searches be be protected against CSRF for logged in vs unauthenticated users? It would be great if you could answer for both.
How about comments by visitors (not logged in)?
Are referer checks required even after Tokens are used for CSRF Protection? I don't think so, still making sure.(Not particularly related to above scenario).
How important is Login CSRF for E-commerce websites?

Let me know if I may have missed something here, i am still trying to fully understand CSRF, its impact and associated risks in various scenarios.

P.S. Some scanners throw CSRF at every form submission without random tokens or referer checks.

1.Since the user is/might never authenticate in this application, do All forms/requests still need to be protected against CSRF? If not, in what case CSRF protection need to be implemented?

If the user has some sort of confidential session state with the application, then CSRF is recommended.
You may want to protect against CSRF for adding products to the basket. However, if you don't then you may find it an acceptable risk instead to show the user their basket contents and ask them to confirm before they proceed to checkout. This way they would be aware if anything had been changed in their basket before they proceed to payment. Of course, the confirmation form itself should have CSRF protection and it should take the rest of the checkout state from the displayed form, rather than session as it could still be susceptible to attacks while the page is being displayed to the user.

2.Additionally should searches be be protected against CSRF for logged in vs unauthenticated users? It would be great if you could answer for both. How about comments by visitors(not logged in)?

You only need to protect "unsafe" requests. That is, actions on your application that change state. See RFC 7231 for details on safe requests. Unsafe requests are usually implemented via the POST method, so you should focus on protecting all POST requests rather than GET requests. This is assuming that all unsafe requests are POSTs (they should be if correctly implemented).

3.Are referer checks required even after Tokens are used for CSRF Protection? I don't think so, still making sure.(Not particularly related to above scenario).

No, token based CSRF protection replaces the weaker form of referer protection.

How important is Login CSRF for E-commerce websites?

By "Login CSRF" here I'm assuming you mean authenticated CSRF rather than protecting the login form itself? If the latter then see here.
Very important. You don't want to make your site vulnerable to attackers submitting or changing orders, personal details or passwords (particularly if they allow access to card details). Even without authentication, you still need to protect the current user's session as they place their order.


Why is change cipher spec an independent protocol content type and not part of Handshake Messages? RFC 2246 says:

  To help avoid pipeline stalls, ChangeCipherSpec is an independent TLS
  Protocol content type, and is not actually a TLS handshake message.

What pipeline stalss is being spoken about here?  Why didn't the creators of TLS make Change Cipher Spec a part of Handshake Message itself?

SSL uses messages which are encoded over records. Encryption is done on a per record basis. However, several messages of the same type (e.g. handshake messages) can be crammed together in the same record. Since the Change Cipher Spec message modifies encryption settings, a new record should begin immediately afterwards, so that the new settings are immediately applied (in particular, it is crucial for security that the Finished message uses the new encryption and MAC).

Using a specific record type for Change Cipher Spec is a way to enforce this property. An SSL/TLS implementation cannot help but begin a new record for the Finished message, since it uses a record type distinct from that of the Change Cipher Spec message. Such a specific record type could be avoided if all SSL/TLS implementations were disciplined enough to begin a new record where they need, and also to verify that the peer also began a new record. It is safer and more robust to make it unavoidable through the record type.


Best practices for email security I writing a security layer for my app and I would like your input on updating users' email addresses (also used for the login).

I'm interested to hear from anyone who has written an application with similar requirements. How would you go about it? Here are some ways I thought of, but I suspect I'm missing something:

Approach one

Update the address and send a confirmation email to the new address
If address is not confirmed with 48 hours, suspend it

It's easy.
If new address is wrong, the user gets locked out of account.
Someone can hijack the account by changing the user's address.

Approach two

Update the address and store the old value temporarily
Send a notification email to the old address with an option to revoke the change
Send a confirmation email to the new address
I restore the old address if the user revokes the change (through the notification email)
If the change is not revoked, but the new address is not confirmed within 48 hours, I suspend the account.

Secure
A lot more work

Approach three

Do not update the address but store the new value temporarily
Send a confirmation email to the old address asking to confirm the change.
If the change is confirmed, carry out the update and send a confirmation email to the new address.
If new address is not confirmed with 48 hours, suspend the account.

Secure
A lot more work

It's best to be as secure as possible, but I don't want to put the user off by giving them 1001 things to do just to change an email address.

They might also have secondary email addresses, not used for login, but for other purposes, and I'm not sure how to handle updates to those addresses. Ideas are welcomed.

If you trust your login mechanism, and users can only change their emails while logged in, then simply:

Update the email address.
Notify the user on the website.
Send an email notification to the old email address about a change, including a link to report any problems.

Otherwise, use your Approach three, but without point 4. Also, in this case, send notification about the update to both email addresses.


Path Disclosure without ability to read files So I am a pentester, and I have discovered  "feature" on a server that allows me to, essentially, blindly traverse a web server's files (without executing or reading them). The problem is that I cannot figure out a way to demonstrate this as a vulnerability. The general question is: what files, by their nature of knowing their name, represent a vulnerability (if any)?

In my specific scenario, the operating system is Windows, and I can make a request like this.

http://example.com?site=file://C:\Users\Administrator

The server will return a page which indicates that it cannot load this file, whereas if I make a request like this:

http://example.com?site=file://C:\Users\namethatwouldneverexist, it will tell me that the file cannot be found.

Essentially, the server checks if the file exists before checking if I have permissions to read it.

Here are some things I tried:

../../../ (etc) This just results in a valid directory, which means it will tell me it is forbidden. Not helpful.
%appdata% This results in a different kind of error, the application does not like percent signs in the path, so it does not expand it for me.
C:\Windows\system32\ping.exe 8.8.8.8 This will result in a "not found" error, as it does not pass parameters (or execute the file).
file://x this will expose the pwd to me, but this is not particularly interesting in my scenario.

I was able to enumerate what network drives are mapped, but this is not particularly useful. I can also essentially port scan the server from the local network to expose private ports, but I am more interested in the filesystem for now.

Essentially, my question boils down to: does the ability to positively identify a file exists on a server constitute a vulnerability, and if so, how? Obviously, if you have an idea for turning this into RCE, then that's fine too!

What you describe can be called an information disclosure vulnerability. You could use this technique as a method of fingerprinting (looking for specific operating system files, common web framework folders and files, etc.) and could prove useful in identifying a version of something on the system that is susceptible to a separate vulnerability. As you've indicated it's a web server, it could aid in exploring web application vulnerabilities such as arbitrary file upload (if the functionality exists) or otherwise.


SQL Injection syntax inquiry-commented injections I have some programming experience, but am having trouble with SQL injection code. I don't understand why there's sometimes SQL syntax after the comment character (such as -- or #). I know that -- - and --+ are just required comments syntax, but there are injection examples with much more complex syntax after the comment characters.
Specific example:
$statement = "SELECT * FROM users WHERE username ='Dean' OR '1'='1'-- ' AND password = 'WinchesterS'";
How is the syntax after the double-dashes able to be interpreted or executed in the database?
According to the site where I found it:  –(double hyphen) instructs the SQL parser that the rest of the line is a comment and should not be executed
https://www.edureka.co/blog/sql-injection-attack
I've been researching for quite some time but can't figure it out.  Thank you

In short, the syntax after the -- comment marker is part of the original query.  For example, if the query was run without injection but with username "Dean" and password "WinchesterS", then the query would look like this:
SELECT * FROM users WHERE username ='Dean' AND password = 'WinchesterS';

The SQL Injection in this case is:
Dean' OR '1'='1'--

Now, if that is entered as the username field, it extends the username into a SQL OR statement, which will always be true, thus allowing login.  However, the original end to the query is still in place:
' AND password = 'WinchesterS';

In order to avoid a syntax error, the -- comment marker is used to ignore that part of the original query.


What are some examples of viruses/exploits with benevolent purposes? A comment from another user had me thinking. What are some well-known (or perhaps not quite so) examples of in-the-wild "malicious" software that do nothing actually malicious, but instead takes advantage of security vulnerabilities to actually patch them and make the target system more secure against future attacks?

I remember reading a couple years back about a router-targetting virus with that behavior. I can't seem to find the reports now, though.

Clarification: By "benign" I mean actively benign, as opposed to non-"actively malicious" specimens like Creeper.

I doubt you'll find any virus which is completely benign (even fixing a vulnerability after exploiting it is still malicious behavior, even if it is intended to be beneficial), but there are plenty of examples of exploits which are. The most well-known would have to be jailbreak exploits, where a vulnerability in a proprietary and closed system is attacked intentionally by the owner of the device to "root" it and gain better control.

In the past, people released malware (viruses, worms, etc.) for fun. Some people would be particularly malicious, with their software corrupting files or rendering a system useless, whereas others would be relatively harmless, doing nothing more than spreading (sometimes too fast, which does cause harm). Back in those days, people would also occasionally release viruses which attacked other viruses. In fact, the Creeper virus you mentioned was attacked by another virus called the Reaper, which did nothing but attempt to remove Creeper infections. Of course, it was still a virus, so it can't be called entirely benign.

Another example of a "friendly worm" would be Welchia, which spread automatically through networks, patching the DCOM RPC vulnerability used by the infamous Blaster worm. Nowadays however, most malware is made for profit, and the historical "malicious mischievousness" is far less common. If you ever see a worm or virus which attempts to destroy existing infections today, the purpose is usually to destroy the competition so it can run its own payload. Some malware calls this feature "mini-AV".


Exploiting XSS with window.name without iFrame I know XSS is possible if the window.name is echoed onto the page, but from my understanding, this requires you to use an iFrame, but what if the page has clickjacking protection, stopping the page from being embedded in an iFrame? Is such an attack still possible? Here's example  JQuery...

<script>
$("div").html(window.name);
</script>

The other way to get hold of another window is to pop it up. You can specify the window name in the second parameter:

var victim= window.open('http://example.com/vulnerable', '<script>alert("boom");<\/script>');


Website file being altered I have recently had random spam links inserted into 3 ASP.NET websites. The links are inserted into the physical file so it is not SQL injection attack.

The websites have very little in common other than they are ASP.NET, 2 of them are MVC and 1 is webforms, 2 are c# and 1 is VB, etc.

The server is Windows 2003 with IIS6 and all security updates have been installed. FTP was turned off overnight and an attack still occurred.

Any ideas on how to start troubleshooting this?

EDIT: Turns out the latest updates have not been installed (last update was June 2010) so I'll need to install all of those first before investigating further.

EDIT 2: Latest updates installed and problem has yet to reoccur. Chalk one up for keeping your server up to date.

Log files on the server? Would be a start for seeing what is going on. Check your access controls for the site and server too. But if the server has been compromised these won't be reliable.


How to avoid ransomware Malware files execute themselves after downloading them. Let's look at it from the point of view of a piece of ransomware like CryptoLocker, from Wikipedia:

  Crypyowall 3.0, uses a payload written in JavaScript as part of an email attachment, which downloads executables disguised as JPG images.

and

  the ads redirected to rogue websites which used exploits in browser plugins to download the payload.

Ok, it may download them but how about running them? As far as I know no server-side language can do any action on the clients, like running programs.

Note: I am not interested in knowing the exploits of how to run a downloaded file, as far as I know no server-side language can do any action on clients, I'm interested in knowing if there is a way to avoid this kind of behaviour.

Disabling JavaScript is not a bright solution since most websites use it.

Is there any way of enabling JavaScript only for the websites of my wish, like a white list (using Chrome)?
Is it possible to disable JavaScript from Gmail's mails or Outlook's?

You can have a look at Script Defender, ScriptSafe and ScriptBlock Chrome extensions. It looks like they can do what you are asking for.

But the JavaScript issue you are talking about is only the tip of the iceberg.  Protecting yourself against ransomware is much more complicated than this.

At a glance, here is what you can do :

If you are using Windows, you can use group policies to prevent the launch of executables from certain directories.
You can block or limit access to Tor IP addresses.
You can block or limit access (read only) to network shares.
You can filter spam and malicious attachments.
You must backup files regularly and you have to make sure to not overwrite a good backup with a cryptolocked one.

Source : Calyptix blog


What web browsers support OCSP stapling? Are the privacy and performance features the same? OCSP stapling decreases the load on a PKI infrastructure's OCSP server by attaching a signed OCSP response to the target in a TLS connection.  In addition it creates a more secure/private session since the CA doesn't know that your browser is accessing a given site.  Some people have compared this behavior to Kerberos.

Question

What web browsers support OCSP stapling?
Are there any implementation considerations among different browsers that need to be addressed to maintain uniform privacy and performance benefits?

My impression is that OCSP stapling is not well supported on the client side, but it's possible my information might be out of date.
Firefox apparently supports OCSP stapling, as of Firefox 26.  (Thanks to Jan Schejbal for this information.)
Chrome supports OCSP stapling on Windows, Linux, and ChromeOS.   (Thanks to Kit Sunde for this information.)  (The Chrome team has decided that they plan to remove CRL and regular OCSP checks, but they haven't disabled OCSP stapling.)
I've read one report that most browsers support OCSP stapling on Windows.
Here is some more information on browser support for OCSP (but not OCSP stapling, unfortunately).


Detecting a Pixie Dust attack? How much of a trace does it leave behind? I've recently been delving more into Wifi security and am starting with Pixie Dust, I've learned about it, mostly how it works (with the pins, being able to crack two halves of the pins and whatnot, not much in-depth, but enough to understand it and know what's going on).

I read on a Quora thread that it's loud (obviously since it's a variation of a brute force in essence to my knowledge except it's using previously gained knowledge to assist in the cracking), but I can't find any information on how to actually detect them or what it looks like when you do.

Does it leave it in the normal logs? Do you need a passive or active scanner running to detect it? Does it leave just a MAC address or more or less?

I'm pretty much oblivious to the Blue Team side of things and all searches about it seem to just pull up guides on how to do it rather than how it works more in-depth or how it's detected, what it looks like, or what trace(s) it leaves.

Thought some people here may be able to help me out, all help is appreciated!

I reached out to SoxRox (an assistant developer of PixieWPS) and this is what he told me:

  "It’s different for every case, but for the average case, most routers
  don’t have enough storage to keep massive logs, and they’re generally
  disabled by default.

  The only way they could know is if they see WPS is locked in the GUI
  or if they were passively listening as you did it

  They could get your MAC address, likely an RSSI, but that’s about it

  And it’s not likely that people passively monitor 24/7

  If they’re next to their router, they may also see the wps light
  flashing "

Thanks so much to everyone and especially https://www.reddit.com/u/realHoffman for letting me know who to reach out to :D

P.S we talked for some more after that, PIN association and any WPS attack follows the same logic as he stated above as it is all the WPS framework.


Is Plaid, a service which collects user’s banking login information, safe to use? I recently signed up for Privacy.com, which uses a service called Plaid to link a bank account.  To do this, it requires the user to provide their banking username and password to a webpage from Plaid, not their bank.  Then, Plaid accesses the user’s bank account with those credentials on the user’s behalf to get information.  Plaid provides an API for websites and apps to easily access this banking information.

In addition to Privacy.com, plenty of other popular services use Plaid, including Venmo, Robinhood, and Coinbase.

Despite the popularity, this service appears to break two "fundamental" Internet security rules:

Never give credentials to a third party.  The standard is to redirect the user to a login page on the website of the service providing the login.  Plaid doesn’t do this, instead providing the login form on their own website.  Even worse, Plaid allows services to embed the form in their websites (as an iframe).  It’s not possible for casual internet users to tell the difference between this and an “unsecured” form on some random website, so this appears to be encouraging bad security practice.  Worse still, Plaid provides a login page that looks very official, showing the bank logo and using the bank’s color scheme.
Never store passwords in plaintext.  The only way for Plaid to access bank account details is with the password, and since my banking password was only required by Plaid once, they must be storing it in plaintext, or "encrypted" but convertible to plain text, so they can continue to use it to access my account.

The problem seems to be that most banks do not provide an API to retrieve customer data, so a service like Plaid (and all the services that use Plaid) simply wouldn't be possible without breaking these "fundamental" security rules.  But I'm not convinced that's justification for breaking them.  If it's not possible to do it securely, should it be done at all?

My confusion here is that all of these services are "legitimate".  None of them are scams; they're all providing a valuable service and have a solid reputation.  Plaid has raised billions in funding!

I would think with Plaid using bank logos to make their “fake” bank login forms look legitimate, banks would be after Plaid with lawsuits.  But apparently some of them are investors!  On Plaid’s website Citi, American Express, and others are listed as investors.  It appears that banks aren’t against this bad practice, and are, in some cases, actually encouraging it.

This makes me think that I might be missing something.  Maybe Plaid has some special access to banking systems and it isn’t as bad as it seems.  On the other hand, maybe Plaid’s reputation is held up only by the fact that they haven't been hacked yet.  If (when) they are hacked it will be devastating, since the worst case scenario means the leaking of millions of user's active bank usernames and passwords.  Also, many banks don’t protect users if they knowingly gave their credentials to a third party, so a lot of people could lose a lot of money.  But if that's the case, wouldn't banks be working to stop Plaid and protect their customers?

I think many of the services provided by Plaid are neat and would like to use them, but if my suspicious here are correct I don’t think I can do so while remaining secure.  Of course, I hope I’m completely wrong here and Plaid has some way to operate securely.

So, does Plaid have some special access to banking systems, or is it using user passwords to log in to bank accounts, which requires storing them in plaintext (or convertible to plaintext) and convincing users to give their credentials to a third-party, encouraging bad security practice?

If it’s the latter, I’m afraid I’ll have to pass on Plaid services for now and consider my banking password compromised.

I want to point out that despite Plaids apparently honest attempts at security, their approach is a privacy nightmare, as you give full access to Plaid, to all and every single information your bank has on you, including loans, funds, investment accounts, credit card statements, etc. This makes Plaid differ substantially from other payment services, such as PayPal, as they only have your account number.
If you don't believe me, here's their data collection description from their privacy statement (Effective Date: May 29, 2019, my italics):

Information collected from your financial institutions. The information we receive from the financial institutions and other financial service providers that maintain your financial accounts varies depending on the specific Plaid services our developers use to power their applications, as well as the information made available by those institutions and providers. But, in general, we collect the following types of information from your financial institutions and other financial service providers:

Account information, including financial institution name, account name, account type, branch number, IBAN, BIC, and account and routing number;

Information about an account balance, including current and available balance;

Information about credit accounts, including statement due dates and balances owed, payment amounts and dates, transaction history, and interest rate;

Information about loan accounts, including due dates, balances, payment amounts and dates, interest rate, loan type, payment plan, and terms;

Information about investment accounts, including identifying details about assets, quantity, and cost basis;

Information about the account owner(s), including name, email address, phone number, and address information; and

Information about account transactions, including amount, date, type, quantity, price, involved securities, and a description of the transaction.

The data collected from your financial accounts includes information from all your sub-accounts (e.g., checking, savings, and credit card) accessible through a single set of account credentials.

To make matters even worse, they can share all that information with their customers, i.e., the company that wants you to link with them. That means that when, e.g., your rent is paid via Plaid (my landlord uses a service that relies on Plaid), all of that information may be shared with that service! And while they, in turn, may not distribute that data further, you now have to trust another party that they are able to keep your data safe.
Again, here's the relevant excerpt from that privacy statement (again, my italics):

How We Share and Store Your Information
We do not sell or rent end user information to marketers or other third parties. But we do share end user information with third parties as described in this Policy. For example, we share your information with the developer of the application you are using and as directed by that developer (such as with another third party if so directed by you). We also share your information:

With your consent;

With our service providers, partners, or contractors in connection with the services they perform for us or our developers;

If we believe in good faith that disclosure is appropriate to comply with applicable law, regulation, or legal process (such as a court order or subpoena);

In connection with a change in ownership or control of all or a part of our business (such as a merger, acquisition, reorganization, or bankruptcy);

Between and among Plaid and our current and future parents, affiliates, subsidiaries and other companies under common control or ownership; or

As we believe reasonably appropriate to protect the rights, privacy, safety, or property of you, our developers, our partners, or Plaid.


Using Two Different Brands of Security Tools To Block Backdoors There's this idea of using 2 brands of firewalls both inline that is usually brought up:

  {Internet}<-->FW(A)<-->FW(B)<-->{Internal Network}

Or using 2 algorithms:

  {Plain Text}<-->Alg1(e.g AES)<-->Alg2(Custom Algorithm)<-->{Cipher Text}

And this is usually done in a way that one of the algorithms or hardwares used are public and known brands and the other one is a local brand or custom made device/algorithm. For example they use AES and Alg_x where Alg_x is not a publicly known algorithm and is made by government of country X.

The rationale behind this is that if country Y which is at war with country X puts a backdoor in the publicly known device/algorithm the second device/algorithm made exclusively by government "X" will keep the data protected and if there are some missing features in that, the first device will complement it.

Or in another case I use an American brand device along with a French/Russian/Chinese/... Device. So if there's backdoor in both of these devices, those 2 governments are most likely not willing to share their access.

Is this a common practice? Has any organization or standardization institute referred to this? (Protecting your vital resources with at least 2 types/models/brands of security devices.)

Edit: slightly changed the questions to make it fit our Q&A.

Funnily enough I have seen this technique recommended in some NSA best practice documentation pre-Snowden. See #1 under Network Recommendations in Best Practices for Keeping Your
Home Network Secure. It refers to routers and not firewalls, but most routers are also operating as firewalls.

I believe this is mostly academic though as I would like to point out that while yes deliberate back-doors in both products will be difficult to exploit without knowledge of both back-doors, you're neglecting the more simple occurrence that it's possible there's vulnerabilities in both, some perhaps even yet to be discovered that are just down to sheer coding error like buffer overflows or as complicated as the shellshock vulnerabilities. With enough expertise and time I'm sure some vulnerabilities could be discovered in either product, back-door or no back-door.

A lot of routers/firewalls will end up using Linux and likely some version of OpenSSL. So any vulnerabilities discovered in both will still likely be exploitable in both devices.