Can files deleted from a true crypt volume be recovered? I have a True Crypt volume that's set as a file. When I mount the volume and delete a file within the container, windows asks if I'd like to send the file to the recycle bin. While the volume is mounted I see the file in the recycle bin but when it is dismounted the file is gone.

Could the file I deleted be recovered by a 3rd party using digital forensic tools if they got hold of my hard drive? If yes, would the file be encrypted?

How does the Recycle Bin work?

When you delete a file from a hard drive the file is moved to a folder named $Recycle.Bin on the same drive. So when you delete the file D:\Work_Files\SuperWeirdPr0n.mp4 it's actually moved to D:\$Recycle.Bin. The main Recycle Bin "folder" is actually just the aggregation of the content from all $Recycle.Bin folders from all the disks you have available.

How does that apply to TrueCrypt volumes?

Well, pretty much the same. When you send a file from a mounted encrypted volume to the Recycle Bin, it won't leave the encrypted volume and it will stay "safe".

If it makes you feel better, just use Shift + Del.

Can your files be recovered by a 3rd-party?

Yes. Regardless of your Recycle Bin situation, it's highly likely that there's still some evidence of the files existence somewhere and enough information to recover it. When you open files inside an encrypted volume, most programs will happily cache it somewhere else in an unencrypted format.

For more information on that, please check both answers in this question.


Database and column names security So the question is simple. Does making strange column or database names in MySQL increase its security?

No. If you can read the MySQL schema tables, you can extract the names anyway, and the schema tables have fixed names.

Work on preventing SQL injection through the use of parameterised queries and other well documented techniques, and it doesn't matter if your table and column names are predictable.


Do we need to add CSP to all web pages in a web application? We have a multi-page web application. I understand that ideally CSP should be set for text/html responses only. Is it enough to add content security policy (CSP) header to the login page or should I add the header to each & every page?

Did not find any supporting csp documentation to check this.

I understand that ideally CSP should be set for text/html responses only.

It does not harm to set it on every other response too, especially if it could be tricked to be rendered in HTML context.

  Is it enough to add content security policy (CSP) header to the login page or should I add the header to each & every page?

CSP gets only applied to the page where it is set. Thus if a CSP is only send for the login page it will not be applied to any other pages. Since this is probably not what you want you need to set it on every page.

  Did not find any supporting csp documentation to check this.

MDN - Content Security Policy (CSP) - Using CSP says that CSP gets only used for the page where it is set:

  Configuring Content Security Policy involves adding the Content-Security-Policy HTTP header to a web page and giving it values to control resources the user agent is allowed to load for that page.


My router is opened to the internet I typed in my IP into my address bar and my router admin page came up. Is this safe? How can I disable it? It's Linksys Smart Wifi

You may already be safe: if you typed your IP address into the address bar of a computer connected to the router, being able to access the router admin page is normal.  The router knows your computer is on the "inside" part of the network, and should be allowed to control the router.

The only time you have a problem is if you type your IP address into a computer somewhere else on the Internet (such as at your local library) and your router admin page shows up: in that case, you need to disable remote administration through the admin page.


Use XSS vulnerability in iframe to compromise parent? I have a site, let's call it parent.com, that embeds a third party plugin from child.com in an iframe. I have found a XSS vulnerability on child.com.

The embedded page from child.com contains a form that POSTs to another page on the same domain. I can exploit the vulnerability by submitting the form. I intercept the POST request with Burp, and insert my payload into it. The payload is then executed.

My problem is that the payload runs inside the iframe on the child.com domain. My goal is to compromise parent.com (in order to win a bug bounty). Is it possible to use this vulnerability to accomplish that somehow? For example, can I somehow make the form submit to parent.com instead?

Iframes have a special tag called "sandbox" that sets how to treat the content of the iframe.  Using that tag, you can granularly set permissions to allow an iframe to interact with the parent.  Normally iframes are pretty restrictive as to how they can affect a parent when loaded from a different domain, but if you see things like: allow-same-origin, allow-scripts, allow-top-navigation, etc then there may be case specific ways to exploit it.

[edit] Most cases of iframe XSS attacks do not actually involve injecting arbitrary code into the parent website.  Instead they are typically one of the following:

You take control of the child website, and replace it with something like a fake login form to make people think that they are loging into the parent website to access the content, when you are really phishing their credentials.
You distribute a "useful" service that other programmers embed in their sites that you actually use to phish private information.  Then you pray on people's trust of these other websites to get them to give you something useful.  For example: a tax bracket calculator that asks for your name, address, and SSN.
Instead of parent.com, you make an evil twin website called parents.com that contains parent.com inside of an iframe so that it behaves just like the real site, but your version of the website is collecting the end user's private information.

So, the most likely way for you to be able to exploit this scenario would be if you could replace the form with something that looks like a login form for parent.com and post not to parent.com, but to something that you actually control to steal user credentials.


Is all RSA encryption now considered insecure? (Notably SSH and SSL) Some of the leaks which emerged during/after Snowden concerned the fact that the NSA was paying the organization behind RSA a lot of money in order for them to systematically weaken the encryption by default.

Since both SSL and SSH typically use public/private RSA keypairs for their encryption, is this encryption now considered insecure?

What exactly was leaked, and does it cast doubts on the security of all SSL/SSH encryption?

You are confusing RSA, a family of cryptosystems that relies on the difficulty of factoring products of large prime numbers, with RSA Security LLC, a company which sells security-related products.

RSA and RSA are both called RSA after Messrs R, S and A, who both invented the RSA cryptosystem and founded the RSA company. The company was founded in part to market products that rely on the cryptosystem.

The current controversy relates to RSA (the company) allegedly deliberately weakening one of their products in order to make it easier for NSA to spy or otherwise attack users of these products. This weakening has nothing to do with RSA (the cryptosystem).

If anything, the current revelations of NSA's capabilities strengthen the confidence that we may have in most reputable, widely-used cryptographic algorithms: the Snowden revelations concern ways to bypass cryptographic protections in various ways (by making service providers reveal their secret keys, exploiting software bugs, implanting spying hardware, etc.). If NSA could break cryptographic algorithms, they wouldn't need to go through all this.


Is TrueCrypt safe enough to store clear-text-passwords? The reason: I want to be able to use a portable USB drive to access my passwords on any machine and OS. TrueCrypt seems to be the only program that has sufficient support on all major platforms. So I thought I'd store my passwords in a hidden volume in a TrueCrypt container stored on the drive in a plain .txt-file, so I can be sure to access that on any machine.

My question is: Is that enough (reasonable) security for storing my passwords? Or should I use more layers of encryption? How easy would it be to access the passwords should I ever loose the drive?

(Aside from obvious attempts to keylog the "master" password on a machine, let's just assume all machines I'll be using the drive on are clean)

That's as good as encryption is gonna get.  TrueCrypt is a well-vetted, respected piece of software for disk encryption.  There are no guarantees in life, but TrueCrypt is about as good as it gets today.

The primary remaining risk is not that someone is going to find a cryptanalytic weakness in TrueCrypt and break TrueCrypt's encryption algorithms.  Rather, the main remaining risks are:

That you will choose a poor passphrase for TrueCrypt.  Defense: Choose a long and strong passphrase for TrueCrypt.
That one of the machines you use has malware on it.  If you type your TrueCrypt passphrase into any machine that is infected with malware, you no longer have any reason to expect you are safe.  So, do you trust your machines are likely free of malware?

(More layers of encryption won't do anything against these risks.)

The short answer is: if you think your machines are clean of malware, this approach is likely to be safe enough.

P.S. If you lose the drive, and you don't have any backups, you're going to be out of luck.  So, keep a backup of the file somewhere else: maybe a printout that you keep in a secure location, maybe another copy of the drive, also encrypted, or maybe something else entirely.


Security implications of Suprocess executing with a active shell vs no shell When we execute a subprocess such as the follows:

sub_ret = subprocess.Popen(args,stdout=subprocess.PIPE,shell=True)

This poses a security risk as it allows malicious users to inject commands via the args parameter.

Would it be safer to use with the shell as false? Such as:

sub_ret = subprocess.Popen(args,stdout=subprocess.PIPE,shell=False)

Or would this pose a security risk as well?

The major difference is the way you construct your commands:

subprocess.Popen("ls -l /tmp", shell=True)

vs

subprocess.Popen(['ls', '-l','/tmp'])

The first example is one string and works with shell set to true, the second example is without. This requires each part of the command to be passed as  a seperate item in the array. The danger is when you accept part of the command as input from an untrusted source.

For instance if you would accept part of the command from a user, in the first example he can literally type any command he wants, whereas in the latter example he can only define on parameter or destination. Adding more commands will not be possible as subprocess will fail (providing you do not construct the array based on the user input, but just accept one argument for a specific position).


What is the use of the "secret" displayed when setting up 2 Factor Authentication? What is the purpose of the "secret" that is displayed when you take the picture of the QR code to set up 2 Factor Authentication on a non-Google site?

Why would you need it?

If you save it, doesn't that defeat the whole purpose of 2 Factor Auth because anyone with the secret can get a login code?

Google Authenticator supports the TOTP and HOTP algorithms.

In both algorithms, a secret needs to be shared between the server and the client to successfully generate the one time passwords. I suggest you read the respective RFCs of the algorithms (or my answer here) to understand it better.

Yes, if the attacker manages to get hold of the shared secret the algorithm is defeated. However, this isn't very practical. The secret is only displayed in the form of a QR-code once when setting up the algorithm. Presumably you will be sitting in front of the screen when this happens and will take notice if someone suspicious walks up and starts scanning the QR code with his phone. There are plenty of physical measures you can employ if this is the case.

Once the secret is shared, it is stored on the server and the client (in this case your phone). At least in the case of Android, the secret is stored unencrypted in a SQLi database file. However, this file can only be accessed by the Authethenticator app unless your device is rooted so it isn't easy to get your hands on it. It should be just as difficult if not harder on an iOS device. You have much bigger worries if an attacker manages to compromise the server.

So yes, the algorithm is defeated if the secret is leaked. But the secret leaking is not an easy thing to happen. In any case, it's TWO-factor authentication. You still have the other factor to protect you.


Can my address as well as final 4 digits and name on credit card be stored without PCI compliance? So, if you stupidly sign up to a site using a credit card and then come to regret it and worry that said site is vulnerable to hacking what data can they legally hold without needing to be PCI compliant.

Things I know are:

They use a PCI compliant payment gateway.
There own server is in a secure facility.
They claim to store only the final 4 digits of the credit card and only so that customers can quickly put more money on their account quickly without the need for entering full cc details every time.

Do you think this is all they hold? Would they also hold name and address to be able to carry out that transaction?

Sorry if I haven't been clear. This is what I received from the company when I asked if I could delete my personal data from their database:

  Firstly, we are not allowed to store functional credit card data, so
  we don't. We do store the last four digits as on their own they are
  meaningless and help us authenticate you when using the quick
  re-purchase method. Secondly, our upstream payment provider is
  authorised to store your card data by VISA/MasterCard. As such they
  are audited annually and have to jump through all the hoops and
  conformity required by the PCI DSS standard. Thirdly, it is a
  requirement of any business to keep records of who they're dealing
  with. Your personal data is being stored so high up the chain that it
  must be kept. Other companies who claim to delete your data are most
  likely the first link in the chain or at an entry level. They delete
  it and probably shouldn't even be storing it, but their upstream
  provider is required to keep it.

They keep referring to this email when I ask for further clarification as to whether they themselves or only the payment gateway hold my name and address against that credit card and the account I set up with them. I have never given my address for delivery only for payments as it was a gambling website.

It is very possible, and quite likely, that they do store- Name, Address, Phone number, email, and other contact and purchase data.  This is irrelevant to PCI.  PCI cares about the credit card data (CHD) and account number (PAN) and the other data on the mag stripe - including the "extra" numbers on the back of the card, and the expiration date.

PCI forbids storage of the mag stripe data and the "extra" numbers, (for anyone other than those who really need it).
PCI permits storage of the last 4 numbers along with other pieces of data such as a transaction number and for repeating transactions, the merchant can also store a special single-merchant number that looks like a credit card number and works the same, but it is tied to the merchant.

Most merchants do not want the wrath of the PCI council and/or their bank and/or law enforcement, and will do everything they can to "de-scope" systems out of PCI scope.  So, there is the question if they are 100% compliant, however, they may be compliant "enough" with only the data you indicated.


Is there any existing attempted implementation of GSS-API/SPNEGO/GSS-SPNEGO for anything other than Kerberos / NTLM? I'm aware that SPNEGO is de-facto only used in the wild for Kerberos or NTLM. Is there any research / academic / educational example on how it can be also used for other mechanisms as well?

There isn't really any other way to use it other than how it was designed because then you're not using SPNEGO, but some other protocol you've invented.

What I think you're asking is whether there are other mechanisms used out in the wild other than Kerberos and NTLM, and the answer to that is yes. A handful that I'm aware of are

Digest
NegoEx (an extension to the negotiate protocol that provides more knobs)
PKU2U (Kerberos derivative)

There are probably more, but these are the ones that are majorly used.


What does identical cipher text data mean in cipher block chaining (CBC) mode? I am trying to understand the choices of the following question

Based on my understanding, none of the choices apply because plain text for the first highlighted block is 1F2..CA2 which is the input of the second highlighted block. Similarly, for the second highlighted block, its plain text input is 60A4..388 which is input to the first highlighted block. Please correct me if i am wrong and which choice really applies here.

I believe none of the answers is correct. The blocks being the same means the XORs of the previous blocks and the plaintexts are the same. So 60A..388 XOR cleartext-1 is the same as 1F2..CA2 XOR cleartext-2.

So cleartext-1 XOR cleartext-2 = 7f8d68bf68fb3f.

Explanation:

The cleartext data can not both be null because their XOR is not null
The previous chunks (ciphertext) are clearly not identical and even if they were, it would not matter unless the cleartexts were identical as well.
They are not identical (cleartext), but why the offset matter is unclear to me. It does not. Also, I would not necessarily say there is no relation, as I wrote the relation down (what they amount to if they are XOR-ed)
No, they can't be identical. Identical blocks would XOR to all zeros / null.

So the "most correct" is the third one, but IMHO still incorrect.


How to use a token to differentiate between a valid logged in user and an attack? Let us take the example of my already being logged in to, say, LinkedIn. When I access LinkedIn on a new tab, it automatically logs me in (using cookie info). Now, suppose I visit a forum and through an image that is loaded, a CSRF attack is run against my credentials. To prevent using my cookie-stored credentials for an attack, LinkedIn would use token and/or nonce, would check that the token is expired (or nonce is already used) and prevent the attack from happening.

What confuses me is, as far as LinkedIn goes, both my logging in through a new tab and the CSRF attack are initiated from my (trusted) browser. But, LinkedIn automatically logs me in regardless. How would LinkedIn then differentiate opening a new tab from a CSRF attack? Or should LinkedIn have enforced a stricter time out and have me login if I try to log in from a new tab?

When you open a new tab and access linkedin the copkie which contains the session is automatically transmitted to linkedin. Linkedin checks the session and if it is valid you are logged in.

A CSRF is usually only required for modifying requests, e.g. if you update some of your account settings or something like that. When the page with the form is transmitted to your browser linkedin adds a hidden field with the CSRF token into the form. If you submit the form the session cookie and the CSRF token are send to linkedin. Linkedin checks the session and if it is valid it checks the CSRF token. If the token is missing the request should be ommitted.


Web App Scans scans through the network firewall? I have a scenario. I want to scan a web app which is placed in another DC behind a different firewall(not web application firewall). We can have open ports to reach the application. The tools generally used by testers is Acunetix, Appscan, burp and webinspect. The Web server is not behind a PAT or Nat. It may have been  load balanced though.

Is there a serious concern that these enterprise scanner would DOS the firewall or degrade the network? Should Web App scans be never done through a network firewall? Shouldn't the firewall be able to handle the traffic from a single instance of the web scanner?

I tried to find some research online but almost all scenarios talked about NAT or PAT scenarios for a port scanner(nmap) or vulnerability scanner(qualys), which is not the case here.

Some webappsec scanners are actually slower than one user using one XP-based web browser.

If Burp Suite Pro Intruder (or Scanner or Spider) is tweaked to over 100 threads, say 175 threads, then things start to fall down, but usually the memory of the target servers before load balancers or firewalls in-between. The max used to be 175 threads but changed to 999 threads in 2014.

Some software-based firewalls will fall under the load of an extremely-cruelly tweaked webappsec scanner, but not appliances or hardware-based ones. For example, a Palo PA-3020 will still push traffic to destinations if you had 20 or even 30 penetration testers using webappsec scanners. However, a Palo VM-100 might only fall to 2 or 3 penetration testers because it's mostly software-based.

WebInspect, AppScan, and Acunetix are nicer than Burp Suite Pro Intruder's maximum configuration (e.g., WebInspect only allows a max of 80 concurrent threads). Even when I tweaked these other scanners to max threads supported by their configuration, the worst that has ever happened was that a web server or two would lock up. Never had a WAF, IPS, or load balancer lock up in that same way. Pretend this has happened to me ten times in my life and that half of the time one web server locked up and the other half of the time two web servers locked up. Every time, no matter how many web servers locked up -- the root cause of failure was due to the web server only having 256M, 512M, or 768M of vDRAM. In every instance these were guest OSes of a server-virtualization based hypervisor or a shared-hosting environment. It was simple enough to ask the far-end IT System Administrator to shutdown the server, give it some more vDRAM (usually 1G was enough), and start it back up.

Usually the best way to determine if there is a problem is to host your pen-test infrastructure (your attacking hosts) with a gateway running Linux. Then, you can leverage ntop or tcptrace to look for retransmissions. If you're not getting any retransmissions, or a very-small amount, then no harm, no foul. Sometimes you will see tools abbreviate retransmissions as retrans, rexmit, or rexmt. Check out the book, TCP/IP Illustrated, Volume I: The Protocols, Second Edition for more information about the inter workings of TCP.


My company policy states I must put all passwords in a password safe shared with management. Is this secure? As the title says, my company has a policy that all passwords to e.g. our workstations and server logins must be stored in an online safe. I won't say which one but there are some out there you can look at promising the end of password pain. These passwords are then shared with the company's management - I don't know how that bit works, but they can read the passwords too.

Is this really that secure? I was given two reasons why it is by my boss:

If I forget my password, I can just ask him for my password.
If I turn evil, they can lock me out.

I don't agree with these. For the first one, surely there must be a better way for most of the things we use like Google Apps - e.g. the admin has a reset button. For the second one I can just change my password anyway and not update the password safe.

So am I right that this is not secure? Or is this the only way?

None of the reasons you've given are valid reasons for escrowing your password.  There's only a couple valid reasons for escrowing any sort of "authenticator" information.  A couple others have touched on these, but I'll try to clarify a bit.

Encryption Keys:  It makes absolute sense for the organization to have access to escrow copies of your encryption keys.  After all, the data you're encrypting (provided you're only using your company's encryption for work purposes, of course) is their data in the end anyway.  So, they need to retain access to that data in the event you lose your key or you are separated from the company.  However, the encryption key should not be the same key you use for digital signatures.  Also, they should not have actual access to your authenticator - the passcode you use for the key.  Instead, they should have their own escrow key that works with their authenticator to decrypt your data.
Failsafe Accounts:  It also makes sense that the organization should have backup copies of credentials necessary to access an Administrator-level account in the event the System Administrator's own account is locked out, or they depart the company.  However, the credentials should not be for the System Administrator's own account.  They should be for a local system account whose sole purpose is for emergency use.  To that end, the account should also never be used for non-emergencies and its usage should be closely monitored and alerted.  Traditionally, credentials for accounts like these are sealed in tamper-evident envelopes and stored in a secure, physical vault.  It's conceivable that there may be digital equivalents, but I personally wouldn't trust those without a thorough review.

There's two big reasons why it's a bad idea for management to have your password.  The first reason is potentially very bad for you, as it could end up causing otherwise unnecessary work for you if things go wrong.  However, the second actually turns this around and makes it potentially worse for the company than it is for you if things go really wrong.

Potential For Abuse:  The obvious one - managers now effectively have unrestricted access to the systems, regardless of whether they should, with the same privileges you have.  Most simply this means that the managers may leverage this to do things on the system that they otherwise should not be doing.  This also leaves the potential for them to bypass your position whenever they want to rush a particular change along without following standard procedure.
Loss of Non-Repudiation:  Once someone else has your credentials - and, especially in a case like this where it can be proven they do - they can impersonate you on any systems where those credentials are valid.  This makes it difficult to definitively prove that any actions taken by your account were actually taken by you.  If a manager does decide to use your account, and ends up royally screwing up the system, it won't be very easy to use you as a scapegoat even though your account is in the logs.  Worse for the company is, if you do something to royally screw up the system while your managers have your password, they'll have a harder time proving that it was actually you that did it.

TL;DR: There's no good reason I can think of for management to have any of your passwords.  As for the reasons they've given:

"If you forget your password..." another System Administrator can reset it for you.  Or, management can "break the glass" on the emergency account (see "Failsafe Accounts" above) and do it themselves.
"If you turn evil..." again you can be locked out by another System Administrator, or the emergency account.


What attacks use enabled Apache's PATH_INFO? In Tangled Web Michal Zalewski says:

  If you are not using path-based parameter passing (such as PATH_INFO), consider disabling this feature.

He gave only one example of this vulnerability. There HTTP response of downloaded file contained Content-Type: image/jpeg and Content-Disposition: attachment. Url to file (supplied by an attacker) contained hello.exe. As the result IE saved file to disk as hello.exe.

What are other attacks that use turned on PATH_INFO exist?

PATH_INFO is an attacker controlled variable and there for can be the source of tainted data.  This variable should never be trusted and a web application must be vary careful not to use this when manipulating files (directory traversal)  or printed to the browser (XSS).

An example of an attacker controlling this variable can be seen with this url:

https://cgi.ccs.neu.edu/home/cgiadmin/examples/phpinfo.php/ATTACK

In terms of non-injection attacks,  I used this property of PATH_INFO to bypass Wordpress's Access Control System.  They where foolish enough to look for the word "admin" in the PATH_INFO variable to check if you where an administrator.


Is someone trying to break in my WIFI router? We have a WIFI router with SSID: "dummyssid" with our own WPA2 password. Today unexpectedly, another WIFI SSID was available in the WIFI scan list with exactly same as of our SSID: "dummyssid" but without any password. Just at that time internet on our devices, like laptop and mobile phones, stopped working. I suppose because there were exactly same WIFI SSID's in the scan list and our laptop/mobile phone is unable to decide which one to use?

I thought my WIFI router is having some issues. So I disconnected from power it but still that ambiguous SSID was available in WIFI scan list. I tried to connect with that ambiguous SSID, then I tried to access the router web page of that ambiguous WIFI. In that page it asked me for my WIFI password. I didn't entered anything there. Leaving everything as it is. After 30 minutes or so, that ambiguous WIFI is no more visible in list and our internet is working fine again.

This is the page that was showed to me when I accessed router page of that ambiguous WIFI.

Do you think someone is trying to get our WIFI password by creating an ambiguous WIFI device and pushing us to enter our WIFI password? If that's so, how do you think we can prevent it?

Yes, as posted in the comments, this looks like an evil twin attack. Someone is likely trying to obtain your network's PSK by:

Creating an open network with your ESSID
Kicking you off your real network with a deauthentication attack
You manually connect to the attacker's network because yours isn't working
You type your PSK into a captive portal on the attacker's wireless network

There is no other logical reason a duplicate network should appear, nor would a configuration page ask for a WPA PSK in that fashion.

While you can't prevent someone from creating their own access point, there are ways to mitigate damage.

The simplest solution is to not connect to the other network, and tell your household/users/guests to pick the network that is secured with WPA2.
A more advanced solution, as deployed in businesses and hotels, is a wireless intrusion prevention system (WIPS), which can actively deauthenticate clients that attempt to connect to unauthorized wireless networks. The legality of such active measures may vary by jurisdiction.
Find out who is performing the attack and get them to stop or involve law enforcement.


What exactly does certificate tranparency do? I have huge problems to understand how certificate transparency is different from mechanism like CRL or OCSP which allow to get the status of a certificate by contacting the CA directly.

Which domains names are contacted when an application want to check the certificate of a specific server. What is sent to those domains name? (I just know it’s about logs)
Since no request are send to CA in any part of the process, why can’t it work if the certificate issuer doesn’t support certificate transparency?
Does it only protect against mis‑issued certificates, or can it fully replace OCSP because it protects every case of revoked certificates (for example, from  attackers who has stolen private keys on a server)?
Does the server, which the client tries to connect to, have to support certificate transparency? (like with OCSP stapling)

Certificate Transparency solves a different problem from CRLs and OCSP.

OCSP and CRLs handle the problem of certificate revocation. The CA is offering resolution for mistakes and bad actions on the part of the CA's users. That is, the CA is assumed to be infinitely trustworthy, but a certificate may need to be revoked because of poor key management or some sort of mistake surrounding the certificate issuance. The infinitely-trusted CA then publishes a list of revoked certificates (the CRL) and uses OCSP to ensure that the clients get the message.

Certificate Transparency on the other hand addresses the fact that CAs are not, in fact, infinitely trustworthy. Misbehaving CAs have previously been able to exploit the fact that certificate signing is not a public event. A certificate may be properly signed but never seen by the public. If a malicious CA signs a certificate for use against a single victim, that victim may be the only client to ever see the certificate, making the malfeasance extremely difficult to detect.

Certificate Transparency moves certificate signing into the public view. Cooperating CAs immediately publish the details of every certificate they sign to one of several public logs maintained outside of the CA's control. If the client requires transparency from the CA in question, then the CA's certificates are not considered valid by the browser unless they were published to the public log. CT is relatively new, though, so enforcement is mostly nonexistent.


How to connect a Raspberry Pi IDS to the home router to detect intrusions network wide? I'm configuring a raspberry pi IDS/IPS with ELK stack on a separate machine, my problem is to connecting it to the router in a way it can read traffic on the whole network and drop the suspicious packets.

The way I came up with is to configure Pi as a network gateway, connect it to the router through the Ethernet and force all the devices through that. I was wondering if there is a better solution.

If you want to passively monitor the whole network a monitor port on the router or similar would be sufficient - although most common home routers (the ones with WLAN and cable/DSL modem in it) don't have anything like this.

If you want to monitor data and also actively block traffic the IDS has to be in the path of the traffic. This means it either needs to be setup as the gateway for all systems in the internal network and then forward the traffic to the router, or the router remains the gateway but the IDS is between the router and the ISP. In the latter case the Raspi needs to care about the ISP connectivity too, i.e. it needs to have the physical ability (which might require a DSL, cable or FFTH modem depending on the kind of connectivity to the ISP you have) and also have the login information, can speak PPPoE or whatever protocol is required for the ISP etc.

So your current idea of setting up Raspi as the network gateway is likely the easiest to implement way. But, as Josef noted in a comment: it should be setup in a way that users simply cannot bypass the IDS just by changing the gateway. This would be best achieved by having the router/modem physically behind the Raspi so that no internal system could be directly reach it and thus the only way for any internal system to the router/modem and then to the internet is through the Raspi.


Would removing spaces in a string protect against SQL injection? I was curious if it's possible to protect against an SQL injection attack by removing all spaces from an String input?
I have been reading up on SQL Injection at OWASP, but they don't mention anything about removing spaces, so I was curious why it would, or would not work?

I was looking at this question, which asks about trim, and the top answer says this:

No, adding a trim will not prevent sql injection. trim only removes space on the outside of your string.
Select * from aTable where name like '%'+@SearchString+'%'

If you @SearchString held something like
'' update aTable set someColumn='JackedUpValue' where someColumn like '

Then when you put it all together and execute it dynamically you would get
Select * from aTable where name like '%' update aTable set someColumn='JackedUpValue' where someColumn like '%'

However if you took that search string
update aTable set someColumn='JackedUpValue' where someColumn like

and performed the operation shown in this question, wouldn't you get
updateaTablesetsomeColumn='JackedUpValue'wheresomeColumnlike

which should not execute, right?
I'm curious if there is any form of SQL injection that could defeat this?  Are there one word dangerous commands? If this can be defeated, would removing spaces at least help a bit with defense?
Note: I'm asking this question purely out of curiosity, not as way to circumvent using the "proper" methods of SQL Injection Prevention.

No. Removing spaces would not prevent SQL injection, as there are many other ways to make the parser process your input. Lets look at an example. Imagine that you had a url which used user supplied input unsafely in a query:

http://example/index.php?id=1 => SELECT * from page where id = 1

In your example the attacker would use spaces:

http://example/index.php?id=1%20or%201=1 => SELECT * from page where id = 1 or 1=1.

Removing the spaces would collapse the injection into a string.

Now let's imagine that the attacker used another form of white space, i.e. tabs:

http://example/index.php?id=1%09or%091=1 => SELECT * from page where id = 1     or    1=1.

Removing the spaces would still allow the injection through.

Depending on the technology in use the attacker could replace the spaces with /**/ %00 %09 %0a %0d or any number of unicodes that causes tokenization by the SQL parser. While the referenced example removed more than just spaces, the aforementioned example takes advantage of SQL comments to cause the tokenization which are not whitespace. You would still be vulnerable.

The only reliable way to prevent SQL injection is to use parameterized queries.


How to capture not only the mtime but also the ctime when making forensic copies of files? Context

I'm investigating a compromised Linux box where I found files with malicious code. The file system is too big to just make a copy of the whole block device and so far I'm only interested in the files of a not so big sub-directory.

While the last-modified timestamp (also called "mtime") of one example file is older, the so called ctime (inode change time) is rather new. So I want to also capture the ctime as it might be relevant.

JFTR: I know that neither timestamp needs to show time the file was created because a chmod or chown command will also change the ctime and the last-modified date might be set by the downloading tool used to download the file, e.g. wget, because—in contrary to the ctime—Linux allows the mtime of a file to be set to arbitrary times.

Question

How do I capture the ctime properly when making forensic copies of such files?

I'm not aware of any archive format (e.g. tar, zip, rar) which captures the (potentially file-system-specific) ctime in addition to the mtime.

So far I came up with these of workarounds:

Do ls -l --time=ctime $file for each captured file and save the out in a text file together with the files. (Did that for now.)
Save the files onto a medium which also contains a file system which stores ctimes, e.g. an ext4 formatted USB stick, and set the system time to the ctime of the to be copied file immediately before copying so that the ctime of the copy is within seconds of the original ctime. (Should theoretically work, but likely has other side-effects on the OS; never actually tried it.)

Both workarounds are highly unsatisfying and I wonder if there are better methods to capture the ctime when making forensic copies of files (with Linux and preferably with open source software), e.g. a tool which can modify the ctime of a file or an archive format which can store more than one timestamp per file, etc.

File archive formats don't capture the ctime because it would be pointless since it's impossible to restore it¹.

For forensics purposes, you need to keep things simple, because you need to be able to prove that the data you captured is genuine. There's no escaping doing a low-level copy of the block device that contains the filesystem. For analysis purposes, where you sift through the data to figure out what is interesting, you can use complex data extraction methods, and verify your findings against the real data afterwards.

Using ls may be tricky if the files have names containing special characters such as spaces, newlines or unprintable characters. Also ls prints an approximation of the time which is timezone-dependent and annoying to parse. If you must use ls, use the --full-time option of GNU ls to get an unambiguous time display, and make sure that you're using a set of options that print the file name unambiguously and that you later parse the name correctly. Recent versions of GNU ls print the file name unambiguously by default, but the format is relatively complex.

Linux provides a stat command which prints more metadata including all the timestamps and the inode number. *BSD systems including macOS have a stat command with a similar purpose but completely syntax. Beware that they print the file name literally, which can make the output ambiguous if some file names contain newlines.

Of course, do all of this from a view of the filesystem that's as read-only as you can get. For forensic purposes, it's best if the first thing you do is to make a copy of the disk through a hardware dongle that ensures that it doesn't modify the source, that way there won't be any doubt that you corrupted the evidence. If the legal risk is low, you may dispense with the special-purpose hardware, but at least make sure that you've made the block device read-only. Doing a read-only mount of the filesystem (mount -r) is not enough: it guarantees that you won't update timestamps, but it will replay the journal, so you can't claim that your capture didn't modify the evidence.

¹  If you're root, you can change the system time, but that impacts the whole system so it would be extremely disruptive.


Tokenless REST API security concerns I'm designing an API in PHP/MySQL that, by its design, will not store a user's password in the database and thus does not generate authorization tokens for the client to hold. The reason for this is to prevent any possibility of sensitive, unencrypted information being obtained in the event of a database compromise.

The user's sensitive data is encrypted using their own password, so that the decryption of the data cannot be done with anything stored within the (potentially compromised) database. I've implemented some security features currently:

As previously described, the sensitive data is encrypted using AES using the user's SHA-512 hashed password (the password is provided with every request as form data), plus some extra salt.
HTTPS is required, and only POST requests are permitted.
User accounts are identified by e-mail addresses (trimmed and lower-cased in storage) and require verification before use.
User passwords are required to be a minimum of 8 characters long.
Eventually, an API token will be required for third-party app usage via the Authorization header. Third-party apps are restricted in that they cannot create, verify or delete accounts.

My question is, is this enough? I'm hardly a security expert and the last thing I want to do is design something with a major oversight. My main concern is the user's password being provided with every request, even though it would be only through SSL.

Edit:

To clarify, users will be able to change their passwords provided they still have their current one. A request is made containing the user's e-mail address, the current password, and the new password. The request is authenticated like it normally is, using the e-mail address and the current password. Validation is done on the new password (enforcing the 8-character minimum) as well, before continuing.

First, just as it's done when the user wishes to retrieve their sensitive information, the information is decrypted using their current password. In its decrypted state, the information is then encrypted using the new password, and the sensitive data is overwritten in the database.

At this point, there is no stored record of the previous password and it can no longer be used. A password change cannot be done by an administrator or, in any case, without the password that was used to previously encrypt the information. If the password is lost, then nothing can be done.

Before reinventing the wheel and building your own session manager,  read the OWASP Session management Cheatsheet,  which will help you avoid common mistakes.

The problem is that the proposed authentication token sha512(password) used to maintain the authenticated state, it is in fact a very understandable session token for a number of reasons:

The worst problem is that this proposed session id has a very small
key space.  It is lot easier for an attacker to guess
sha512(password)  than to guess 16 bytes of /dev/urandom.
Encryption != Authentication. Multiple keys can act upon cipher text
    to yield some result,  only the correct key will actually yield the
    real plain-text.   You still have to verify that you have received
    the exact key and AES-CBC won't do that.  The correctness of this key could be verified with a
    hash function,  a CMAC or HMAC. AES in an authenticated mode of operation would work.
CWE-613 states that session ids or "tokens"  must expire.  By
using the password hash, in effect a new password has been created that is sha512(password) that
doesn't expire and can be used to authenticate without knowing the plain-text password. Once this value is compromised an attacker can
access the account.
SHA512 is bad Key Derivation Function (KDF) and a bad way to store
passwords in general (CWE-916).   bcrypt,  pbkdf2, scrypt are all good options.
If you are being RESTful,  then use the proper VERB!  Using
POST for everything is confusing.  Enforcing POST doesn't make the system more secure,  these requests are just as vulnerable as GET to attacks like CSRF or other attacks.


Is there anything like a known proxy server IP list/database? I'm looking for something like a known proxy servers IP list (text, comma seperated or database based). Do you happen to know if anything like that exists? Free would be nice. I doubt it because these things change every day, but as various websites contain big lists of available proxy servers I think it could be a possiblity. I know for example that MaxMind uses something like that for their fraud checking, but I'm not sure if they compare the IP against a database or use HTTP headers instead. I'm trying to do the former. Any info would be helpful, thanks.

In terms of building a free list of proxy servers, there is a tool called Charon that uses Google to search for proxy lists and then verifies them. YAPH is a commonly used tool for finding proxies.

If you are trying to detect if someone is using a proxy,  the x-forwarded-for won't work with "anonymous proxies",  however you could test each new ip address with YAPH to see if they are running a proxy server on a common port.  Of course if they are using a proxy server on a strange port this method won't work.

In terms of "real security" I think this is complete and total waste of time. IP addresses are basically free, and its trivial to bypass IP based blocking/delays for brute force protection.  The counter argument is that IP based blocking is better than nothing,  and I suppose thats true just don't depend on it.


Is image uploading to a database secure if you resize the image first in raw bytes? Please see the upload code below. the method is called within a try, catch. If the code for the image utilities is needed, just say. Basically, everything is handled in raw bytes and then stored to the DB. I currently render images as base 64 but am moving towards using the bottom snippet in web api.

My main thoughts are:

The image is uploaded in raw bytes. While it could contain a virus it wouldn't run
The server has a max file size set, and prior to this method the user is authenticated, and are checked they are not concurrently downloading any other files (one at a time) with a max upload of 100 images an hour. This would, I hope, stop a specific image DoS.
Because the image is modified to be a certain size (100 x 100) then if it's not a valid image type this would throw an exception and everything is binned
I could add a white list on file extensions before this if you can see any potential issues?
I believe Image.FromStream is safe from an overflow attack

public string StoreProfileImage(ImageViewModel model, string userId)
{
        var postedImg = model.Image;
        var image = Image.FromStream(postedImg.InputStream, true, true);
        if (image != null)
        {
            Rectangle rect = new Rectangle();
            rect.X = (int)Math.Floor(model.x / model.scale);
            rect.Y = (int)Math.Floor(model.y / model.scale);
            rect.Width = (int)Math.Floor(model.width / model.scale);
            rect.Height = (int)Math.Floor(model.height / model.scale);

            // crop the image
            var croppedImg = ImageUtilities.CropImage(image, rect.Height, rect.Width, rect.X, rect.Y);
            // resize to max pic size
            var resizedImg = ImageUtilities.ResizeImage(100, 100, croppedImg);
            // convert to bytes
            byte[] imageData = ImageUtilities.ImageToByteArray(resizedImg);

            using (var db = new DbContext())
            {
                var userImage = new UserImage
                {
                    ImageBytes = imageData,
                    ImageName = postedImg.FileName,
                    UserId = userId,
                    IsProfileImage = true
                };

                // add new users image
                db.UserImage.Add(userImage);
                db.SaveChanges();
            }
            return ImageUtilities.BytesToBase64(imageData);
        }
        return null;
    }

Rendering snippet

 HttpResponseMessage result = new HttpResponseMessage(HttpStatusCode.OK);
 result.Content = new ByteArrayContent(image.ImageBytes);
 result.Content.Headers.ContentType = new MediaTypeHeaderValue("image/png");
 return result;

While sanitizing the image by resizing it is a good idea there were several critical bugs in image processing libraries in the past.  Which means that the process of resizing the image itself could trigger such a bug and thus cause DOS with a complexity attack against the image manipulation library or even remote code execution. That's why the process of resizing should be done within some kind of VM or sandbox and should be also limited in CPU and memory usage.

And then there are several ways of resizing. I'm not familiar with the implementation you use but it might be that the meta data of the image are preserved (i.e. comments, flags, creation time etc) and thus might still be used later inside an attack. So you better convert the image first into some format like PPM which has no ability to store meta data to remove any kind of potential harmful meta data.

I'm also not familiar what your code of storing the image in the database really does in the implementation. Hopefully it uses parameter binding or similar techniques, because otherwise a malicious image might also be used for an SQL injection attack.

As for reading the image you should be aware that browsers often ignore the content-type you send depending on the context. This means if the URL is used as the source for the script tag the image will be interpreted as script, even if the content type is image/png (Chrome does not allow this but others do). Similar context enforcement can be done with a forced download. For example you could sent malware hidden by an image type with <a href=image.png download=malware.zip> and it might even have the correct magic bytes for the image type at the front because extraction of ZIP files often ignores junk at the beginning of the ZIP file. But if you removed the meta data like I've recommended you are probably safe against this kind of misuse.


Nmap "adjust_timeouts2" error Just tried a port scan against a cloudflare protected website:

nmap -sV --version-intensity 9 --top-ports 2500 -v --script banner --data-length 0 -n <ip address here> -Pn -T2 -sT

I get a lot of this as a result:

  adjust_timeouts2: packet supposedly had rtt of 125995326 microseconds.  Ignoring time.

How is "adjust_timeouts2" effecting my scan and why?
What is rtt?
What does "Ignoring time." mean exactly?

Your message should come from the -T option level set from 0 to  5. The option is the temporize between the in/out going of the IP packets. The 5 is last number and the quicker, and you put 2.

RTT is meaning the round trip  times  is also known as the ping time. You could use --min_rtt_timeout/max-rtt-timeout/initial-rtt-timeout <msec> option and many other found in the man page of nmap

Ignoring time in you case should mean the time is to long to be evaluate. 125 second is an eternity in network.


Delivering data securely when the data source is the key maker Let's say we have the following:

Bob needs to send data securely to Alice.
Only Bob and Alice are allowed to read/see that data.
Alice is not able/allowed to create keys.
Alice can use any number or type of keys to decrypt data.
Bob can create and share any number or types of keys
Bob and Alice can have an initial secure exchange of information.

How would Bob and Alice use PGP or alternative public-key cryptography system to meet their communication needs?

Per the stipulation that Alice and Bob may conduct a private initial exchange in person (or through some other secure channel they have been previously using) Bob simply generates a separate Private-Public key pair for each of them.  He can then hand Alice her private key and they can proceed to do normal public key cryptography from then on as if Alice had constructed her own Private-Public key pair.


Which approach to use to implement encryption in a Windows desktop app? I will need to do some encryption of the user data in my Windows desktop application, written in C/C++ using WinAPIs (no .NET or WinRT stuff.) Namely, I'll be doing the following:

Symmetric encryption: AES
Public key encryption (asymmetric): preferably using Elliptic curve cryptography.

My only requirements would be:

The code must run on Windows XP SP3 and later OS.
Be sufficiently robust.

So I was wondering, which would be better suited to use for Windows?

To use Windows built in Cryptography APIs, or
To use some C or C++ based crypto library. If so, which one? Can you explain? (The app will be developed in Visual Studio 2008 as C++/MFC project.)

My thinking on the benefits of the each was this:

With Windows built in crypto APIs, it is a faster coding since most of the encryption code is provided in the APIs. Plus Windows libraries may implement CPU acceleration (for instance, some Intel CPUs have built-in AES operands.)
But, with C/C++ library, there's no dependencies on Windows DLLs that may not be present on the older OS, or contain older bugs that Microsoft did not patch.

I strongly advise using platform-specific libraries wherever possible. The main reason is that they'll get updates automatically, whereas if you bundle a third-party library then it becomes your responsibility to monitor for updates to that library, produce updated versions of your software with the update to the third-party lib, and get your users to install the update. With frequently-updated libraries (such as OpenSSL), this is a considerable maintenance burden to take upon yourself. In my years as an infosec consultant, I saw many, many outdated OpenSSL libraries bundled with applications, most with a few dozen CVEs.

Of course, if you have to support an OS that no longer gets security updates from its developer (on account of being 16 years old), well, you're screwed either way. I'd still lean towards using the platform-provided libraries (Cryptography API or "CAPI", in this case), both for performance and because worrying about the security of anybody who uses an out-of-support OS is a fool's errand (but your users on current OSes will appreciate being able to stay secure).

One downside of using the platform APIs if you want to support XP is that XP only has the legacy CAPI, not the CNG (Crypto API Next Generation) that Vista+ offer. CNG both supports newer algorithms (I know it offers EC algorithms; less sure about CAPI) and has a nicer / more flexible API.

CNG is also a lot easier to "plug into" by third-party code, which is useful if you have a client that, for example, wants to use a specific implementation of certain algorithms (or key storage, or whatever) instead of the MS-provided implementation. This is another reason to use platform libraries, of course; if somebody has changed their default CNG provider, they probably want you to respect that!

I suggest you consider very carefully whether it's actually necessary to support such an obsolete OS when writing security-conscious code.


Safest way for multiple users post to a single social networking account Suppose I have a team or organization managing a single twitter account and a single facebook page. Different users need to be able to post content to the same account. How can I minimize the risk of this account being compromised?

In my opinion, the ideal scenario would be (1) multiple users having posting permissions, and no user having admin permissions, combined with (2) posting to the account indirectly, via a service that can be used only to post but not to change settings.

I can achieve this with Twitter: The account is never used from any browser or app. The password is stored in a safe place offline. Each user has set up a Tweetdeck account and associated the twitter account with it. This way they can post to twitter, but can't change the original twitter password or any other setting. If someone unauthorised gains access to the tweetdeck account of any team member, the worst possible outcome would be tweets. If the original twitter account is hacked, or the password forgotten, the usual account recovery takes place. As the original account is used only indirectly, it is in fact less insecure than an account used frequently.

This approach also helps in the case of hit by a bus: the email used for twitter account is an email account belonging to the organization, so getting account recovery info is trivial.

It doesn't occur to me a similar approach on Facebook (or other social networks where there's a secondary profile linked to a personal profile. I think Google Plus also behaves that way)?

In Facebook, at least one user has to be admin of a "page". The admin credentials are linked to the daily-use personal account. If this personal account is compromised, the entire page is compromised. Multiple users can be admins, but it will only multiple the risks, as a single admin can remove all other admins.

Combine this with the immense number of malware and xss attacks aimed at facebook, as well as fake login screens and social engineering attacks.

1) Is my assumption and approach to posting on twitter correct or flawed?
2) If (1) is correct, how to proceed about posting to FB?

In this case, I wouldn't try to roll my own solution per platform, since there are tools designed specifically to manage team access to social media accounts.  HootSuite, for instance, has a number of team management features.  All you have to do at that point is manage access to HootSuite, not Twitter and FaceBook and anywhere else you might have accounts.   For options other than HootSuite (which I don't personally use, so can't vouch for) try a search using a term like "social media marketing management tools for teams" or something similar.


Different SSL/TLS versions on subdomains using a wildcard certificate I am currently in the process of implementing a secure payment system. I want this system to be PCI compliant and have the highest version of TLS implemented on it.

The system as it stands has several subdomains using a wildcard certificate, the users that access the site operate legacy browsers meaning that we have a slightly older version of TLS.

Is it possible to have a new checkout subdomain using the wildcard certificate and implement a different version of TLS on this new checkout subdomain (it will reside in a separate environment as well)?

If it is possible is that the best and most secure option, or is it recommended to separate it out completely with its own certificate?

That is absolutely possible.

For both Apache and nginx, you can define TLS options per virtual-host.

Taking nginx as an example, every block like the following (taken from Mozilla's TLS config generator can specify its own TLS options and preferences:

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;

    # certs sent to the client in SERVER HELLO are concatenated in ssl_certificate
    ssl_certificate /path/to/signed_cert_plus_intermediates;
    ssl_certificate_key /path/to/private_key;
    ssl_session_timeout 1d;
    ssl_session_cache shared:SSL:50m;
    ssl_session_tickets off;

    # modern configuration. tweak to your needs.
    ssl_protocols TLSv1.2;
    ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256';
    ssl_prefer_server_ciphers on;

    # HSTS (ngx_http_headers_module is required) (15768000 seconds = 6 months)
    add_header Strict-Transport-Security max-age=15768000;

    # OCSP Stapling ---
    # fetch OCSP records from URL in ssl_certificate and cache them
    ssl_stapling on;
    ssl_stapling_verify on;

    ## verify chain of trust of OCSP response using Root CA and Intermediate certs
    ssl_trusted_certificate /path/to/root_CA_cert_plus_intermediates;

    resolver <IP DNS resolver>;

    ....
}

You can use any (hopefully valid) cert within the block, including re-using a cert between subdomains.
The TLS settings are distinct from the details of the certificate and key used.

However, although you can do this, it may make sense to consider, at least, using different certificates - it would allow you to revoke certificates for different parts of your site in case of compromise.

Using the wildcard cert, if that key is compromised, your whole site will be offline until you can get a new cert.
If you have per domain certs, and possibly a wildcard as a fallback, you make yourself better able to deal with that situation without necessarily affecting your entire service.


What would cause a port scan to an email server in an office? I supply email accounts to customers. Occasionally some customers are blocked by our firewall (CSF) if they get the usernames or password wrong. But sometimes they get blocked because their IP address was determines to be port scanning the mail server. The log message would be:

Temporary Blocks: IP:123.123.123.123 Port: Dir:in TTL:3600 (lfd - *Port Scan* detected from 123.123.123.123 (GB/United Kingdom/-). 21 hits in the last 261 seconds)

Because they are not hackers, just a normal business office, one possibility is a computer has a virus and is trying to connect to the mail server, perhaps it obtained the mail server settings from Apple Mail. But I doubt this to be the case.

So does anyone know what other software could be performing port scans on the Apple Mail mail server? Apple Mail itself? We would need to stop these "scans".

Edit: Just found out its all Macs and Apple Mail in the office, not Outlook. And they have a temporary EE (mobile provider) box to connect to the internet because BT are taking ages to sort their internet out. Have updated question above.

Edit: The customer was connecting to port 585 very often and were being blocked. This port is not open in our firewall. But it seems port 585 is indeed an IMAP port, and various websites state Apple Mail uses it. So I have had to open this port due to Apple Mail using it.

Edit: See accepted answer, but instead of opening the port, I added it to DROP_NOLOG in the CSF settings. Accepted answer shows how to do that using iptables command if not using CSF.

The CSF log message you provided states that it found "21 hits in the last 261 seconds."  So the question is, what was hitting?  The CSF configuration file describes their port scan detector as follows:

###############################################################################
# SECTION:Port Scan Tracking
###############################################################################
# Port Scan Tracking. This feature tracks port blocks logged by iptables to
# syslog. If an IP address generates a port block that is logged more than
# PS_LIMIT within PS_INTERVAL seconds, the IP address will be blocked.
...
# This feature blocks all iptables blocks from the iptables logs, including
# repeated attempts to one port or SYN flood blocks, etc

So, your iptables configuration is blocking individual connections from your customers, and CSF watches the iptables logs and reacts when it sees too many individual block log entries.  Since it is using your iptables logs as its raw data point, the same raw data must be there for you to review.

So what you need to do is review your iptables logs for the time period in question and see what port they were reaching for that was being blocked.  If it was 465/tcp or 587/tcp, for example, that might indicate their mail client is trying secure alternate ports first before going to 25/tcp for SMTP.  That implies a sort of legitimate false positive, and you might compensate by configuring iptables to block without logging on those two ports.

If, on the other hand, they're trying a broad array of ports which aren't mail related, (21/tcp, 22/tcp, 23/tcp, 139/tcp, 161/udp, 445/tcp, ...) then someone or something there is truly portscanning you.

Based on the comment below, your logs state that connections on port 585 are triggering the blocks.  Port 585/tcp is associated with Apple email clients.  You could ask the user to fix their email client, but since it's an Apple client, all the online mentions of this say it's hard to figure out how to do that.  So you can instead adjust your firewall rules to not log this traffic.  If you look at your IPtables INPUT chain, you'll see the last two lines are probably LOG and DROP:

# iptables -L INPUT -n --line-numbers
Chain INPUT (policy DROP)
num  target     prot opt source               destination
...
20   LOG        all  --  0.0.0.0/0            0.0.0.0/0           LOG flags 0 level 4
21   DROP       all  --  0.0.0.0/0            0.0.0.0/0

You can then INSERT a new and specific DROP rule at the location of the current LOG rule:

# iptables -I INPUT 20 -p tcp --dport 585 -j DROP
# iptables -L -n --line-numbers
Chain INPUT (policy DROP)
num  target     prot opt source               destination
...
20   DROP       tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpt:585
21   LOG        all  --  0.0.0.0/0            0.0.0.0/0           LOG flags 0 level 4
22   DROP       all  --  0.0.0.0/0            0.0.0.0/0

and now the port 585 connections will DROP before they would be LOGged, and your CSF tool will no longer react to these connection attempts (but they will still be blocked!).


How to protect open ports for Services/Programs needed for network connectivity? I've noticed a number of Windows services required for network connectivity maintain open ports.

What can be done to ensure Service functionality without allowing the always-open ports to act as a network liability (i.e. hacking vulnerability)?

As an example: RPC (Remote Procedure Call) maintains multiple instances of open ports.

Also, could someone provide a link that would let me 'prune' all services that are constantly 'listening' to the network yet that don't ever, or very rarely, provide functionality to the OS on a network level?

Use a firewall, either inbuilt or purchase a physical one. Really not much explanation needed - also consider using its packet filtering capabilities to ensure that only legitimate data is being passed through.


Should a server set a cipher order? I've seen conflicting opinions on whether or not setting a cipher order is recommended. testssl.sh prints a red warning when no cipher order is encountered, implying that a lack of cipher order is considered a deficit. It also makes intuitive sense that a server should begin by offering the strongest ciphers first, and only then offer weaker ciphers.
Mozilla on the other hand recommends not setting a cipher order, as the client will know best which ciphers they prefer (e.g. depending on which ciphers have hardware support).
So, which one is it? Should a server cipher order be set or not?

...  a server should begin by offering the strongest ciphers first, and only then offer weaker ciphers.

As long as the server only supports ciphers which are strong enough it does not actually matter in terms of security who chooses the cipher. Instead of security other criteria are relevant, typically performance from the perspective of the client or of the server. Just using a "stronger" cipher might add a perceived value but not an actual value (still assuming that only sufficiently string ciphers are supported in the server).
See also Do TLS standards require the server-side preference to always be used when negotiating ciphers to use?
 on why one would prefer client cipher order or why not.


Creating a "key server" (HIPAA compliance with AWS) I'm a part of a small company that is going to be implementing HIPAA compliance. We will be seeking legal counsel, etc so anything heard here will not be taken as legal advice, etc. I just want to bounce some ideas off of you guys.

The basic spirit of HIPAA from what I have read:

Ensure only authorized people can access PHI.
Ensure data in transport and at rest is encrypted.

I've done some googling (AWS whitepaper, hipaa hosting, etc) and was wondering what you guys thought of the following scheme:

Rails front end application code (Heroku/AWS) that handles all
the client requests, all phi sent over HTTPS.
Data sent to a centralized encryption server to be encrypted.
Encryption server sends encrypted data to the database server (AWS probably).

This would allow me to offload most of the server hardening onto the encryption server, as well as separate the keys from the data. Does anyone have any experience/insight in setting up a system such as this? Or even a system like this for HIPAA specifically? Is it even a good idea from a security standpoint? Also I've been hard pressed to find a company that simply hosts an "encryption server", are there any companies that specialize in something like that?

The HIPAA requirements not nearly strong enough.   In short it states that you must encrypt medical records at rest and you cannot use a broken primitive,  which is obvious.  Whoever audits your system probably like to see AES.  This is trivial to support, and an Amazon RDS MySQL instance already supports this out of the box with the aes_encrypt() and aes_decrypt() functions.

Where HIPAA and PCI-DSS fall short is that they don't state what mode of operation should be used.   In fact MySQL's aes_encrypt() uses ECB mode,  which is horrific.  Further more, there are problems with enforcing security when using encryption at this layer.  aes_encrypt() is easy to break by configuring mysql to log all queries.  The AES key must be embedded in your application so if it is compromised, the attacker could read the value out of a configuration file and access the records.  This is two points of failure that can be avoided by encrypting the data within your application and then transmitting cipher text to the database.    But HIPAA doesn't care about this problem.  HIPAA's other requirements,  such as requiring a CISSP to analyze your application is more important.

So no one needs to spoon feed you this masturbatory security feature.  I urge you to implement a secure system,  but HIPAA wasn't designed well enough to care.


Can I securely share an HMAC key over a TLS connection? In a game client/server that I'm developing, I want to allow a user to authenticate over TLS (via a REST endpoint on an HTTPS server) before dropping to an unencrypted low-latency UDP protocol. To prevent spoofing and replay attacks, the UDP protocol uses a SHA-256 HMAC and a nonce in each packet.

I want to make sure that the shared secret used as the HMAC key is secure. Not being a security expert, my first thought is to use a secure RNG to generate the secret at the server, then send it to the client over the TLS connection. Is this approach secure, or is this somewhere that I should be wary of "rolling my own crypto"? And if it's insecure, am I better off using e.g. libsodium's key exchange APIs? Or is this second key exchange (after the key exchange that happens when the TLS connection is established) redundant?

It's redundant. This is no different, conceptually, from sending an unencrypted API key over a TLS connection.

That said, an HMAC won't prevent all types of attacks against such a protocol. An attacker in the middle can replay and/or withhold messages of their choosing, for one.


How do Client-specific keys and Certificates work? I have clients that communicates with my server. Clients sends it unique id (guid) to server with its request over a secure https channel. Also to increase security I use my own private-public key pair to encrypt requests & responses.

If someone find this public key (it comes with client software) and reverse-engineer the software I think they can send handmade requests with a custom id. I want to prevent this kind of attacks. I have couple of questions:

Is generating private-public key pair for each client is a good practice? Since every client sends it's requests with their own public key, it will be easy to detect this kind of anomalies.
Is it possible to give clients certificates that identifies only them? I see this client certificate thing everywhere but there is no clear explanation. Can you guys explain me how client certificates works? I think this is what I need but I have no idea about it.

If you want to authenticate a client to your server, you will need a private key for each client.

The usual HTTPS method (TLS) uses only one certificate to authenticate a server. The server has his public key published and signed by some authority, the client verifies the certificate and the authority signature of the certificate, then the client is sure to communicate with the right server, since only this server can sign the communication with his own (corresponding) private key.

Usual HTTPS method only authenticate the server.

If you want the client to be authenticated as well, they need their own private/public key-pair. After having authenticated the server, the client will send their public key and the server can then check the certificate against a local database, or a more global infrastructure if the certificates (of the clients) are signed by an authority.

Other parts of the HTTPS protocol support client authentication in this way.


Benefits to Arch Linux over Kali Linux What are the relative benefits of BlackArch or other Arch-based distro over Kali?

Are the tools broadly the same, or does one have better functionality in a particular area?

Are there any other pen-test distros that are based on a Linux OS that is not Arch, Debian, or Ubuntu? The only one I can find is -- http://networksecuritytoolkit.org -- which is based on Fedora and thus more RHEL/CentOS-compatible

I would say the biggest difference is that ArchPwn is not as actively developed. (EDIT:  see BlackArch,  this project was reborn!).  A lot happens in a year in the realm of security.  In fact in the last year a tool for cracking WPA-PSK called Pyrit was released and can be found on BackTrack.

Now the counter argument is that both Archlinux and Ubuntu have package managers,  and even though its a live CD you can really install anything or have  USB stick with your own tool chain.   It really depends what you are after. In fact no Live CD is going to have everything.  Invariably you'll need a USB stick.


Is using Gmail and encrypted documents enough for secure email communication? My friend was asking me what would be the best way to exchange documents with clients.

He was trying to tell me that just sending the documents via email was sufficient and I told him he was insane. I think the only solution is PGP. It seems like there should be some slick way to do this. Any thoughts?

So I have two questions:

Am I right about Gmail being a bad idea? He claimed that he read this was a good idea in some professional journal.
Is there a service that could implement a secure point-to-point mechanism?
Would PDF or Office encryption be sufficient?

It sort of depends on what you are protecting.

Have a read of this question on what steps Google, Yahoo! and others take to protect webmail.

Also have a look at this question, giving alternate solutions on sending data. I tend to use pgp/gpg to encrypt before emailing, where possible or use a hosted secure mail (similar to the one @Paul described) for some clients.

You can secure the connection fairly well, but unless you encrypt your data before sending it, it will reside on Google's servers in the clear. This may be okay, but it may not - it all comes back to how sensitive the data in those messages are.


Virus scanner on server I see lots of people claim virus scanners are unnecessary on a linux server. But if this server accepts files uploaded from users (and lets others download them), does it become worth it to scan the files when they are uploaded on the server?

Virus scanners for Linux look for Windows viruses. The logic is that your Linux server is acting as a file-storage location for users who are running Windows, and therefore scanning for Windows viruses will help protect your users.

Protecting the Linux server isn't the goal. Viruses aren't the attack vector for servers.

The concept of a virus implies a user at an interactive session. Someone opening email in Outlook or documents in Word, or running programs they received in an email. A virus implies a human element. Servers don't (or shouldn't) allow reading emails and browsing websites. Instead, attacks against servers are fully automated; no human required. They call that a "worm" rather than a "virus".

Worms are a concern on Linux. But protecting your server from that type of threat works differently. Protecting users from viruses requires something stopping users from doing things they shouldn't. Hence the "anti-virus". protecting servers from worms and similar exploits involves fixing vulnerable software. If something is exploitable on your server, then the thing needs to be fixed.

In other words, you don't watch inbound files checking to see if any will hurt you if you run them, because you never run them. If you do run code delivered to you by someone on the Internet, then that is your problem. To fix the problem, you remove or fix the thing that's behaving dangerously.

So, for example, a vulnerable Wordpress plugin on Linux is vaguely analogous to a vulnerable Microsoft Office installation on Windows. On the Windows desktop, you carefully examine all inbound Microsoft Office documents, checking to see if any will exploit the vulnerability in Office. But on the Linux server, you just remove or patch your Wordpress plugin and be done with it. Instead of keeping an antivirus up-to-date, you're supposed to keep your server up-to-date.

And on the other hand, yes.

Now, it turns out that there is something called a Web Application Firewall, which is surprisingly similar to the antivirus concept, but applied to websites instead of humans.

A WAF is built on the idea of protecting vulnerable sites from exploit much the same way as an antivirus tries to protect vulnerable desktops. It even uses roughly the same technique (looking for and blocking certain patterns). But while all antivirus products err heavily on the side of avoiding false-positives, a WAF can be configured to be so permissive as to be useless, or so restrictive as to break your site.

Your particular installation should be very carefully tailored to match your given website. It takes work, and time, and lots of patience. But there should be a local maximum that gives you reasonable protection against the vulnerabilities you don't know are there, while still maintaining a working site.

Though be warned, the more websites you have on a given server, the more difficult it becomes to tune your security configuration. On general-purpose shared-hosting servers, this type of solution is all but completely unworkable because of the false-positive rate. In other words, your mileage might vary.


Why are HTTPS requests blocked by Firefox when using ZAP proxy? I have Zed Attack Proxy (ZAP) on my machine and my browser is Firefox. When I route the browser traffic through the ZAP proxy (using FoxyProxy), if it's HTTPS traffic, Firefox says "Your connection is not secure" and that's it. I can't do anything. I can't even google when the proxy is on.

Is there a certificate I need to install on ZAP or can I circumvent that?

ZAP creates certificates, on the fly, in the name of the site Firefox is going to.

Firefox is saying "I don't trust the CA that signed this cert", which is reasonable, because it's a MITM by an unapproved certificate authority.

You need to import Zap's signing certificate into Firefox's Trusted Roots Certificate Store.  If you Google "zap install certificate" you get lots of links to do so:

Adding SSL Certificates from OWASP ZAP - A Visual Walkthrough...
Setting up Zap for Browser
Intercepting HTTP traffic with Zaproxy

To quote the first link:

  Open up OWASP ZAP, go to Tools -> Options
  In the Dynamic SSL Certificates*, click on Generate if you don't see a certificate, else, Save the certificate in some location
  comfortable to you like your home folder.

...and then import it into your browser, using whatever process is appropriate, and which varies from browser to browser.  Should look something like this:

*In version 2.5.0.  Earlier versions may be just named Certificates.


Rest API Sensitive Data GET We are trying to decide the best approach to designing our new interface with our consumers. Currently we are talking about an Rest API.  However there is some debate among our team about how to handle a specific situation.  Currently, our consumers make a post to our service with NPI/SPI data, we take that data, gather more data and persist it to a DB.  At a later point in time, users will want to retrieve that information we have gathered.  Another web service will call ours (so the endpoint should never be exposed to an actual user) however we still want to hide our query parameters.  It seems there are two possible ways of doing this.

Encrypt our query strings (this options seems to have additional overhead on both our logic and our consumers but adhere to rest principles)
Have our consumers do another POST to get the data (however this options seems to violate rest principles, but a simpler implementation)

Thus we are trying to decide the best approach.  Any input?

The "hiding" issue with GET-vs-POST is logging, so yes, you want to avoid including anything in your GET URI that you wouldn't want to see saved in a logfile.

One common workaround for your problem is to use the HTTP headers to communicate information for a GET request.  It's very common for credentials or session cookies, but may also be used for search strings or lookup indexes for the data you're GETting.  Like the POST body, headers are generally not logged, so it's "more secure" then putting them in the GET URI.

REST is a wonderful theory.  Implementing it can be disillusioning.


Why does Android use SELinux? To restrict/sandbox processes Android uses SELinux. Why was that chosen and not the linux capabilities or cgroups+namespaces solution? After all the cgroups+namespaces is kind of home grown for them too. What does SELinux provide or what do the others not offer?

cgroups and namespaces are about isolation whereas SELinux is a mandatory access control system: fine-grained access over which system calls are allowed, how information is allowed to flow between processes (domains).

The android permissions that applications have to subscribe to can be easily enforced through SELinux, as can process isolation and even many potential vulnerabilities can be mitigated through the SELinux policy (as long as the exploitation of the vulnerability is not contained within the application or is a kernel vulnerability).

cgroups and namespaces have a different function, and not necessarily an exclusive one: SELinux, cgroups and namespaces can happily be used together (improved SELinux support for namespaces is being worked on, but they can already be used together).


SSH Key vs Complex Password with Fail2Ban & Two Factor Authentication Normally you hear that using an SSH Key is far more secure than using a regular password. However I've been wondering if this statement is really true.

Let's say we have the following variables for this example:

The SSH Server is publicly accessible
The SSH Server has fail2ban and will perma-ban any ip that tries to ssh to root or fails more than 3 times.
Users have Full Disk Encryption on all devices using SSH
The SSH Server requires two factor authentication from a authy on an android device with FDE
Users are using complex 48 character passwords for FDE (ex: YUba3KR06/62.Dzq!955513s0k2m123;sF32a60G6n2PYu0Z8_vv8u) with the guarantee of not writing them down

Which would of the following would truly be more secure?

Users use memorized passwords (not written down) for SSH. All passwords would be complex with 16+ characters (ex: S_s7vEn93z0!.Lid)
Users use Passowrdless SSH Keys

There are 2 awnser. They differ on the attack vector under consideration .

Password based login. Is more secure when the machine that would have held the ssh-key is not protected against access to the key. (Use password protected keys always to defeat this weakness and agents for convenience).
keys are more secure when transmission matters. The ssh-keys influence the way the initial key exchange is in such a way that it is already partly encrypted with the private key.  Similar to how client side certificates work.

The difference is minor and the specific threats you want more protection against determines what choice is better here.


How do I find a PKI smart card reader/writer for development (Microsoft .NET) I would like to learn how to develop software leveraging PKI smart cards. Ideally, I would use Microsoft Base Smart Card CSP, but I really just need the ability to store symmetric and asymmetric keys on the card securely, and to perform the associated functions, no matter the software requirements. I need the ability to write keys, and to encrypt/decrypt/sign/verify on the card. This should mean a writer, a card, and an SDK. It would be nice if the cards support ECC secp256k1, ECDSA, RSA 4096, AES, SHA256, etc... but I need to start somewhere.

I have following questions regarding smart card security:

Are smart card readers typically also capable of writing to the
card, or performing whatever administrative functions supported by
the card?  Or do I need a specific interface (software or hardware) for writing to a smart card.
Do I need to be looking specifically for a cryptographic smart
card, or do all cards support some cryptographic functions?
It appears that there are differing contact patterns on different cards.  Are there any competing standards for smart card security?  I found ISO 7816, but no others.

Have you ever built any PKI infrastructure before?  The technical details are only a part of the story with PKI, some of the most important details are in the policies and procedures generated to support this system.

I can understand wanting to dive in and experience the technical aspect.  I would recommend creating at least a two-tiered PKI with something like OpenSSL or even experimenting with GPG, since they are low barrier to entry.  If you are really wanted to gain more experience with the Microsoft stack the Windows Server 2008 PKI and Certificate Security were an invaluable resource for me when I setup my first Windows based PKI.

The Federal Public Key Infrastructure guidelines are a great exercise in seeing how the policy side should look from a sideways glance.  WARNING Do not try to emulate these too closely as it is turtles all the way down.

Once you understand how it is all put together you are really setting yourself up for steamrolling smart cards.  Personally, I've always wanted to try to the ones which keep a portion of the application on the card to see how it actually works performance wise in a real environment.

That aside, I'm just a guy on the Internet and I would encourage you to follow your passion.  Just keep in mind, there is a reason why PKI deployments command a high price.


Crack 8-char password with known number of set bits At University, I got some CTFs to do for my security lectures.

Basically, I need to crack an 8-character password (96 possible characters). I know that 42 of the 64 bits are set to 1 and I know the SHA256 hash value for the password.

Obviously, a brute force attack would consume far to much time, so I thought of generating all possible 8 character strings and only compute the hash when the number of set bits is correct.

(By just trying it out quickly it turns out that after five minutes it hasn't even generated a single candidate...)

Is this a dead end? Is there a more efficient way to do this?

I think your idea about prejudging candidate passwords based on whether they meet the expected 42 'on' bit count is correct, but it should be easier to go about it the opposite way: generate a list of only the passwords that meet that requirement.  The pool of candidates matching the bit count requirement is relatively small in comparison to the overall number of possible 8 character passwords, which should save you a lot of time.

Based on my quick estimate, there are only 1,708 arrangements of 8 byte values within the appropriate character range that equal 42 bits.  But that count treats all bytes with 4 'on' bits as the same, when in reality there are 30 different character possibilities represented by a byte with 4 'on' bits.  So the total number of matching candidate passwords (again, based on my estimates) is 1,173,326,943,180, or roughly 0.00018% of the possible 6,634,204,312,890,625 entry search space for 8 character passwords.

One challenge is that it will take around 1,467 Gigabytes of disk space to write all these possible passwords to a file, which poses some logistical problems.  You could try to break each of the 1,708 bit arrangement password candidates into their own file, but those are still large text files to work with.  So I'd recommend either generating and piping your candidate passwords directly into a program to compare the SHA-256 hashes, or just comparing the hashes within the candidate generation program you develop.

Depending on the speed of your program conducting this comparison (likely on CPU) it is possible it might still be faster to just brute force the SHA-256 hash using a cracking program like Hashcat and a good GPU.  Looks like that approach should enable you to reach speeds of around 2,876,000,000 - 4,330,000,000 hashes/sec, or better, which would mean about 18 - 27 days to crack all password possibilities.  I doubt your program would be slower than this, since you have so many fewer candidates to test, but it's something to watch for if you can estimate your candidates compared per second.

Edit: To come up with the 1,708 arrangements I created a simple program with eight nested For Loops to represent each of the eight byte values.  Each loop incremented a counter between 1 and 6, with the final inner loop also adding up the respective byte counters and evaluating if they equaled 42.

When a match is found you should record the order of the individual counters to see the viable 'on' bit options.  I also created an index of which acceptable characters were associated with which 1-6 'on' bit values.  At some point you have to take this record as a template and iterate through all the different bytes with that number of 'on' bits swapped with acceptable password characters.  This is going to generate millions of candidate passwords per arrangement that you then need to hash and compare to the target hash.


How do anti-virus apps for Android work? There seems to be a lot of anti-virus apps for Android.  On a desktop or server an anti-virus must run with super-user privileges,  however I am pretty sure these mobile anti-viruses are running as an unprivileged user.  That being said,  real anti-virus companies like AVG and McAfee have released anti-virus apps for Android.

How do these anti-virus apps work? Are they effective?

The basic tasks of an antivirus do not require that much of super-user accesses; to see whether a given executable file seems to contain a known virus, then read access to that file is sufficient. This can be done from userland, without modifying the kernel or even obtain root privileges; the system of configurable permissions for apps can handle that. Similarly, interception of network traffic can be done with the relevant permission.

What would require fiddling with the kernel would be launching the antivirus on a file when that file is executed. But Android has a stricter security model than desktop operating systems; application code cannot do everything it wishes, e.g. inspecting the RAM used by other applications. This constraints what an antivirus can do, but also what virus can do. If malware has already gone beyond this system-enforced layer, then things are much worse than what antivirus can fix.

On a rooted device, of course, these things change a lot. A rooted device is much similar to, say, a PC. In that case a PC running a kind of Linux, where both virus and antivirus are scarce.

Apparently, Google is (or was) very much against the mere idea of an antivirus on Android. The permissions model is such that, at least on the paper, malware filtering is better done on the app repository (Google Play); at least so it is claimed. Antivirus software is useful only as long as it detects malware which would otherwise be disruptive for your device or your data, but such disruption would be considered as a bug on either the OS or the app repository, and promptly fixed by Google. Thus, an antivirus is efficient only insofar as the antivirus vendor and its update policy are more reactive than Google themselves.


How proxychains works I am accessing the Internet using my ISP's proxy that blocks many services like netcat. So I installed proxychains and now I can use netcat.

I did not add any external proxy IP to the proxychains configuration file. I just added my ISP proxy on it. I can see packets being sent to my ISP proxy directly.

So how is it working?

proxychains.conf:

# proxychains.conf  VER 3.1
#
#        HTTP, SOCKS4, SOCKS5 tunneling proxifier with DNS.
#

# The option below identifies how the ProxyList is treated.
# only one option should be uncommented at time,
# otherwise the last appearing option will be accepted
#
#dynamic_chain
#
# Dynamic - Each connection will be done via chained proxies
# all proxies chained in the order as they appear in the list
# at least one proxy must be online to play in chain
# (dead proxies are skipped)
# otherwise EINTR is returned to the app
#
strict_chain
#
# Strict - Each connection will be done via chained proxies
# all proxies chained in the order as they appear in the list
# all proxies must be online to play in chain
# otherwise EINTR is returned to the app
#
#random_chain
#
# Random - Each connection will be done via random proxy
# (or proxy chain, see  chain_len) from the list.
# this option is good to test your IDS :)

# Make sense only if random_chain
#chain_len = 2

# Quiet mode (no output from library)
#quiet_mode

# Proxy DNS requests - no leak for DNS data
proxy_dns

# Some timeouts in milliseconds
tcp_read_time_out 15000
tcp_connect_time_out 8000

# ProxyList format
#       type  host  port [user pass]
#       (values separated by 'tab' or 'blank')
#
#
#        Examples:
#
#               socks5  192.168.67.78   1080    lamer   secret
#       http    192.168.89.3    8080    justu   hidden
#       socks4  192.168.1.49    1080
#           http    192.168.39.93   8080
#
#
#       proxy types: http, socks4, socks5
#        ( auth types supported: "basic"-http  "user/pass"-socks )
#
[ProxyList]

http    Isp proxy   Isp port    username    password
https   Isp proxy   Isp port    username    password
ftp     Isp proxy   Isp port   username      password
socks   Isp proxy   Isp port   username      password

# add proxy here ...
# meanwile
# defaults set to "tor"
#socks4     127.0.0.1 9050

Finally got it whats happening is when i do netcat somehow my request is directly destined to the given address not to the proxy but when i do netstat with proxychains ,proxychains is directing my request to my proxy server then my proxy is making connection with the address and response is redirected to me.


How does the hacker manage to spoof a different IP address? For the last 2 days, +/- every 15 minutes, someone is attempting to sign-in to my online email account. When I verify recent activity, the IP address (and the corresponding country) is different for each attempt. I assume it is the same person (bot) attempting to log in from the same geographical location.

How does the hacker manage to fake a different IP address? (Is he using an anonymity software like TOR?)

TOR, VPN, bots, proxies, you name it.. The source IP is not "spoofed" per se... it's the real deal. If someone really spoofed a source IP, they couldn't establish a TCP connection or receive any replies. The source IP spoofing method is more useful over UDP when launching an amplification attack to a victim/spoofed IP.