Stopping ill-mannered use of guest wifi I support a small business' tech issues including setting up a guest WiFi network.  The WiFi is important since they want people sitting around and consuming their product. Over the past months they've received numerous DMCA notices from their ISP regarding someone who insists on downloading porn via P2P. We're currently using a consumer-grade netgear access point.
We're looking for ideas on how to stop the bad actors without sacrificing the service to our customers.

It does not take much effort to block P2P etc with current routers and restrict access as this detailed article from 2011 (Lifehacker) shows.

But unless you restrict access a lot and thus make users unhappy they will still be able to upload copyrighted content to youtube, make bomb threats etc. If you don't want to deal with these liability issues (which also differ between countries) you better let  a commercial hotspot provider deal with it. These providers usually create a separated network for the guests and route the traffic over their own infrastructure. This way they appear as the source of the traffic and not you and thus they also handle all the liability problems. Of course this shift of responsibility has a price which either you or your customers must pay.


How to detect if file is being modified while my program reads it? I'm writing an auto-updater tool that is run with admin permissions. It's job is to download and install files from a tat archive.

The problem is solved to the point where I can verify identity of the file with ecdsa signature. However there is nothing that prevents file from being modified after signature is verified but before it is read.

One solution is to read file into memory and then verify signature of that data. However update files may be several hundreds MB and I would like to avoid eating that much RAM.

Another solution I can think of is to change permissions (at least write) to be only accessible by admin. I'm not sure if it opens any other vector of attack though.

Yet one more solution is to detect if file was modified after signature was verified but before data was read completely. I don't know if OS provide reliable and trusted method to do this.

My updater will work on Windows and OSX.

UPDATE

Apparently, changing owner or file permission won't help if attacker already opened file.

UPDATE 2
I come up with the following solution:

Archiving:

For each archived file also store its ecdsa signature of sha256 digest
Along with archive store its ecdsa signature of its sha256 digest

Extracting:

Open archive, verify its signature
Without closing it, begin unarchiving
Create temporary directory with rwx access by root / administrator only. Forbid all other users
Extract file into that dir, verify its signature, install it into target location. Repeat for each file
Delete temporary directory

Since you are already using a signature verification method on the file itself, just modify that system a little bit:

Sign individual chunks of the file, and store the signatures inline.  If your signature takes 32 bytes, and you use a 4,096 byte chunk size, you can have 4,064 bytes data + 32 bytes signature in each chunk.
Sign the list of signatures, and store that signature also.
To verify the entire file, verify all chunk signatures and the final signature.  If you then keep the signatures in RAM while you are reading your file, you can be assured that it has not changed since the time you verified it.  Any change will result in an invalid or valid but mismatching signature.

Alternatively, if you cannot store the signatures inline, use a file just for that purpose.  Either way, you can basically prove that the file hasn't modified since you verified its contents.


Backing up an encypted drive on an encrypted drive I have searched, and have been unable to find an adequate answer to my question. My apologies as I'm sure this is a relatively elementary question for the users here.

I have encrypted my Windows 10 boot drive with BitLocker. I have also encrypted my USB backup drive with BitLocker (separate Recovery Keys). I am using Macrium Reflect to do Grandfather, father, son back-ups to this drive.  This drive stays connected to my system most of the time.

Additionally, I would like to add a second back-up drive that I do NOT leave connected to my system, to protect against ransomware attacks. I will, presumably, be encrypting this drive as well.

I am concerned about my ability to recover from my backups in case something happens, considering every drive is encrypted with a different key. My biggest concern is the second back-up drive, which will likely be an image back-up. I will be encrypting an already encrypted image. Assuming this is the case, it begs the question if I even need to encrypt the second back up drive, as the data backing up to it will presumably be encrypted.

Considering this architecture, should I be able to recover fully in the event of an issue?

You can encrypt encrypted material as many times as you like and assuming proper implementation by your software vendor, should also be able to unwrap all of those layers of ciphertext without issue.

However, keep in mind that if you have ransomeware running on your system and it is encrypting the data it has access to, every time you connect your primary, secondary, tertiary -> ad nausem, drive to the system, it runs the risk of also being partially or completely encrypted by said ransomware.

A point of clarification, BitLocker does nothing for you to protect against ransomware.  Drive encryption or whole-disk encryption protects your drive if it is physically stolen.  Then an attacker would have to have your key to unlock the drive and read the contents.  While your machine is turned on, the key is dynamically decrypting the drive on the fly so to your OS (Windows), it does not appear encrypted at all and can have individual files encrypted with no problem.

Your best bet, in my opinion, to protect against ransomeware is to rotate your backup cycles with different hardware.  Lets say you perform backup once every two months.  Use 3 different same sized hard drives (don't necessarily need to be encrypted) that you rotate their use.  Each containing roughly the same amount of data.  If you lose your computer's drive to ransomware, you have 3 drives over a 6 month period that is less likely for the ransomeware to be patient enough to get all of them.


Are there any known Heartbleed attacks? Are there any known instances of malicious security breeches exploiting the Heartbleed vulnerability? Or is there at present only a known vulnerability, albeit a very serious one?

There's several proof of concept examples out there, and researchers have been able to use these to steal private keys and user login credentials, among other things.

I have come across a blog post detailing how to use a python script to automate fetching user session information from a vulnerable server. I have also heard people were able to steal Yahoo login credentials in plain text.

So yes - There are attacks that work and potentially anyone could be using them right now.


Is flash less secure now that it is End of Life? As of this month, the Flash player has been disabled from all mainstream browsers. However, several platforms are still offering ways to use Flash content, most notably the games hosted on said platforms.
How (in-) secure is this method of using Flash? And especially how does this differ from last month?
Considerations:

The method of access may matter, let us assume one uses the latest version of their recommended player, not an old version of a regular browser.
There must be multiple threat vectors, if the platform or content supplier has bad intent it is presumably completely insecure, but perhaps this was already the case before this month as well.
It might or might not help if one had a way to not access any new content, but only content that was already created and accessed before this month.

I believe all major flash platforms did this: NewGrounds, Kongregate, Armorgames
I know Kongregate.com is pushing the SuperNova Flash player so let's focus on that if the platform matters for the answer.

End of Life means that Adobe will no longer provide any updates to it. That means if anyone (had already) found a vulnerability today, Adobe would not patch it - regardless of how critical it would be.
How much of a problem is this in practice?
How lucrative of a target Flash is becoming depends on how many people still cling to it - despite being told with brightly flashing red warning labels that they shouldn't. After all, even to this day, there are people running on Windows XP. Flash is, from a security point of view, in a relatively good position (compared to Windows XP), as there has been plenty of time for developers to switch to alternative options, such as HTML 5. Furthermore, Flash is rarely used for enterprise applications, and as such companies have very little incentive to keep Flash alive - which in turn makes it a less lucrative target for attackers.
What are the actual real life risks of using Flash?
That depends on the vulnerabilities being found. The more time passes, the more severe the vulnerabilities will become. Since the end of life period has barely begun and news articles of "the big Flash vulnerability" haven't flooded in yet, I would cautiously rate it as "probably not extremely dangerous yet". However, regularly using Flash even after end of life is just asking for trouble - as such, every security expert will recommend you not to use it.
What about third party Flash players?
Flash content is provided through a number of file formats, which are more or less publicly documented. Even while Adobe's Flash player was still actively maintained, other third-party projects like Gnash were being developed, which sought to offer an open-source alternative to Adobe's proprietary software. In theory, it is possible to develop a feature-complete and secure flash player, but I doubt that this will ever happen.
The reason for this is the fact that Flash has lost all relevance. Nobody develops content for Flash anymore, outside from niche groups. As such, "keeping Flash alive" should be seen more as an archival project, similar to emulators for old video game consoles. After all, this too is history worth preserving.
Are third-party Flash players safe to use?
I don't know. Nobody can really know until these players have been audited to a satisfactory degree. If all you care about is occasionally playing your favourite old Flash games, then it will probably be fine to download the files and run them locally. If you aim to keep that one business application running that was developed in 1998 using Flash...then I would advise against that.


Is Certificate validation done completely local? Am I right in my conclusion that validation of a certificate by a client that wishes to communicate with a server that offers said certificate, is done completely local? As in, the client is supposed to have all information (eg. CA's public key, used to sign the servers certificate) already locally available?

The exceptions being, I think, comparing the ip address/dns information offered through the certificate with the real world servers address and domain name.

An answer in another question (SSL Certificate Trust Model) in fact explictely states "In fact that's the whole idea of certificates: to allow offline validation.". Is that true?

It is almost true. :) But not entirely.

A certificate can be revoked in case of a compromise. The only way to discover if a certificate is revoked at any given time is basically contacting the CA that issued it. Any info signed in the certificate itself (fit for offline validation) will be valid for a revoked cert.

There are two protocols for checking revocation, CRL and OCSP. A CRL is just a list of revoked certificates published by the CA, and OCSP is kind of a web service, but the idea is the same, any client doing cert validation should have a look and check if the certificate happens to be revoked.

In fact, a fairly common flaw in cert validation implementations is that they don't check revocation.


follow up to previously answered "Escalating from Apache shell to root" I have seen numerous questions similar to the above with answers that relate to elevation of privileges to those of root. the answer and example that silverlightfox has given is one of the better defined.

The issue I am having as I try to emulate this exploit is that within my VM installation of Linux Red Hat 2.4.xx with various exploits that list source code, is that my non-root privileges on the box will not allow for compiling (gcc is installed) or executing a binary file.

unless I am way off base here, the source coded (listed by silverlightfox) and other found across the net (exploit db, etc) must be compiled and run on the target machine.

if the non-root access you get (find the username and password, remote exploit, etc) will not allow compiling or running a binary file, what other options are there to 'exploit' the source code on the target machine? I would think that metasploit would handle the automation, but as much info as I have seen about running the binary file on the target machine makes me think I am doing something way wrong.

You don't have to be root to compile and execute code. Presumably your configuration limits access to the necessary compilation toolchain such that your user can't do it.

Attackers can get around this by pre-compiling the necessary binaries or by dropping a pre-compiled compiler or interpreter of their own onto the system.

Best to start out by getting to know your system, your user environment, the tools necessary for carrying out your workflow, and how your local permissions affect it all. THEN move on to understanding how exploits work. Because unless you understand the basics, that stuff isn't going to help.


Should security-critical code be reused or rewritten? Usually, in programming, reusing code is always a better idea than writing your own implementation of an algorithm. If an implementation has been around for a long time and is still used by lots of projects, it is likely to be pretty well designed to begin with, have received plenty of testing and debugging, and perhaps most important someone else is in charge of maintaining it which means more time to focus on the specific software product that you are building.

However, I was wondering if this principle still holds true for security-critical code, which performs tasks such as encryption and authentification, or which runs with high privilege for any reason. If one implementation of an algorithm is shared by lots of software systems, then there is a strong incentive for people to crack it, and when a flaw is found in it, it is likely to be a massive security disaster. Heartbleed and Shellshock are two recent examples that come to mind. And for closed-source examples, pick anything from Adobe :)

Many different pieces of software sharing a single security-critical library also makes this library a target of choice for attackers wanting to insert a backdoor in it. In a large open-source project with lots of activity, a backdoor commit which also features plenty of other corrections (such as a code style cleanup) as a decoy is unlikely to be noticed.

With all this in mind, is code reuse still considered a good practice for code doing security-critical tasks? And if so, which precautions should be taken to mitigate the aforementioned weaknesses of that approach ?

The important thing is maintenance. Regardless of whether you reused existing code or wrote your own, you will achieve decent security only if there is someone, somewhere, who understands the code and is able to keep it afloat with regards to, say, evolution of compilers and platforms. Having code without bugs is best, but in practice you must rely on the next best thing, i.e. prompt fixing of bugs (especially the bugs that can be leveraged for malicious usage, also known as vulnerabilities), within a short time frame.

If you write your own code, then the maintenance job relies squarely on your own shoulders. And that job can be very time-consuming. For instance, if you decide to write and maintain your own SSL/TLS library, and use it in production, then you must understand all the peculiarities of cryptographic implementation, in particular resistance to side channel attacks, and you must keep an eye on published attacks and countermeasures. If you have the resources for that, both in time and competence, then fine ! But the cost of maintenance must not be underestimated. Reusing an existing library, especially an opensource one that is widely used, can be quite cheaper in the long term, since maintenance is done by other people, and widespread usage ensures external scrutiny. As a bonus, you cannot be blamed for the security holes in an external library if half the World shares them.

To sum up, the question is not really about code reuse, but about maintenance effort reuse.

(I write all this independently of the great pedagogical qualities of writing your own code. I encourage you to do your own implementations -- but certainly not for actually using them in production. This is for learning.)


Why does a Revoked PGP Key show under my Valid Key? TL;DR

As you can see, I revoked keyid 178AA2B7 recently.

pub  4096R/178AA2B7 2014-08-13
sig revok  178AA2B7 2014-08-13 __________ __________ [selfsig]
     Fingerprint=321F 31A7 BB1B 60C7 490F  B80B 2809 4F6A 178A A2B7

uid Eric Duncan (eduncan911) <ed****n911@gmail.com>
sig  sig3  178AA2B7 2014-08-13 __________ __________ [selfsig]
sig  sig3  178AA2B7 2014-08-13 __________ __________ [selfsig]

sub  4096R/0AD3364B 2014-08-13
sig sbind  178AA2B7 2014-08-13 __________ __________ []

But why does 178AA2B7 show up under my valid/primary/active key?

pub  4096R/A510AA8C 2014-08-13
     Fingerprint=78A9 13EA AF81 2415 4B50  0B2A 5CE0 F95A A510 AA8C

uid Eric Duncan (eduncan911) <me@ed****n911.com>
sig  sig3  A510AA8C 2014-08-13 __________ __________ [selfsig]
sig  sig3  A510AA8C 2014-08-13 __________ __________ [selfsig]
sig  sig   178AA2B7 2014-08-13 __________ __________ Eric Duncan (eduncan911) <ed****n911@gmail.com>
sig  sig3  A510AA8C 2017-06-26 __________ __________ [selfsig]

uid Eric Duncan (eduncan911) <ed****n911@gmail.com>
sig  sig3  A510AA8C 2017-06-23 __________ __________ [selfsig]

uat [contents omitted]
sig  sig3  A510AA8C 2017-06-23 __________ __________ [selfsig]

sub  4096R/E08B9994 2014-08-13
sig sbind  A510AA8C 2014-08-13 __________ __________ []
sig sbind  A510AA8C 2017-06-27 __________ 2018-06-27 []

sub  4096R/8666E626 2017-06-27
sig sbind  A510AA8C 2017-06-27 __________ 2018-06-27 []

More to the point... How do I get rid of it?  I've tried editing the key but I cannot see it in any of the prefs or uids or subkeys.

(To see the full output, see this link: http://pgp.mit.edu/pks/lookup?search=eduncan911&op=vindex&fingerprint=on )

I created my identity a few years ago with two separate PGP keys.  Only recently did I find out about the ability to add multiple uids to a single key.  So I have added my two email addresses to the primary key I have been using, and published in the WOT.

I also revoked one of my original keys - as I never used it.

http://pgp.mit.edu/pks/lookup?search=eduncan911&op=vindex&fingerprint=on

But as you can see, it shows under my primary key that is still valid.

Some additional information...

There was a piece of software once that I tried to import my private keys into (the two separate private keys from both accounts) and it always told me I had already imported a key for my @gmail address.  It would never let me import both keys.

Now, I suspect I originally goof'd something up when I made those primary keys years ago.

Thanks!

You're looking at a certification (signature) that you issued from one of your keys to the other one. All the output you're looking at says is that there is a crytographically tested certification from the one key to the other, but it does not make any assumption on the validity of that key (whether it is verified, trusted and not revoked).

Two things considering OpenPGP are important here: OpenPGP is built to never forget anything to be resilient against deletion attacks and due to the distributed nature of the key server network (there is no way to delete information from the keyserver network, just mark it as revoked). And no certifications, ... are to be trusted unless verified through a so-called trust path from your own key to the key to be validated.

GnuPG will not account the revoked key any more when recalculating the trust database, no matter whether the signature is listed or not.

Deleting signatures is not really considered as use case in GnuPG. If you really want to delete it, you will have to decompose the public key using gpgsplit, search for the proper signature packet and recompose and import the public key again. But this is not really useful: as you cannot delete the signature from the key server network, next time you fetch your own key the signature will be added again.


Before encrypting text, would encoding it with non-std. chars (ex: Asahi Characters) make it more secure? Before encrypting text, would encoding it in a non-standard character set (such as Asahi characters) make things more secure? Maybe not to a state-actor, but to the "hacking community at large", would using non-standard character sets be more secure?

For example, Asahi character encoding is not even a part of the core Java libraries.

No,  it won't make it more secured if attacker already decrypted the data he will find the encoding type and simply decoding it it's not making it more secure just use a strong cipher AES with blocks mode of operation like CBC or CFB with 128bit block size and random 16byte key and random IV every time and your data is secured now!


Is it ok to send plain-text password over HTTPS? I understand why the password should be salted and hashed before being saved into the database, but my question is if it needs to be hashed on the browser side or just sending plain-text password over HTTPS is considered to be secure.

If it is ok, is there any document which I can use to prove to my client that the system is secure? If it's not, what are the best practices?

It is standard practice to send "plaintext" passwords over HTTPS. The passwords are ultimately not plaintext, since the client-server communication is encrypted as per TLS.

Encrypting the password before sending it in HTTPS doesn't accomplish much: if the attacker got their hands on the encrypted password they could simply use it as if it were the actual password, the server wouldn't know the difference. The only advantage it would provide is protecting users that use the same password for multiple sites, but it wouldn't make your site any safer.


The source addresses are not totally unknown: the first one is from canonical.com, which hosts Ubuntu packages (therefore I suppose that your system runs Ubuntu, and currently tries to see whether there are available updates for your installed packages). The second address is stackoverflow.com, a well-known site in these parts. Most probably, these packets are just part of client connections from your computer to the Internet at large, for which your router runs NAT (which is its primary job). Port forwarding is for incoming connections (from outside to your system).

The log shows that the packets go through your eth1 network adapter. On a Linux system, this is the second adapter, the first one being eth0 (possibly, you have an ethernet interface and a WiFi adapter, and you use the latter). tcpdump uses eth0 by default, which would explain why you see no packet with it. Try using the -i option for tcpdump (see the man page).


MITM attack foiled by network? I would like to clarify that this is not aimed at being a malicious attack and is being assisted by my school's IT department and my computer science teacher. It is fully sanctioned.

The primary goal is to intercept a computer, then using the driftnet program to intercept all pictures being loaded to the client's computer.

The syntax of my commands is correct (proved by me testing at home with perfect results), but I think my failure is related the school's networking. This is supported by the fact that when I run bettercap with targets specified correctly, it returns that it is unable to determine the router's MAC. When I run arpspoof, the output appears to be completely normal, but the client's Internet is completely interrupted, it is stuck at loading then displays a connection error. This is fixed when I stop arpspoof. And yes, I have run: $sudo sysctl -w net.ipv4.ip_forward=1

My procedure:

10.47.68.107 is the client
10.47.0.1 is what the client says is the router in preferences

Other clients are always assigned 10.47.x.x, the x appears to increase as the spots are leased. All clients show 10.47.0.1 as the router. However there are clearly around 100 access points in the school.

I start an arpspoof session from the client (10.47.68.107) to the router (10.47.0.1) and vice versa. Next, I start driftnet. This same exact procedure worked at my house, which leads me to the conclusion that this is a networking problem. What am I doing wrong?

I'm using Parrot Sec OS 3.5 (Full)

First of all, I always prefer MITMF tool to practice a "Man In The Middle Attack".

In addition, monitor the network traffic during the attack using Wireshark to identify what is really going on in the network.

Moreover, you should make sure about DNS settings of your school. The DNS settings can be different between your home and your school. Large public areas such as schools, universities usually configure their own proxy and DNS settings. The difference in DNS settings usually the cause of "no internet" problem while trying a MITM attack.


Does InfoSec include monitoring? I am new to InfoSec role, and not really sure if it includes responsibility for monitoring: that's, when we write policies and procedures, who is checking whether they've been obeyed or not? Is it internal audit, is it InfoSec?

It can be either, depending on the purpose of the monitoring.
InfoSec needs to monitor in order to respond to issues quickly and efficiently so that risks are limited right now.
Governance, Compliance, and Audit will want to monitor in order to ensure that the controls, processes, and policies are working as intended and having the intended effect over time.
However, every organisation can have different resources and needs, and Infosec might also gather and review data for compliance and audit purposes. This is most common in small orgs with small teams where only the infosec people really understand the compliance issues and what the data means.


Are iPhones intrinsically more secure than updated Android phones? If I replace my current smartphone with a Google Pixel, which would get updates pretty quickly, would I be just as safe from hackers as I would be using an iPhone? This is assuming I don't install shady apps, of course.

If you're wondering what my baseline for security updates is, I have a Google Nexus 6 (good support) and used to use a Samsung Galaxy S III (not very good support IMO).

Thanks in advance.

I will attempt to make this question which could easily be viewed as an "opinion based answer" into something with concrete facts.

I think that, on a whole, the Android ecosystem is a tire fire. If you put every iPhone sold up against every device running Android sold up against each other and compared which platform had more security vulnerabilities, Android would win by a landslide. The reason for this is the variety of form factors and phone manufacturers makes cheap hardware possible, but you have no vetting of your supply chain in many cases. We have seen Android handsets sent with factory installed malware in several cases. Couple this with the fact there is no easy native backup solution which drives people to root their phones and you have an environment where malware can thrive.

Now with that said, if you put a Google Pixel, which was purchased from the manufacturer, not rooted and running the standard ROM (without any carrier bloatware) up against an iPhone I would argue that there is no difference in security between one or the other. Both manufacturers tightly control their supply chain and manufacturing process, as well as put out ROMs or OS's with a security focus in mind.


ShellShock vulnerability and Java Web Applications I am running a java webapplication ( Spring 3.2 based) on linux hosts.
The linux hosts are vulnerable to the ShellShock vulnerability.

Can someone exploit this vulnerabiity on my website ?

This is very difficult to answer, as no one here does know how your application is built.

As long as you are not executing (either directly or indirectly) any system commands your application should be save.

There is only a risk when you execute commands (either directly or indirectly) in the shell out of your application.

This risk is very high if you execute shell commands (either directly or indirectly) that your users are entering as then your system is vulnerable.

Executing shell commands out of a Java web application is very unusual and not needed in almost all cases.


How to Estimate time taken for Web Application Security Testing? I would like to do some kind of estimation for time taken to test a website/ web application for security vulnerabilities. I will be testing websites against OWASP Top 10

Based on my understanding, Number of static/dynamic URLs, number of parameters to test (URL, Body) in a website , other insertion points like cookies parameters , parameter name, HTTP Headers, REST Style parameters are all the contributors towards the time taken. Please correct if I am wrong.

With that said, what are all the factors that we can include for arriving at a time taken for performing security assessment ?

Also, Since estimation should be done before we start testing and number of URLs / Parameters in a website will be known in later stages (like after spidering/crawling), is there any way that we can do the estimation beforehand ?

Business Logic, Number of functions to test, Number of Privilege levels may have an say on the time taken, but still will it not break down to the number of parameters that we are going to test ?

I would like to do this estimation to convince my client about the time taken for performing assessment.

For example, if my client asks to perform assessment of 10 websites in 'n' days, I should be in a position to tell them with proof/estimation that it will take 'X' time.

Could some one share your thoughts ? Is there any methodology for this ?

You cannot provide proof that it will take n days for the vulnerability assessment. You can provide them with an estimation.

When I scope an application for testing, there are a few things I look at. Most of it is what you've already covered.

What the application does (process money or HR data, or serve a blog)
How large the application is (a few URLs/pages or a lot; just content, or lots of functionality)
How complex the application is (size and complexity are not always the same thing)
How many roles are involved (eg user, admin, super admin)
Any APIs involved (eg REST, SOAP, custom)
Multiple clients involved (eg mobile, thick client, and web)

Like anything, it takes experience to be able to accurately scope an item for testing. You'll take in to consideration how long an application of similar size and complexity would take you to test, and scope appropriately. Depending on where you work, there may be a formula for x time spent on different types of functionality and other factors, that's up to your employer.

If you have the option, I would suggest listening to someone more experience on your team do the scoping so that you can understand how they do it and why they made the decisions they made. Under-scoping or over-scoping for a client can cause one or both of you issues. If you under-scope it, you or the person on your team may not have enough time to complete the testing, and over-scoping can cause the client to spend money unnecessarily. Mistakes are made of course, that's part of the learning process, but it's important to understand why things are scoped the way they are scoped before jumping in without the experience to back it up.


Does adding a random character to a pseudo-randomly generated password improve entropy significantly? I'm asking a practical question. I was taught computers are bad at generating random data. Does this mean password generators, such as the one built into Keepass, suck? If yes, then would it help for the user to manually enter a character or two in the generated password?

Humans are rather terrible at generating random data. Ask a person to give you a random number between 1 and 20 one will get a lot more 7's and 17's than other numbers as we perceive those numbers to be more "random". (Source: http://scienceblogs.com/cognitivedaily/2007/02/05/is-17-the-most-random-number/)

Computers on the other hand are deterministic and as such cannot generate true random data on their own. So pseudorandom generators are used which are slightly complex equations. Those equations need a seed which should be somewhat random. To generate this seed here are some methods:

High resolution of time measurement (often clock cycles) at the time of execution
User input, often from the mice, good implementations use the human inability to perfectly control the mice
External randomness generator, there are external devices that use some not deterministic chemical or physical process or some environmental parameters that fluctuate a lot to generate random data.

So to answer your questions.

  Does adding a random character to a pseudo-randomly generated password improve entropy significantly?

Adding characters to a password even when not perfectly uniformly distributed increases entropy. Is it significant? This mostly depends on the length the password already had, see Anonymous Coward's comment on this answer for an explanation.

  Does this mean password generators, such as the one built into Keepass, suck?

This completely depends on the way the seed gets generated. I do not know how Keepass does this but there are definitely password generators that use very good seed generation methods (sometimes combinations of methods).

  would it help for the user to manually enter a character or two in the generated password?

Assuming the resulting password stays the same length then it depends from your vantage point. As I said humans are very bad randomness generators and as a result this would theoretically reduce the entropy of the password. However it does add more variables to the password generation process which if correctly implemented could increase the strength of the password against attacks directed at the pseudorandom algorithm and seed process.

Edit: reply to comment

  How could a human adding 1 or 2 random characters (in a random position of the existing password) decrease entropy?

I'll assume you mean replacing 1 or 2 random characters as like I explained above, in answering the title question, just adding random (even if not uniformly distributed) characters will always increase entropy.

So let's look again at the process of generating the random data:

obtain a seed
use the seed as an input to the pseudorandom generator
obtain output from the pseudorandom generator (and use it somewhere)
use the output as the next input to the pseudorandom generator (this is most often done behind the screens of the pseudorandom generator)
repeat from step 3

A rather simple process and as a computer is deterministic the only unknowns to some attacker are the seed and the number of times the process is iterated before the output is used for the specific password we are trying to breach.

If one looks at this process one could wonder why not always calculate a seed and use that as random data, in the end the seed is what makes the process random. So what is the job of the pseudorandom generator? It's function is twofold, first of it allows multiple random data to be generated from one seed. This is important as good seeds are expensive. Next and maybe more importantly it creates uniformly distributed random data. And this is very important as the seed (say when we are using some time measurement) will often have some structure.

Now when you replace 2 characters of this uniformly distributed random data with less uniformly distributed random data (remember the 7's and 17's) then you are reducing the entropy of the password. However this does not necessarily mean the password is therefor harder to break, as it creates an extra unknown to the system next to the seed en # of iterations.

However as a side-note from a theoretical standpoint one could use those 2 characters of user input to help create the seed which could increase entropy in the system, depending on the previous seed method and what else is used to create the seed.


Can Keyloggers get passwords from Windows 7/8 Logon Screen? If yes, do you know some examples of Keyloggers capable of perform this?

EDIT: I mean when logon in the windows right after power on the PC and/or when locked with Win+L.

The log on screen is created by the WinLogin process. If a program can bind to the WinLogon process then it can most definitely keylog your login password.

The Metapreter Payload from the MetaSploit library is a good example of a tool capable of migrating into the logon process. You may look at "MetaSploit Unleashed", to learn how to compile Metapreter into a binary payload (.exe) or attach that to another (.exe) and obtain the same results.

A good demonstration of the technique can be seen at : Clicky

More References:

http://www.offensive-security.com/metasploit-unleashed/Backdooring_EXE_Files
http://www.offensive-security.com/metasploit-unleashed/Existing_Scripts

Note: Use of any kind of malware or spyware should only be done with prior consent of the system owner and/or users.

Also, look at Polynomial's comment below for other ways. +1 to him ;)


How to make weak passwords stronger? I am storing our customers' passwords with PBKDF2 and I would like to make these weak passwords more stronger (I don't want to restrict user to some very specific password length or special chars etc).

My idea is as follows:

Take user (weak) password
Generate random string ("salt") of defined size (cca 20 chars), encrypt it (we use Amazon KMS) and save with other user data
Combine weak password with this random string (note1) - the final length will be size of random generated salt
Generate hash with PBKDF2 from this "stronger" password string

Should this process make passwords more secure / stronger?

note1) How to generate this stronger - "password" it should be some sort of combining original password and random generated string. Some ideas? This algorithm must be deterministic.

The only way to make passwords stronger is to disallow weak passwords.  The reason a password is weak is that an attacker can guess it, not because of how you store it.

I've found http://www.passwordresearch.com to be a great resource for academic studies on passwords.  You may be interested in Designing Password Policies for Strength and Usability, which explores the effectiveness of policies on making passwords hard to guess, and how easy they are to remember.


Can I export my digital certificate to this emtec usb It is said here

http://www.emtec-international.com/sites/default/files/s530_aes_en_0.pdf

2048 bit RSA module: ready for PKI application
SHA256 data hashing: ready for digital signature

Does it mean it is an usb token where I can export my digital certificate that will automatically prompt for pin code ?

Possibly. Or not. The data sheet is quite short and lacks details. Most of it is about AES encryption for data storage, which is orthogonal to usage as a private-key storage token. The two lines you quote are the only indication that the device may act as a smartcard-for-PKI at all. Come to that, there is not enough text on this PDF file to decide whether the most touted encryption system is applied correctly or not (it seems that the encryption occurs in the hardware, which is necessary, but not sufficient for appropriate security). A cursory look at EMTEC's Web site did not yield additional data (however, it did reveal a line of USB drives in the shape of Angry Birds, which is rather fascinating and might perplex a future archeologist a thousand years from now).

There is not a single trace of any kind of conformance to FIPS 140-2 or an EAL level. I would be wont to claim that such standards guarantee any kind security; but they still are widespread standards, and I find the lack of information about conformance to these standards quite discomforting.

Note that if the device is able to act as an asymmetric key store and signature engine (something which Windows would call a Cryptographic Service Provider), with the popup asking for the PIN code at the time of usage(*), then serious, competent setup would require private key generation on the module too. Ideally, the private key should never exist outside of the tamper-resistant hardware. That's one of the things about which FIPS 140-2 is rather insistent. RSA private key generation is heavier than simple signature computation, so some modules can do the latter but not the former.

(*) If the host PC handles the PIN code entry itself, then the security model must assume that the PC is secure and free of keyloggers, an assertion which verges on the preposterous.


HTML 5 postMessage PCI compliant We're building an application (App-A) that will allow a user to enter credit card information. This application will live on a non PCI compliant zone.

We have another application (App-B) that also does credit card processing and this application is in a 100% PCI compliant zone.

If we want to leverage the functionalities of App-B, we'll need to embed it in App-A.

What I want to know is - are we still considered PCI compliant if App-A sends data to App-B via HTML 5 postMessage API.

It depends, the key on this is to ensure that the card data is not stored in any insecure (or generally readable mechanism). Vendors such as stripe.com, recurly.com and others have used JSON-P or other secure post technologies combined with one-time tokens to represent the transaction to avoid merchants processing actual card data. These work very similar to the method you describe & allow the zone for App-A to be classified as a lower compliance required level. To that end a post of the card data to App-B without storing or processing on App-A shouldn't be an issue.

Ensure, however, that on App-B you have a strong method to validate the source domain. The postMessage API itself isn't an end-all to allowing cross-origin data.


How can I recover my encrypted data from a Sandisk Secure Access I had saved my all important and personal data on sandisk secure access 2.0 on 16gb pen drive cruzer but after 1.5 month when I connect my pen drive to the system, it asked me to generate new passwords, which I did, but I was not able to see my stuff. But in other sandisk secure access folder I have all files encrypted.

How can I decrypt those files?

The downside to encrypting your data, is that if you lose your password, and it wasn't an easy one; it's pretty much game over.

As you made the password (you did, right?), try any password you ever made. If that fails, try using a script that brute forces the top 10 000 most used passwords, there are password lists scattered all over the itnernet. If that fails your last resort may be to brute-force the password, Kali Linux has lots of great offline password cracking tools.

Note: Brute-forcing passwords can take a LONG time (we're talking anything from an hour to 300 billion years if you have a decent password) if your password is anywhere above 5-6 characters. You can test how long it would take to bruteforce a certain password on this website: www.howsecureismypassword.net.


Log User In Automatically After Clicking Account Activation Email Scenario: Forum account registrations, user must click an activation email after they sign up e.g. they create an account with username, email, password, and an email is sent to the email they select. They must click it to "activate" the account.

Lets assume that all steps up to the clicking of the email are secure for the use case/purpose of the site.

I understand that the users email account could be compromised, but this is not in our control.

What security issues are present in the scenario that we auto-log the user in when they click the activation link in the email (and activation is successful)?

I have read the answers in the question Logging in a user after password reset via link, and it seems the strongest reason for NOT auto-logging the user in would be those mentioned by Tom Leek e.g. user not knowing they are logged in automatically, and potentially leaving the device unattended with an authenticated session still open, etc.

For many sites the model is that an accounts are controlled by anyone that has the password or has control over the email account.  An auto-login is just an extension of that model.  The link should only be available to that email account and that email account should only be available to the account holder.

That said, SMTP is a pretty bad channel to rely on for secrecy.  Your message will move over networks in the clear and bounce through multiple mail servers where it could be stored.  Additionally the activation link might be processed by a proxy where it gets stored in the logs.  You might decide that you trust email enough for the verification step but not for authentication or password reset.

You could try a hybrid approach where you get the benefits of auto-login and minimize those security risks.  When the user creates an account you create a session for them in a probationary state.  You know who they are but you don't let them access any features.  Once they activate you change their state from probationary to active and they can access features.  Just having the link will no longer get you access to the site.

If you do follow your proposed model you should time-bound the auto-login token, make it appropriately hard to guess and verify that the activation token matches the user account.  You don't want people guessing tokens and getting access to your user accounts.


What is the risk of a PDF "infected" with BC.Pdf.Exploit.CVE_2017_3033? ClamAV (detection version 20170623) detects BC.Pdf.Exploit.CVE_2017_3033 in quite some PDF files. I wonder if this is not a false-positive because no other engines detect such "infection". The CVE regards:

  Adobe Acrobat Reader versions 11.0.19 and earlier, 15.006.30280 and
  earlier, 15.023.20070 and earlier have a memory address leak
  vulnerability when handling JPEG 2000 code-stream tile data.

  CVSS v2 Base Score: 4.3 MEDIUM
  CVSS v3 Base Score: 3.3 LOW

  Source: https://nvd.nist.gov/vuln/detail/CVE-2017-3033

Does this mean that the PDF file is just causing Adobe Acrobat Reader to crash due to memory address leak? Or does this mean that the PDF is "infected" and can it cause more harm? Or is it just that the JPEG 2000 code-stream in that PDF file can possibly cause Adobe Reader to crash?

Lastly, apart from obviously updating Adobe Reader, what can I do in order to "fix" and "clean" this PDF files?

Determining if this is a false positive or not is impossible without actually looking at the files.

The vulnerability in question seems to be a classical out of bounds read and probably exploitable but it's hard to tell until somebody actually puts in the work to write an exploit.

Maybe you should consider telling the ClamAV people to look into this. A similar problem has apparently already been fixed: https://lists.gt.net/clamav/users/69581


Left my Facebook logged in - what could my employer see? I left my Facebook logged in on my work computer (I help with social media and am an admin). I closed the tab without logging out and it was only when I went to go back onto Facebook again that it was already signed in. Will my manager be able to see conversations even if the tab is closed?

Without any traffic to the computer, there would be nothing to "see".
All that occurred was that a special key (and "authentication token") was left on the computer, so that when you visited Facebook again, it logged you in without you needing to enter your password again.


DNS cache poisoining prevention by directly using ip instead of url My basic understanding of DNS cache poisoining is that at some local server the cache is been altered. i.e (some urls will be directed to malicious ip address instead of original).
So If I entered the IP address of a website directly I will not be a victim of DNS cache poisoining ??

So If I entered the IP address of a website directly I will not be a victim of DNS cache poisoning ??

This depends on the web server its configuration. Often web server use virtual hosts in order to host multiple domains on the same web server.

Based on the domain name, the content of the web page is routed to the proper content directory for that specific domain.

The generic answer to your question is most likely "no!" because of the above described inner working. The only exception is when one domain is served on a specific IP address. In that case it might be possible.

In order to overcome DNS cache poisoning, one could edit the hosts file where the domain is pointed to a specific IP address. The hosts file lookup is performed before any DNS queries take place.

Please note that when DNS changes are applied to a specific domain, your hosts requires updating as well. Although this will work for some time, it is not the best solution.

The best way to prevent such attacks is to use DNSSEC as it allows you to authenticate DNS messages.


which password was paired with my gmail address Recently media have reported that a file of about 5 million gmail address and password pairs was published on a Russian Bitcoin forum.

A media article on the leak

Other media have reported that the password is typically not a gmail password and might be used on systems other than gmail where the gmail address is the identifier. I want to determine which of my passwords was paired with my gmail address. The link has a zip (7z) file and it appears that there are only gmail addresses present -- no passwords. Other media have reported that the posted file has been revised to exclude the passwords.

Is there a website that will email (to my gmail) the password that was leaked?

Responsible media outlets which have obtained the original data set for a password leak will not publicly disclose the passwords. You can go searching around for the raw breach data yourself, but the areas of the internet which would advertise hosting of such data (after it's been pulled from Pastebin and the likes) are likely riddled with malware and exploits.

If your email is listed among those included in a breach specifically associated with your mail provider, it would be safest to assume the email account itself was compromised.

Given that other sources are claiming that the password data may actually be from services other than GMail itself, you should also assume (if your email is listed) that any other accounts associated with your email address are also compromised.

As an aside, you may want to check out http://haveibeenpwned.com. There, you can plug in your email address and see which (if any) public data disclosures it has been found in. Recently, functionality was added which also searches some sources from Pastebin and similar sites.


How can I implement a secure download area on a website which requires an electronic signature? For quality management purposes, the company I work for would like a system which requires a client to read through a disclaimer and then provide an electronic signature, acknowledging said disclaimer, before being granted access to a download area. After the disclaimer has been signed for, we would also like a feedback system in the form of an automated email, which is sent back to a designated address. I am clueless in this department so I am wondering what is the best way to implement this - most likely best left to a professional but any response here would be great!

I had imagined the process to be as follows:-

Company sends a client a pin number and project reference number which is unique to a particular download area (each project we work on and intend to submit to a client would in theory have it's own download area)
Client visits a page on our website where they enter the reference number and pin number we provide them with, which takes them to their specific disclaimer (disclaimer is different for every project)
Client reads disclaimer, signs an electronic signature by providing name, job title and probably some other information yet to be decided.
Client is granted access to the download area specific to that project and is able to download the files within.
Once the electronic signature is signed, an automated email is sent to a designated address to provide us confirmation and evidence of the client's access.

A few further notes:-

A web-based system would be ideal so it can be integrated into our website - we set up the project on a webpage, entering the specific disclaimer details and uploading the relevant files.
If the client wishes to gain access to the file area again, they just have to re-enter the reference number and pin number which then bypasses the disclaimer form. However, We must have the option to force the client to re-sign if for example we update some files within the download area.
To avoid the risk of duplicate pins being issued owing to human error or whatever, some level of automation which provides a randomly generated pin would be great too. We could use a random number generator every time but it would help if the process was streamlined.

I have come across the following - https://www.universign.eu/en/timestamp/ - which seems to be what I'm after but again, the implementation into a website is beyond me.

It is worth noting that numerous services exist online that do this sort of thing. Accellion, LiquidFiles, Dropbox, Box.com, and numerous others can grant you this kind of functionality. Depending on volume and complexity, you might even be able to leverage some marketing-oriented online service like salesforce.com or hubspot.

There are a zillion things that you do wrong in trying to do it yourself. You should definitely consider signing up for an existing online service or installing software that does this.


Flash Vulnerabilities What type of risks do I expose myself to by enabling flash in the browser?

Web developers or online game developers who can use those vulnerabilities to crash my computer or exploit it by downloading files into my computer without permission?

Or by making the browser more exploitable to hackers who use the same public network as I?

tl/dr: Just let flash die.

Adobe officially announced the End-of-Life for Flash a while back.  It will officially be EOL at the very end of this year (2020).  This means that there will no longer be new or updated flash players after that.

Given the long history of dangerous flash vulnerabilities, using unpatchable software with a history of dangerous bugs is probably a bad idea.  The biggest danger (which has happened in the past) are vulnerabilities that allow a malicious flash program to escape its sandbox and execute commands directly on your machine.  This would allow an attacker to compromise your machine and install malware simply because you visited the wrong website.

Again, given that such vulnerabilities have happened with Flash before, it's safe to assume that more such issues will be discovered once Flash is EOL and will no longer receive updates.  Therefore, enabling Flash as a browser extension is dangerous and, unless you like malware, should probably be avoided.  If you really have some hardcore nostalgia for all those Flash games of the 00's, then I would suggest running it in an isolated environment.  I.e. consider running in a browser inside a VM that is used for no other purposes and is trashed when you are done.  If you continue to use Flash in the long run though you should assume that it will eventually result in malware being installed on your machine without your knowledge.


How to implement secure user sessions using HttpOnly cookies? I'm creating a web application, and want to allow users to log in (and stay logged in).  My plan to support this in a secure way goes as follows:

User logs in from a login form - when successful, the server responds
with a secure and HttpOnly cookie that simply contains their username.
When the user closes their browser and later comes back, a request is submitted (which includes the cookie) to an endpoint on the server upon page load that asks the server if the current user is logged in, which the server determines by the presence of the cookie.  If so, the server returns the value of the cookie, which the client-side can display on the UI as the user's username.
Any request that requires an authenticated user (such as saving or updating data) will do so under the name of the username specified in the cookie in each given request.

One major question I have - if someone goes into their browser and manually changes the username cookie using devtools, would this allow them to make requests under the guise of another user with the way I have this laid out?  Or does HttpOnly prevent this?

Am I overcomplicating this?  Do I gain anything by making this cookie HttpOnly, since I'm essentially allowing the clientside to read it anyways?  Is my approach even secure?

No, your approach is definitely not secure.

HttpOnly is intended to prevent malicious Javascript from accessing the cookie. A malicious user with access to the browser (including the user himself) can do whatever they want to the cookies, or even ignore them and make up their own cookies to submit with the request.

If you would like to keep something somewhat close to your existing design, I would suggest encrypting or signing the contents of the cookie in order to make it tamper-resistant. Another option is to simply store a session identifier in the cookie (with sufficient entropy) and store the user ID in session state on the server side.


Where can I download the Sony hack malware (for analysis)? I want to analyze the Sony hack Malware.

I would like to perform my own independent analysis of this malware; where can I download this malware so I can analyze it?

Trend Micro has analyzed the malware here: http://www.trendmicro.com/vinfo/us/security/news/cyber-attacks/the-hack-of-sony-pictures-what-you-need-to-know and do not make it available for other researchers.

I looked for the malware and found it, here is the link but you have to go on the forum and download it:

http://malwaretips.com/threads/2014-12-11-destover-malware-7-samples.38799/

Go to the above link and you will see the zip file and the password for it.


What is the best way to protect against a phishing attack? As stated in the title, what can I do on the server (or anywhere else for that matter) to protect against phishing attacks?

Some suggestions I've heard is to tell users that you'll never send them a link to click on. However, our password reset functionality is built around this.

We've also added two factor authentication, but a phishing attack can also easily bypass this through clever scripting that passes the user credentials to our site in real time.

Phishing is a social engineering trick, so the effective way to mitigate it - is to educate your users. Create a mandatory training courses, buy or create a plugin to outlook or whatever mail clients they are using that can flag emails as phishing attacks and send to you or your team for forensics, contract a third party to sometimes perform a non malicious phishing attack (when you click on attachment it will say "this was a part of our comprehensive phishing awareness programs..." to keep your users aware.


Credit card fraud prevention The project that I am working on requires processing of credit cards. Is there any way to detect cloned/counterfeit cards? Are there any proven workarounds to prevent credit card fraud or misuse?

We are asking the customer to swipe their credit card at the POS, so no CVV is necessary. However we would like to be able to detect any cloned/counterfeit cards, if there is any such possibility of doing so.

The challenge of identifying fraudsters becomes even more complex in an unmanned POS like kiosks etc. Right now CC companies or payment gateway don't offer any protection against fraud in unmanned kiosks etc.

Already a question in stackoverflow. However was closed as appropriate here, so reposting question for further inputs.

Question updated with the case of unmanned POS such as kiosks

A male cardholder using a card with a clearly feminine name would be a potential flag. Other than cardholder gender, though, there isn't much you can do to verify non-fraudulent transactions. As a merchant you do not have access to the full history of purchases the CC company does, and purchase record analysis is how most fraud is detected.

Generally speaking, if a criminal group is going to the trouble of cloning credit cards to be used at a human-operated POS, they will go to the trouble of making them convincing. The detail work on a credit card is less intensive to replicate than the magstripe.

Brian Krebs has numerous entries on credit card skimmers and monetization of stolen/cloned credit cards. Most of his information isn't germane for your situation, but sifting through what he has written might give you some ideas.


Why Google and smartphone manufacturers don't care about updates? For Windows, Firefox/Chrome, Java, Flash critical updates are issued each couple weeks, and as far my understanding goes, it is REALLY bad not to install them ASAP.
For my 3 year old Samsung smartphone, however, there isn't a single OS update. A brief research shows that in most cases you can't upgrade your Android version for most phones in a year or so after release.
Given that smartphone in many cases is a very juicy target for hackers, with all two-factor authenthications, email and bank passwords going through smartphone, it sounds very scary that there are basically no updates for OS/firmware.

Is it really scary? If yes, why don't google enforce stricter policy for manufacturers, or don't make OS update by itself? What is situation with iPhones?

Whilst I don't believe that there's a definitive confirmation that this is the situation, I'd suggest that the problem with android likely comes down to a conflict of interests between the carrier, handset manufacturer and OS manufacturer.

It's in Googles interests that handsets are upgraded regularly, as it improves peoples perception of the OS and makes app. developers lifes easier (less fragmentation makes easier testing).

However from the handset and carrier perspective, updates are costly.  it costs a lot of money to test these updates and push them out so there's a disincentive there for them to do it. Also to an extent they'd rather you buy a new handset instead of getting the features from a free upgrade. That's why in general I think that android updates don't happen for older handsets, or are slow to happen.

Apple have always had a tight control on the whole process so have pushed for the updates to go out reguarly...


About performance of Smart card for performing 3DES in a MD5 hash Another question related to previous, unanswered A SW system constructed with Microsoft CNG can be FIPS 140-2 Level 2 Compliant?

Another alternative is to store the keys in a Smart card permanently attached to our system (a standard server in a rack) using a USB Reader under Windows 2008 R2. So the cryptographic operations can be performed by the Smart card itself or by the Windows CNG module. The question is about performance, as we need to perform the operations repeatedly. The operation is basically performing a 3DES over a provided MD5 hash and we need to perform this operation about 10.000 times a day. This makes sense? Performance required can be achieved using the Smart card.

What way is preferable, performing the 3DES by the Smart card so the keys never go out the Smart card or importing the keys into CNG and perform 3DES by CNG?

Sorry, too much questions, but we are designing the system and want to ensure compliance, performance...

If your smartcard is any good, then it will commit seppuku rather than allow the 3DES key to be exported. If the key can be exported, then the smartcard is no better than a USB disk. Correspondingly, you should not have a choice: have the smartcard do the job it was designed to do.

(And, MD5 ? Really ?)

Also, a smartcard is a piece of hardware; it may fail, especially if employed repeatedly and continuously (smartcards are not usually designed to be operated in such a way). You'd better have a backup plan, to readily initialize a new smartcard with the same key. If you can do that, then you can produce several smartcards and use them concurrently, which would give you a performance boost. And if you cannot rebuild a smartcard after a hardware failure, then your project looks doomed.


Is there anywhere we can scan projects (PHP, JAVA...) for vulnerabilities, like VirusTotal.com does (All-in-one)? Virustotal is excellent in its field.
Does there exist any tool (or site) where we could upload (or that  could be also an offline PC version) to test projects or websites (PHP, Java, whatever) for Vulnerabilities, but ALL-IN-ONE scanning (like Virustotal), which would include all free/trial tools available on internet?

UPDATE: Well, seems there is not. As a volunteer idea, I've created an example site showing the idea what I mean : Live Demo  (Github).

To my knowledge, there is not a comprehensive, all in one solution that can effectively scan for different types of vulnerabilities on different types of projects. This is partially due to the fact that the type of data store required for that solution is immense, therefor many products have chosen to tackle a specific issue and excel at that verses being an inch deep across multiple vectors.

At a high level, I like the idea. I think it's probably a great niche for a business, but it would require that an appropriate team be assembled with enough knowledge around all of the fields you would like to support to be beneficial. Half way implemented features would not do this service any good and it would be dropped in favor of the specific tools that meet the needs of current processes.

There are some challenges I think you'll need to think about:

The number of programming languages that need to be evaluated
The number of potential CI/CD pipeline configurations
The variation of OS systems and patching levels
The limitations of cloud based security systems (AWS wont let you scan)
Desktop application scanning
Web Application Scanning
Mobile Application Scanning
Potential integration with multiple code repositories

Again, it's not a bad idea in theory. But taking it to production is a feat that I'm not sure anyone is really ready for at this point.


Why the following XSS vectors work without closing bracket? The following XSS injections will execute without the accompanying closing tag (see this demo):

<body/onload=alert(1)
<svg/onload=alert(1)
<iframe/onload=alert(1)

I just need to know why these work, any documentation link would also be appreciated.

If you view how your code is actually delivered by the server (for example by using the "view frame source" context menu in Chrome for the white frame in jsfiddle) you can see that it is embedded in some other code like this:

<body>
  <svg/onload=alert(1)

  <script>

This essentially means that the full HTML element seen by the browser is starting with <svg and ending with >. The < will be not considered as the beginning of a new HTML element since the existing element is not yet closed.

<svg/onload=alert(1) <script>

After fixing up the browser will likely interpret this as <svg onload=A B> where A is alert(1) and B is <script, thereby executing your payload A and ignoring the attribute B since no behavior is defined for it.

As for the details how the parsing is done see the HTML5 syntax definition which describes the parser in detail. By following the standard you will end up with:

initial:    "data state" (8.2.4.1)
'<svg':     move to "tag open state" (8.2.4.6) and then "tag name state" (8.2.4.8)
'/':        move to "self closing state" (8.2.4.40)
'onload':   parse error, go do "before attribute name state" (8.2.4.32) and
            from there to "attribute name state" (8.2.4.33) and read the attribute
'=':        switch to "attribute value state" (8.2.4.35)
'alert(1)': read attribute within "attribute value (unquoted) state" (8.2.4.38)
' ':        switch to "before attribute name state" (8.2.4.32)
'<script':  read attribute name within "attribute name state" (8.2.4.33)
'>':        switch to "after attribute name state" (8.2.4.34) and from there
            to "data state" (8.2.4.1)

In other words as I said shorter before: The tag is svg, the attribute onload has an attribute value of alert(1) and there is another attribute <script.


Sophisticated DDOS attack According to this article, ProtonMail was the victim of a very sophisticated DDOS attack.

  "At 2pm there was a dramatic escalation," said Yen. According to Yen and Gargula the attackers smacked 15 different ISP nodes simultaneously, then attacked all the ISPs going into the datacenter using a wide range of sophisticated tactics. "This was not your standard DDoS anymore," Yen explained, "in fact most of the experts we spoke with had never seen anything like this."

  "First we moved the BGP IP prefix," said Gargula as he detailed the attack, "I tried to isolate legit human traffic from bot traffic and not to mix it up. We sacrificed one of their three BGP uplink layers as a 'canary' to test the sophistication of the attack. Then we changed the configuration for the IP uplink."

How does moving the BGP IP prefix help? From what I understand, as long as the MX record can be resolved to an IP, attacker can flood the IP with packets which will be routed to the new AS. If it cannot be resolved, legitimate users will also not be able to access the service.

And also, what other sophisticated DDOS techniques are there?

"First we moved the BGP IP prefix," said Gargula as he detailed the attack, "I tried to isolate legit human traffic from bot traffic and not to mix it up. We sacrificed one of their three BGP uplink layers as a 'canary' to test the sophistication of the attack. Then we changed the configuration for the IP uplink."

"How does moving the BGP IP prefix help?"

I believe they are refering to a sinkhole--a sacrificial router, in this case a BGP router, since BGP may not require much authentication.  By configuring the sinkhole to "advertise routes with bogon destination addresses, you can set up a central trap for malicious traffic of all types" [Hacking Exposed 7: Network Security Secrets and Solutions, 2012].  Lists of bogon addresses can be found online: www.cymru.com/Bogons, slides

"And also, what other sophisticated DDOS techniques are there?"

There are a number of sophisticated DDoS techniques.  DDoS leverages DoS methods using a distributed attack surface.  Most of us probably know about SYN flood, where a syn packet is sent with a spoofed source address and the receiving system tries acknowledge it does not receive a response and is left with partial connection in a short queue that is easily disabled by flooding.  Similarly, a UDP flood is designed and source IP addresses are often spoofed to target DNS servers which rely on the UDP protocol.

Reflective amplification is another DDoS attack (DRDoS) that again uses spoofing.  Often botnets send the packets, the source address is the victim IP address, and the packets are sent to machines that try to respond to the victim simultaneously, generating a flood of packets sent to the victim.  For example, DNS servers respond to small requests with a large amount of information and DNS amplification can overwhelm the victim's system.

Application-layer DDoS attacks use the same ideas at a higher level, such as the web level, rather than the transport or communication level.  Here the goal of the attacker is to find an easy and short request that generates lots of work in the victim's API.  For example, a single-word search request can eat up lots of cycles on the victim's machine.  Or a database-driven site, might have pages that trigger database queries when the URL is requested.  Now, the attacker can use just a few queries per second, either making the requests in a distributed manner or not, and bring the victim's machine grinding to a halt.

There is also a low-rate DoS attack where the attacker causes a TCP connection to enter a retransmit state.  If enough connections enter this state, the victim's machine suffers declining performance.

See Hacking Exposed 7: Network Security Secrets & Solutions for more discussion of DDoS attacks.  See Wikipedia for more attacks: https://en.wikipedia.org/wiki/Denial-of-service_attack


What is the first step in auditing the security efficiency of a simple website? I am asked to write a first technical audit about the security best practices to improve a PHP web-site security.

I am wondering from where to start? Is there a famous audit forms to analyze and evaluate the security of a website? An online free tool to make the first check?

The website in question is a very basic one developed in PHP.

Have a look at the OWASP Top 10 Project.

OWASP has the best set of resources available online when it comes to web applications. You can learn plenty of information from there.

In addition, I would look into hardening the servers which your application run on. CIS has a good set of benchmarks you could base your audit upon.

As far as tools go - recommendations are beyond the scope of the site. There are far too many out there. The BackTrack distribution comes with many great ones. It can be quite confusing for a beginner though.


"global" OCSP with Apache mod_ssl / Alternative to -VAfile option Openssl Context

I'm developping my own OCSP responder which signed its ocsp responses with its own self signed certificate caOcspBC.crt.
You can find it here : https://github.com/Dinou/ocspResponder
I want to get the revocation status from a certificate RC.crt issued from a CA certificate CA.crt thanks to openssl.

All my certificates are located here : https://github.com/Dinou/ocspResponder/tree/master/src/main/resources/certificates

So, I execute this first command where I explicitly trust my ocsp certificate thanks to -VAfile option  :

# openssl ocsp -issuer CA.crt -VAfile caOcspBC.crt -cert RC.crt -req_text -url http://responderurl:port/myServlet
OCSP Request Data:
    Version: 1 (0x0)
    Requestor List:
        Certificate ID:
          Hash Algorithm: sha1
          Issuer Name Hash: 19266539D5B4B518D4382B2D3779CBF53A6061D6
          Issuer Key Hash: 89B91685082EF65F5611F965E94422D602BE27DB
          Serial Number: 0A
    Request Extensions:
        OCSP Nonce:
            04106D042BFA97BFA61F5AAAD756C5619CF2
Response verify OK
RC.crt: good
    This Update: May 19 14:51:51 2014 GMT

It works well.

If I don't use the -VAfile option I get :

# openssl ocsp -issuer CA.crt -cert RC.crt -req_text -url http://responderUrl:port/myServlet
OCSP Request Data:
    Version: 1 (0x0)
    Requestor List:
        Certificate ID:
          Hash Algorithm: sha1
          Issuer Name Hash: 19266539D5B4B518D4382B2D3779CBF53A6061D6
          Issuer Key Hash: 89B91685082EF65F5611F965E94422D602BE27DB
          Serial Number: 0A
    Request Extensions:
        OCSP Nonce:
            0410C8D048BB5A49596A7714B4D74935E3C5
Response Verify Failure
140451402069696:error:27069065:OCSP routines:OCSP_basic_verify:certificate verify error:ocsp_vfy.c:126:Verify error:unable to get local issuer certificate
RC.crt: good
    This Update: May 19 14:52:09 2014 GMT

It doesn't work. In fact my client openssl doesn't trust my ocsp certificate.

Problem

But I want to use Apache mod_ssl with my generic OCSP, and there is no directive mapping to the -VAfile option -> I can not specify the trusted responder certificates.

Question

What can I do to make my apache trust my self signed OCSP responder certificate ?

Extra context

I tried many things :

I imported my self signed certificate caOcspBC.crt in /etc/ssl/certs by using this :
http://gagravarr.org/writing/openssl-certs/others.shtml#selfsigned-openssl (symbolic link)
It didn't work (Same error as was mentioned previously ocsp_vfy.c:126:Verify error:unable to get local issuer certificate)
In openssl ocsp documentation states :

If the OCSP responder is a ``global responder'' which can give details about multiple CAs and has its own separate certificate chain then its root CA can be trusted for OCSP signing. For example:
openssl x509 -in ocspCA.pem -addtrust OCSPSigning -out trustedCA.pem
Alternatively the responder certificate itself can be explicitly trusted with the -VAfile option.

So, I executed this command on my self signed certificate and then I put It in /etc/ssl/certs as was mentioned previously.

It didn't work (Same error as was mentioned previously ocsp_vfy.c:126:Verify error:unable to get local issuer certificate)

Question

What can I do to make my apache trust my self signed OCSP responder certificate ?

Answer

First, the self signed certificate must have these following properties :

KeyUsage : digitalSignature, nonRepudiation, keyEncipherment, keyCertSign
ExtendedKeyUsage : OCSPSigning
BasicConstraints : critical,CA:TRUE, pathlen:0

It must be in pem format.

Then, apply the following command to the certificate :

openssl x509 -in selfSignedCert.pem -addtrust OCSPSigning -out trusted.pem

And finally append it to the file specified in ssl.conf in Apache by SSLCACertificateFile directive


IE on Windows 2012 doesn't show certificate or lock icon despite using HTTPS Can anyone explain why IE on Windows 2012 doesn't show the lock icon despite using HTTPS when visiting the following site?

https://www.microsoft.com/en-us/default.aspx

I am able to see the lock icon on Facebook and any other site.

It's because the connection is not actually secure: There is an HTTPS error on the page about mixed content. Some data is loaded over HTTP (and not HTTPS), which causes this error. You can see this if you open the page in another browser like Chrome.
Edit: Some more information about mixed content errors, from my answer on this question.

if one of the resources used by the website (such as an image or a script) is loaded over HTTP, the confidentiality cannot be guaranteed anymore. Even though browsers do not send the HTTP Referer header when requesting non-secure resources from a secure page (source), it is still possible for someone eavesdropping on traffic to guess where you're visiting from; for example, if they know images X, Y, and Z are used on one page, they can guess you are visiting that page when they see your browser request those three images at once. Additionally, when loading Javascript, the entire page can be compromised. An attacker can execute any script on the page, modifying for example to whom the bank transaction will go.
When this happens (a resource being loaded over HTTP), the browser gives a mixed-content warning: Chrome, Firefox, Internet Explorer 9


Data breach policy - immediate actions We have a web application server and a database on AWS.

Is there any "immediate action" policy somewhere we can adopt as to the steps we can take when we suspect or detect a data breach?

There are books on this topic under the subject heading "cyber forensics".

Normally you will want to image all the memory of the computers involved and then the drives, so you can figure out what may have been taken. You also want to review and organize all your network logs. You also want to T-off any infected machines to capture the packet stream for surveillance reasons. This can be done at the switch or using specialized hardware like a basic SharkTap sniffer. It is advisable to get yourself set up to tap and copy ahead of time, so if you need to do it, there is no delay.

You also want to avoid tipping off the hackers that they have been noticed. Don't go around shutting things down, because then they will go and hide. You want to pretend like nothing has happened, so they keep doing stuff. If you can figure out how to watch them, you will be in a much better position to determine what may have been copied, and maybe even able to catch them.


Finding out the password or bypass Linux password for home encryption? I forgot the password of one of my account on Ubuntu 16.04.

The user account directory is encrypted.

I have configured the Yubikey SSH key based login so I am able to login, into that account. But when I login using Yubikey SSH, it does not decrypt the user home directory.

I know the password that Ubuntu uses to encrypt home directory is encrypted by password of that account. But I don't remember that password.

Is there any possibility that SSH key on Yubikey can decrypt the user home directory also ?

I am using currently all the password combinations that I ever used in the past but for some reason its not getting cracked. I am using John The Ripper to crack my own password. Is there any possibility that someone might have messed up login files?

Unfortunately, no. The only password that can decrypt that file system is the one you chose when you set up encryption in Ubuntu.


AWS S3 resource access control through IAM permissions or bucket policies? The way we create buckets in our org and ensure sane ACLs around it is by providing an automated tool (that internally uses Terraform) to provision an S3 bucket. So say when a user requests for a new bucket, named testBucket we create a bucket named testBucket and also create an IAM user by the name testBucket-user. The automation ensures that the testBucket-user's policies are such that the only allowed actions to this user are :

"s3:ListBucket",
"s3:PutObject",
"s3:GetObject"

and the only allowed resource on which the above actions are allowed is the testBucket bucket.

Similarly, the automation also ensures that the automation puts bucket policies to ensure that the only actions allowed on it are the above 3 actions and only by the user testBucket-user

However, on demand (& if business justified) we do make changes to the created bucket policies as and when needed. So recently there was one such requirement, where a certain bucket needed to have a folder in it that was meant to hold all publicly intended images.

Now there were 2 options we had in order to provision the above requirement:

Modify the bucket policy to allow principal:* for the folder in the bucket thus allowing all objects in that folder in the bucket to be by default public.
To modify and give PutObjectACL permissions to the IAM user that has access to that bucket and let the dev manage which objects in the folder can be or can not be public.

As the security team we were more convinced of the first option just because it looked more logical. The problem with the first option however was the fact that now any object (publicly intended or even otherwise) in this folder would be by default public.

I wonder what does the community think here around it? AWS/IAM experts, what would be your choice of the two options above and why ?

Restrict access to your S3 buckets or objects by:

Writing AWS Identity and Access Management (IAM) user policies that specify the users that can access specific buckets and objects. IAM policies provide a programmatic way to manage Amazon S3 permissions for multiple users. For more information about creating and testing user policies, see the AWS Policy Generator and IAM Policy Simulator.
Writing bucket policies that define access to specific buckets and objects. You can use a bucket policy to grant access across AWS accounts, grant public or anonymous permissions, and allow or block access based on conditions. For more information about creating and testing bucket policies, see the AWS Policy Generator. [[Note: You can use a deny statement in a bucket policy to restrict access to specific IAM users, even if the users are granted access in an IAM policy.]]
Using Amazon S3 Block Public Access as a centralized way to limit public access. Block Public Access settings override bucket policies and object permissions. Be sure to enable Block Public Access for all accounts and buckets that you don't want publicly accessible.
Setting access control lists (ACLs) on your buckets and objects.
[[Note: If you need a programmatic way to manage permissions, use IAM policies or bucket policies instead of ACLs. However, you can use ACLs when your bucket policy exceeds the 20 KB maximum file size. Or, you can use ACLs to grant access for Amazon S3 server access logs or Amazon CloudFront logs.]]

Extra Points!

In addition to using policies, Block Public Access, and ACLs, you can also restrict access to specific actions in these ways:

Enable MFA Delete, which requires a user to authenticate using a multi-factor authentication (MFA) device before deleting an object or disabling bucket versioning.
Set up MFA-protected API access, which requires that users authenticate with an AWS MFA device before they call certain Amazon S3 API operations.
If you temporarily share an S3 object with another user, create a presigned URL to grant time-limited access to the object. For more information, see Share an Object with Others.

Ref Link: https://aws.amazon.com/premiumsupport/knowledge-center/secure-s3-resources/


Is it OK to tell your password to your company's sysadmin? I'm working in a small company (20 employees) as a senior software engineer.

After having problems with my email, our newly employed IT administrator asked me to write my user password to someone in our hosting company to help them identify the problem.

Without any thought I gave him my user password.

After 30 minutes, I realized that in my 10 years of working in several companies nobody asked me for a password, and I found it rather strange. Immediately after that, I changed my password.

Are there cases where the password is really needed, when I really have to tell my password to an IT administrator?

I have heard of stories where admins asked for the user's password, but only on sites like The Daily WTF, which prompted this question.

(Related: "A client wants to tell me his home laptop's password. Must I push him towards a more-complex alternative?")

Short answer:

ABSOLUTELY NOT!
Your password is between you, and your computer alone.
No one else.

Not your boss, his boss, the system administrator, your bank official, your insurance agent, your ISP support technician, or your cat. Well, your cat you can tell, if she promises not to share it.

There is NEVER a good reason to share a password.
There are many reasons NOT to.  Mostly, because a password is YOUR authentication, and as soon as even ONE other person knows it, it can no longer prove your identity.

Any reason your admin comes up with, is bogus, either because he is malicious, lazy, misinformed, or incompetent.
That said, it may not be his fault, but the fault of his organization.
Either way, there is incompetence, ignorance and laziness abound.

If an admin, or ANY support technician asks for your password, the correct response is to LAUGH.
Because there's no way they're  serious, right?

If your admin insists - explain to him that you will document sharing your password with him... and that, based on this, you are going to send nasty emails to all around - not about him, but you will claim that they came from him (using your account, in your name, using your password that you just shared with him). Of course he won't be able to prove that he didn't misuse your password... which is the point.

No, on second thought, just don't give him your password. It's yours, between you and the computer alone.


Risks of encryption keys contained in a memory dump after a crash? Assuming a full disk encrypted system where non-volatile storage is encrypted.

While the system is running, in case of a crash and memory dump, e.g. plugging a USB drive causing an IRQL_NOT_LESS_OR_EQUAL error, what are the risks that the encryption keys are contained in that memory dump file?

As a variation, assume an environment where you have an encrypted container sitting open, and the system crashes at that moment.

In any scenarios where there's something encrypted on disk but decrypted on-the-fly while the system is running, and a system crash occurs, are there risks that the memory dumps contain encryption keys or something that would lead to them ?

Local case:

The above scenario just happened to me, and I have done a local analysis.

I opened %SystemRoot%\MEMORY.DMP with a hex editor, and looked for passwords or passphrases but didn't find them. However, is it possible that they are still contained in another form, or that there is something leading to finding them out?

Absolutely it's possible that the memory dump could contain keys.  If all programs follow good programming practice (clear keys immediately after use) that reduces the likelihood, but there's nothing that a program can do when doing encryption/decryption in software to 100% prevent keys from being in memory.  After all, a key has to be in memory to perform encryption/decryption and if as soon as the key is put into memory the operating system crashes there's nothing the program can do about the key at that point.


Authentication System Usernames For a reason I can't fathom, people seem to subscribe to the opinion that a secret username isn't more secure than a public one. I find this opinion completely ludicrous and would like to know why this dogma has continued for so long.

If an authentication system depends on a secret password to authenticate, wouldn't logic dictate that a secret username would be twice as secure?

My opinion is that, if a username is treated by both the user and authentication system as a password then, by definition, it IS a password; the first in a series of two.

What caused this confusion and frustration is a question I posted elsewhere. I asked if it were possible to separate an email user's address from the username during authentication. The logic being that if a hacker needed to brute the username along with the password for a targeted attack, it could take twice the effort to succeed.

What logic could you possibly provide to prove that a username is not a password if it is treated as such (aka a secret)?

This question concerns only this specific attack vector and not any other related ones like social engineering, system vulnerabilities, etc.

UPDATE: This question is not a duplicate of another question because it asks a completely different question:
"would like to know why this dogma has continued for so long" in the first paragraph. The other questions are only included to provide support for the main one and to offer the Answer-er a vehicle for supporting their answer.

UPDATE: I get it - with an authentication system that does not intend to keep a username secret (ie reveals if a username is valid or not) is not more secure than a password of double length). My question targets an authentication system that DOES treat a username as a 1st password (ie does not reveal the validity of a username).

If both the username and password are intended to be kept secret by the user and endpoint, there is no need to separate the two. There would be no difference compared to just logging in with an access key (no username, just a long password).

The reason we think a "secret username" does not add to security is because it is an oxymoron. A username, by definition, is a non-secret piece of information not intended to be kept secret.

Again, if the username was intended to be secret as well, then it would be no different than being a 2nd password, and having 2 passwords is no different than having 1 password if both are meant to be secret.

2 passwords is not more protective than just 1. Either you will be keeping both passwords secret via the same means (ie. the same password manager) or you will be splitting up your methods for keeping them secret (ie. password manager AND sticky note), in which case, you can achieve the same security by splitting up your single password into two parts and storing them as separate pieces.


Is Dom based XSS still a valid security concern in modern browsers? I am trying to understand how DOM based XSS work, e.g. from this post, I managed to reproduce it in IE11, but e.g. Chrome and Firefox are immune at least against this exact example.

What happens is that document.baseURI and similar objects do return a string that is encoded, so unless you explicitly write code to decode it back or something I don't see how it can be abused.

Are there any other examples that the modern browsers are still vulnerable to? I did not manage to find any, since virtually all examples on web point to a similar vulnerability.

P.S. The gist of the example is to form a hashbang query with injection:

http://victim/displayHelp.php?title=FAQ#<script>alert('Hello')</script>

Yes, DOM-based XSS is still a concern. While some issues cannot be exploited due to URL encoding, there a number of situations where URL encoding will not stand in the way of exploitation.

  The gist of the example is to form a hashbang query with injection

That's one example, but DOM-based XSS encompasses all XSS issues that result from insecurely handling data via JavaScript.

Data can come from sources such as the URL, the DOM itself, etc.

The most basic example where user input is eg read from location.search and processed with innerHTML or .write will indeed not work with any up-to-date browser, as the value is URL-encoded.

But DOM-based XSS with different sources than location.search or different sinks than innerHTML will still work, and do exist in real-world applications.

An incomplete list of examples with different sinks and sources can be found below.

Source: URL

An example for a DOM-based XSS vulnerability where the user input comes from the URL:

Attack:

http://example.com/test.html?x=

Source: The DOM

In my experience, this is the most common class of exploitable DOM-based XSS issues.

Let's assume an application that properly HTML-encodes all user-supplied data that is inserted into the HTML code.

Applications will still often read out user-supplied data from the DOM, and then reinsert it in an insecure manner. For example:

<input type="text" id="userinput" value="&quot;>">

Sink: Eval

Sometimes, we don't need " or > to gain XSS. An example would be user input that is passed to eval:

Attack:

http://example.com/test.html#';alert(1);x='

Sink: document.write

Another example where we do not need " or > and which works with document.write:

Attack:

http://example.com/test.html#test'onmouseover='alert(1)


Properly solving IP leaking from WebRTC and other apps with STUN when using a VPN This is really a follow-up question from this: Stun scripts/webRTC IP leaks

I'm connecting to a VPN using a virtual adapter, which has a default routing rule so all traffic goes through it. I still have the real adapter and it needs a specific routing rule so the virtual adapter can connect to the VPN. The problem is, apps can see both adapters and can work out their public IPs.

With regard to disabling WebRTC,
I'm not sure I see the point of trying to disable a specific app (the browser) from trying to find a public IP if it can be found. For that matter, what if you wanted WebRTC functionality with a VPN.

It seems like I need some way to block regular apps (browser or otherwise) from seeing the real adapter or routing through it, yet still allow the VPN connection to see it. Is this even possible? (e.g. run the vpn connection under a different user and only grant permission to use the real adapter to that user)

With a physical configuration, where I have a separate router to transparently tunnel all traffic through the VPN, this would be trivial. A virtual machine could have its traffic routed similarly. Both cases seem quite solid and I don't see how an app could figure out the real IP. Is there a way to get this effect natively on the one machine?

You need to configure your firewall to only allow traffic over the VPN connection. I can't be more specific because it depends on your firewall on how to accomplish this.


Does HTTPS allow replay attack on authentication request? If I sent a username and the password to a website over HTTPS, is it possible that someone on the net would save this request and re-send it later to authenticate on the website?

If someone just records encrypted HTTPS session and if the connection served over the secure TLS protocol version with the strong cipher suite, then the answer is no. Neither they will be able to decrypt your credentials nor replay traffic to create bogus session. TLS protocol provides message authentication and has its own replay attack protection.