CentOS for security testing? I am a QA Engineer, but have been tasked with creating a security testing platform. I have many years with Backtrack/Kali and my primary OS are Arch and Ubuntu. The Systems guys here gave me a CentOS machine in the cloud to build out a machine that will be the hub for all of our security tests. Both systems level tests and application layer (I will be running the tests).

Has anyone else found that CentOS be a viable option to house all your security tools? Initially I had asked the systems team to spin up a debain/ubuntu server for me to start with. They subsequently laughed in my face. The problem I am facing is most of the security tools I am familiar with are debian dependent. Are there other security tools out there that work well out of the box for CentOS? Their main argument against using Ubuntu is the difficulty that creates with Xen Server and the instability/insecurity of ubuntu. Not sure I agree with ubuntu being unstable, I haven't had any issues and security is a matter of how good an Admin you are imo (tempted to hand them CIS benchmarks). Any advice?

Linux is Linux is Linux. Quite a few commonly used tools (nmap, wireshark etc) are already in the package repository. Those that aren't, you can compile yourself.

Will it be more effort than simply spinning up Kali or Debian? Sure. Is it perfectly viable? Definitely.


Is nonce of HMAC secured message considered secret? Consider app using say, HMAC-SHA2, with securely pre-shared symmetric key. Are the nonces of exchanged messages considered secret as well?
 Or in other words, does its easy predictability or even outright knowledge(plaintext) of nonce to attacker compromise/reduce HMAC security?
Some sources suggest using cryptographically secure PRNG for nonce generation as if the PRNG algorithm/seed was part of preshared secret which confuses me.

NIST (National Institute of Standards in Technology) defines an nonce as a time varying, non-repeating value to help prevent 'replay attacks.

The nonce doesn't necessarily have to be secret but should be a random sourced non-repeating value used in block ciphers for symmetric and asymmetric encryption.

Please reference NIST SP 800 series of documentation for additions details of best practices, implementation & reasons for use.


Unsafe C program accepting malicious string inputs I have a question regarding to this unsafe C program.

int main(int argc, char **argv)
{
    char text[32];
    static int some_value = -72;
    strcpy(text, argv[1]); /* copy the parameter into the array "text" */
    printf("This is how you print correctly:\n");
    printf("%s", text);
    printf("This is how not to print:\n");
    printf(text);
    printf("some_value @ 0x%08x = %d [0x%08x]", &some_value, some_value, some_value);
    return(0);
}

From this code we can see that printf(text) is potentially unsafe as a malicious user can input a malicious string into it. Take for instance a user who enters %s as his input which will result in %s being stored in another memory location which would be defined in the stack. For instance, lets assume %s is stored in memory address 5054 in which the number 5054 would be stored on the stack to allow the processor to know where %s is located at.

Now when a compiler runs  printf("%s", text), it would look into the stack and go to the address 5054. However what about printf(text)? How does it access the address of 5054 to print %s which after printing might result to a segmentation fault?

Now when a compiler runs  printf("%s", text);, it would look into the stack and go to the address 5054. However what about printf(text)? How does it access the address of 5054 to print "%s" which after printing might result to a segmentation fault?

It doesn't. In the case where the user enters "%s" as the input, there will be two strings at different locations, both containing "%s": the string constant from the second printf, and the text char array containing the user's input.

Here's what's happening in more detail:

printf("%s", text);

In this case, the first argument is a string constant. So, the compiler creates a string containing "%s" and adds it to a table of string constants somewhere in memory (let's say at address 5054). When this printf is called, the address of the string constant (5054) is placed on the stack, along with the address of the text array. (The order in which they are pushed on the stack depends on the argument push order, but it's usually right to left). Then the current execution address is placed on the stack or into a special register (so the CPU can return from the function) and the CPU jumps to the address of the printf function. The printf function evaluates the formatting string, and when it finds the %s it looks on the stack for the second argument (the address of the text string) and prints it out.

printf(text);

In this example, only the address of the text argument is pushed onto the stack. Then the execution address is saved and the CPU jumps to the address of the printf function, as before. The address of the string constant (5054) is not placed on the stack, because there is no string constant in the list of arguments to the function.

In this case, the printf function evaluates the formatting string, and when it finds the %s that the user entered, it looks on the stack for the second argument, but there isn't one, so whatever was on the stack will be read out, treated as the address of a string, de-referenced in order to print it out, and a segmentation fault would likely occur.

printf is a Variadic function, which means it can take a variable number of arguments. It relies on runtime parsing of the formatting string to determine how many arguments (should) have been passed to it. This is what makes it vulnerable to malicious data: the contents of the formatting string do not match the number of arguments that were actually passed.


How to safely setup user rights inside a backup folder? I use a Synology NAS that has full Linux based user rights control and I want to setup a root shared folder called backup where I'll save backups from different technologies: Time Machine and Windows File History. Let's say I have the following structure:

Ana: uses Time Machine in a MBA
John: uses Windows File History in two different computers
Mark: uses Time Machine in a MBP

Time Machine backups are stored in a folder <computer-name>.sparsebundle and File History in a folder <windows-username>/<computer-name>, so my backup folder would have:

/Ana's MBA.sparsebundle
/John/PC1
/John/PC2
/Mark's MBP.sparsebundle

How can I configure the folder backup in a way that each users only sees their own folder and of course are blocked from R/W other users backups folders. Each user would need to be able to write inside the root folder backup so they would be able to create their Time Machine/File History folder for the first time and start using it for backup storage.

So, is it possible to achieve, or at least something similar?

set the sticky bit on /backup  (that's how /tmp works)

chmod +t /backup
chmod ugo+rwx /backup


Does using a different DNS server prevents DNS leaks? Let's say I visited a website which uses HTTPS. So my ISP can't see the HTTPS traffic between us but it can see which website I'm connecting due to my DNS request. If I use a public DNS server such as OpenDNS or Google, is my ISP still able to see which website I'm using? Imho, they can see since my DNS query is plaintext.

Also some VPN providers claims that they don't leak our DNS queries. How do they do that?

No. The DNS protocol has no built-in security, it is not encrypted. So your ISP will be able to read the DNS request and response regardless of the public server you choose.

Also, due to Server Name Indication (SNI), HTTPS reveals the target domain name during the TLS handshake. So an attacker wouldn't even need to sniff the DNS traffic in order to learn which domain you're connecting to.

There are however projects that aim to encrypt DNS traffic, for example DNSCrypt. But note that encrypting the DNS traffic still doesn't prevent leaking the domain name via other channels such as SNI. So this doesn't replace a properly configured VPN. From the website:

  Please note that DNSCrypt is not a replacement for a VPN, as it only authenticates DNS traffic, and doesn't prevent "DNS leaks", or third-party DNS resolvers from logging your activity. The TLS protocol, as used in HTTPS and HTTP2, also leaks leaks websites host names in plain text, rendering DNSCrypt useless as a way to hide this information.

  Also some VPN providers claims that they don't leak our DNS queries.
  How do they do that?

They configure your system so that all your DNS queries go through the VPN tunnel to their own DNS server and block traffic to the ISP's DNS. The exact measures necessary depend on you OS. Here are some suggestions on how to configure your system to prevent DNS leaks yourself.


SQLmap non authorized user, but the url works in browser Through Burp Suite I get a possible SQL injection point using this request:

POST /restrict/menuApc.do?ccsForm=AssistitoImposta:Edit&MVPG=ApcAssistitoDatiAnagraficiInserisci HTTP/1.1
Host: test-san-as01:8080
Accept: */*
Accept-Language: en
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0)
Connection: close
Referer: http://test-san-as01:8080/restrict/menuApc.do?MVPG=ApcAssistitoDatiAnagraficiInserisci
Content-Type: application/x-www-form-urlencoded
Content-Length: 1893
Cookie: JSESSIONID=ID.testsan; JSESSIONIDSSO=12345678

DOM_DISTRETTO_DESCRIZIONE=555-555-0199@example.com&RECAPITO_TELEFONICO_2=555-555-0199@example.com

I am able to go inside this page using the browser test-san-as01:8080/restrict/menuApc.do?ccsForm=AssistitoImposta:Edit&MVPG=ApcAssistitoDatiAnagraficiInserisci.
I am NOT able to go inside test-san-as01:8080/restrict/menuApc.do.

I run python sqlmap.py -u "http://test-san-as01:8080/restrict/menuApc.do?MVPG=ApcAssistitiRicerca&s_ELIMINATI=1&s_TIPO_ASSISTITO=&s_ASSISTITO=giovanni&s_TIPO_SOGGETTO=1" --level 5 --risk 3 --threads=3 -v 2  --dbms=oracle --method=POST --data "DOM_DISTRETTO_DESCRIZIONE=555-555-0199@example.com&RECAPITO_TELEFONICO_2=555-555-0199@example.com" but I get this error: [CRITICAL] not authorized, try to provide right HTTP authentication type and valid credentials (401).

Why? Is there a way to go through this? Am I doing something wrong?

The URL works in the browser because your browser sends your cookies for every request you make.

You need to tell sqlmap to send your cookies by adding this option in your command line:

--cookies="JSESSIONID=ID.testsan; JSESSIONIDSSO=12345678"


Basic Auth over HTTP redirected to HTTPS - does it leak? I'm creating a Flask API and I'm somewhat unfamiliar with the attack surfaces that exist in redirecting from HTTP to HTTPS, or requesting HTTP when HSTS header has been sent previously.

Lets say a user requests the route user@pass:<url>/ping over HTTP. They can either be:

Redirected to HTTPS, not necessarily realizing their HTTP requests always get redirected, which means they can continue to do so.
Blocked. All attempts to HTTP are served with a "forbidden" response of some sort. They will realize, as they can't access the endpoint, but I guess the data sent is still revealed.

If a user sends a request with Basic Authentication header over HTTP, and it gets redirected to HTTPS, either as a rewrite or with HSTS in place, hasn't the information still been revealed?

If so, I'd imagine blocking HTTP would be a more effective way of telling the user to stop requesting the HTTP route. The redirect may never cause them to actually stop using HTTP for the initial request.

I have a feeling I might misunderstand some feature of the redirect that still preserves the  security of the data being sent...?

If a user sends a request with Basic Authentication header over HTTP, and it gets redirected to HTTPS, either as a rewrite or with HSTS in place, hasn't the information still been revealed?

If the request is redirected to HTTPS (using a 30x response and a Location header), the authentication information has already been sent plain-text over the wire.

If HSTS is enabled, the HTTP connection won't be made and the authentication credentials are sent over HTTPS immediately. This is because Strict Transport Security tells the browser to connect directly over HTTPS.

Note that HSTS is trust-on-first-use and can expire, so it isn't an absolutely waterproof protection.


How long can I store personal information on unconfirmed subscriptions? I have a monthly newsletter. In my subscribe form I use a double opt-in method:

The visitor subscribes.
I send him a confirmation email.
If I receive a reply, I add him/her to my system.

In the event I do not receive a reply, how long can I store his/her email address? Are there any legal requirements related to that?

I am from the US and I am also interested in the policies of European countries.

For the US, there are no legal requirements that I know of.  I do not know European law and cannot advise you on that.

I would suggest giving the person, say, 14 days to respond.  If the person does not respond within 14 days, delete their email address.  If you haven't heard from them within 14 days, you're probably not going to hear from them.  And for odd corner cases, people can always go back and re-subscribe to start the process all over again, if necessary.


What is the best way to hand out passwords to a widely spread diverse employee base? I have a problem I need to solve - specifically, how to hand out passwords to people in a variety of locations, and with a wide variety of access.

I've thought of some options, but there are drawbacks to all:

Email: insecure and travels in the clear, unless it is kept internal to the company. However, some mail is forwarded outside the company, and some user access from the Internet is no doubt done with unencrypted access. In any case, not all have email access (e.g., contractors).
"Briefcase": I could add the password to the user's Zimbra briefcase, but this suffers from most of the same problems as email.
Telephone: Problem with using the phone is that VoIP can be tapped and is, I believe, generally unencrypted (though I don't know). It is also possible that the recipient is using VoIP and whether it is encrypted or not is unknown - in fact, the very nature of the receiving phone is unknown. In any case, some user's are in a time zone 12 hours off from ours - so this is out for the most part.
Encrypted Email: I hesitate with this one as it includes user education, but it may be the best way. Also, it means handing out keys somehow. There is also the email client support issue: users mostly use Outlook, but there are users using Gmail, Hotmail, Evolution, iPhone Mail, Apple Mail, and the Zimbra web interface, among others.
Web Portal: With this, users could access a web page inside the company or over an encrypted link and get a password (or perhaps, request one as well). I'd have to set this up (not a problem: I'm a programmer and administrator in one...) but it still requires handing out a password for the VPN or to log in the first time.

Here are the problems that have to be overcome, in a nutshell:

User education
Unencrypted traffic
User access
User timezone differences
User location differences

My inclination is that I'll probably wind up with some form of encrypted email and/or web portal; for now I'm using a mobile phone.

EDIT: The big problem here (as in all encryption methods) is in getting the initial password or key to the source. In particular, there needs to be a way to identify the originator and to prevent disclosure of the key. The problems we face in preventing disclosure are the following:

User workstations are not all on central network
Some users are isolated (work at home, etc.)
Some users are international: 12-hour time difference
Many users are not even employees, but contractors with sister companies or with outside vendors

I wonder if I'm just going to have to accept some risk.

I would think that your only real way around this road block is with a pre-issued two-factor token, and an email with a one time password that has to be reset to the user's new password upon first login.

The one time password would be of no value without the two-factor token.


How do I transfer the HMAC? I have a file I'd like to encrypt with a symmetric key using AES-256 and then use an HMAC for integrity. So I don't "roll my own" scheme which I know is a big mistake, what are the standards for using the HMAC once I've created it? Is this what GCM is for? Can I just store the HMAC with the keys or should it be included in the encrypted file somehow by either prepending or appending it to the final message? I've seen a lot about how to create the HMAC and what data to calculate it on, but nothing about what to do with once I've got it. Perhaps I'm just looking in the wrong place or making things too complicated.

Combining MAC and encryption is hard. Depending on how you do it, the result will be secure, or not, or only "mostly secure" modulo a zillion of implementation details. GCM is an Authenticated Encryption mode which does all the hard work for you, so it is warmly recommended that you use GCM (or an equivalent mode like EAX) instead of designing your own protocol.

For research purposes only, the MAC value will be part of the encrypted data if you use MAC-then-encrypt, whereas it will have to be transmitted or stored separately if you use encrypt-then-MAC or encrypt-and-MAC. Afterwards this is only a matter of encoding. "Encrypt-then-MAC" is recommended notably because since the MAC operates over the encrypted data, it cannot reveal anything about the plaintext data, so the MAC value can be shown to everybody with no ill effect.


Can certificates be extended and/or does the serial number change in that case? I was wondering, if there is a way to extend the duration of an existing certificate.

Or is simply a new certificate requested for the old public key?
Is this mentioned somewhere in the certificate? (Someone told me that the trustworthiness of websites is rated on how often the extended the certificate)
Does the serial number change in that case?
What are reasons to use the old keypair instead of requesting a certificate for a new keyPair?

No. This is not possible as you would be reissuing the certificate. Your serial number will change.


Process of finding device hostnames on LAN Is there a reliable way to retrieve hostnames from LAN devices without having to install extra software or performing nmap-style OS fingerprinting?

I'm ideally looking for either a protocol that has something like this built in or a program that comes installed as default.

It would be useful to know what operating system you're using, also some idea of the network topology.

Some devices announce themselves using mDNS or perhaps the network supports reverse DNS lookup with clients providing their hostnames during DHCP exchanges.

If DNS is available on the network, nslookup is available on most platforms nslookup xxx.xxx.xxx.xxx

Then there is NetBIOS, on Windows you could try nbtstat -A xxx.xxx.xxx.xxx

Also ARP might be useful arp -a


How secure and private is the case where you use hushed app with a VPN on Android? So just how secure and private is the case where you use hushed app with a VPN on Android?

Here is what i was thinking , so i have two phones, one is without a sim card just sided loaded apps namely hushed, and a vpn and the other has a sim card and all the usual non private things like google account attached, non vpn, no cryptography of any kind just all the usual functions and none of the security

If from the non sim card phone i turn on the vpn, then use a hushed number(burner number) and connect to my other phone which has a sim card and uses cellular network over a mobile hotspot wireless connection on the other phone , is the first phone protected and secure and private so that nobody can access the information i send over it? or does the data sent through the wireless hotspot connection become visible through the phone which is offering the wireless hotspot connection?

In order:

  If from the non sim card phone i turn on the vpn, then use a hushed number(burner number) and connect to my other phone which has a sim card and uses cellular network over a mobile hotspot wireless connection on the other phone , is the first phone protected and secure and private so that nobody can access the information i send over it?

Short answer: Sort of, yes. Let me elaborate and clarify. First, a primer on VPNs:

VPN tunnels are between two endpoints. If your VPN is on your burner phone, the other endpoint is usually the provider or VPS. (e.g. VyprVPN, ProtonMail, etc). This creates a tunnel of encrypted traffic between these two, meaning your ISP (and anyone else in the middle, like someone  on Wifi) cannot see your traffic. However, this does nothing to protect your other, non-burner phone. The only thing encrypted is packets sent and received on your non-burner phone.

However, if you set up and create a hotspot on non-burner phone, and use this hotspot on your burner phone, then connect VPN on burner phone, your burner phone will still remain anonymous (see bottom for note on this) and encrypted - but traffic orginating from your non-burner phone is not. Meaning anything sent/received from your non-burner phone is still visible, while your burner phone is (relatively) safe.

  Or does the data sent through the wireless hotspot connection become visible through the phone which is offering the wireless hotspot connection?

Short version: Your burner phone will remain anonymous, but your non-burner phone will not. As long as the data is only going through the hotspot with a VPN connected, you should be safe. If you want anonymous info on your non-burner phone, set up a VPN on that one, too.

Note on anonymity - VPN's alone are not enough to ensure true anonymity. Things like DNS leaks can compromise your IP, so if you want true anonymity, you will need a layered approach. Perfect anonymity is nearly impossible, however, and requires going through lengths most people will find annoying or even eccentric. I am not addressing those, I'm simply discussing the VPN traffic as you presented the question. VPN's are a huge step in protection, and will make it considerably more difficult to track you, especially for usta  casual user - difficult, but not impossible. I thought it important to clarify this distintion.


How safe is it to use developer's version of the browsers I have heard that the developer versions of browsers (chrome and firefox) are less secure than stable versions of them. Is it true?

Is there any sense in using developer editions of browsers for development and stable versions for general use?

Typically developer versions (called beta editions in the Software Lifecyle) are used to showcase upcoming features. Some of these features haven't gone through the rigorous testing as a stable (Release) version. To illustrate this, here is Chrome's explanation documenting the differences

  Stable channel: This channel has the full testing of the Chrome OS
  test team, and is the best bet to avoid crashes and other issues. It's
  updated roughly every 2-3 weeks for minor changes, and every 6 weeks
  for major changes.

  Beta channel: If you are interested in seeing upcoming features and
  enhancements with minimal risk, Beta channel is the place to be. It's
  updated roughly every week, with major updates coming every 6 weeks,
  more than a month before the Stable channel will get them.

  Dev channel: If you want to see the latest Chrome OS features, then
  you want the Dev channel. The Dev channel gets updated once or twice
  weekly. While this build does get tested, it is still subject to bugs,
  as we want people to see what's new as soon as possible.

What you can note are two things: Stable Channel "full testing to avoid crashes" versus Beta Channel: "minimal risk" and Dev Channel: "While this build does get tested, it is still subject to bugs" so you need to ask yourself: "Where is this beta going to be... What is the risk of using it?"

In production environments, betas are a no no, and are often contained on dev machines that are likely not connected to anything mission critical. If you're just talking about using something at home/hobbyist, you still should ask yourself what is the risk of someone finding a bug in a beta. What is the risk that perhaps my browser won't be a victim of a client side attack, and allow an attacker to get access to my connections/bank account information and so on.

Granted on the Stable side of the equation, bugs still make their way through however, these bugs are quicker to be patched than lower channels (beta, and dev). It all boils down to your tolerance.


Can Polygraphs be effectively 'beaten'? This article suggests that polygraphs are rather rudimentary and thus very susceptible to being 'beaten'. In pop culture we see all the time movies where polygraphs are beaten -but with great difficulty. Can this truly be done and if so, how difficult is it -does it take great skills and discipline to learn 'tricks' or is the polygraph system itself flawed?

The reality is they don't work effectively. They test stress and emotional response to stress, which can be an indicator. So you are correct, they can be 'beaten' if the person is stressed by other reasons (such as 'I am being questioned on a lie detector' can be scary enough...) or if someone is a sociopath and has no real response emotionally anyway.

LegalMatch.com has a bit of info on the subject:

"In past times they were often used by police and government agents to interrogate suspected criminals, but as they have been proven to be extremely unreliable indicators of lying..."

http://www.legalmatch.com/law-library/article/admissability-of-polygraph-tests-in-court.html


Are Windows Superseding Patches not fully securing my systems? I have completed a Nessus vulnerability scan of a Windows system.  The scan is indicating that some windows patches are missing, but the patches are superseded patches and the most recent version of the patch is installed.  I researched the two patches and the older patch is superseded by a cumulative patch and the old one is not available.  The Nessus report has offered a registry fix that does remove it from the scan.

I can see two scenarios here (and possibility missing more):

Windows is releases fixes to patches that are not fully fixing problems
Nessus is enumerating the patch list and is reporting the patch as an audit concern and not a security concern.

I am wondering should I be proceeding with the fixes for system hardening or can I take the easier route (in my case) and document that the finding is not a security concern.

When doing patch enumeration, Nessus looks at the installed patch list and only understands patches that are in its database. If the rollup patches which supersede the original patches are relatively new, then Nessus may see that the old ones are not applied without knowing that there's a rollup in place, and may falsely report that the original patches are missing. When you apply the registry fix, Nessus identifies you as no longer vulnerable because you've applied a workaround that it detects is applicable.

Your first step here is to update your Nessus plugins to ensure they're current. This will help avoid this kind of problem, but Nessus will always be a short while behind the patch cycle on these.

Your second step should be to check which module reported the issues. If you're doing an authenticated or local scan and it's the patch plugin which reported them, then Nessus is simply failing to pick up the rollup patch. Verify that the patch is included in the rollup (which it looks like you have) and don't worry about it - it's a false positive. However, if you're doing a remote scan and the plugin which discovered it did so via the network (e.g. TCP port 123 has vuln xyz) then the vulnerability may well be present, and you should do further research.


What are my options to store a key which unlocks encrypted data locally on a device? Think whole-disk encryption. I have a similar situation where I need to encrypt some data on a device (embedded, not PC) but that data needs to be decrypted and used when the device is booted up. The problem is, there is no user interface available and it wouldn’t make sense to store the key for the data on the drive as well in plaintext.

Whole-disk encryption on the PC has the advantage of either storing the key in the cloud or accepting it via an external device such as a USB key. However, my constraints include no network access at times as well as no support for external USB devices. What would be he most security sounded option to store a key for encrypted data on disk with such constraints?

No matter how you slice this, if the key is available on the device and the key is not protected then the crypto system is flawed.

You are thinking correctly trying to find a secure way to get the key but in the end, it’s checkbox encryption and you store the key on the device or you find a way to get a keyboard on it to type a key in on boot.


Is checking a pre-shared fingerprint of a certificate good enough security for TLS? A third party my system needs to connect to (via FTPS) is using a certificate that is not trusted by machine (unknown certificate).

If I want to avoid installing the certificates from the issuing authority on every server that my application needs to run on, could I as an alternative just get the third party to confirm the SHA-256 fingerprint of their certificate in advance, and just override my certificate validation logic to check the fingerprint?

Would that provide the same level of security as installing the certificates from the issuing authority?

I have read the answers to this question, and it makes me think that this is fine, but my question is about configuring my application with the fingerprints and using them to validate received certificates rather than manually checking fingerprints while browsing etc.

What you are referring to is usually called pinning, i.e. check that the certificate or the public key in it are known to the application by either comparing the certificate/pubkey itself or using a fingerprint for validation.

This is a perfectly valid way to validate a certificate as long as the fingerprint is strong enough, i.e. SHA-256 is fine while MD5 is long considered broken and practical attacks against SHA-1 were just shown so it is bad too. But, having only pinning does not offer a way for the client to check for certificate revocation. This might be fine if the certificate check is done inside an application and the application will be quickly updated with a new fingerprint when needed but it is not a good idea if there is no way to update the expected fingerprint in a secure way.


Payment gateway integration, any security considerations? I'm interested in understanding what security considerations there are around implementing a payment gateway. I have, so far, thought of:

having a SSL Cert is a MUST.
logging actions is critical.
a database separate from the internet.

Any other recommendations?

As background, my application is selling  product to the client via electronic delivery. When the user pay the fee via paypal, I will send the 'code' to them. And they can use the 'code' to redeem the goods, for example, active the software or items from the game.

Never store the credit card details: number, ccv, exp, etc.  There is rarely a situation where you need them.  Instead just store the response code and reference number from your gateway.  Those are sufficient to issue refunds from when necessary.

Okay, from your comments you are using PayPal.

Paypal has several different gateways, I'm going to assume it's the PayFlow Pro one.

First, as stated above, do NOT store the credit card information locally.  Simply accept it the post from the user and immediately send the data using PayPal's API.  Once you get the response, keep the transaction ID and store that.

Under no circumstance should you "log" the credit card information.  Logs can be hacked and you don't want that liability.

In the event you are allowing the end user to set them selves up for recurring payments, still DON'T STORE THE CC INFO.  The paypal API can handle this and will give you the relevant transaction ID's to keep for future reference.

Next, review the paypal documentation for their best practices.

Finally, don't store the credit card number.  Not even part of it.  You do NOT need a "remember my payment details" button.  Those are a very bad idea and scream "target" to hackers.

Okay, now what should you do?  First, read the PCI compliance literature.  Second, read OWASP literature.  Third, build your site and secure it.  Fourth, hire a third party company to do a security audit.  Fifth, fix whatever it is they found and have them do another audit.  Repeat until your site is considered "secure" by someone other than you.  Preferably someone with experience doing audits.  It won't be cheap.  If it is, then you've hired the wrong company.

Ongoing, keep up with your windows and gateway updates.  If paypal sends out a new API, check it out, update your code and deploy.

Every time MS sends an update, apply it.  Don't wait, just do it.  If something breaks, fix it then.  Anymore by the time MS or another vendor issues a patch there is almost always an exploit deployed within a day or two for that patch.  Sometimes the exploit was already out there.


How can a passphrase with 256 bits of entropy practically be constructed & memorized? Quoting Wikipedia:

  A password with, say, 42 bits of strength calculated in this way would be as strong as a string of 42 bits chosen randomly[.]

Assuming that interpretation is correct, combined with knowledge that cracking a random 256-bit number is infinitely expensive nay physically impossible, how can a passphrase with 256-bits of entropy practically be constructed & memorized?

A common word of the English language has approximately 11 bits of entropy. That means a 256bit passphrase (passtext?) would require 24 words.

How could one make up a text of that length which is still easy to memorize? You could write a poem. The art of writing poetry and memorizing poems is not hard to learn. It doesn't even has to rhyme. In fact, not rhyming makes it harder to crack. Have fun!

However, we assumed that all words are completely random. In natural language, some words are more likely to appear after others. Poetry also usually conforms to certain rules and structures which further reduces the entropy. This answer on linguistics.stackexchange.com comes to the conclusion that the entropy per word in a poem goes down to about 5 bits per word, so you would need to write and memorize a poem of at least 52 words to get over 256 bits of entropy.


Customized approach to protect plaintext passwords/usernames in database table? I'm in the process of building an app to let users sign up, connect their many email accounts (like Gmail) to the site, and allow email-related activities... like sending an email (please don't ask or say "oh the user can just go to their mail clients or Gmail tab to do that!", i know i know.) You could say i'm making an online mail client. I tried to explore how ThunderBird, Outlook, or Apple's Mail client manage login credentials, but I couldn't quite figure it out.

The Approach:

When they submit their email's login and password for the first time to my app, we do the following:

salt the username and password with a 30 to 40 char key (different for every user)
use AES-256 encryption (username and password have different keys stored elsewhere)
then store the encrypted username and encrypted password

I'm aware of the theories, industry-recognized approaches to use one-way hashes and the many open source libraries, but my app needs to submit the user's email credentials, say, every time they want to send an email.

Here is a sample output of a user's email settings record stored in the database (using Rails):

#<EmailSetting id: 10, user_id: 3,
username: "{\"v\":1,\"adata\":\"\",\"ks\":256,\"ct\":\"E1M3+Eza9w5yNIoBVS...",
password: "{\"v\":1,\"adata\":\"\",\"ks\":256,\"ct\":\"8N/Ylh7IGiHKDz1QM7...",
outgoing_server: "smtp.gmail.com",
incoming_server: nil,
email_connection_type: nil,
outgoing_port: 587,
outgoing_authentication_type: "plain">

I'd like to make sure that if this database is ever compromised, i can protect the user's as best as i can while providing a service.

Question: is this strong enough to protect email login credentials? Is there anything i might be forgetting in protecting the database table?

As a service provider, You should never, never store passwords in a way that they can be retrieved.  Comparing yourself to an email client is a bad way to think of it, and doesn't take into account an attackers perspective.  Compromising a Thunderbird install only gets an attacker one or a few sets of credentials.  Compromising your service could get an attacker your entire customer bases credentials.

As other commentators have pointed out, you now have the job of protecting the password set.  If that's compromised and DB access is possible, you've now leaked ALL of your customers gmail usernames and passwords.  If you have a lot of customers, this is a gold mine.  Don't underestimate the power of dedicated attackers.

As Stephen Touset points out, you should be using the GMail API, which doesn't reveal passwords, but uses revocable tokens using the OAuth2 framework.  If you were compromised, the tokens could all be revoked.  That's not possible if the attacker were able to get all the username/password combos.


Preventing Voter Fraud on a Social Media Contest I'm creating a contest that will allow users to login using their Facebook & Twitter accounts and submit votes on videos. My clients concern is that users will game the system by logging into different Facebook & Twitter accounts to keep spamming votes on the same video.

How can I prevent this type of voter fraud?

Rather than logging in to accounts they control, I expect voter fraud would be done by clickjacking or CSRF, harnessing the social viral power of Facebook to attract unwitting accomplices.

With the prevalence lately of images on Facebook that claim that you can obtain a PS4 simply by "liking" and "sharing" an image and the sheer numbers of people who do so, I suspect it would be possible to create something similar that tricked Facebook users into signing up to your site and submitting the voting form.

Another possibility is that the viral image on Facebook could tell them that they had to sign up and vote for a particular entry in your competition to win the PS4.

CSRF has standard mitigation techniques involving nonces, secret keys and MACs.  There are mitigation techniques for clickjacking too.

Determining that someone is voting in a particular way for a separate reward is more difficult.  Probably a job for an A.I.  The first referrer header you see from a client may offer a clue as to their motivation.  The amount of time they spend evaluating the various voting options might as well.  Choose too quickly and it's probably fraud.  You will probably get good data out of tracking mouse movements.  These techniques would probably work for your original fear of a single person logging in to multiple accounts.


Does mixing in keystrokes of Backspace, Arrows and Delete add any security to password typing? It is well known that the analysis of the keyboard sound can reveal/hint at what keys were pressed when a password is typed.

One could mix in wrong characters (not belonging to the password) with strokes of Backspace, Arrows, Delete, Home, End, etc that in the end would remove these wrong characters and leave the original password in the field.

One example: I can type S and back-arrow in tandem (ok, S a little before the back-arrow). The caret now is behind the S. When I press delete, the S character is removed, making this a zero-sum stroke combination.

Assuming visual inspection is impossible (the attacker has "sound-only" data from the password typing), does this add any security?

I know some people that combine keyboard and mouse when typing passwords. They would type a piece of the password and then click moving the cursor between previously typed characters and insert new characters.

The idea is that the whole password is not typed in sequence. It is supposed to make keyloggers less effective.

Obviously this doesn't work with all password prompts.


Finding Hidden Keylogger Through Forcing a Computation Error It must be possible to detect keylogging by close scrutiny of timing between physical keystroke execution and the character's eventual occurrence on the screen.

I've had a friend show me this with his camera. The camera can record at 16,000 frames per second. He recorded himself typing the letter 'a' in program 1, then -- in the slow motion playback -- the amount of time that elapsed between character occurrence to the screen differed in program 2 or program 3 and so on.

This made me think. Perhaps a keylogger could be detected quickly without having to deal with the malicious design of an intelligent keylogger that can detect when it's being detected if these kinds of data were analyzed. If one knows the expectations, and there is a slight time difference on this kind of scale without other processes running perhaps something can be gleaned from such data.

I'm not sure whether this question is clear, but I'd like to know if there is any merit to being able to detect keyloggers through off-device analysis; that is, like a sophisticated camera of this caliber being used to time character occurrence.

Perhaps a physical device could be made to press keys on the keyboard faster than what a human hand can perform to generate an error which could be analyzed. Perhaps this error could be useful.

It's hard to gauge I grant you because you've probably never come in contact with a camera like this, and seen the results as I have. Anyway, maybe someone has something to offer.

The big problem you're going to run into if you're trying to find a keylogger by analyzing keypress latency is the monitor's refresh rate: most monitors only update 60 times per second.  A good keylogger is only going to add a few microseconds of latency, so even before you take other sources of noise (such as scheduler randomness) into account, you're handicapped by what is essentially a 1:10000 signal-to-noise ratio.  Yes, it's possible to find a signal that far below the noise floor (see Shannon limit), but it's not easy.


What are the risks of providing SSLv2 for additional device compatibility? SSL 2 was deprecated in 2011. However many devices are manufactured before 2011 and still in use today, and it is impossible to upgrade the software in the device (e.g. cellphones, tablets, PDAs, routers, IP cameras, printers etc.). In designing a network service, it is impractical to limit secure connection to clients with TLS 1.x only, since that would block out a major portion of users.

How insecure would it be, today, if a well-designed network service provides SSL 2 compatibility? Well-designed being, security is provided by multiple approaches, e.g. 2-factor authentication, proper user permission management, encapsulating user inputs in code, auto account locking after a number of failed logins, DMZ properly setup etc. The key factor here is, if SSL 2 is not provided, the service will be completely inaccessible a major portion of devices (30~40%) that are otherwise perfectly functional.

An example would be a corporate email server for daily communications. Sensitive information are never communicated or stored on this server. This server is capable of all SSL/TLS protocols, with an option to disable the weaker protocols.

What exactly are the risks of accepting SSL 2 connections on the server?

EDIT: This is not a question about how SSLv2 is insecure or why it should not be used. It is about the business risk associated with provide SSLv2 as an additional supported protocol for device compatibility. The concerned devices are:

Perfectly functional.
Supports only SSLv2. There are no possible software upgrade paths as these are not computers.
The only other alternative on these devices is a plaintext transmission.
Represent a majority (or non negligible portion) of the devices using the service.

I'm evaluating the whether to replace all devices, or continue using them but in a relatively insecure manner. It is therefore a business risk management decision. However I must first understand the business risks of providing SSLv2.

SSL 2 was deprecated in 2011

It was not deprecated, it was outright prohibited which is a huge difference.
See also What's the difference between SSLv3 being deprecated and SSLv2 being prohibited?

  However many devices are manufactured before 2011 and still in use today

TLS 1.0 was defined 1999 and was available in major TLS stacks (including openssl) from around this time. Not supporting it was already not an option in 2011.

  if a well-designed network service provides SSL 2 compatibility

It is a kind of contradictory statement: well-designed vs. providing SSLv2 compatibility. Having a SSLv2 device on the network is not only insecure because of the SSLv2 protocol itself but also because it is highly likely that any old devices which cannot speak any better than SSLv2 wants to use weak ciphers too.

  if SSL 2 is not provided, the service will be completely inaccessible a major portion of devices (30~40%) that are otherwise perfectly functional.

Depending on the environment you might be able to secure such devices by adding some software in front so that they are available with better protocols and ciphers.

  An example would be a corporate email server for daily communications.

If this server supports only SSLv2 than it must be that old that it has lots of other vulnerabilities. TLS 1.0 was available with Windows XP already.

  What exactly are the risks of accepting SSL 2 connections on the server?

While it is bad to have SSLv2 only it is bad to have SSLv2 additionally to other protocols. See DROWN attack for details on how availability of SSLv2 can aid in decrypting properly encrypted connections.

In summary:
if all of this is done within some restricted network where you have no malicious activity the using SSLv2 is probably perfectly safe as would be plain text. But as soon as you have the possibility that someone attacks the network you need to deal with the problems caused by the insecure SSL version (DROWN) and age of SSL stack (weak ciphers) and also at the general software problems (i.e. outdated and probably vulnerable software).


How to mimick malicious activity in a network? I'm trying to setup a VM that will try to mimick malicious web browsing behavior.  It should download malware and just get infected.

There are a lot of open source threat intel feeds with bad IPs and URLs. Is there a way to have it visit malicious sites and get infected?

In case you are wondering why, it's in a test lab and I'm trying to test how well my IDS and malware sandboxes work.

I'm trying to setup a VM that will try to mimick malicious web browsing behavior.

It sounds like you are trying to mimick web browsing of malicious sites, not malicious browsing of web sites.

  It should download malware and just get infected.

As a precaution, you should run the VM on a system that is physically isolated from the rest of your network (for example, an old laptop). Ideally, tape over the webcam, and disconnect the microphone, BT, WiFi (though that may require opening it up). It should have wired Internet only with a firewall that prevents it from accessing the rest of your network, such as a so-called "DMZ" configuration.

  There are a lot of open source threat intel feeds with bad IPs and URLs. Is there a way to have it visit malicious sites and get infected?

Shouldn't be too difficult to write a script that repeatedly opens firefox with a URL from a list and then kills firefox a few tens of seconds later after the malicious website has had time to do its thing.

  In case you are wondering why, it's in a test lab and I'm trying to test how well my IDS and malware sandboxes work.

Great. Just be careful. Be very careful.


Does searching for my info expose my info? My bank does a 'dark web' search on my email address to see if it's out there. It occurred to me that they might be putting my email address on the dark web by searching for it.

What stops the websites they're crawling from capturing the search string, extracting the email addresses, correlating them to the source of the query, and compiling a list of known good email addresses belonging to specific institutions based on an activity designed to protect from exactly that?

You assume that the search happens by giving the website your details. It would be more efficient for large volume of searches to scrape all the data, then look for your details offline.

But, what your bank does and how they do it is up to them. It is of course possible for anything entered into a malicious site's search function to be logged.


What happened with Kazakhstan's Root CA MITM policy? In 2015 there were news that Kazakhstan was going to start intercepting all HTTPS traffic via "man-in-the-middle attack" starting Jan 1, 2016, by requiring kazakhstanis to install their root CA.

The original post has been taken down, archived version here:
https://web.archive.org/web/20151202203337/http://telecom.kz/en/news/view/18729

Hacker News:
https://news.ycombinator.com/item?id=10663843

Did this go actually into effect, is the policy active?

(edit) A third round...
The Kazakh government made a third attempt at intercepting SSL traffic in December 2020. Again the primary target domains were large foreign tech sites such as Google, Twitter, Facebook, Instagram, and Netflix. Many citizens were notified by ISPs via SMS of the demand to install a new root certificate and traffic to some sites was blocked beginning December 6th unless routed though the man-in-the-middle attacked government endpoint.
Officials gave the excuse that during the COVID-19 pandemic cyberattacks targetting "Kazakhstan's segment of the internet" grew 2.7×. On December 7th browser manufactures again announced they would blacklist such certificates.
(edit) Update...
The state sponsored MITM attack described in the answer below was dropped on August 7th, 2019 (approximately 3 weeks after being started). During that time several hundred sites, largely email, communication, and social media sites were intercepted. The government of Kazakhstan officially stated that their "test was completed" and "was a success" and noted that citizens could uninstall the offending root certificate.
As of later August major browser vendors including Mozilla's Firefox, Google's Chrome, and Apple's Safari all added the certificate to a hard coded internal black list so that it would not function even in the event some people leave it "installed" on their local machines.
Original Answer...
As the previous answer suggests, the 2015/2016 attempt at this stunt got so much backlash they basically backed away from it and it sat for a while. The original January 1st 2016 deadline came and went with no real enforcement. Their request that Mozilla trusts their root certificate was declined. The MITM attempts still cropped up in individual cases of sites put under surveillance, but nothing widespread.
Until July 2019! Apparently, they never let go of the idea itself, the project was resurrected, and in the last few days enforcing started en masse through many ISPs (first implementation seen on July 17th, 2019). See this Mozilla bug report for technical details, Hacker News for discussion, or this ZDNet article for the news take.
Here is KCELL's (a major telecom company in KZ) information page in English that is a sample of what locals are being prompted to do when trying to access sites that have been MITM'ed.

Pursuant to the Law of the Republic of Kazakhstan On Communications and clause 11 of Rules for Issuing and Applying Security Certificates, Kcell JSC informs its customers of the need to install Security Certificate on devices capable of connecting to the Internet. According to law, telecom network operators are to ensure that customers with whom the operators have service contracts are able to install the security certificate on their mobile devices.
We draw your attention to the fact that installation of the security certificate must be done on each device that will be used to access the Internet (iOS/Android mobile phones and tablets, Windows/MacOS personal computers and laptops).
Customers failing to install Security Certificate on their mobile devices may face technical limitations when accessing certain websites.

Is spite of reports that it would be mandated first only in the capital (Nur-Sultan, formerly Astana) the enforcement seems to be rolling out on a per ISP basis, and has started impacting other cities as well. Bulk SMS messages have gone out (mostly to Nur-Sultan area subscribers) with instructions on how to add the government root cert to many cell phone OSes.
The certificate they are demanding everybody install is identified as Qaznet Trust and distributed through qca.kz. While the demand that all HTTPS traffic be intercepted is a governmental one and the root CA certificate in question is a Kazakhstan government-controlled one, it should be noted that the actual interception is being implemented by ISPs. Technical details of this are still not clear, but this likely means that each and every government authorized ISP will be able to intercept data from all website traffic.


I used 10minutemail and my own phone number, is there a risk? I created a twitter account and used 10minuteemail, then twitter said my account was having automated behaviour, so I searched a temporary fake number to use but for the sake of lazyness I just put my own phone number. I removed it almost immediately.

Unfortunately twitter send back my number in plain sight. 10minutemail erases all mail but is generally site secure, isn't it full of crawling bots and such? Do I risk IMEI or identity theft?

The following people now know your phone number:

Twitter
The operators or 10minutemail
Anyone breaking into one of the above services stealing data. (Note that 10minutemail isn't supposed to show your email to others, so some kind of security breach would be required.)

Is this a problem? Not really. There's not that much one can do with just a phone number. You might get some SMS or phone call spam, but I would not worry to much about it. Maybe it could be used in some kind of social enginering attack, but that is quite labour intensive and not something I would expect at random. If I were you, I would just forget about this whole thing.


Increase entropy by making passphrase more complex I have just started reading on the use of passphrase to increase a password entropy and have gained a rough understanding of it. However, I'm wondering if it's possible to further increase the entropy by making it more complex.

For example, let says a password is generated by putting two words from a dictionary of 2^14 words. This would cause the password to have a 2^28 entropy bits. To increase the entropy bits, I decided to do 2 things.

First, I would change the first letter of each word to uppercase.

Second, I would randomly choose 4 characters (excluding the first letter of each word) and change them to a corresponding digit.

Would either of the above-mentioned steps help in increasing the passphrase entropy? And if so, how do we calculate it?

There are two ways to look at whether these changes provide you with more security.  The first assumes that attackers doen't know of the passphrase creation changes you've made.  If they tried to guess passphrases constructed from all lowercase words then they won't ever guess yours since they are outside the pool of guessed combinations.  If they tried to guess traditional password formats or just brute-forced all possibilities up to a certain length then they probably won't guess your passphrase unless it happens to be short (e.g. you randomly select two three character words).  In this scenario you probably have improved your passphrase security, but it's nearly impossible to measure.

The second, and in my opinion better, approach is to assume attackers do know your system for creating passphrases.  It may be unlikely, but not outside the realm of possibilities that they might capture one of your passphrases or find one stored in plaintext from a site breach.  This might allow them to guess your system by examining what they know from these other passphrases.  Or this could be a common modification that they've learned other people have made to their passphrases so they consider it worth their time to try.

In this situation the attackers know to take two random words and capitalize the first letter.  So the fact that you capitalize both words buys you no additional 'entropy' or strength against their attack.  If you randomly decided whether to capitalize the first letter or not then that would essentially double your pool of possible words, because the attackers would need to try both versions for each word.

You don't really say how you're making your conversion of characters to digits.  Are you doing a 'leet speak' change so that "e" becomes "3" and "i" becomes "1"?  Is the substitution completely random?  Either way I believe we'd need to know what words are in your dictionary and their respective lengths to estimate how many variations that change could produce.  This is actually the hard part.

Let's assume all your words are seven characters and the digits are randomly chosen before replacing a letter.  Then the number of candidates for digit replacement would be 12 since you aren't changing the two capitalized letters (U).  You would need to map out all the possible arrangements of lowercase letters (L) and digits (D):

U D D D D L L U L L L L L L
U D D D L D L U L L L L L L
U D D D L L D U L L L L L L
....
U L L L L L L U L L D D D D

Then you would need to take the number of possible arrangements and multiply that times 10^4 (since each digit location can be one of 10 characters).  Unless my math is wrong that should give you the total passphrase possibilities.  You could then compare that to an unmodified word passphrase total to see how much additional security you've added.

But again, that assumes all the words in your dictionary are seven characters in length.  Since this most likely isn't the case you'd need to map out digit possibilities for every possible permutation of two words for the different word lengths.  I can estimate that's a pretty substantial security increase, but you'll have to work the numbers to figure out exactly how much you've gained.


Host header injection attack with Spring boot embedded tomcat Our application has been checked by PEN Test tool, and there are description of issue:

  An attacker can redirect the application using the host header on the
  below mentioned URL to redirect them to phishing websites.

Reproducing steps:

Make request into application
Intercept the request using proxy tool
Apply attack value into "Host" header
Forward the request
Observe the 302 response with the injected attack value

Expected behaviour:
White-list all the redirect URLs. Make sure users are reminded that they are going out of domain before the redirect occurs.

So, as we use spring boot with embeded tomcat, I guess it should be some server settings.

May be someone can help with required steps for this attack preventing?

For non-standalone Tomcat, the trick is to configure two virtual servers, where one is the default and belongs to no web application and the other one is the real one where your web application is linked with, see https://serverfault.com/q/850955

It seems that this doesn't work with Spring boot, because it seems that you cannot configure virtual servers.


Internal network security policy for development environment What are the best practices for network security for an internal development environment. Besides adhering to updates, antivirus, and firewall.

For instance, is it recommended to use an IDS/IPS like Snort? Should you be whitelisting outgoing ports? Developers often needs access to a variety of resources, especially for testing purposes.

What kind of security controls are often overlooked in these type of environments?

I know this is a very broad question, so any and all answers are appreciated.

EDIT: The network is an internet connected LAN.

Yes, follow a iSMS such as ISO 27002, PCI DSS, Visible Ops Security, or similar.

Overlooked controls include 2FA authentication and TLS protection of developer repos (e.g., GitLab, Subversion, Atlassian, Perforce, et al) that conform to SSL Labs criteria, as well as other components of Application Lifecycle Management (ALM), such as tools for bugtracking, code documentation, code review, collaboration, et al. API keys are always at risk: developers accidentally leave these in their code, .git/.svn folders, etc. Be aware, have backups, and have a backup plan when all else fails.

... And remember, the best penetration testers in the world attack developers, not apps -- http://www.darkreading.com/attacks-breaches/tiger-team-member-attacks-developers-not-apps/d/d-id/1129737


Are there any known botnets targetting smartphones? Are there any known botnets that specifically target smartphones? What is their topology and how are they controlled?

What are they used for?

Generally speaking, we haven't seen large, long-lived botnets formed by compromising smartphones, in the same way as we've seen for desktops.  (There are small-scale exceptions, but this is is a good first approximation.)  There certainly has been no shortage of malware targeting smartphones, but what it does once it compromises your machine looks a bit different from what tends to happen on desktops.

It's instructive to look at why.  Why do bad guys want to compromise your desktop or your smartphone?  Because they want to make money.  Therefore, they are going to be driven and motivated by what they can do with your compromised machine -- in particular, how they can make money from it.

Right now, the main ways of making money off a compromised desktop are things like sending spam, hosting bad web sites (phishing sites, pharmaceutical storefronts, etc.), launching DDoS attacks, stealing users' credentials, and so on.

Most of those attacks are not possible or less attractive on smartphones.  Smartphones tend to have lower network bandwidth than desktops, so they're not as useful for sending spam, hosting bad sites, or launching DDoS attacks.  Also, due to sandboxing and other security protections, it is not as easy to steal users' credentials (it is possible, but not as trivial).

For these reasons, we shouldn't expect to see bad guys leverage compromised smartphones in the same way that they leverage compromised desktop machines.

For more detail, see the following research paper, which surveys smartphone malware seen in the wild (up to 2011) and speculates on incentives that might drive malicious behavior in the future:

A Survey of Mobile Malware in the Wild.  Adrienne Porter Felt, Matthew Finifter, Erika Chin, Steven Hanna, and David Wagner.  ACM SPSM 2011.

For more research, see the following:

Dissecting Android malware: Characterization and evolution.  Yajin Zhou, Xuxian Jiang.  IEEE S&P 2012.


Why is it considered safe to install something as a non-root user in Linux environments? We always hear it is safe to run unknown programs as non-root users in Linux because non-root users are sandboxed from the system level and can't change anything out of their permission scope.  If need be, as root user one can always delete a non-root user and be confident the rest of the system wasn't affected.

However, isn't it possible for a low-level user to install a script with a keylogger, for example, that waits for an su - or sudo call and takes system control from there?

We always hear...

Do we? I don't.

Installing some untrusted program as a normal user is a bad idea with Linux the same it is with Windows or Mac: this program has access to all your data and can delete these data, send these data to somebody else etc. Moreover it can make screenshots, control other applications running on the same X windows screen (even if they run as a different user), can grab keys (i.e. keylogger),... For details see The Linux Security Circus: On GUI isolation.

Apart from that we regularly have privilege escalation bugs even in Linux bugs which can be used by an unprivileged user to get root or even kernel level permissions.

Thus don't install any untrusted programs on any kind of system unless you are willing to compromise this system or the data stored on it.


Incrementing Work-Factor of Hash Functions Over Time For a long time hash functions have required a work-factor in order to keep the operation "slow" enough to protect individual passwords in the case of a database leak.  Bcrypt and PBKDF2 being notable examples.

I'm also aware of the "Don't Roll Your Own" when it comes to security, but it's easy to imagine a situation that over time the work factor of your password hashing scheme becomes too quick because of hardware increases.  One could also imagine a situation where the owners of the database upgrade their own hardware and thus a higher work-factor is suitable compared to what was being used before the hardware upgrade to ensure better safety per-password.

The problem comes with having to "re-hash" a password, because you don't want to store a plaintext or even an encrypted password in a database so the system has no way to access the password again for rehashing to change the work factor.  To fix this, simply do this re-hashing when a user logs in.  Whenever the user logs in their plaintext password is already available to the system, on a successful hash verification of the password the system can check the previous work-factor associated with the hash of the password (easy to do in bcrypt) and if it is less than the standard work-factor selected by the system operators then the plaintext password is rehashed and stored with the new work-factor and new salt.  Sessions don't need to be reset as the same password is being used as before, just a different work-factor and salt.

Apart from the plaintext password being in memory for slightly longer during the verification of the password and an increased time in verifying the password whenever a work-factor increase is issued, I can't find any faults of this model. Are there any security flaws that I have missed?

You seem to have summed it up pretty well.
The only drawback I can think of is inactive users in your system - they will continue to have a previous work factor because they may never log in again, or may not have chance to log in before your next breach, meaning their stored password is more vulnerable to attack. As work factor is visible within the stored data, the attacker would know which ones are using the old setting (although they will not know the relative entropy within each password).
To prevent this, you could regularly disable accounts that have not been logged into for say 6 months, blanking their password at the same time. If they need to login at a future time, they can simply go through your forgotten password functionality to enable a new password to be set and stored with the new work factor.


Kali Linux metasploit and android attack by PAYLOAD In kali linux 2.0, when I run exploit in msfconsole and the victim opens my payload, how can I force the session to be persistent?

For Android platforms, when using the metasploit-framework project, you will need to utilize meterpreter as an APK installation in order to establish persistence.

The androidpayload is available here -- https://github.com/rapid7/metasploit-payloads/tree/master/java

A more-detailed post explaining all of the dependencies can be found here -- https://blog.ask-a.ninja/?p=39


What are the risks of using non-ssl connection between server and (externally hosted) database? I am building an application using AWS Lambda and using a MongoDB database hosted directly with MongoDB (Atlas). For some reason, I get an error when trying to connect via SSL and I've been working on it for days without any luck.

What are the risks, I mean real-world risks including scenarios, of using a non-secure connection when connecting to the database?

I guess in theory it's open to man-in-the-middle and if the connection is intercepted somehow they could read the contents of the request, but how would this work practically between AWS Lambda and MongoDB Atlas (hosted within AWS)? Someone would have to have some form of access to the network in order to eavesdrop wouldn't they?

As a good practice, the connection between the Server and Database should always be over SSL, whether the network/connection is exposed to the extra world or not. In this case, there could an MITM attack by the person having access to the network. Just remember the principles like 'Segregation of Duties (SoD)', 'Need to Know' and 'Need to Have'. Unauthorized should never have access to confidential information.


How to encrypt columns in a database and be able to easily change encryption key I have several fields in a database table I would like to encrypt, but I would like to do it in a way that would allow me to easily change the encryption key every n months for security reasons.

My initial thought was to store the IV with the row so I could use that to decrypt each entry where the key for the encryption would be stored elsewhere, in code or a configuration file. This seems like it will be a nightmare every n months when I needed to change the key, as I would have to have some job run that would need to change the IV for every row along with decrypting/encrypting again all of the necessary columns to the new key.

It just seems like this approach could also bog the system down while trying to decrypt and encrypt again. I have not seen a lot of articles describing practical approaches to this problem, just mentioning that the key should be changed periodically. Any help would be greatly appreciated, I am new to the encryption game.

Also, I am using AES-256 encryption.  I am using SQL Server but might migrate to MySQL in the future.  The application is coded in C# .Net.  We are storing personal information (irst, middle name, last name, ssn, etc.) and must be HIPAA compliant and we want to make sure as well that if a key is ever compromised we could quickly change the key on the fly.

If you are using MSSQL, switch to Transparent Data Encryption and don't encrypt by yourself. This will be massively more maintainable as you will be able to run queries against the data while encrypted.

https://connect.microsoft.com/SQLServer/feedback/details/676553/transparent-data-encryption-tde-for-sql-server-standard

Failing that (due to licensing?) use the built in cell level ecryption


Are there any guidelines for passwords that need to be read out loud? I recently saw the movie Olympus Has Fallen.
Like in many action movies, at the end a missile is launched, and the hero (Mike Banning, played by Gerard Butler)  has 60 seconds to recall the launch in order to prevent a disaster. (Spoilers!)

   The way to recall it is by inserting a password, but Banning doesn't have the password. Instead, he has radio contact with the pentagon, who do have it.

So the person from the pentagon is reading the password to Manning over the radio: "Lima, Charlie, Hashtag...". But Banning doesn't have a clue what a hashtag is, so he yells: "What?" And the pentagon perso repeats: "Hashtag?" And time is running out... And then someone else from the pentagon yells: "Shift 3!".

   And America is saved...

After the movie was over, I thought a lot about that scene. I realize that in real-life there are rarely cases in which a password should be read out loud (most of the time, if it happens, it's because people share passwords, and that's a different problem...).
But here is a case in which the only way to get the password is by saying it over the phone, and it's not a personal password - it's a password only used in an emergency, by whomever has access to the missile launch dashboard.

Now, I know there are various guidelines for passwords: How to make them easy to remember but hard to guess, how to avoid confusing characters, etc. But has anyone come up with rules for over-the-phone-read passwords? I agree, it's a small niche, but at least according to Hollywood – it could be crucial…

To be clear, this is not about "how to read it", but rather "how to choose a password that CAN be read, but is still strong".

UPDATE: Here is the scene, 1:30 minutes on YouTube.

Microsoft already has done something like this with their product key alphabet. They selected a subset of characters that are distinctive, and excluded characters that could lead to either confusion or offensive words.

The 24 used are:
2346789BCDFGHJKMPQRTVWXY

The 12 unused are:
015AEILNOSUZ

The hyphen character is used to separate five character groups, but is not significant.

Product keys are broken into five character groups, separated by hyphens for readability.  The fifth character of each group serves as an independent check character, ensuring only that the group of five was typed correctly. (It's just a check sum, and doesn't indicate if that group is part of a valid password or not.)

Why this relates to you is that if you are generating passwords, these can be completely unambiguous whether spoken or typed. Nobody has to ask "Oh or zero?" "Two or zed?" There are no symbols that can cause the difficulties you encountered. Furthermore, you would translate them to upper case in software to avoid case issues. And they are common to all languages that use the Latin alphabet.

The drawback is that with only 24 possible symbols, one character can offer only 4.8 bits of unpredictability. For equivalent security a password has to be three times longer than a password that can have upper case, lower case, numeric digits, and symbols.  To that, add another 20% for the check characters. That makes every 128-bit password a hefty 35 characters long, or seven groups of five. (Microsoft's five group scheme offers 96 bits of uncertainty.)


Is e-mail a direct vector for XSS I'm curious if there is a way to execute XSS via email.

I am not talking about using e-mail as a way to deliver a link that has reflected XSS in it.

I'm talking about sending an email from example.com and having javascript in that e-mail that executes as if it is executing on http://example.com (i.e. gets passed the browser same-origin policy and can read the response of an xmlhttprequest).

The first answer talks about sending an email from example.com to a user of gmail.com that could be used to attack gmail.com. It also mentions problems in Thunderbird but doesn't clarify if those would allow attacks on example.com (i.e. the origin of the mails) or somewhere else.

Yes,  this is a very serious concern when it comes to reading your email via a web browser.  In fact gmail has had this happen a few different ways.  In a broader sense,  XSS within an email could be used to spread an email based worm.  The XSS payload has access to your list of contacts and the also the ability to send email as you.  This is similar to the Sammy XSS Worm.

When it comes to a client like,  Outlook or Thunderbird this really isn't much of a concern because the context in which the script executes is mostly useless to the attacker.  Although this type of vulnerability has happened and this type of XSS could be useful for delivering a client-side exploit such as a html or javascript based buffer overflow.  The pairing of XSS in thunderbird with a buffer overflow would lead to a very nasty email worm.


How to find list of IP address in a network with multiple subnets? There are many subnets connected via a router in the same network.
I need to find list of all IP address available in each different subnet. I am able to get the list of IP address available in the subnet where I reside.

What is the best way to determine the rest of the subnets in use on my network?

As long as you don't have access to the router there will be no 100% accurate way to detect all the host on these networks.

If you know the network addresses and subnet sizes you can scan these networks using a tool like nmap to detect hosts. If you dont know the addressspace of these other networks but its a private network you can scan all the ranges that are available for private use. These are refered in RFC1918. Doing one or the other will of cause be very noisy and probabbly not accurate if there are strict firewall rules. Such a scan might even not be accurate if you scan your own network because in well segmented networks administrative services are only accessable from the administrative subnet(s).

// It is possible to scan the network you are not residing in as long as the router is routing that packages.

You can also scan every possible ip address with a low TTL value to ensure that its only one or two hops away. This will of cause take a very long time.

You should also consider the possibility that they are using IPv6 for some of their networks which will render scanning useless becaus the possible adressspace is too big.


How do Common Vulnerabilities and Exposures (CVEs) work? The Common Vulnerabilities and Exposures (CVE) system is a dictionary of publicly known information security vulnerabilities and exposures in publicly released software packages.

I am looking for a canonical answer to the following questions:

How do CVEs work?
How do you find a CVE related to a particular product?
Where can I find a hotfix for a CVE?
Do all listed CVEs have hotfixes?
What do I do if I can't find a hotfix for a listed CVE?

I have run a google search to identify, collect and view CVEs for different products. The results vary however, and I was hoping we would be able to use my question as a basis from which users can become aware of the CVE system, and can following a step-by-step procedure for identifying and collecting product CVEs.

As the name suggests it, CVE are divided to two categories: Vulnerabilities and Exposures both are mainly errors in a given software code or its configuration that respectively may allow an attacker to -for example- gain a privilege escalation (running a code as root on a user level environment) or to gain an indirect access to a system/network.

Before trying (at least) to adresse your points, its important to keep in mind that the very first stage of creating a CVE is discovering and disclosing a vulnerability. And for the sake of simplicity :

How do CVEs work?: Once a vulnerability is discovered and disclosed, CVE Numbering Authorities (CNA) assigns this vulnerability a CVE ID then post the CVE on the CVE List
How do you find a CVE related to a particular product?: There are many repositories around, like the one suggested by @bonsaiviking, you can use https://cve.mitre.org/, https://www.cvedetails.com/ or https://nvd.nist.gov/...
Where can I find a hotfix for a CVE?: Generally hot fixes are updates pushed by affected software vendors, this why its important to keep its Os, Softwares, Web browsers updated.
Do all listed CVEs have hotfixes? To make it simple, the answer is NO, researchers and bug hunters usually respect what is called  Vulnerability Disclosure Policy, to make it simple, a typical disclose starts by contacting the affected vendor and making it aware of the found vulnerability, by providing it a Proof of Concept for example and technical details, the vendor should correct the concerned vulnerability within 90 days  passing this deadline, the vulnerability could be disclosed, IF t this happens, then the "bug" is assigned a CVE.
What do I do if I can't find a hotfix for a listed CVE? In general, nothing except waiting an update from the vendor or avoiding the use of the affected software.

The answer was not exhaustive but hope it helped !


Setup and record outbound traffic from a botnet in a sandbox/secure environment How do I record the outbound 'attack' traffic from a botnet on a Windows XP machine? The captured traffic will be in the Windows XP firewall log.

I need to setup some kind of an experiment where I can use a Win XP firewall log for later analysis, for research purpose.

If you want to use the XP firewall log, just enable it - it works tolerably well.

Better may be to use wireshark, which will log the actual data sent out from the machine


Cipher Suite TLS 1.2 - Weak in OHS I am trying to correct weak encryption in TLS, by doing a test in SSL Labs, it throws weak encryption in the following chpher suite:

Current Configuration:

SSLCipherSuite HIGH:!MEDIUM:!LOW:!aNULL:!eNULL:!AES128:!SHA1

Cipher Suite TLS 1.2 - Weak:

TLS_RSA_WITH_AES_256_CBC_SHA256 (0x3d) WEAK
TLS_RSA_WITH_AES_256_GCM_SHA384    (0x9d) WEAK

  OHS Version: Oracle-HTTP-Server-11g/11.1.1.9.0 (Unix)
  mod_ssl/11.1.1.9.0

Try to solve with:

SSLCipherSuite HIGH:!MEDIUM:!LOW:!aNULL:!eNULL:!AES128:!SHA1:!SHA256:!SHA384

SSLCipherSuite ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM:!LOW:!SSLv2:!EXPORT

SSLCipherSuite ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS

SSLCipherSuite ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-CHACHA20-POLY1305:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:!RC4:!LOW:!MD5:!aNULL:!eNULL:!3DES:!EXP:!PSK:!SRP:!DSS

SSLCipherSuite HIGH:!MEDIUM:!LOW:!aNULL:!eNULL:!AES128:!SHA1:!TLS_RSA_WITH_AES_256_CBC_SHA256:!TLS_RSA_WITH_AES_256_GCM_SHA384

None of these settings worked for my SSL configuration in OHS.

Someone has eliminated those two issues in weak encryption?

The ciphers are considered weak by SSLLabs since they use RSA key exchange which provides no forward secrecy. To disable RSA key exchange in your ciphers add !kRSA. In general, just use the Mozilla SSL Configuration Generator to give you a secure setting.


PKCS#1-1.5 encoding - is there a reason to use 00 in block type? For encryption block looking like this: EB = 00 || BT || PS || 00 || Data
where BT - block type and PS - padding string,
I've read that we use three types of BT - 00, 01, 02.
Now, since 00 and 01 are for private key operations (where 01 is recommended - why?), like signature, and 02 is for public key operations, like encryption, I am wondering why it is not recommended to use '00' block type. Also, if it is not recommended, why is it even possible?

Apologize once again for being a newbie.

PKCS#1 only defines two "old-style" paddings (aka "v1.5" because these were the two paddings defined in PKCS#1 v1.5, while more modern versions add other options, known as "OAEP" and "PSS"). These two paddings are the "type 1" and "type 2". There is no defined "type 0" padding; of course, any byte can conceptually have any value in the 0 to 255 range, but PKCS#1 defines only two paddings, not three or more.

The two paddings do not differ only by the "type byte" (of value 0x01 or 0x02). The subsequent bytes (the "PS" string) are very important for security. In the "type 1" padding, the "PS" string consists only of bytes of value 0xFF; it is fully deterministic. In the "type 2" padding, the "PS" string consists of random bytes (the bytes must not have value 0x00, but otherwise they must be generated randomly in the 0x01..0xFF range). They cannot be used interchangeably. The type 1 padding is for signature, the type 2 is for asymmetric encryption. If you use a type 2 padding for signatures, then you obtain a very weak signature scheme (because of the malleability inherent to modular exponentiations). If you use a type 1 padding for asymmetric encryption, then you obtain a weak encryption scheme (because of the determinism of type 1 padding, allowing a brute force attack on the plaintext).

The "BT" byte that identifies the padding type is there chiefly (and mostly) to make the two paddings unambiguously distinct. Otherwise, one would have to worry about attackers using a signature as an encrypted message or vice versa. Thus, the two paddings should have a distinct "BT" value; the PKCS#1 authors could have chosen the two values to be 0 and 1, or 1 and 2, or 17 and 42, or any other pair of distinct values; they chose 1 and 2. This is arbitrary.

In any case, the importance of the padding is not in the "BT" byte, but in the bytes that follow (the "PS" string). It is not recommended to use a "type 0" padding because there is no such thing as a type 0 padding.


GnuPG passphrase entry and X11 sniffing Each time when I’m entering my passphrase in pinentry-gtk-2, every other X11 app may sniff it, as seen in

$ xinput test-xi2

running in the background.

What can be done about it?

Or do I have to trust hundreds of different processes running under my account(*) to not X11-sniff my passphrase when I’m typing it and not send my ~/.gnupg/ directory along with it over the internet to some adversary?

(*) Here, I’m not considering an almost-hardware keylogger running as root very close to the kernel, as not much can be done about that. I’m talking regular, user-land applications, like closed-source Skype or Insync.

The best solution is to run your session as SELinux user user_u or staff_u, which will much more strictly enforce inter-process communication between other apps and the pin entry app, which runs in gpg_pinentry_t domain.

By default, users are mapped to unconfined_u, which offers some protection, but not nearly as much as if you were to run things as user_u (e.g. you will notice that most things run as unconfined_t, but firefox plugins are executed as mozilla_plugin_t).

For extra high paranoia, you can try Qubes OS which solves precisely this problem -- but it requires getting used to the constraints it imposes on your work environment.


Third party exchange authentication My organization has an in-house user authentication system shared between a very large number of internal systems.

One of these systems needs to retrieve information from the logged in user's exchange account. Logged in here means logged into the system - the client is not necessarily a windows machine on our domain. However, the mapping to a valid windows user is known.

I'm trying to find a secure way to handle this without requiring the user to authenticate manually with both sets of credentials. The two suggestions are:

Store the users' plain-text exchange password in either the client or server of the service used to access exchange. Obviously if that service were to be compromised, this would result in the passwords being compromised.
Use an account allowed to impersonate all users. If this were compromised, then all exchange data would be compromised.

Neither is exactly appealing. Is there any way to pass our existing token to exchange and have an exchange plugin or service call to verify it?

I found a Microsoft blog (link) that addresses the problem.

  Code needs to obtain credentials at runtime based-upon its runtime
  security context AND that context needs to be valid with the
  server/app its code is going against.  This is what is used when
  default credentials with EWS are used – ie windows authentication.
  However, UseDefaultCredentials won’t work with Exchange 365.

A link to the proposed property

This would allow your application to connect as the current user and it would make sure you wouldn't have to modify the file every time the user changes the password, however, there are some limitations:

  You cannot use the default credentials of the logged on user if the user’s mailbox is hosted in Exchange Online or Exchange Online as part of Office 365. Instead, use the Credentials property to set the user’s credentials. The user’s credentials must be in user principal name (UPN) form for Exchange Online.

As for other authentication mechanisms, microsoft describes these:

OAuth 2.0 (Exchange Online only)
NTLM (Exchange on-premises only)
Basic (no longer recommended)

Here's a link with pro's and cons about the 3 methods above.

I honestly think having to store passwords when you are already authenticated with the Domain Controller in a way is a design flaw of the application.


Why is my website showing as secure in Firefox but not in Chrome? I am facing an issue with my clients website. It is showing as fully secure in Mozila Firfox but not in Google Chrome. Why is that, and how can I fix it?

Welcome! As suggested by @toom if you use Developer Mode you can see what the issue is. Looks like it's a Symantec certificate you're using which is causing the issue, please see blockquote below.

  The SSL certificate used to load resources from https://www.paypalobjects.com will be distrusted in M70. Once distrusted, users will be prevented from loading these resources. See https://g.co/chrome/symantecpkicerts for more information.

I will assume you're not aware but Google are dropping support on Symantec certificates that were generated on the old PKI infrastructure.

Google drops Symantec certificate support

To further add to this as per Daves comments please see Symantec sells SSL business to DigiCert


Cookie-Based Authentication Security of Popular Websites Let's take Google and other popular bank websites which uses cookie.

I've been working with a website using Angular which uses Laravel as an API. Data are stored in cookies which is vulnerable in client side including the JWT.

For websites using cookie-based authentication, what security implementation and practices they do to protect and secure the data from any attack aside from setting the security flags and options of cookie?

Here are some of specific cookie attacks:

CSRF, cookie
poisoning
XSS
Session fixation
Eavesdropping,
cookie hijacking/stealing
Cookie injection
from related hostnames
Cookie eviction
Direct cookie injection
TCP/IP hijacking

How popular websites and bank websites handle these attacks in order to protect the data stored in the cookies?

How can I protect myself against CSRF attacks?
OWASP offers a great cheatsheet, which aims at providing the basics of CSRF protection. Here is their summary of CSRF protection:

We recommend token based CSRF defense (either stateful/stateless) as a primary defense to mitigate CSRF in your applications. Only for highly sensitive operations, we also recommend a user interaction based protection (either re-authentication/one-time token, detailed in section 6.5) along with token based mitigation.
As a defense-in-depth measure, consider implementing one mitigation from Defense in Depth Mitigations section (you can choose the mitigation that fits your ecosystem considering the issues mentioned under them). These defense-in-depth mitigation techniques are not recommended to be used by themselves (without token based mitigation) for mitigating CSRF in your applications.

The basic gist is that you want to send the user a token with your application, and the user will have to send that token back with every request. If an attacker would try to get you to send a request when visiting their website, the attacker would have to "guess" that token, which may not be possible if the token is created well.
How can I prevent XSS vulnerabilities?
XSS, also known as Cross-Site Scripting, is an injection attack. Basically, an attacker is able to "inject" scripts into your website, causing the victim to execute them.
The way to prevent them is to encode your output properly for the context into which you put any user-supplied data. Input validation is seen as an additional step, depending on its complexity. For instance, checking if an input is a number is trivial to do. Checking if an input is valid XML is more difficult.
Since you specifically asked about cookies, setting the HttpOnly-flag is an effective Defense-in-Depth measure to prevent an attacker from reading the contents of cookies, even if an XSS vulnerability can be exploited.
Again, OWASP offers an excellent cheatsheet.
Session Fixation
Session Fixation is a problem in regards to session management. The attack works the following:

An attcker visits a vulnerable website and is assigned a session (e.g. session=abcd)
The attacker then sends the victim a link to the website, which establishes the same session. (e.g. https://example.com?session=abcd)
The victim then logs into the application.
The server now considers the session abcd to be an authenticated session with the victims credentials.
The attacker now has access to the victim's account, as the attack knows the session ID of the victim.

Again, this attack doesn't really have anything to do with cookies, and more with session management. There is also not really any "generic" advice, as it highly depends on the session management mechanism.
How can I prevent eavesdropping?
By using TLS and ensuring that cookies are only sent via secure channels. For this case, setting the Secure-flag instructs the browser to only send cookies via HTTPS, never plain HTTP.
How can I prevent Cookie Eviction?
According to I. Ristic's "Bulletproof SSL and TLS: Understanding and Deploying SSL/TLS and PKI to Secure Servers and Web Applications", Cookie Eviction is an attack against the user's browser. Browsers limit cookies in various ways, such as the size of the individual cookies, the amount of cookies per domain, or the total amount of cookies.
The attack consists of the attacker sending countless bogus cookies to the browser, causing it to delete older, but legitimate cookies, until eventually, only their bogus cookies are left.
This can be considered a Denial-of-Service attack, but one that can be remediated quite easily by deleting all bogus cookies and not visiting the attacker's malicious website(s) anymore.
You can, frankly, not really do anything against that. It's up to browser vendors to prevent this kind of attack.
About TCP/IP Hijacking
This TCP (and even more IP) is far below in the OSI Layers, and has absolutely nothing to do with cookies.

I am uncertain what you mean by "Cookie Injection by related hostnames" or "Direct Cookie Injection". Could you please elaborate further on that?


Can an exploit in my browser read login passwords without logging in again? When I log into my email account through a browser and open an email which exploits some vulnerability in my browser would it be possible for the attacker to take over my account? Passwords for full disk encryption are saved somewhere in the memory. I guess the same applies for browsers and passwords too but I'm not sure if user level access is enough to extract the password. Of course it would be possible to install a backdoor which logs the password on the next login, but suppose the attacker has only one shot to gather the password.

Yes, it is possible for an attacker to access your account.

Assuming your computer has been compromised, the attacker could easily gain access to your different accounts.

Different ways exist, such as retrieving the session cookies. Although they won't get your password, they could get directly logged in your account. (If you were already logged in.)

Other techniques includes grabbing the credentials stored in your browser, running a keylogger (as you mentioned), etc.


How to detect changes to client I am developing a Java game and money is involved. As such, I want to prevent people from modifying the client if at all possible (I'm a game designer, not a security expert). I know that it is impossible to prevent people from modifying the client, so what is a way that I could detect if people have changed the client? Is there some way to verify that the client is legitimate at start up or something? I know I can't completely stop it or detect all changes, but I just want to make it as difficult as possible for people who modify their clients to go undetected and gain an advantage.

You are approaching the problem from an entirely wrong perspective.

Whatever is on the client-side is out of your control. Any determined enough person will be able to bypass whatever measures you employ. Instead, have your server control and validate the important data. There's no reason for game money to be controlled by the client unless it is a single-player game and if so, why bother?