Is it secure to allow an account to use `test123!` as their password? I'm working on tightening up security for the auth layer of my app and I'm currently making a call on the complexity I'll require for passwords.

Is there a 'standard' recommendation for complexity?

The current requirement is like so:

8 char minimum
a-z
At least one number
At least one of the following: !@#$%^&*

So if anyone were to choose test123! as their password, my app would allow them to use that as their password.

This is about "twice" the complexity my bank requires for my account login. They still allow 5 char, a-z, 0-9 for passwords, which seems nuts to me. But they also don't seem to be suffering from an epidemic of attacks, so it must thwart hacks just fine, 'somehow'.

  Question: As an infosec professional, what minimum complexity would you require Gmail to have if it was your call?

How do I use an entropy estimator effectively?

I just found out what an Entropy Estimator is and they are wowsers cool. I haven't been this jazzed by software for a long time now.

No, I didn't input any of my passwords into any of them.

No, I don't really understand how they work.

And I'm not entirely sure how to use the information that they give me. For example, I entered test123! into the GRC Password Haystacks estimator and got these results:

GRC Password Haystacks

Search Space Depth (Alphabet):  26+10+33 = 69
Search Space Length (Characters):   8 characters
Exact Search Space Size (Count): 521,354,232,876,120
Search Space Size (as a power of 10):   5.21 x 1014

**Time Required to Exhaustively Search this Password's Space:**
Online Attack: (100,000 guesses per second) 1.66 hundred centuries
Offline Fast Attack: (100 billion guesses per second)   1.45 hours
Massive Cracking Array: (100 trillion guesses per second)   5.21 seconds

So, ostensibly those seem like pretty good results. The likelihood of one my users being targeted by a blackhat with a massive cracking array at their disposal seems highly unlikely.

I've also implemented rate-limiting and a blacklist lockout mechanism with the following config:

- IP is used as the ID
- Rate-Limited with a max of 10rps from any given IP
- A maximum of 5 failed login attempts are allowed every 60s before an IP is blacklisted
- Blacklist duration is 5 minutes

  Question: Considering the defences I've put in place, should I consider my login endpoint secure if any user decides to pick test123! as their password?

What about a Dictionary Attack?

Obviously test123! is going to be tried very close to the beginning of the attack.

If I'm allowing 5 attempts every 60s before blacklisting an IP, and the blacklist duration is 5 minutes, it seems reasonable that a determined attacker would attempt to either rate-limit their guesses to 5 per minute and then it would just take them longer to grab this low-hanging fruit, or if they really, really wanted in they could grab a new IP every 5 attempts, or string together 10,000 machines to attack with 5 attempts every minute to speed things up. Highly unlikely, but not impossible.

And this leads me to believe that there really isn't any way to protect from a dictionary attack except to force Passwords of Unusual Complexity on my users, which I really don't want to do.

And considering that Facebook, Google, etc. don't seem to have these requirements there must be some way to protect against a long-term, low-guesses-per-second dictionary attack? Or is it just that no one really bothers to do this because it's not worth it?

  Question: Is there any reliable way to protect from dictionary attacks? Would adjusting the params of my rate-limit and blacklist modules improve the security of my endpoint?

Thanks in advance for any help or opinions.

You've almost answered your own question(s). First off, it's important to note that password complexity typically only comes into play for offline attacks. As your entropy report showed, a password that can be easily cracked offline would take much longer as an online attack. As for your bank only requiring a minimum of 5 characters, obviously the short passwords could be easily cracked in an offline attack, and as such one could argue that perhaps it would be better practice for them to have a longer minimum password length. That being said, as any bank should, they probably have very tight security on their servers and data, meaning that the chances of someone gaining access to perform an offline attack are extremely low. As long as they have good brute force prevention measures in place for the login pages (lockouts and/or 2-factor authentication for unknown devices), then this could explain why they don't have accounts regularly being compromised. (Though arguably even if they did, they would be individual accounts and likely not publicized anyway.)

Regarding your question about preventing the distributed password attempts, the simple solution is instead of locking out attempts from an IP after 5 failed attempts, just temporarily lock out the account after 5 tries regardless of IPs. This would completely thwart a distributed attack. It does have the unfortunate side effect of potentially locking out the actual user if someone tried to hack into their account, but as the lockout would be temporary the attack would have to be pretty much constant for the user to even notice in the first place. Most attackers would not gain anything from doing this, so I believe you're right that the reason it doesn't happen more often is they don't bother wasting their time on something that has an extremely low chance of success.


SSH connection attempts from China show different key; is China doing a MITM attack on SSH traffic? I have a server located in the USA and SSH to it from various places around the world.  When I SSH in from a computer I have never used before, I'll see something like this:

The authenticity of host 'my.usa.server.com (11.22.33.44)' can't be established.
RSA key fingerprint is xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:b8:1d:61.
Are you sure you want to continue connecting (yes/no)?

From most places in the world, the RSA fingerprint is identical, which makes sense, because I'm always connecting to the same server:

[From a server in Sweden]

me@sweden:~$ ssh myaccount@my.usa.server.com
The authenticity of host 'my.usa.server.com (11.22.33.44)' can't be established.
RSA key fingerprint is xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:b8:1d:61.
Are you sure you want to continue connecting (yes/no)?
me@sweden:~$

[From a server in The Netherlands]

me@nl:~$ ssh myaccount@my.usa.server.com
The authenticity of host 'my.usa.server.com (11.22.33.44)' can't be established.
RSA key fingerprint is xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:b8:1d:61.
Are you sure you want to continue connecting (yes/no)?
me@nl:~$

[From a server in the US]

me@otherusaserver:~$ ssh myaccount@my.usa.server.com
The authenticity of host 'my.usa.server.com (11.22.33.44)' can't be established.
RSA key fingerprint is xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:b8:1d:61.
Are you sure you want to continue connecting (yes/no)?
me@otherusaserver:~$

HOWEVER, when I try to connect from a server in China, the key fingerprint is different:

me@chinaserver:~$ ssh myaccount@my.usa.server.com
The authenticity of host 'my.usa.server.com (11.22.33.44)' can't be established.
ECDSA key fingerprint is xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:d8:0f:01.
Are you sure you want to continue connecting (yes/no)?
me@chinaserver:~$

Notice that the key and cipher are different.  It should be noted that I OWN the physical China server and the room where it is located, so I can be sure that the server hardware is secure.

Does that mean someone upstream, such as the China government or the ISP (China Telecom) is doing some sort of MITM attack?

See what the servers answer:

  RSA key fingerprint is xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:b8:1d:61.

and:

  ECDSA key fingerprint is xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:d8:0f:01.

That's not the same key type, therefore not the same key: RSA in the first case, ECDSA in the second case.

SSH servers can use several cryptographic algorithms, and indeed several keys. What algorithm will be used depends on what the client and server support, and also their order of preference. Chances are that your SSH server has both a RSA and an ECDSA key pairs, and the Chinese client happens to be configured to put ECDSA higher in its list of preferences than the other clients.

If unsure, try running the SSH client with the -vvv command-line option to see what the client and server actually send.


Vuln research: reverse engineering, debugging or fuzzing? I wonder how hackers find vulnerabilities.

If they use fuzzing, security engineers do it, and it's probably that security engineers (that work in a firm) have more resources than a group of hackers.

Reverse-engineering takes a lot of time, and I think it's not reliable enough to depend on. Is that really the case, or am I missing something?

What is in my mind is these contests where hackers have one day to find a vulnerability for a browser and exploit it. How do they do that? And the time allocated for an open-source browser (chrome) is the same time allocated to a closed-source browser (Internet Explorer).

The basic path for exploiting an overflow-related vulnerability is to find a crash (often by fuzzing), evaluate the crash and whether it presents an attack path, and then build something to exploit it.

Sometimes where one looks can involve knowledge of the architecture, such as when Charlie Miller noted that iOS 4.3 has a section of memory which will run unsigned code. In the case of all his Apple attacks, I believe the source was closed. SQL injection weaknesses are similar -- you're starting with a crib knowing where a good place to look is.

While it is simplest to identify and correct a bug via source after finding a crash, the work to setup the environment can be without value if one's goal is simply to write a working exploit. Often, the relevant space of a program will involve looking at less than 1 KB of machine code.

From my perspective, open source allows one to view bugs being added as they happen and say, "Hey, that bit of source looks insane." Beyond that, the work for exploiting closed-source and open-source work is often the same. As for reverse engineering, that's rare unless you're trying to alter or recreate an application rather than launch an exploit from it.

I wouldn't underestimate the ability of hacker groups to dedicate a lot of computing resources to a task. Warez groups have been known throughout the history of the Internet to muster substantial storage and bandwidth resources. It might be naive to think hacker groups don't muster the same scale of CPU power.

Finally, most people who do this for a long enough time keep a discovered exploit or two up their sleeves rather than releasing it.


Sending token through GET vs POST Looking for recommendations for security in sending token (e.g. JWT Token) through a GET vs POST request to the server.

There are two options:

Sending token through Headers as part of HTTP GET request
Sending token via request Headers/Body as part of HTTP POST request

Note: TLS is used for securing the connection.

Both options are basically the same, only the request looks a little different. There are some additional risks involved, when you send confidential data via GET though:

The URL containing the confidential data is shown in the browser and a user might make the mistake of sharing the link (via simple copy/paste, sharing on social media, using an online bookmarking service, etc.).
The confidential data is logged by a logging server after TLS-offloading. This can also happen with POST data, but many logging servers only log the URL per default.

If you have the choice, use POST instead of GET. It is also recommended in the OWASP Top 10 concerning Session Management, that you should never send session IDs in the URL. This can be said about security tokens as well, since they are used for a similar purpose.


Why does TLS need an explicit heartbeat protocol? The heartbeat extension to the TLS protocol seems like a useful idea for DTLS; according to the specification itself, it can be used to find out if a peer is still alive (and prevent firewalls from dropping the connection) without a renegotiation and for path MTU discovery.

However, I don't understand the motivation for specifying and implementing it for regular, TCP-based TLS. Wouldn't sending empty application data fragments essentially solve the problem of stateful firewalls dropping idle connections as well?

The RFC for TLS explicitly allows that behavior:

  Zero-length fragments of
     Application data MAY be sent as they are potentially useful as a
     traffic analysis countermeasure.

The heartbeat serves two purposes: to make some link-level activity (to avoid closure by zealous firewalls) and to make sure that the peer is still alive. If you want to do both with empty fragments, then you need some convention between client and server, so that when you send an empty fragment, the peer responds with an empty fragment. This has potential for infinite loops if not done correctly.

Moreover, when empty fragments were used as a countermeasure to the BEAST attack, it appeared that some widely deployed implementations had trouble with them. This is why we do a "1/n-1 split", not a "0/n" split.

Thus, the heartbeat extension is mostly a formalization of that ping-like convention, with its own initial negotiation and format so that interoperability issues do not arise.


501 Not Implemented ServerInfo.jsp I looked at my logs from amazon ec2 instance and found the following lines:

94.177.121.102 - - [29/Mar/2014:08:50:52 +0000] "XGET /web-console/ServerInfo.jsp HTTP/1.0" 501 418 "-" "-"
94.177.121.102 - - [29/Mar/2014:08:50:52 +0000] "XGET /jmx-console/HtmlAdaptor HTTP/1.0" 501 415 "-" "-"

I looked at http status codes and 501 means.

  501 Not Implemented

  The server either does not recognize the request
  method, or it lacks the ability to fulfill the request.[2] Usually
  this implies future availability (e.g., a new feature of a web-service
  API).

I checked that such files and even parenting directories do not exist in my /var/www and therefore I do not understand why it shows 501 and not 404.

I googled about these particular names (ServerInfo.jsp and HtmlAdaptor) but did not find anything that I can properly understand.

I found also similar issues in my error.log file (due to stupidity I truncated the logs...).

Do not know if this is helpful, but nothing was installed on the server except of git and some updates.

Does this sound like an intrusion or am I overreacting? What can these 501 means (wiki explanation are not really helpful to me)?

very simple: the request-method is not GET, but XGET which is not known, thus you server reports error 501

do you run tomcat/jboss or a similar app-serever? i guess, not.

this looks like a simple scan from some random skiddo who tries to find vulnerable app-servers but fails with the simple task of generating valid requests; the XGET looks interesting (from an ids-pov)

  Does this sound like an intrusion or

no, just a simple scan

  am I overreacting

surely :)


What can virtualisation infrastructure operators do about ring 0 SMM exploits? Just saw this new privilege escalation from Ring 0 to SMM.

Say I am operating a small VM/cloud infrastructure for internal people to run whatever they like, is there any way to prevent this vulnerability from being exploited? Maybe some CPUID bits to mask out?

This vulnerability is not exploitable for VM escape.

The attack works roughly in the following way:

The attacker creates a malicious GDT at offset 0.
The attacker remaps the APIC MMIO region to the SMRAM by modifying the IA32_APIC_BASE MSR. This "overwrites" the SMM's DSC structure, which is used by the SMI handler to restore SMM GDT.
When an SMI happens, the SMI handler will use the malicious GDT, so the control flow can be hijacked.

The bottom line is that this type of attack is feasible only when the attacker can control the IA32_APIC_BASE MSR.

Assuming you run "hardware supported" VMs (VMX non-root mode), an attempt to write an MSR from a VM will generally cause a VM exit, which will be handled by the VMM. The "normal" way of handling an APIC MMIO remap is to either ignore it, or emulate the remapping in the VMM, but this will not cause host's APIC range to be remapped.
The only exception I can think of is when the VMM uses MSR bitmaps (which can be used to "whitelist" certain MSRs to not to cause VM exits), and it somehow incorrectly calculates that bitmap (maybe in the process of merging MSR bitmaps when using nested virtualisation) in a way that allows guests to modify IA32_APIC_BASE, but that would be a vulnerability of the VMM itself.

That being said, this vulnerability can still be useful for post-exploitation: if your VMM gets compromised, the attacker can use it to bypass TXT or install a very-hard-to-detect rootkit.

  is there any way to prevent this vulnerability from being exploited?

Actually, one way is to use virtualisation, or you can wait for an official patch (Intel is said to be working on it).

Jacob Torrey also has an interesting blogpost about this topic: http://blog.jacobtorrey.com/mitigations-to-the-memory-sinkhole


Serial Number / Thumb Print of Digital Signature/Certificate When I looked the digital signature properties of LSASS.EXE, I am presented with this:

Which states Serial Number 33 00 00 ... 00 CC. Fair enough.

When I looked the attached digital certificate properties, what I see is:
.

Which has the exact serial number presented in SIGNATURE. Why is this? Is the serial number part of certificate or signature?

Further, the thumb-print of certificate is mentioned as:

.

Which is a different one.

So, what does uniquely identify a signature - a thumbprint or a serial number?

None of them. A digital signature does not have a recognizable identifier.

You are seeing in the two forms the serial number of the certificate. The serial number is a unique identifier assigned by the Certificate Authority to the certificate and the thumbprint is a hash of the certificate data.

A signature contains a message digest of the signed data (you can see it in form), signed with the private key of the sender. A digital signature has no a identifier but you can know:

the identity of the signatory, because the public key contained in the referenced certificate match with the private key
That the message has not been altered, because it will break the signature


Should I block visitors who seem to be probing my site? I have detected some attempts to probe the security of my site.  Should I blacklist their IP address?  What are the considerations or tradeoffs to use in deciding when to block their IP address and when not to?

As a rule, the returns on this type of defense are nearly zero. There are exceptions, but even then this technique may offer only a small amount of security.

Exhaustive vulnerability scans of randomly-chosen hosts offer extremely low returns on scanning resources. Instead, successful attackers generally choose one of the following two options to increase their odds:

Check for a very small number of vulnerabilities over a large number of hosts
This includes bad passwords for common services such as SSH, POP3, cPanel, Wordpress, Joomla, and the like. If your root password is "root" or your site admin password is "admin", you can expect to get caught in one of these drift nets surprisingly quickly.
Starting with a single known vulnerability, use a search technique to narrow down your target list to only the most likely victims.
Usually this starts on one of the common vulnerability databases. He finds a recent candidate and identifies some string that would be common on vulnerable hosts. This is often a "Powered by" line or a login link or a specific URL pattern. Then, using his favorite search engine he retrieves a list of sites that follow that pattern.

The important point is that in neither of these cases does the attacker make more than a few attempts at a given site. Either they're successful immediately, or they move on.

That's not to say that you won't see the occasional persistent attacker. There's always some misguidedly optimistic individual running Nessus against a /16, but such attacks are by their very nature self-limiting and very rarely successful, since the vast majority of the attacks target software that a given server doesn't even run.

Could such an attack be successful? Yes. Does it ever happen? I deal on the average with several compromised servers per day, and so far I have yet to see even one come from nessus-style full-spectrum scans. But the probability isn't exactly zero. And in the world of random attacks, statistics and probability matter quite a great deal.

The exception is when the attack is not random. If you run a high-value or high-visibility site, you'll attract a lot of direct attacks against you in particular. Sites like Facebook, Twitter, Hotmail, etc., see an extraordinary amount of attack traffic. If you deal in this type of site, you probably already take security very seriously and aren't looking for advice.

A note about SQL injection: This type of attack does take some refinement; after catching an SQL error message in a cursory scan, an attacker may send several dozen queries to a given server to get the bits centered right. So theoretically a clamp-down response may prevent such an attack... but probably not, since he'll probably just return using a different IP. Since he's already alerted on your server, he won't be deterred by a blacklist. Better advice is don't run crappy software. There's no excuse for using non-parameterized queries today.


RSA vs DSA working methodolgy? I have looked for various answers but I am being confused on how does RSA can be used for both Digital Signatures and Encryption/Decryption like in "TLS_DHE_RSA_..." or "TLS_RSA_.." cipher suite whereas DSA is only used like in "TLS_DHE_DSS_.." only for certificate signing, and not for encryption/decryption.

It would be better if someone could explain the mathematical functions/how they work with an example each for these two standards.

Edit : Also if DSA and RSA are only used for Digital Signatures how does there public keys are provided to client because the public key is needed to verify privately signed certificate, do certificates  are exchanged twice and what are the parameters that are encrypted in the digitally signed certificate ?

First to answer your original question:

How can RSA be used for digital signing and encrypting and DSA only for encrypting?

To understand this one has to dig into the definitions of RSA and DSA.

RSA by itself was designed to be a public-key encryption scheme and later converted to a digital signature scheme. RSA does encrypt data by rasing them to an exponent e modulo a composite number n. You can invert this process if you know the factorization of n, you can calculate the exponent d that turns the encrypted message into the original message. Now you should see how it can be used for PK-encryption. Note that m^e^d=m^(e*d)=m. Now you want to sign something. So calculate the hash of this message (H(M)) and "decrypt" this so everyone knowing e and n can "encrypt" it to get H(M) back and then verify this belongs to the message M. (Wikipedia Article)

Now DSA does things a little differently. You can only sign data with DSA because it's defined to be used with a hash-function. The result of the hash-function is used to do the signing math and hence a verifier can only check that certain values match, to believe your signature but they can't reconstruct the hash itself as it is possible with RSA. Wikipedia Article

Now to your second question concerning the certificates.

In TLS a server presents the client with his certificate to prove the public key belongs to him. How is that verified? The server also provides you with what is called a "certificate chain". The whole idea of the certificate-system is that some institutions (CAs) believe you that you are who you claim to be. So your browser (or your OS) has a list of public keys of CAs it's trusting to do their job right. Now the server presents you with his certificate. The server also provides you also with an intermediate certificate. You check if the signature on the server's certificate can be verified using the intermediate certificate's public key. The you verfiy the intermediate ceritificate's signature using the next one... until you reach a point where the certificate is stored in your browser / OS then you'll trust that chain. Now you know that the public key belongs to the server. The certificate contains by itself some data that gives you information about who owns the private key, about the algorithms used, about the validility period, about the CA who issued the certificate and about the signature. (Wikipedia Article about standard X.509 certificates)

I hope this answers your questions if not, ask in the comments.


How secure are sentence passwords? Lately I've been doing the trend of using passwords that are sentences, at least on sites that have a reasonable maximum character length and allow spaces. So for example the most basic variation is 'This is my password.', or 'This is my <insert website here> password.' It seemed rather silly to memorize a group of random words instead of simply rather constructing a sentence, which is way easier on muscle memory. Is this easier to predict?

Let's do some math and study the language to see how this compares to the standard password requirement of 8 characters upper, lower, number and symbols.

Now we are going to be rigorous, so we assume that the attacker knows that you use a sentence as your password and is only trying to break it based on that information. He also knows that you do not use any spaces, capitalization or punctuation in the sentence. I am also intentionally ignoring grammar and syntax since it's too complicated and doesn't provide much insight to an attacker, apart from some words occur primarily at the beginning and or end of a sentence.

While there are a million or so words in the English language people don't use or know that many. The average person uses about 500 unique words in a day, and it is believed that an average person needs between 1500 and 2500 words in their vocabulary to communicate effectively for an extended period of time. Average person also knows about 15,000-20,000 words that they use infrequently.

So let's try those numbers with a 5 word pass-sentence:

Standard to compare is 95^8 = 6.6 x 10^15

500^5 = 3.1 x 10^13

1500^5 = 7.6 x 10^15

2500^5 = 9.8 x 10^16

From this we can conclude that using the expanded vocabulary of the average English speaker we can create a password that is as resilient to specialized attacks as the industry standard is to a brute-force. It would however be significantly more resilient to that same brute force, 26^16 = 4.4 x 10^22. (I used 16 as an average length of 5 words)

Take this all with the same mentality as a normal password. The password "P@55word" has all the features of a secure password but is totally insecure. The same would be true for a pass-sentence like "ilovemygirlfriendmelissa" especially with a little social media recon on the target.

I'm sure some security experts will disagree with this, but then again the security expert quoted in another answer on this page advocates writing down passwords, so I just assume they'll never agree like most experts.


PDF parser and OPcodeExtraction I'm performing an university project on malware detection. Specifically I need:

  - extract javascript from a PDF,
  - put it in the right order,
  - extract opcode sequences of a possible embedded shellcode using for
    example libemu.

In particular the parsing process has to deal with obfuscated/encrypted
 javascript and  even with javascript not located in normal positions referred
 by the documentation.
 Any suggestion on how I can perform these tasks will be very appreciated. Is
 there something already implemented?
 Thanks very much.

Try Didier Stevens' PDF tools which should allow you to do this via CLI instead of GUI: https://blog.didierstevens.com/programs/pdf-tools/. Also, Didier did a lot of work on obfuscation methods so they should help you with most malformed situations.


How can I open a meterpreter shell on the target server after redirecting the target server to my own web server hosting the payload? Alright, so here is what I did to a vulnhub machine after I found a XSS vulnerability in it.

Generated a reverse_tcp php payload and kept it within my web server.
Navigated to my web server's payload location via the document.location() method using the XSS exploit.
On my end, the msfconsole is listening to any incoming connections.
As soon as the target server redirects to my php payload, we get a meterpreter shell. But in like 5 min, I realized that it was a shell to my own machine and not the machine i'm trying to break into.

I'm a noob at using meterpreter and payload. Can anyone please help? I know the payload should be uploaded to the targeted server and then accessed. Can redirect to my web server not cause the payload to be executed in the targeted machine?

XSS vulnerabilities can be used to exploit the client, not the server (with the exception of some edge cases on NodeJS and other javascript frameworks).

You will not be able to use the php payload with a XSS vulnerability. One thing you can do is find a browser payload in metasploit (e.g. Auroroa), and exploit yourself!


Why does IP address need to be listed as a DNS name in SAN/UCC certs? I have heard that when creating a CSR that if you want to validate an IP address that you should list the IP as a "DNS" name and not "IP Address". I have actually had to re-create CSR's like this to fix clients that won't connect and browser SSL warnings. At first I thought it was something limited to self signed SSL certificates but now I've seen this behavior on CA certs. Why do CSR utilities give you the option to list an IP as an IP if this does not work?

Why do CSR utilities give you the option to list an IP as an IP if this does not work?

I don't know which CSR utilities you refer too, but some of them target people who know what they do. Certificates are not restricted to browsers and the rules how they get used differ in other contexts. Especially the often used openssl is a tool which is able to create CSRs which are valid, but maybe not valid in the context of browsers. Thus it is definitely a tool for professionals who know the relevant standards and not for newbies.


How can I determine if a malware sample is morphic? (polymorphic, metamorphic, etc) I want to do a malware test that specifically uses recent morphic malware samples (polymorphic,  metamorphic, etc). There are a couple of good sources I can pull samples from, but I need to know if their signature will change or not.

The best idea I have so far is to use a tool to disassemble it so I can look at the Assembly code. Then get it to propagate and look at the code to see if there is a change.

Does anyone know of a better way to do this? I'm not even sure of a reliable way to make it propogate.

It depends on whether you want polymorphic or metamorphic.

Polymorphic usually means the malware which is capable of changing itself while distributing itself. So first thing to determine is whether malware is actually making copies of itself (most typically writing into network folders). Then you can see whether those copies are different. This could be confirmed either by static analysis (such as disassembly - time consuming) or dynamic analysis (emulation or sandboxing - faster). This is relatively rare nowadays.

Metamorphic usually means the malware is changed at the server, and everyone downloading it gets a different binary, even though all those binaries implement the same thing. This is very common nowadays. A specific sample you downloaded will always remain the same, and will make the same copies. However a sample someone else downloaded would be different from yours. Trying to download several copies, including different source IPs (ideally via local connectivity, less ideal VPS, much less ideal VPN) and spread in time (i.e. every few hours) would get you lots of samples.


Generate CSR and private key with password with OpenSSL I am using the following command in order to generate a CSR together with a private key by using OpenSSL:

openssl req -new -subj "/CN=sample.myhost.com" -out newcsr.csr -nodes -sha512 -newkey rsa:2048

It generates two files:

newcsr.csr
privkey.pem

The generated private key has no password: how can I add one during the generation process?

Note: take into account that my final goal is to generate a p12 file by combining the certificate provided according to the CSR and the private key (secured with a password).

Ditch "-nodes"

If you actually WANT encryption, then you'll need to remove the (awkwardly named) -nodes (read: "No DES encryption") parameter from your command.

Because -nodes will result in an unencrypted privkey.pem file. And if you leave it out, then the file will be encrypted.

So without -nodes openssl will just PROMPT you for a password like so:

$ openssl req -new -subj "/CN=sample.myhost.com" -out newcsr.csr -sha512 -newkey rsa:2048
Generating a RSA private key
.........................................+++++
................+++++
writing new private key to 'privkey.pem'
Enter PEM pass phrase:
Verifying - Enter PEM pass phrase:
-----

But interactive prompting is not great for automation. So if you don't want to be prompted then you might want to read on for how to use "Pass Phrase arguments".

Use OpenSSL "Pass Phrase arguments"

If you want to supply a password for the output-file, you will need the (also awkwardly named) -passout parameter.

This is a multi-dimensional parameter and allows you to read the actual password from a number of sources. Such as from a file or from an environment variable. Or straight from the command line (least secure). Below are examples for each of these usages.

(The official manpage lists even more password-sources in the "Pass Phrase Options" section (Archived here.))

Example: password from command line with "pass:"

$ openssl req -new -passout pass:"Pomegranate" -subj "/CN=sample.myhost.com" -out newcsr.csr -sha512 -newkey rsa:2048
Generating a 2048 bit RSA private key
................................................................................................................................+++
......................+++
writing new private key to 'privkey.pem'
-----

$ openssl rsa -in privkey.pem -passin pass:'Pomegranate' | head -n2
writing RSA key
-----BEGIN RSA PRIVATE KEY-----
MIIEpQIBAAKCAQEAsSP5kLRPP8wPODrnvuAeeoqGMqTOvRULL423vv6+zjYhwPUi

Example: password from variable with "env:"

$ export MYPASS='Elderberry'

$ openssl req -new -passout env:MYPASS -subj "/CN=sample.myhost.com" -out newcsr.csr -sha512 -newkey rsa:2048
Generating a 2048 bit RSA private key
............................+++
.....................+++
writing new private key to 'privkey.pem'
-----

$ openssl rsa -in privkey.pem -passin pass:'Elderberry' | head -n2
writing RSA key
-----BEGIN RSA PRIVATE KEY-----
MIIEpQIBAAKCAQEAv0NnBnigPp+O9G4UXc0qSyeELdJJjTmnO9GEtE5GlPGoK7vW

Example: password from file with "file:"

$ echo "Farkleberry" > password.txt

$ openssl req -new -passout file:password.txt -subj "/CN=sample.myhost.com" -out newcsr.csr -sha512 -newkey rsa:2048
Generating a 2048 bit RSA private key
......................+++
...........+++
writing new private key to 'privkey.pem'
-----

$ openssl rsa -in privkey.pem -passin pass:'Farkleberry' | head -n2
writing RSA key
-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEAsHICgYvqe4i9CIR5eQk38JJmuTaJQvyxPH9S+BahT5XWh88z

Related Reading

https://stackoverflow.com/questions/4294689/how-to-generate-an-openssl-key-using-a-passphrase-from-the-command-line


Can wifi router be ddosed by "trying" to login to router repeatedly and in very fast manner? Trying to make an important router as safe as possible from low skill "dos" attack on it. Is it possible for someone in the range of a wifi router to write a script in whatever programming language to try to login to the router with wrong password on purpose with full speed to basically "dos" it to the point where the router is out of function?

Normally for dos attack they would usually have to know my ip address and go through our safe walls, but how about without even knowing our password, ip or any other information, say for example if my wifi just pops up because they are close enough to it(less than 100m away), can they maybe just spam login to it until it's down?

And if this is the case is there any way to protect our router from this, or is it impossible?

--
btw, i know that a jammer could always be used in such a distance, but i am avoiding worrying about high skill attacks, since they are illegal, and an amateur would have a hard time trying to produce one.

I think the closest type of attack to what you're referencing would be a WiFi deauth attack. There are ways to protect against it, but ultimately I think trying to secure WiFi against dos is like trying to secure a glass door against break-ins by putting more locks on it. WiFi operates on unlicensed spectrum, so no license is required to transmit. The tradeoff you have to accept when you use unlicensed spectrum is that everyone else can transmit on it too, so there are no guarantees on the quality of that spectrum. You can put in all the technical defenses you want but it will have a hard time stopping someone who just comes along and spews noise on the spectrum.

  -- btw, i know that a jammer could always be used in such a distance, but i am avoiding worrying about high skill attacks, since they are
  illegal, and an amateur would have a hard time trying to produce one.

Laws will of course vary depending on jurisdiction, but making WiFi unusable through a deauth attack could also be considered a form of jamming and potentially also illegal, so I'm not convinced that someone willing to perform a deauth attack would be unwilling to perform RF jamming. Additionally, a lot of WiFi interference happens unintentionally. Microwave ovens are infamous for wreaking havoc on 2.4Ghz spectrum. Cordless phones, wireless security cameras, baby monitors, and neighboring WiFi networks can all cause interference, sometimes to the point of making WiFi unusable. These forms of interference would generally not be considered illegal jamming, since it's unintentional.

Another interesting tidbit about how WiFi works is that as a form of congestion control, if a WiFi device hears another WiFi device transmitting on the same channel, it must wait for the other device to stop before it can transmit - even if the other device is associated with a completely different network. So even the existence of another network on the same channel as yours, if transmitting data constantly, can severely degrade the performance of your network.

In conclusion, if guaranteed network availability is important to you, wired connections are the way to go. WiFi should be for convenience only.


What should I know before configuring Perfect Forward Secrecy? PFS has gained attention in our audit department because of its innate ability to limit our exposure if someone steals our private key.

What pitfalls or common mistakes should I be aware of before implementing this?  Anything administrative, implementation-specific, or platform-specific?
Are there misconceptions regarding what PFS can and can't do?  Could our Audit department need a reality check?
Are the benefits of PFS limited by application?  (web vs smtp, etc)

Some of these concerns come from this answer, which seems to imply that not all web clients will support PFS.  Prior to making PFS mandatory on our server, I would like to account for and prepare for the incompatibilities.

Would it be reasonable to expect my OS vendor or load balancer (SSL Offloading) to support reporting of encryption used?  I'd like to generate usage statistics.

PFS in SSL implies that the server performs, for each new session, a Diffie-Hellman key exchange and a signature, so the CPU cost of the handshake on the server is about doubled compared to a non-PFS cipher suite. But it is rather infrequent that the handshake CPU cost is non-negligible (clients which open several connections use the abbreviated handshake which uses symmetric cryptography only, and a basic PC has enough power to handle several hundreds of complete handshakes per second with a single CPU core). I suggest making an in-context benchmark.

Still with SSL, there is no defined PFS-able cipher suite which also supports RC4 encryption. Apart from that, all non-archaelogic Web browsers currently deployed will accept the "DHE" cipher suites (which yield PFS) so there is no interoperability issue here; the question is rather whether you want RC4 or not: you have to balance the fear of ulterior key compromise (against which PFS adds some protection) with the fear of chosen-ciphertext attacks (i.e. BEAST, to which RC4 cipher suites seem immune).

The OS or load balancer might report cipher suites statistics, but I would not bet on it. You can make tests with OpenSSL (the command-line executable, with the s_client command). You can also use any decent protocol analyzer like Wireshark, which can tell you which cipher suite is used on a given connection (the cipher suite identifier is sent "in the clear" as part of the initial steps of the handshake, so it is easy to grab it with a sniffer).


Should merchant be SAQ-A compliant if full payment processing is outsourced and NO paper (reports or receipts) with cardholder data is retained Given:

e-commerce merchant, which fully outsourced payment processing to third-party PCI DSS compliant service
NO paper with cardholder data is ever retained

Question: should such merchant still be SAQ-A compliant?

Or probably more general question: is it possible to fully outsource payment processing to third-party service and not worry about PCI DSS compliance at all?

Assuming you are a merchant with your own website and charge cards as yourself (as opposed to doing business though another site - like eBay or Amazon - and just being paid by that company), then there's no way to get around needing to be (at least) SAQ A compliant.  After all, part of the point of SAQ A is to document that you don't handle cardholder data.

Whether SAQ A or SAQ A-EP applies depends on just how much of the process is outsourced.  There's a guide for that

  SAQ A has been developed to address requirements applicable to
  merchants whose cardholder data functions are completely
  outsourced to validated third parties, where the merchant retains
  only paper reports or receipts with cardholder data.

  SAQ A-EP has been developed to address requirements applicable to e-commerce merchants with a website(s) that does not itself receive cardholder data but which does affect the security of the
  payment transaction and/or the integrity of the page that accepts the consumer’s cardholder data.

Since you say "fully-outsourced", I'm assuming you fall under A, but it's possible to fully outsource the payment handling, while still retaining enough influence in the process to fall under A-EP instead.  For example, payment controls on your site which send the card data to the third party could be either, depending on how they're implemented, while simply redirecting to the third party site should always be A.


Can a djvu file be dangerous? PDF files can contains malicious JavaScript , open actions & etc. But what about djvu files ? If djvu can be malicious, then how to detect that manually (without opening malicious file of course)?

Yes, a DjVu file can be dangerous. While, as others have mentioned, it is designed not to have any executable code, a vulnerability in a DjVu parser can be used to exploit the viewer. Many viewers use the same library, making a vulnerability in a single library relevant to large number of viewers. A historical example is CVE-2012-6535, which affected the popular DjVuLibre library, used by many document viewers. The vulnerability, as reported by Microsoft, was a memory corruption bug that allowed for code execution. The CVE details page gives some general information about its impact:

DjVuLibre before 3.5.25.3, as used in Evince, Sumatra PDF Reader, VuDroid, and other products, allows remote attackers to execute arbitrary code or cause a denial of service (memory corruption) via a crafted DjVu (aka .djv) file.

Unfortunately, it is not possible to manually detect a malicious file of this sort. They do not necessarily contain any tell-tale signs such as visible embedded scripts or suspicious strings, and antivirus will rarely be able to detect them. In fact, they usually skip files that are not executable.
This is not at all specific to DjVu. Any file format can be exploited, even ones you don't expect. The best way to reduce the risk of exploitation is to ensure all your software is up to date, so any discovered vulnerabilities are promptly fixed before they can be widely exploited.


All I see is RPC, how do I proceed? I finished a tiered hacking exercise, and after submitting it was told that the last tier (a machine on the network) was not possible to attack in the given exercise.

The machine was only running rpc.statd on 111 and had a status service listed when I checked rpcinfo.

The box is static (as in, no incoming/outgoing connections exist or will exist)

As a new penetration tester who is up and coming, what do you do when faced with a situation like this? Of course giving up is the last thing you do, but in this specific scenario, is there a feasible solution or is it just a brick wall intended to teach me a lesson?

Thanks.

The procedure when you are pentesting looking for open ports is always the same:

1º Run a port scanner

2º Check ports and services running

3º Find (or write your own) exploits for known vulnerabilities.

4º Report

In this case of RPC, as far as I know it isn't a big deal now. In the 90's it was very popular, but right now I haven't seen any vulnerability related with it.


Do dial locks have repeated numbers? Can dial locks, such as the one below, have repeated numbers in their combination? For example, the combination 10-39-10 has the number 10 repeated twice in it. If so how often is this the case?

Yes, these locks can have repeated first and third digits, which occur about one in 10 times.  See Samy Kamkar's page on Master locks to learn more about them.


How does one make password easily forgettable? Is there any phycological research that appears relevant to making passwords easily forgettable under adverse circumstances?  Circumstances might include when under duress, after some duration of non-usage, i.e. imprisonment, or willfully by silently rehearsing random wrong variations on its theme.

You might for example remember a series of English words using the method of loci, but later disrupt the nemonic device itself by rearranging the objects and story repeatedly.

We tend to remember passwords automatically and (I think for many people) using auditive memory, which makes them prone to blurting them out under duress. There has been research on other forms of passwords, such as the broad class of graphical passwords, for which a classical article is The Design and Analysis of Graphical Passwords by Jermyn, Mayer, Monrose, Reiter and Rubin at Usenix 1999.

Suo, Zhu and Owen's 2005 survey covers some developments in graphical passwords. Their survey tends to show that a graphical password scheme with sufficient entropy would require a large amount of small steps, and with most techniques presented each step is prone to being revealed under coercion.

A well-known implementation of graphical passwords is the connect-the-dot scheme used on Android phones. This particular implementation does not have much entropy and is not good against hardware attacks (such as smudge observation) anyway.

I am also reminded of an old (2000) message on the Caml mailing list about Rubberhose, an early filesystem with deniable encryption, in which Julian Assange (now better known for other works) explains how his group has been thinking of using other methods for keying such as gestures (maze walking) and simile problems. I haven't found any later publication elaborating on these musings.

A 2009 recent study by Chong and Marsden shows that gesture-based passwords, at least with the constraint of recording them on a mobile phone, are less easy to memorize than PINs. I don't know how they would fare under the different point of view that passwords may be harder to memorize if that makes them easier to forget or avoid revealing.


OpenSSL Basic Constraints I have been working through the book 'Planning for PKI' and I have gotten to the point where I want to create an end-entity certificate. However, I am faced with an error message saying that there are extension errors inside the certificate. I have been guided by my teacher to look closely at how the basic constraint extension can be altered to fix this issue.

The book recommends against the use of the Basic Constraint extension in end entity certificates. However, when I simply delete it, a default extension of "CA:TRUE" is inserted anyway.

So my questions are:

Is there a way to override this automatic insertion or did I misunderstood the book?
Any ideas as to what I may be doing wrong?

The below is the extension I have been using to create the certificate:

[ server_ext ]
basicConstraints        = critical,CA:false
nsCertType              = server
subjectKeyIdentifier    = hash
authorityKeyIdentifier  = keyid,issuer:always
keyUsage                = critical,digitalSignature,keyEncipherment
extendedKeyUsage        = serverAuth

I suspect the openSSL man pages might be of some assistance:

  If the basicConstraints extension is absent then the certificate is considered to be a "possible CA" other extensions are checked according to the intended use of the certificate. A warning is given in this case because the certificate should really not be regarded as a CA: however it is allowed to be a CA to work around some broken software.

i.e. the KeyUsage/ExtendedKeyUsage would (it seems) be used to guess.

Taken from https://www.openssl.org/docs/manmaster/man1/x509.html, Certificate Extensions section.

This seems (to me) to be different to what the openssl cookbook says (https://www.feistyduck.com/library/openssl-cookbook/online/ch-openssl.html):

  The Basic Constraints extension is used to mark certificates as belonging to a CA, giving them the ability to sign other certificates. Non-CA certificates will either have this extension omitted or will have the value of CA set to FALSE. This extension is critical, which means that all software-consuming certificates must understand its meaning.

Checking the man page for x509v3_config (https://www.openssl.org/docs/manmaster/man5/x509v3_config.html - see Standard Extensions section), one possible issue is your syntax.

They provide the following as their examples:

basicConstraints=CA:TRUE

basicConstraints=CA:FALSE

basicConstraints=critical,CA:TRUE, pathlen:0

They provide one additional way of achieving similar results:

basicConstraints=critical,@bs_section

[bs_section]

CA=true
pathlen=1

I would just amend your config to read:

basicConstraints=CA:FALSE

In place of:

basicConstraints        = critical,CA:false

This way, your profile is explicit, and should override any other (possibly opposite) config being applied elsewhere.


Is it at all possible to store Windows Sticky Notes in a secure manner? Example: Users want to use Sticky Notes for quick note taking. They don't like other options, they want Sticky Notes.

However, Sticky Notes normally stores the information in a SQL db that can be read with Notepad++ with little trouble.

Telling users not to store passwords on there is all well and good, but they will still do it and even if we punish them, they still put the company at risk.

Can you secure Sticky Notes such that they can't be simply read with an editor?

It depends.

Full disk encryption will protect the sticky notes (and everything else on your hard drive) when the computer is turned off. However, it will not protect you from someone taking a peak while you are on a coffee break. If that is a requirement, you'll have to get them to use something else.

What your users really want is probably not sticky note. What they want is convenience. You will have to find another solution that is even more convenient, and take some time to teach them how to use it. For instance, a password manager could autofill the passwords for your users, so you don't even have to do the copy paste!

But convincing people to change habits is hard, so don't expect it to be easy.


CAM table attack in 2011? Today's switches are vulnerable to CAM Table attack?

https://secure.wikimedia.org/wikipedia/en/wiki/CAM_Table

Flooding the CAM table to force the switch to fall back to hub behavior (broadcasting all packets to all ports) is an "attack" only if you consider the normal switch behavior (sending the packet only on the "right" link) to be a security feature -- which it is not. Switches are an optimization, not a protection. Unfortunately, the idea that "switches protect against snooping" is widespread (but wrong).

Besides flooding, other kinds of "attacks" include sending packets with a framed MAC address, so that packets meant for a given host are misrouted. Such "attacks" will work on all switches, because they just exercise the job that the switch is meant to perform (some switches can be configured to maintain a static list of MAC-to-port translations and at least raise a warning flag in that case, but this is an orthogonal issue -- some switches incorporate all kinds of firewalling and filtering and may have an IP address themselves, and can generally be thought as a merge between a switch and an host).


Role Based Access Control + Data Ownership based permissions Is there a common system or pattern that combines the permissions given by a role in a RBAC-system with permissions in relation to data ownership?

For example:

  Bob is a doctor and has the role with the privilege 'view patient details'
  but only if 'patient is assigned to doctor Bob'

the above example places the relation on the Actor (Doctor Bob in this case) but
I'm actually looking for group-based solution:

For example:

  Bob is a doctor and has the role with the privilege 'view, patient details'
  Bob is a member of group 'A'.
  Bob can view all patient details for patients assigned to group 'A'

My question is
Is there any common access model that does the above?

summary of the answer(s) I found
There seem to be two more or less related solutions for this scenario: Parameterized RBAC (pRBAC) and Object-Sensitive RBAC (ORBAC). The pRBAC solution has, from what I could find, generated more interest than ORBAC. In my opinion, it is also the more elegant and flexible of the two solutions.

There are other lines of research out there that look to solve the same access control issue, but those are aimed at replacing RBAC with some other type of Access Control model.

This is a very good question, and it has been identified as one of the problems with RBAC. There is been a line of research on parameterized roles (the pdf can be found online), and more recently, the idea of relationship-based access control has emerged (see work of P. Fong et al, for instance this one). I'm not sure how much has been implemented though.


Can you block command line prompt but allow Python? I want to block users for using the command prompt, but I also want to allow them to use Python. However, Python has the os module which users can use to execute commands, like:

>>> import os
>>> os.popen("command to be run eg start "C:/")

How can I stop Python from allowing os.popen (above) to run?

You should be looking for a full sandbox, and not just preventing os from being imported.

For instance, you can use RestrictedPython for blocking imports.

Or you can set sys.modules['os']=None. Look at this related post for more options.


How can short-circuit hash equality be exploited? I recently came across some password code that hashed the password and then compared it with the saved hash in the naive way: one character at a time, short-circuiting as soon as a non-match was found. We agreed it was a security bug and fixed it.

However, this code piqued my curiosity: suppose an attacker is able to glean from the timing of password checking the number of hash digits that match. How could this bug be exploited in practice? I understand security should be deep and you need not find a practical exploit to take a security measure - I'm asking purely out of curiosity.

For example, the attacker might try progressively extending the hash one character at a time. But if the hash is n digits long, the attacker eventually needs to extend from n-1 digits to n digits. Assuming a good hash function, this seems to require a full pre-image attack. Assuming the attacker can compute the hash, which requires the attacker to have the salt if there is one, this attack could largely be performed client-side (given n digits in base b, a maximum of n*b queries to the server are required). But hash functions are chosen to resist pre-image attacks so is this exploit practical?

This answer on crypto.SE outlines the attack Anders points out in the comments. Even if there is a salt it's still best practice to make it a time-safe comparison simply because salts are assumed to be public information, though in practice it seems unlikely it'd be a big issue unless you divulge the salt without also divulging the password hash.

Your assumption about this attack requiring a first pre-image attack on the hash seems logical, but it has a major problem: the pre-image space that matters is the pre-image space of hashed passwords, not of the hash itself (i.e. the preimage of H(p) where p is a password rather than H(d) where d is any data). This is a problem even with a slow hash because that pre-image space can be much smaller, such as trying the 220 most re-used passwords (vs eg 2128 for the hash itself).


How to get Sqlmap to detect insertion point with sleep payload? I have a server which seems to be vulnerable to SQL injection with the following payload detected by BurpSuite:

param=value,(select*from(select(sleep(10)))a)

The application takes twice the time defined in sleep to respond (sleep 10 returns a response after 20 seconds). I am trying to get Sqlmap to detect the insertion point, however it won't pick it up. I have tried with --prefix and --suffix, increasing the risk...

Does anyone know Sqlmap can be tweaked to detect this?

Burp Suite won't always pick up right detection. On your question, you noted the application seemed to be vulnerable; This meant it's never determined if it's a positive detection. You will need to check if the detection is Certain or it's just Tentative? (What does Burp Suite tell you?) If it's Tentative detection, you could try using SQLMap or rather try detecting manually.

  The application takes twice the time defined in sleep to respond (sleep 10 returns a response after 20 seconds)

Did you try that manually, if yes - there is a probability of a web application firewall.

Since, SQLMap is the approach which you've taken - I assume you should be targeting on a particular parameter using -p switch and then the name of the parameter which you are testing. You have noted that --risk & --level doesn't help. It's because if the parameter detection is Tentative, it's a false positive.

On a sidenote, use --tamper=ptm & tamper=charencode, let us know how that went.

Another way could be using --identify-waf switch to determine if the target is beyond a firewall which might be dropping interesting packets.


Understanding port scanning with firewall enabled My objective is to do a port scanner in windows and find the ports which are open. Suppose, I run an application which opens up a port 8000. Now I create a new inbound rule to block all incoming packets on port 8000. So now is the port technically open?

My requirement: Find all the ports which are open? That is, find the ports which are allowed by firewall and are open.

The ports which are blocked by firewall are anyway going to be shown as "open" on netstat but I do not want that information since it has already been taken care of.

Any ideas on how to proceed with it?

To explain things in a simple manner: ports can have 3 general states:

Blocked - (by firewall or any equipment between source and destination) - nothing gets through in either direction. Everything is denied.

Normal - (default state in most cases) - you can request connection towards anywhere and they will work, but incoming connections towards you are not permitted. A connection will work if you (the source) initializes it. If someone from outside initializes it, it will not work.

Open (sometimes called forwarded such in the case of NAT) - all connections can go through both ways. Anything incoming via such port will be allowed.

If an application is active and listens to a port, it will only be able to receive incoming connections if the port state is Open, it will be able to initialize connections if Open or Normal and will not be able to do anything if Blocked.


how to protect from Network scanner on android? How can I block and detect network scanners on android platforms to stop scanning vlan of my hot spot.

My question is:

which scanners they use?
how can i detect such scanners?
Can i protect LAN by MIKROTIK or there are better tools available.

This kind of attack are very moving in form, tools, and manners. (one day it's vlan, that offer some backdoors, another day, there is SIP... or some .mp3 plugins...)

Depending on what's new security failure where discovered...

But Android community is very quick to build patchs and correction for dangerous sercurity failures.

So the right answer is (as I think):

Any scanner, depending on which failure have to be exploited
Don't try to do that if you're not a network security expert;-)
Keep your system up to date!

And if you're in doubt, ask a friend to trace network activities and maybe to inspect your system.

(Don't buy expensive anti-virus or other anti-spy software, as they are as obscure as malwares you try to stay away.)


CSP allowing all Google domains? I'm trying to develop a CSP for the site https://www.lidl-tour.ro.

Right now there is a policy than runs in report-only-mode, so nothing is blocked at the moment.

The site contacts googleads.g.doubleclick.net and stats.g.doubleclick.net. So I have put these hosts on the whitelist.

But it seems that these sites then (make the user) load content from www.google.com and www.google.YOURTLD. I can see CSP violations being reported where the browser wanted to contact https://www.google.com.cy, https://www.google.co.uk, https://www.google.it, https://www.google.de and so on.

Now I don't want to put all google domains into the CSP.

I thought about allowing https://www.google.* (I don't know if this is even valid in a CSP) but this expression wouldn't match URLs like https://www.google.co.uk.

So, how can I build a valid CSP in this case?

As an addition - not only is it not supported, you wouldn't want it even if it was supported.

Because https://www.google.* would then match not only https://www.google.co.uk but also https://www.google.evilattacker.com. And you can be sure that is exactly the URL attackers would use, as it would give them best leverage against CSP on majority of sites.


How can I force a specific device to re-authenticate? I gave out my home router Wi-Fi password to a guest who wanted to surf the internet while staying at home. I am almost sure that he checked the "remember password" option on his device so, from now on, in future visits he can potentially access my network resources (including shared folders) whenever he is within range.

At that time I didn't have an isolated guest network enabled. Now I do.

I would like to deauth his device or revoke his credentials so that on future visits he is forced to re-authenticate using the guest network instead.

How can I do it without having to change my password or resetting my router?

The best approach is to simply change the Wi-Fi SSID password. You could even change the SSID itself.

You could add their MAC address to a block list if you know it, that will also block them but it isn't 100% effective as they could change their MAC address in a number of ways. The easiest being to use a different Wi-Fi card.


What is behaviourism and heuristic control in anti-virus software and how does it work? In one local magazine I read interview with Adrian Porcescu, who is a technical consultant that works for Kaspersky Lab.

Among other things, he says their anti-virus uses behaviourism and heuristic control to detect malicious software.

I wonder - what is behaviourism and heuristic control in anti-virus software and how does it work?

Heuristic are:

learning techniques
common sense
discoveries

Their objective is to recognise a virus by analysing its code (not limited to). If a program is programmed to open a certain file, or to load/read certain memory address.
These methods are based on multiple criteria. They eventually can run program in virtual environment to monitor for known virus schemes : replication, stealth etc.

Behaviourism is analysis in real time. By analysing what a program is doing (file I/O, memory I/O, network I/O, use of the PC during idle time, ...) you can assess whether it is legitimate or not. If one program begins firing packet on 100 IP addresses on each port, you can be sure it's a virus, because it is not a normal behaviour for a program.

I would conclude saying this: behaviourism deals with unknown behaviour (certainly try to profile the user behaviour to detect changes in normal activity) and it certainly uses heuristic. Heuristics objective is to detect an unknown virus, or variant, but the scheme they are looking for are well known.

Some references:

Wikipedia of course: http://en.wikipedia.org/wiki/Antivirus_software ; http://en.wikipedia.org/wiki/Heuristics
Some journalistic article : http://systemtechnologygroup.com/Behavior_Blocking.pdf
One paper on the subject: http://www.springerlink.com/content/t3r27639x9533601/ (maybe access limited)


Should I reply to e-mails that reached me by mistake (very low chance of being regular spam)? My name is fairly usual where I live and my e-mail address is {first_name}.{last_name}@very_large_provider.com, so from time to time I receive what is very probably legitimate e-mails sent to me by mistake. They usually are sent to {first_name}{last_name}@very_large_provider.com (the same without the dot), which the provider interprets as the one with a dot.

These e-mails:

have various content (e.g. price offers with furniture schematics, advertising related materials that are supposed to reach some client, even projects to change some law sent by an assistant to some member of Parliament for approval).
are written in my native language
do not contain any disclaimer related to confidentiality of information or any type of disclaimer whatsoever
the provider consider them as legitimate and it usually detects spam very accurately (sometimes too aggressively)
almost all of them contains attachments (no executables or scripts, just Word documents and images)

I am tempted to reply to these e-mails and warn the sender about their mistake, as they seem legitimate.

Question: Should I reply to e-mails that reached me by mistake (very low chance of being regular spam)?

Depends on how far you want to go, I see two scenarios here: the first one is that the sender wants to establish a relationship with you so will be able to send you more messages after. Some Anti-abuse systems correlates this types of events (send and receive messages accepted) and creates a trust chain (The receiver receive messages from the sender X on the past). The second scenario  is that the messages are a mistake. In any of both of them I will reply, if there is a mistake the good sender will notice this but the bad..... not sure of that.


Is it possible to encrypt WiFi connection? Is it possible to encrypt (encrypt traffic) WiFi connection from my laptop to my router?
If anyone of you did it?

How I can do this?

If you're using WPA2, you are encrypting the traffic between your wireless devices and the wireless AP (typically built into a router).

There are two implementations of WPA2, but I will assume you are using the pre shared key version.

It introduces encryption using this method.  It is generally acceptable for home network solutions, but not enterprises.  The reason for this, is because, with WPA2-PSK, if you know the passphrase for the network, it is possible to decrypt other people's traffic who are talking to the same SSID (wireless name), as long as they are able to capture that device's 4-way handshake (mostly trivial unless there is 802.11w involved).

WPA2-PSK is currently considered "strong" and has no known major faults.  However, it should be noted that the amount of security is derived from the strength of the password you use.
If you use a password of "abc123", your network is much less secure (from dictionary/brute force attacks) than if your password is "a0fj9sd09fj#J)()F9".


Is it safe to add IP address to SPF record I am a programmer who manages online exchanges user also and i have been asked to add IP address to SPF record so that one of the application can hosted on Azure can send emails to user etc..

v=spf1 +ip4:xxx.xxx.xxx.xxx include:spf.protection.outlook.com -all

Adding IP address to SPF record so that emails send from this application are accepted by the exchanges server and end up in the Inbox.

Now my question is, Is it safe to add IP address to SPF record from security point of view as am afraid it may be used to send malicious email by spoofing or other means such as IP impersonating or IP spoofing.

I personally am against adding IP address to SPF record as i am not sure if it can be misused to send back email to user in our organization.

What can be done depends how much control you have over this IP address. Adding this IP to the SPF record means that any mails originating from this IP address are allowed to use any email address within your domain as sender within the SMTP dialog. If there is only one application which runs there and you trust it this might be fine.

If instead you must fear that this application might misuse your trust to send mail from different users in your domain or that other applications on the same IP address might send mail then you should probably not allow this. In this case it might be better that the application instead delivers the mail via your own infrastructure where you have better control which mails are send and can add the appropriate restrictions.


What is the simplest way for a Proxy/UTM to block HTTPS traffic using URL filtering? I'm building a UTM using ubuntu, How can I block HTTPS traffic using URL filtering? (For example I want to block https://facebook.com)

I'm using Squid as a transparent proxy server. Solutions I don't want to use:
Blocking websites by IP's, Squid-in-the-middle SSL Bump

The orthodox way to accomplish this would be to use SSL interception, such as SSLBump, with Squid.

If you don't want to intercept SSL traffic, you can do this via DNS.  This would have the effect of blocking the entire website regardless of protocol, e.g. http vs https vs ftp, based on DNS.  So you could blacklist "facebook.com" and have your DNS server redirect it to a "This page is blocked" site hosted on an internal IP.  An example of a service for such DNS filtering is OpenDNS.

Such a DNS workaround could be avoided by users if they have the ability to edit their workstation DNS settings to use another DNS server, or edit a hosts file.  They could also use a number of web sites which offer a proxy to facebook and other sites (which are questionable since they may intercept the users' password) to relay the connection.

Because of the weaknesses of using a DNS-based setup, when looking to inspect HTTPS traffic it is generally more effective to use your squid proxy as a ssl-man-in-the-middle engine and inspect traffic decrypted, this will lead to much better filtering.


What are the relation (difference and similarities) between Replay attack, reflection attack and relay attack? What are the relation (difference and similarities) between Replay attack, reflection attack and relay attack?
All of them together seems a mess to understand! Are they not MITM?

These three have little in common. Only the replay attack can be really considered MITM, and even then, the MITM is only part of the attack. If anything, in theory reflection attack is a special case of relay attack, where you only use one device, though in practice they are very different.

Replay attack is partially MITM. Lets say you send an encrypted and signed command "OPEN_DOOR_1" to open a door on your smart home. Replay attack would be to capture the command and just send it again to open the door again, without knowing what the command is (encrypted) or knowing how to sign it (it is already signed).
Reflection attack is using the target to authenticate its own challenge. For example, you have two devices that authenticate each other and you use shared secret and HMAC to do the authentication. The target sends you a nonce that you are supposed to HMAC. You open a new connection with the target, request that it authenticates itself and send the nonce you received previously. You receive the HMACed response and send it back to the target pretending you HMACed it even though it was in fact the target.
Relay attack is usually used with smart-cards and tokens. You basically go to the terminal, with one device and to the smart-card with another. You just send the messages between to over distance. A nice example is in cars with wireless ignition, people were able to just use signal booster to boost the signal from the keys inside a house to the car outside, using the owners keys to unlock the car without ever entering the house or touching the keys and without breaking any encryption. Just making the car think the keys are closer then they really are.


How does Ram Scraper work? I heard that during Christmas a lot of customer data was stolen using malware attack called Ram Scrapers.

What exactly is a Ram Scraper?How would one infect a machine with it?What information can you take with a Ram Scraper?How to detect if you have Ram Scraper installed?And how to protect yourself against Ram Scrapers?

Sorry if this is a stupid question. But I am very curious about it since it seems to have affected a huge amount of stores.

Thanks to anyone for their help and explanation.

RAM Scrapers are a type of Malware which work by searching through a device's RAM, looking for confidential data (such as credit card numbers).

The malware can infect POS card terminals as well as ATMs, Computers, Mobile Phones... The method of infection is usually the same as for most other types of malware, but most commonly through users infecting the host machine (Windows) with the infectious agent which then jumps to the terminal when it is initialized.

Detection is not easy, especially if the device is dumb (PoS terminal). For most at risk businesses, the most likely detection will be through antivirus programs running on the machine connected to PoS terminals, and by analyzing outgoing web traffic.

As a credit card user, there is little you can do except, perhaps, to limit the exposure by using pre-paid credit cards when making payments in a bricks and mortar store.

http://nakedsecurity.sophos.com/2013/07/16/a-look-at-point-of-sale-ram-scraper-malware-and-how-it-works/


What's the risk from an SSL page (HTTPS) that serves some of its content unencrypted (nonSSL, HTTP)? What if the majority of the page is served via SSL properly (HTTPS) but there's some stray javascript file that is served unencryped (HTTP)?

What's the risk here? Thanks

If someone can inject my JavaScript code into the page, for instance by hijacking an unsecured connection, then they can basically take control of entire page.

For instance, let's say you're trying to log in to That Website That Stores All Of Your Personal Information™, but one of the JavaScript files is served over an insecure connection. A rogue employee at your ISP intercepts this one connection, and injects JavaScript code that, when you click the "Log In" button, takes the username and password you entered and sends it to himself. Now he has control over your login information and can potentially steal your identity, based on the information that he can find on your account page (such as full name, address, phone number, last four digits of your credit card number etc.)


Apache RewriteRule htaccess security If I configure an .htaccess file like this :

RewriteEngine On
RewriteRule ^([^/]*)$ /view.php?key=$1 [L]

Which transforms:

original URL   http://www.example.com/view.php?key=123
rewritten URL  http://www.example.com/123

Is there any way for an attacker to find the real PHP file (here view.php) and directly access it (in the URL bar)?
Considering URL-bruteforce is not an option, nor .htaccess reading.

There are several ways; php could have display_errors on or you could have HTML source or links that reveal the file location.

URL is a little trickier, but using something like ///view.php might do the job.


Prevent Database from accessing with knowing system admin user My question might be broad. Suppose that we trying to store our client's information data with a database on a server. The server may get a vulnerability and give access to a hacker to get access to the system admin user. Also, the hacker can reset administrator passwords. Currently, there are many databases like Oracle, SQL Server, MySQL and etc. For example, in SQLite with SQLcipher, if you access the database data file you cannot decrypt it easily without having the db password. On the other hand in SQL Server if you copy all database files (*.mdf) you can access all data in other systems without even knowing the database users and passwords.
My question is which databases cannot be recovered easily with admin user without having db user information.

If the attacker has full access on the database server AND has access to the server decrypting the data you lost with any of these database systems. I have heared about mainframes and custom built systems where the database is integrated into the operating system and you don't get any real admin-access but even for those an attacker with high enough privileges typically can set the read-limits high enough to read the whole database row by row and nothing off the shelf below 100.000 USD per year.

In your case with SQLite with SQLcipher you will need to store the decryption somewhere and because with SQLite it is typically the application server the attacker typically only needs access with the rights of the application/webserver to get all the data. Other database systems provide similar functionality like mentioned below but might be only available in certain editions like for Microsoft SQL Server in the Enterprise and Datacenter editions.

Ways to make it harder for the attacker:

Harden your server (keep software up to date, firewall, secure settings for applications, restrict (maintenance-)access to certain ip-address-ranges, pentesting, don't run services as admin, rate limiting, ...)
Don't store data you don't need to or in a form you don't need (no passwords in cleartext, sometimes you don't need the name of a person for processing but only unique identifiers, ...)
Database encryption: Some databases provide different database encryption options like whole database, tables, columns for example see here. Beware that this might mean a big performance reduction. This causes the attacker to also need the encryption key but if he has full access on the database server he can also sniff the key sent to the database server except in the case of Client-Side Encryption but then he would only need sufficiant access to the server accessing the database.
Limiting attack surface: You can put more sensitive data on separate servers with better security audits. For example for user names and passwords you can use a separate server with a single webservice with the functions "Check password for user id", "Add password for user id", "Remove password for user id" and an extra database server for those data which only accepts connections from this server. Because it has less functionality/code it is easier to audit and has less attack surface.

Of course you will too need other security measure not mentioned in your attack vector like physical access to server, encryption of harddisks/backup, ...


A site bypasses VPN despite several precautions. How? There's a website and it shows two pieces of information for a user:

"IP location: [country]" and "Detected location: [country]".

When I use a VPN, the "IP location" country matches the VPN country, but the "Detected location" always shows the real country.

I have reviewed several methods mentioned in previous questions but this site does not seem to rely on them:

It does not use HTML5 Geolocation API (the browser doesn't ask for location permission, and no location indication in address bar).
WebRTC is off (tested).
No DNS leaks (tested).
Browser language matches VPN country.
System time matches VPN country time.
Using fresh browser; never logged without VPN.

https://whoer.net, which tests for several of these factors gives me:
"100.0% Your anonymity measures are safe or you don't use them."

I googled several sites which detect user location but not a single site could show the real country. So, what new or more sophisticated method is this site using?
As per discussion with Steffen Ullrich, here are more details:
The site is called Paxful (https://paxful.com). It (unfortunately) needs an account to use (but a basic/unverified account should suffice). Also need to chat with another user to see what I've described. On the chat window, clicking on "Details" will show "IP location" and "Detected location" at the bottom. I can provide more details if anyone wants.

To the question about Google Maps:
If you allow Google Maps web site to access tHTML Geolocation API and if the browser has permission to access your device location information, then Google Maps will know your location from your device.


Is there man in middle attack when using mobile phone calls? My question is about the encryption between me and my mobile operator. My mobile operator uses A5/1. I use Samsung. Sometimes I see the symbol G on my phone which means GPRS. I don't know whether it means that it uses a secure connection or not (for voice calls).

Note: I know that government can go to the mobile operator and ask them to record my mobile calls but the question is about unauthorized spying.

Yes if an attacker can create a fake basestation then they can effectively emulate the phone network and intercept calls which are made via that basestation.  This is obviously a relatively local attack (e.g. you need to be close enough to the fake basestation for it to be the strongest signal available)

Some time ago the costs of doing this were pretty high, which precludes low-end attackers from doing it, however more recently there has been some research on using femtocells like the Vodafone suresignal to provide cheap interception of voice calls (more information on one project here


Is HTTPS as secure or more secure than SSH if both have an IP address whitelist? I'm wondering whether an HTTPS API endpoint would be as secure as or more secure than SSH.

API Endpoint

The API endpoint would require HTTPS
The API authentication would use a POST'd API key.
The minimum required length of the API key could basically be arbitrarily long
The API endpoint would only accept connections from whitelisted IP addresses.
The API endpoint's URL would not be publicly available or linked from anywhere.  Only the client application would know what it was.
The client application connecting to the endpoint will not accept weak SSL cyphers.

SSH Connection

For the purposes of this question, we'll make the following assumptions about the SSH connection that we're comparing to.

The minimum required password length is 8 characters with upper case, lower case, and number required.
The domain that you connect to is the public facing domain (i.e. for http://domain.com you connect using ssh domain.com)

Considerations

Some considerations that I've thought of which may affect whether or not one is more secure than the other are:

Is HTTPS's detection of IP address as reliable as how SSH does it?  I'm guessing both of them just look at what the client sends them and therefore can't be 100% trusted, but nevertheless provide some level of security.
I believe that SSH has a built in mechanism to prevent rapid retry attempts.  I know that HTTPS by itself doesn't do that, but in many cases where security is paramount that it built into the web serve layer.

My hunch

My hunch would be that the API endpoint would actually be more secure than SSH for the following reasons - but I'm not a security expert by any stretch, so I'd love to get a solid answer:

With SSH, the potential attacker knows what domain to target (i.e. ssh domain.com).  But with the API, the URL would not be known so in order to even begin to try to attack it, they'd first have to figure out what the URL was.
The API password strength is greater

Context

The reason I'm asking this is that I'm considering building an API endpoint that would allow a trusted, authenticated user to access a lot of potentially sensitive data.  It would be a powerful tool that would allow for nicely decoupled application business logic to be written very quickly.

The reason why I'm asking whether it's as secure as SSH is because my assumption is that potential users for this application have SSH enabled with at most an IP address whitelist as an additional layer of security.

So that is to say that the capabilities of this API endpoint are already present via SSH.  If the endpoint would present no additional risk over and above the risk that is present with SSH, then I would consider that an acceptable level of risk.  But if it were less secure, then I would most likely not consider it acceptable.

UPDATE: Added note about weak cyphers to API endpoint.

Is HTTPS's detection of IP address as reliable as how SSH does it?

Both are protocols over TCP, where you verify the IP address when the TCP handshake is completed.  (With a completely fake IP address the packets likely would not be routed to you, so you couldn't complete the TCP handshake (or more accurately have a 1 in 4 billion chance of guessing it) which requires replying back with a random 32-bit sequence number that the server directed to you).  A powerful adversary who has control over a server on the network between the client and server can fake your IP address and collect and not forward packets intended for a faked IP address, but it requires them to have full control of a server on the actual route chosen through the network.

  I believe that SSH has a built in mechanism to prevent rapid retry attempts

It doesn't really, you really need to setup fail2ban to do this.  (Yes there are some options to insert delays within repeated password attempts within a ssh session, but they aren't that great).

I still don't understand the setup.  Both SSH and HTTPS encompass a wide variety of setups.  E.g., using self-signed HTTPS connection where you do no checking of untrusted certificates will be vulnerable to man in the middle attacks (at least with SSH it warns very loudly when host certificates change).  Similarly there are some weak HTTPS protocols -- you shouldn't use SSLv2 or weak ciphers.

Is the HTTPS/SSH connection using a client certificates?  Isn't this supposed to be automated?

If you have an API that needs to be run from a webserver, doing this securely with HTTPS is the natural route.  SSH is intended for remotely connecting to another computers commandline.  Yes, you can use it for other things like remote-command execution or tunneling network traffic, but if you want to offer a secure web-based API it makes much more sense to use TLS with checking client and server certificates (even if they are self-signed).


Local network proxy/spoof Are intruders in a local network able to mask their local IP in any way?
Could they 'hijack' another local IP and perform scans and exploits from there?

Absolutely.

One way to go would be with ARP spoofing. It can be used to put your node as a gateway for the network.


Is there a standard about storing the password of a bank's website bank-account-management-account in a password vault? Please assume that I use some FOSS, SaaS, public key && passwordized private key protected password vault program to primarily store passwords of websites I rarely use (such as Q&A websites or free content enterprises), which are not very "sensitive" by means of security and that I wouldn't have any significant damage if any of these accounts would be hacked but I contemplate to save the password of my bank's website bank-account-management-account password in that password vault.
Please further assume that I store the private key in my password-protected operating system and that I have fully memorized my private-key's password.
Is there a standard about storing the password of a bank's website bank-account-management-account in a password vault?
Perhaps a better question (or a worse question) would be, is it safe to store the password of a bank's website bank-account-management-account in a password vault?

There are different approaches to storing passwords, and it might vary according to your threat model, your affinity with relevant technical tools, and the frequency at which you query the passwords.
There are hardware options, and software options, and in-usage it seems people adopt a combination of both. The standards can vary from using an air-gaped machine, on-device key, and access management protocols, to simply using a software password manager (I assume you mean password manager by the term "password vault").
You could take a look at several sfotware tools that can help you store your sensitive passwords (i.e. bank creds). From the top of my minds, I would recommend KeePass, Password Gorilla, Mozilla Lockwise, or simply your in-browser password manager. Qubes OS handles this in a more use-friendly manner, but it still requires a relatively advanced technical knowledge.
I would recommend this short read on the potential flaws of password managers, here.


Is there reliable information on the prevalence of debug backdoors in software? Developers sometimes forget to turn off the debug features of the software they ship: CWE-489

It is said here that

  About 20% of home routers have a backdoor in them, and 50% of
  industrial control computers have a backdoor.

But this assertion is not backed. Is there any other information available, or study made, about the prevalence of those backdoors in code?

I don't believe there is a reliable, scientific study as to the prevalence of backdoors in proprietary devices or SCADA/industrial control systems.  A search of JSTOR turns up nothing interesting (although, if someone else wants to double check, please let me know if you find something!) Thus, the number you reference is likely just speculation or based on anecdotal evidence.

That said, I do not believe this number is without some justification.  When using closed-source products, there's always the risk of a backdoor.  As the article points out, many are unintentional and are a result of developers wanting to quickly test the system without dealing with access controls.

However, the main theme of the article has to do with international intelligence organizations inserting backdoors into products intended for vital roles in another nation, in this case, SCADA systems in China meant for use in the USA.   In those instances, it can be assumed that such backdoors are in place.  When the USA ships Boeing airplanes to China, for example, they have famously come laden with numerous and redundant bugs throughout the chassis.

So, my short answer is, one can never be sure about backdoors in closed-source products.  On the home router, it may be best to flash to an open source firmware if you share these concerns.  But as to scientifically quantify the rate that devices are backdoored; I believe that hasn't been done and would be challenging to do in a statistically significant fashion.


How difficult is it to mitm ssh connection after trusting fingerprint If I connect using ssh to an ip address of a server and have to trust a new fingerprint. How hard is it to be a man in the middle to redirect my ip connection?

I.e. How much risk am I taking if I just trust a fingerprint?

Also I am not asking about the consequences once an attacker successfully becomes a man-in-the-middle, I am asking about how easy/hard would it be to become a man-in-the-middle in the first place.

As others have pointed out, MITMing a SSH connection is no different from MITMing an SSL connection. All data is eventually sent as packets, and if an attacker can MITM your traffic, they can poison all your traffic.

By trusting a fingerprint that may have been poisoned by an attacker, an attacker can make you connect to their own server and get you to hand over your credentials, send you fake traffic or using the harvested credentials - even execute commands on your server.

Your final question has been answered several times - here, here and here. Tl;dr: It's extremely easy depending on the network that you're on and how you're interfacing with it.


Optimal way to capture HTTP(S) traffic on proxy-unaware iOS applications I am trying to capture HTTP(S) traffic from a proxy-unaware Xamarin iOS application. The current tools I have available is a Mac with a Linux Mint VM, Xcode and iOS developer tools, Burp Suite Community Edition, Charles Proxy and Wireshark.

Strategies

I have tested the following strategies with various degrees of success (but never full success):

Burp Suite and Charles Proxy

Setup: Burp Suite/Charles Proxy running on a Mac, with the proxy's CA certificate installed on the iOS device. The iOS device is configured to use an HTTP proxy.

Problem: Only intercepts certain requests not made by Xamarin's native HttpClient API, such as Google Analytics, which is not useful in analyzing the API of interest.

Wireshark

Setup: iOS device connected via USB cable to the Mac, made a network interface on the Mac per this guide so as to capture packets direct from the iOS device by letting Wireshark read from that network interface.

Problem: All requests are HTTPS and can't be decrypted.

VPN and Burp Suite

Setup: By making a VPN that the iOS device connects to, all traffic will be routed through that VPN and into Burp Suite. The VPN is set up on a Linux Mint VM with its network adapter bridged to my Mac's Wi-Fi card.

Problem: I partially followed a tutorial that describes a PPTP VPN with Burp Suite, but iOS 10 and above has dropped support for PPTP. Attempts to replicate with OpenVPN yielded unsatisfactory results (another post on ServerFault here).

Question of the day

How does one effectively and (hopefully relatively easily) intercept HTTP(S) traffic from an iOS mobile app that does not respect system proxy settings?

This has been a rather interesting turn of events, apparently, the issue with VPN/Burp Suite method had to do with my configuration of the Burp Suite's invisible proxying (in which I neglected after troubleshooting a few times) as answered in the ServerFault question I posted previously. To contribute back to the community, here's a tutorial on how to MITM a proxy-unaware iOS >10 app!

Guide on MITM'ing a proxy-unaware iOS app for iOS 10 and above

Setting up the VM

Set up a Linux VM of your choice (I used Linux Mint, but Ubuntu and Debian based distros work just as well with the rest of the tutorial), and download Burp Suite, preferably the JAR version as it is more portable.

Install OpenVPN as per DigitalOcean's guide. Double check that your iOS device can connect to the VPN and that it can access the Internet.

iptables configuration

You should have already configured your iptables as per the guide above for masquerading client connections. You now have to configure iptables to forward all HTTP and HTTPS requests from OpenVPN's tun0 interface to port 8080 (or whichever port your copy of Burp Suite is using)

# iptables -t nat -A PREROUTING -i tun0 -p tcp --dport 80 -j REDIRECT --to-port 8080
# iptables -t nat -A PREROUTING -i tun0 -p tcp --dport 443 -j REDIRECT --to-port 8080

The fun bit

Launch Burp Suite, making sure to:

Disable Intercept: you don't want to stop and inspect/edit every single connection unless you need that feature
Proxy > Options > Proxy Listeners > Edit and enable listening on all interfaces
Proxy > Options > Proxy Listeners > Edit > Request Handling and enable invisible proxying or none of the above will work!

Have fun ;)


Is it possible to MITM TLS without maintaining connection between proxy and remote server? And I talk about scenario where you explicit let users know MITM is happening and where users must comply (for example, Kazakhstan wanted to have a national-wide MITM proxy, to protect their citizens from malicious foreign websites, even go as far to ask Mozilla to include their CA.)

But I just can't think of a scenario where you don't have to manage the connections between the MITM proxy and Remote server. And that feels very expensive to me to do on a national scale.

Thus my question:

Is it possible to MITM TLS without maintaining connection between proxy and remote server? When the client will comply with your order to install Root CA certificate.

Let's assume we need to handle HSTS as well, and users are using normal browsers.

(Of course, using backdoors on OS/Browser will be easier than hijacking TLS, but let's assume we have to go the hijack route.)

Is it possible to MITM TLS without maintaining connection between proxy and remote server?

From a technical point this is impossible. TLS MITM is only possible by having separate TLS connections from the proxy to both the client and the server. You need to maintain the state of both the TCP and the TLS stack for the full duration of the interception because otherwise you could not receive, decrypt, re-encrypt and send the data from the client to the server and back. But this does not need to be done on a single machine but can be made to scale will over thousands of systems.