How would a DMZ work I have a problem understanding how a DMZ would be implemented. I've read two different answers regarding the communication between the DMZ and the internal network. Some people suggest that you can open some connections from the DMZ to the some services on the internal network. Other people suggest that absolutely no communication should be allowed from the DMZ to the LAN.

Suppose that I want to implement a webserver on the DMZ that communicates with a database thats inside the LAN. How would i go about this? How would the webserver read the necessary info from the DB without allowing connections from the DMZ to the DB, at least on that single DB port? I've read some people suggesting periodic updates from the DB to the webserver, but that seems like a terribly inefficient solution.

The whole purpose of an architecture with DMZ is to limit direct access from external network to sensitive components of the internal network. Your question itself is self explanatory and it is perfectly normal to allow database communication between webserver situated in DMZ and database server located in internal server farm. From a security perspective it limits the exposure of database server to the public.


How to find live hosts on my network? I am trying to find the live hosts on my network using nmap. I am scanning the network in Ubuntu using the command sudo nmap -sP 192.168.2.1/24. However, I am unable to find the live hosts. I just get the network address of my own PC as live. When I see the DHCP client list through my browser (my router can be accessed via browser using my network IP), I get around 10 live hosts on the network. Can anyone tell me the reason why this could be happening and how do I find the live hosts on my network?

This is the simplest way of performing host discovery with nmap.

nmap -sP 192.168.2.1/24

Why does it not work all the time ?

When this command runs nmap tries to ping the given IP address range to check if the hosts are alive. If ping fails it tries to send syn packets to port 80 (SYN scan). This is not hundred percent reliable because modern host based firewalls block ping and port 80. Windows firewall blocks ping by default. The hosts you have on the network are blocking ping and the port 80 is not accepting connections. Hence nmap assumes that the host is not up.

So is there a workaround to this problem?

Yes. One of the options that you have is using the -P0 flag which skips the host discovery process and tries to perform a port scan on all the IP addresses (In this case even vacant IP addresses will be scanned). Obviously this will take a large amount of time to complete the scan even if you are in a  small (20-50 hosts) network. but it will give you the results.

The better option would be to specify custom ports for scanning. Nmap allows you to probe specific ports with SYN/UDP packets. It is generally recommended to probe commonly used ports e.g. TCP-22 (ssh) or TCP-3389 (windows remote desktop) or UDP-161 (SNMP).

sudo nmap -sP -PS22,3389 192.168.2.1/24 #custom TCP SYN scan
sudo nmap -sP -PU161 192.168.2.1/24 #custom UDP scan

N.B. even after specifying custom ports for scanning you may not get an active host. A lot depends on how the host is configured and which services it is using. So you just have keep probing with different combinations.Remember, do not performs scans on a network without proper authorization.

update: When scanning a network you can never be sure that a particular command will give you all the desired results. The approach should be to start with basic ping sweep and if it doesn't work try guessing the applications that may be running on the hosts and probe the corresponding ports. The idea of using Wireshark is also interesting. You may want to try sending ACK packets.

nmap -sP -PA21,22,25,3389 192.168.2.1/24 #21 is used by ftp

update two: The flags -sP and -P0 are now known as -sn and -Pn respectively. However the older flags are still found to be working in the newer versions.


How can the Origin header be used for CSRF prevention if Firefox doesn't send it for same origin requests or requests from data URIs? I'm planning to use synchronizer tokens for CSRF prevention, but OWASP recommends checking the referrer and origin headers too. I've been trying to figure out the correct logic for this, but my experiments suggest that there is no valid way to check due to the way Firefox behaves.

Firefox doesn't send the origin header for same origin requests, which I would have thought means you have to allow requests through that lack an origin header. I've just experimented with data URIs though and it looks like Firefox doesn't send the origin header from them either, which would mean an attacker can just direct the user to a Data URI that auto submits a malicious form.

This

data:text/html;base64,PGZvcm0gYWN0aW9uPSJodHRwOi8vd3d3LmV4YW1wbGUuY29tIiBtZXRob2Q9IkdFVCI+CjxpbnB1dCB0eXBlPSJzdWJtaXQiPgo8L2Zvcm0+

is a link to a data URI containing a form that submits to example.com.

Which is the following code base64 encoded:

<form action="http://www.example.com" method="GET">
<input type="submit">
</form>

When I open it in Firefox with the web console open it shows no origin or referrer header being sent.

What am I missing here? Is there some logic I should use on the server that will allow through requests from FIrefox but not malicious requests from data URIs?

The Origin header on it's own is not always enough (it's only sent on POST and CORS requests, but what you have is a GET request), but the Referer and Origin headers usually is (I'll include an example where they aren't sufficient at the end).

By default, Firefox does send the Referer header for same-origin requests. This is in-part why OWASP recommends using both the Origin and Referer headers:

  To determine the source origin, we recommend using one of these two standard headers that almost all requests include one or both of:

  Origin Header
  Referer Header

If both headers are not present, which should be rare (your base64 case being one of them), you can then either choose to allow or deny it.

  If neither of these headers is present, which should be VERY rare, you can either accept or block the request. We recommend blocking, particularly if you aren't using a random CSRF token as your second check. You might want to log when this happens for a while and if you basically never see it, start blocking such requests.

As OWASP says though, there are cases where these headers may not be present, so it recommends using an additional check, of which it recommends using CSRF tokens, especially if you do not block when neither header is present and correct.

  checking headers is a reasonable first step in your CSRF defense, but since they aren't always present, its generally not considered a sufficient defense on its own.

When requiring headers isn't enough:

If the site allows for user-generated content, like posting an image, it can be possible to do request forgery from the same origin. A GET request could be as simple as adding the following img tag to a public posting.

<img src="/forum.php?whatever=parameters">

Additionally for a POST request, if a user could also inject an HTML form (say the site is smart enough to filter JavaScript, but not HTML forms), it could be possible to trick people into submitting it, also from the same origin. This would at-least require user interaction though.


Does allowing the  tag create any XSS vulnerabilities? Backstory: Stack Exchange's markdown parser allows a couple of HTML tags (a,b,i,img) through, with some restrictions on the attributes to prevent XSS. We're thinking of requesting the <cite> tag to be allowed so people can include citation metadata in the script.

So, the question is, does allowing the <cite> tag to be used in user-submitted content expose any XSS (or similar) vulnerabilities? As far as I can tell, the tag is harmless as it only contains metadata (which may be rendered by extensions or the like).

Looking at the definition for the cite tag it doesn't look like in and of itself it's likely to introduce XSS issues as in most uses it's a bare tag without JavaScript style parameters.

The only potenial issue I could see is if it interacts badly with the code that is being used to filter content in a tags as a tags can be nested inside cite tags, but that's mainly just a filter implementation issue rather than a fundamental problem.


Are all fields of the PE certificate directory hashed during authenticode signing? In a Windows portable executable (PE) file the certificate directory points to an offset to a WIN_CERTIFICATE structure. My understanding is that while the field is named bCertificate, it actually contains an array of certificates in ASN.1 format in order to support multiple signatures.

Having extracted the bCertificate data from a number of signed Microsoft executables, I can see that the data within is an ASN.1 SEQUENCE structure containing one or more objects with OID 1.2.840.113549.1.7.2, corresponding to PKCS#7 signedData. It is unclear to me whether this structure is itself hashed (is a PKCS#7 signedData structure a certificate?) as part of authenticode, or even if multiple certificates are encoded as sequential ASN.1 structures with no parent ASN.1 sequence (i.e. concatenated ASN.1 certificates), or as ASN.1 elements inside a parent SEQUENCE element.

The documented process for producing the authenticity hash talks about skipping some PE fields - the checksum, the certificate directory RVA/size, and the certificate entry itself. It is clear to me that the certificate itself does not need to be part of the hash, as its authenticity is already controlled via CA/intermediate signing. However it isn't clear to me whether the exclusion includes any wrapping structure, if one exists (see prior paragraph).

Can someone clarify this? Is the PKCS#7 signedData structure considered to be a certificate in the context of authenticode hashing? Is the certificate array simply a concatenation of ASN.1-encoded certificates, or is the array facilitated by a parent ASN.1 sequence? If it's the latter, is the ASN.1 sequence definition (type + size) part of the authenticode hash?

Nope. The entire certificate entry table is excluded from the Authenticode digest.

The intuition for this is that, in the case of multiple certificates, the length and other metadata in the certificate entry table would cause problems for consistent hashing.

MSDN offers similar reasoning (link):

  When included in a certificate, the image digest must exclude certain fields in the PE Image, such as the Checksum and Certificate Table entry in Optional Header Data Directories. This is because the act of adding a Certificate changes these fields and would cause a different hash value to be calculated.


Might the Bitdefender Safe Pay module be consider a VPN service? I have Bitdefender Total Security 2017 installed on my pc, so I also have the SafePay tool activated.
The general purpose of this tool is letting customers doing payments safely by encrypting data while surfing secure websites, by creating a safe sandbox.

Me I was also looking for a VPN service or solution to configure on the same pc for surfing and doing operations anonymously over the internet and I wonder if I may consider the Bitdefender SafePay a good alternative to a paid VPN service (e.g. Trust zone VPN) or if I better should use it for doing payments only->

May I consider the SafePay browser included in the Bitdefender security suite a good alternative to a free or paid VPN service?

They do completely different things. A VPN connection encrypts data going across a network - it might be used to hide traffic from a network monitor or ISP, for example. A sandbox prevents access between applications on the same PC - it would aim to protect against malicious software on the local machine.

When making payments, the data being sent to the recipient site is usually encrypted by the use of HTTPS. It can't be encrypted further for the final leg because the recipient site wouldn't be able to decrypt it. This is the case when using a VPN too - the connection between the VPN endpoint and the shop is only encrypted with the shop's SSL certificate. By contrast, when you connect directly, the connection between your computer and the shop is encrypted with the SSL certificate [1].

A VPN can be used to browse anonymously, as long as you trust the VPN provider - they will know both the original source of the data (and if they're a paid provider, probably precisely who is behind it) and the destination. However, if you make payments using credit cards or similar methods, you will still reveal your identity to the recipient site, even though they wouldn't be able to see your original IP address as easily.

A sandbox doesn't conceal your IP address - it can't, since the data is still coming directly from your computer. It also can't encrypt data in transit further, else the receiver wouldn't be able to use it. However, it can attempt to protect against other software on your machine being able to tamper with the data before it is sent. It has nothing to do with anonymity.

[1] This is a slight simplification, but the key elements are included.


What is the advantage of using a digital signature over simple asymmetric encryption? If you're sending me a message, you can:

a) Encrypt the message using your private key, and I can decrypt is using your public key.

b) You can create a digital signature of your message, and then send the signature along with the un-encrypted message.

My two questions are:

1) I read somewhere that in the (a) scenario, if your encrypted message is tampered with en route, I won't be able to decrypt it using your public key. Is this the case? I thought I'd be able to apply your public key to any message, tampered-with or not, and if it's been tampered with, the message might just be gibberish or something.

2) What is the advantage of (b) over (a)? Given that the encrypted message in (a) and the digital signature in (b) are both encrypted using the same private key, in what way is the security provided by (b) better?

These misconceptions come from people trying to explain digital signatures to the layperson. Once someone understands the concept of asymmetric encryption, a common way to explain signatures is "encryption with private key", but in reality there is no such thing (for a very technical explanation, see here). You're far better off thinking of asymmetric encryption and digital signatures as two entirely separate things.

You've come across some of the many problems with this explanation. If someone did try to send you a message "encrypted" with their private key and it was tampered with, you are correct that you would be able to "decrypt" it, but it would be gibberish.

In practice though, messages are too long to be encrypted or signed directly with asymmetric cryptography. When encrypting, a symmetric key is usually generated and used to encrypt the data, then that key is encrypted asymmetrically with the recipient's public key.

Likewise, when signing, the message is first passed through a digest algorithm (cryptographic hash) to remove any structure in the data and to output a small digest that is then signed with the private key. Even if you only have a very short message to sign though, you must still pass it through a hash, otherwise an attacker may be able to forge signatures on random messages algebraically related to yours.

Since correct signing requires some sort of hashing to be used, the signature obviously can't be reversed to the original message, so the message also has to be sent separately to the recipient (consequently your (a) scenario isn't even possible). Often, messages are signed with the sender's private key, then encrypted with a random symmetric key, which itself is then encrypted with the recipient's public key.


Filtering Obfuscated Spam Emails In Exchange So the past few weeks we have been trying to cut back on the amount of spam reaching our users in our organization. We have been successful in implementing hard filtering rules like if an email subject or body contains "my bitcoin address" that usually means the email is a spam email along the lines of "I hacked your email now send me bitcoins". This rule has been good but some are still getting through. Upon inspecting the raw of the emails that make it through we see that they are using some utf-8 encoding to escape the filter.

Here is an example:

Raw shows:

=E2=80=8BMy=E2=80=8B b=E2=80=8Bit=E2=80=8Bco=E2=80=8Bin=E2=80=8B a=E2=80=8Bdd=E2=80=8Bre=E2=80=8Bss=E2=80=8B (=E2=80=8BBT=E2=80=8BC =E2=80=8BWa=E2=80=8Bll=E2=80=8Bet=
=E2=80=8B) =E2=80=8Bis

But decodes to:

My bitcoin address (BTC Wallet) is

Does anyone have experience in defeating this form of obfuscation? Specifically using Exchange 2010 filtering rules to help defeat this.

After some serious digging we were able to find a solution to this problem. The UTF-8 encoding that we were seeing specifically =E2=80=8B encodes to a no width space. This is used to bypass the filter by breaking up text but still look normal on the recipients end.

Filtering It Out

We were able to copy the character from this website:

  https://codepen.io/chriscoyier/pen/iLKwm

We pasted this character into exchanges filtering rules and it was able to detect and properly filter the encoding. Be warned this character is fairly common in day to day emails apparently so if you are going to filter based off of this character be sure to send it to a moderator do not just delete it without notifying anyone.

Hope this helps some people as this took a lot of work to figure out.


Intercept network traffic with a hub If I plugged a hub inbetween a switch and firewall, that also had a device running wireshark or similar capture software connected, due to the way a hub operates, would I be able to read ALL of the traffic between the switch and firewall, E.g. All inbound and outbound packets?

In theory, yes.  I did this for over a year some time back.  Be prepared for the possibility of this hurting your overall throughput, especially if you've got a lot of traffic and are approaching the maximum of your firewall's interface.

Another caution, at a conference where a team was going to demonstrate this using a Linksys hub, they discovered Linksys was branding some of their switches as hubs.  This was > 5 years ago but I wanted to warn you to avoid potential frustration.


Is a password protected SSH key necessary on an encrypted system? I have a laptop running Linux encrypted using dmcrypt. To use git, I just created an SSH key, but did not password-protect it. Since my hard drive is already encrypted, is there any benefit to password-protecting my SSH key?

Yes.

File-system and hard-drive encryption are security controls which defend against a specific threat, in this case it usually protects the data when the system is physically taken.

When attackers access a system while it's running via something like a vulnerable web application or through some other method they are effectively accessing the filesystems locally with user permissions of what ever application they compromised or in some rare cases they take over the kernel. When this happens the controls which keep the filesystem or disk encryption are effectively bypassed and the "user" can grab whatever files he or she has access to via the compromised account. Likewise there are many other flaws which allow attackers into systems but the point is that the two security controls you mentioned protect from different attack vectors and are both important to create a Defense in Depth strategy.

The security control of the password-protecting your SSH key is still valid and does offer additional protection that the file-system or disk-encryption by itself does not offer especially in the case of an attacker who has access to your system remotely. In this scenario the attacker would take or use  a copy of your key and instantly have access to your Git account.


Is using Tor and VPN combination more secure? I have been reading more about Tor and its risks to personal data leakage to the exit nodes in the chain. This last node can snatch encryption keys or log in information of websites I may have accessed.

Then i thought what if I used an encrypted VPN to access Tor to give me a secure form of anonymity. Security is my main concern but for example if I'm downloading a car the Tor anonymity will hide my location while using a VPN can protect me from the very nodes that comprise the Tor chain.

Is it safe and more secure to use a combination of Tor and VPN then just using Tor? What is more secure, routing VPN through Tor or Tor traffic through a VPN tunnel? Is there a more secure way to browse the internet and download content? What is the optimal way to securely surf the web? What is the best way to safely download content? Am I overthinking this?

In theory yes, In practice maybe not but also yes at the same time.

If you were to use VPN and a tor network you remove one of the security layers in the tor network. tor uses relays and your path changes every time you use tor by using a VPN you would be using the same end point (assuming you went TOR -> VPN)

If you went VPN -> TOR, You would encrypt all of your traffic to your start point (The VPN Out interface) and then the TOR network would take over, the issue here comes with the VPN service its self, they could very easily see you are using the TOR network, this would be your weak spot you want to be under the radar with everything.

To make it secure you would need to buy an anonymous VPN and pay for it in bitcoins after rolling your bitcoins via a tumbler (depending how you obtain the bit coins will determine your weak spot in the chain, but the tumbler should fix most of that issue). To also secure the purchase make bitcoin transactions and VPN transaction VIA TOR.

then once you have the anonymous VPN you would not want to connect to your VPN from your home address (though anonymous VPNS hold no data so technically you shouldn't be able to be traced from your home address). then once connected to the VPN you can use the TOR network that way.

To summarise:

Using a VPN creates an issue with its self as to obtain the VPN you would use personal information. though any extra security would be nice as you mentioned the chain is only as strong as its weakest link. The VPN would be the weakest link with personal information following you back (using a free VPN would end up in records being kept of your activities).

Keeping data private is never the issue, its keeping the data disassociated from the owner. 01/01/1970 is someones birthdate, asking someones birthday can be a security question...sadly I dont know who this birthday belongs to, following?

Hopefully I kept mainly to the point in my answer.


Why am I receiving this error message when browsing nvidia.com? I'm receiving this randomly when I try to visit nvidia.com.  I can either not reach the site at all with a 504 error, or I get this screen.

What does it mean, and what is the cause?

From the report by SSLLabs:

  Chain issues  Incomplete

This is a misconfiguration of the server: it is not sending the full certificate chain up to (but not including) the root certificate but instead only sends the leaf certificate. Specifically it is missing the intermediate certificate for RapidSSL TLS RSA CA G1. Without knowledge of the intermediate certificates the browser can not verify the certificate chain up to the locally trusted root CA - which results in the error you see.

While desktop browsers often successfully work around this configuration issues this is not successful in all cases.


Does a virus need to be clicked on to function? Can a virus infect my Windows XP operating system by its mere presence? I mean, if I copy/paste a virus on my computer and I never click on it, will it infect my computer or will it remain dormant, not harming my computer, as long I do not click on it?

A virus can't do anything by simply being present on your system as data.  A virus is just a program, it must be executed by something.  The trick is that that something does not have to be you clicking it.

Computers do many things automatically without your attention.  They accept requests for file transfers, remote desktop, provide details about their state, check for system updates, etc.  Additionally, you perform many actions that can be hijacked by nefarious code on another system, such as running websites with Javascript or Flash or running programs that pull data from the Internet or process documents (such as e-mail or office documents).

Any of these hundreds of paths of execution can be used to either trick a system in to running a virus that is downloaded with a website or to even remotely cause execution of a virus loaded on to the system without any user interaction at all.  So while you could (generally) safely download a copy of most viruses and let the code sit dormant on your system, there are a great many ways that an attacker could potentially cause a virus to be installed on your system without you taking any direct action.  (This is, in fact, the way that the quarantine option normally works in a virus scanner.  It just renames it and copies it to a different location.)

That said, I'd still recommend setting up a virtualized environment to test with.  There isn't any good reason not to, they are easy to setup and provide an extra layer of protection.  There is a very slim possibility it might be able to abuse some system process, such as hooking a search indexer or thumbnail viewer.  However, there is also a very slim chance that a virus may be able to escape a virtualized environment.  The odds of it doing both become increasingly unlikely though, especially if you change the extension on it to disassociate it from many system processes that might otherwise process it differently.

This is why it is so important to use things like firewalls on your network and to keep your operating system and other applications patched and up to date.  Security patches are released to fix holes as they are discovered, but many undiscovered or unpublished vulnerabilities certainly still exist.  Things are secure enough that not just anyone can break in to your system if you keep it up to date, and as long as you keep attackers off your network with a firewall you are probably pretty safe though, especially if you disable active content (like Flash and certain Javascript) when browsing the Internet.

As XP no longer gets security updates, you are left high and dry against any newly discovered vulnerabilities and it will become increasingly easy for a remote code execution vulnerability to be used against your system without there being anything you can do to stop it short of removing your computer from the Internet.


What is entropy in the context of passwords? Does "password entropy" only mean that it's long and/or looks random, or is there something else? If the password contains 50 random numbers, will it be high entropy or not?

The entropy of a password is defined as the base 2 logarithm of the number of guesses an attacker would have to make in order to be sure of correctly guessing your password.

It's an idea from the science of information theory, and in the information security field it is normally used as a measurement of how resistant a password is to a "brute force attack", which is where an attacker tries every possible password one after another.

If a brute force attack is possible it always works eventually. The catch is in the word "eventually". If an attacker can brute force a password in 20 seconds, then it's not very good. If it takes them two weeks, it's better. If it takes two years, most attackers won't bother.

A password with higher entropy will, on average, take longer to brute force.

You can increase the entropy of a password by either

increasing the length
having a wider range of possible characters (e.g. use upper and lower case and punctuation as well as numbers)
doing both

A 50 digit numeric password has an entropy of about 166. That would be considered very high indeed. I personally use passwords with entropy of around 100, which is pretty high. That is about the same entropy as a 32 digit numeric password.

You can't say how high an entropy is "high enough" without knowing more about the specific system the password is associated with - it depends on how fast the attacker can make guesses.

Let us suppose you use the password to protect a 7zip encrypted file, and your attacker is well resourced and uses a Cray XE6 supercomputer that can do 55 trillion guesses a second. If you're a 12 year old white US male, you have 63 years remaining life expectancy. Some simple math lets us work out that you need an entropy of about 77.5 for a password the Cray will not, on average, break in your lifetime.

If you use a numeric password, then, it will have to be at least 24 digits long (e.g 687374947891238403277394); or if you use mixed case alphanumeric with punctuation, it will have to be at least 12 characters long. (e.g. !cV~#$Liit4F).

It is important to remember, though, that brute force attacks are not the only way to break a password, and that entropy alone does note determine if a password is good or bad.


How to properly secure a $_GET in PHP? I found an SQLi in a buddies work site. He reported it to his superiors and they allowed me to run additional tests and also patch the site. After reviewing the site, The vulnerable code was a $_GET. I simply added intval() to check the variable if it was an integer. I reran sqlmap, w3af, and a few other scanners. The holes seemed to have been patched. Was this the proper patch? If not, how do I properly secure a $_GET in PHP?

It doesn't matter if its $_GET, $_POST, $_REQUEST, $_FILE  or even $_SERVER.  Its all user input and a there for a potential source of an attack.  What matters is how the user input is being used.   In the case of SQL Injection,  casting it to an int,  such as intval() works well.    However,  you should be using parameterized queries with a library like sqli, adodb, or pdo.

But sql injection is just one issue on the owasp top 10 and just one issue out of the thousands of vulnerability types tracked by the CWE system.  There is no magic wand to stop every vulnerability.


Is rowhammer comparable to faults caused by radiation? As far as I know, both rowhammer and radiation based fault injection, can cause arbitrary bit flips in the memory.

Are there any differences in matters of possible outcomes of both "attacks" on common hardware?

EDIT: In order to specify my question a bit: Could rowhammer cause control flow errors like usual fault injection does?

Yes, the principle and impact is the same. One of the specific properties of Rowhammer is that it is affecting nearby memory rows only (hence the name rowhammer). This makes establishing non-destructive attacks a challenge.


Is allowing public access to a DNS server, a security threat? If i was to create a DNS server that is hosted at my home, so then i can use it for my VPS servers; am I creating any security threat that can be abused by unknown clients from around the globe?

TL;DR:
If i set-up a DNS server, is it safe to open port 53 to the internet?

There are some attack methods (especially Dos/DDoS) using DNS Servers such as; DrDoS and DNS Amplification but there are also ways to strengthen your DNS Server and the connection between server and VPSs.

DNSCrypt is one of them (and I highly suggest you to use it by default) used especially for preventing DNS Spoofing.
Also, I suggest you to install and configure a good firewall on your server (Windows Firewall on Windows and ufw on Linux can be used) which allow only your VPS IP addresses to access your DNS server; other incoming traffic should be 'denied' by default. If you want not only your VPS Servers but also others may send a DNS request, you may use Limit option to set limits to prevent excessive traffic.
IPS and IDS applications/programs can be also used to detect and prevent some attack vectors but they mostly require a little technical knowledge. Snort, Surricata and Bro IDS.
At the end, you may want to use a log management and monitoring system (there are dozens of log management and monitor system available both open source and paid ones).

Note: There are some readings that you may use it to develop your understanding about DNS Server security practices:

https://technet.microsoft.com/en-us/library/cc770432(v=ws.11).aspx
https://www.sans.org/reading-room/whitepapers/dns/security-issues-dns-1069
https://www.cisco.com/c/en/us/about/security-center/dns-best-practices.html
What can and can't a malicious DNS do?
Listing of DNS vulnerabilities
https://insights.sei.cmu.edu/sei_blog/2017/02/six-best-practices-for-securing-a-robust-domain-name-system-dns-infrastructure.html


How is the use of Process Monitor a security risk? I was trying to debug an application that was not working on specific environments and in my research I had multiple sources refer me to the tool Process Monitor found in \live.sysinternals.com\tools.
Not having admin access to my machine I made a request to IT to get permission to install and use this tool.
Fast forward a few days and I get a response saying that I would be able to use it under supervision and that "they are allowing it this time, but was definitely given a serious cautionary note with it."
By this time I had already used another tool to read the ".bin" files in the library and I was able to find the error (the library had an updated bin file while the library required a previous version) and I no longer needed the tool.
I'm a little perplex at the response I got from IT. My question is how can the use of this tool be a concern to IT?

Process Monitor needs to run with Administrator rights. In fact, it installs a driver to peek on the actions performed on the filesystem, registry, network, etc.
As it obtains data system-wide, the concern of IT might be that you might get access to data you shouldn't, either for the system/setup or -if this was a shared machine- of other users. ProcessMonitor only shows metadata but even that might be too much information (e.g. suppose someone was working on file Z:\Departments\Human resources\Dec 2020 massive layoff\Schedule.docx!).
However, I think the concern will be more basic. Process Monitor need to run as administrator, and it is likely it would be possible to escalate privileges from it. I think their decision of letting you use the program needed, but with someone from IT supervising you is a good solution.


How are GPUs used in brute force attacks? I have read that GPUs can be used in brute force attacks? But how can this be done and is there a need for any other hardware devices (hard disks for instance)?

Note: I'm more interested in web application security, but I don't want to put on blinders. I'm sorry if my question is ridiculous for you, but my hardware background isn't very good. I just know how basic components work together and how to combine them.

I'm choosing to assume you're asking why it's a risk rather than how to hack.

GPUs are very good at parallelising mathematical operations, which is the basis of both computer graphics and cryptography. Typically, the GPU is programmed using either CUDA or OpenCL. The reason they're good for brute-force attacks is that they're orders of magnitude faster than a CPU for certain operations - they aren't intrinisically smarter.

The same operations can be done on a CPU, they just take longer.


Is it possible to spoof the last proxy of an X-Forwarded-For Header? I'm using a firefox plugin https://addons.mozilla.org/en-US/firefox/addon/x-forwarded-for-header/ to spoof the X-Forwarded-For Header to 8.8.8.8.

For the following php page:

echo $_SERVER['REMOTE_ADDR']  . '
';
echo $_SERVER['HTTP_X_FORWARDED_FOR']  . '
' . '
';

When accessing the instance from the instance ip address this is the following output:

72.14.255.255
8.8.8.8

When accessing the instance from the load balancer address that the instance is in, this is the following output:

10.173.25.72
8.8.8.8, 72.14.255.255

The first value is local ip of my elastic load balancer.

Since the format of the X-Forwarded-For header is like so http://en.wikipedia.org/wiki/X-Forwarded-For

X-Forwarded-For: client, proxy1, proxy2

Is it safe to assume that the last proxy cannot be spoofed?

The load balancer sets the 'most recent' part of the header.

As long as you trust the load balancer (and the connection between your server and the load balancer) to set the header as the IP address at the other end of its TCP connection, then you can trust that the last entry in the header is an accurate representation of the source of the connection (from the load balancer's perspective).


Keepass - password paranoia How do I know that the Keepass app isn't behind the scenes at some point sending my master password over internet to some secret site whose job it is to collect them and use them for evil means?

You don't.

However you can put in some basic controls, such as disallowing all outbound traffic, or analysing all outbound traffic for any nasties.

What the use of applications like these boils down to is trust, assurance or confidence. You use an operating system, right? How do you know it isn't doing this? (Actually, you probably know it is doing something like this, if you use Windows or iOS, or Android, or various others)

So, at one extreme, you can avoid all computers, and hide your face, and only use cash etc. or you can use the things that make modern life comfortable and accept there is an element of risk, but try and learn what risks are more likely and worry about them.


Wildcard SSL Certificates & SAAS From what I have read, using a wildcard SSL/TLS certificate is not advisable, how do you do certificate issuing & management in your SAAS application(linux) where each client has a user selected subdomain?

There is nothing wrong with "wildcard certificates". A wildcard certificate is equivalent to a certificate containing a lot of possible server names. If this maps well to your problem (e.g. you have a server with a lot of frontends who advertise distinct names, but all these names are in the same domain and you control that domain), then wildcard certificates are certainly a possibility. The main issues with wildcard certificates are:

A wildcard certificate is usable with several server names, and you usually need to use several names because you have several machines. Since the wildcard certificate corresponds to one private key, that private key will have to be installed on all these machines. Private keys which are duplicated and which travel around are somewhat less private, because they are more exposed.
Commercial CA use a business model that relies on selling many certificates. A wildcard certificate allows a customer to buy one certificate instead of many. Thus, commercial CA tend to make wildcard certificates much more expensive, to compensate for the corresponding loss of business.

In your situation, as I understand it, you have a hosting server, who runs a SSL server for several sites; the sites have names which follow the pattern name.example.com where name is a customer-specific name, and example.com is a domain under your control. Since, in HTTPS, the SSL dialogue occurs first (before any HTTP occurs), the server does not (usually) know the intended server name (the name from the URL which the client uses), the server must somehow send a certificate which "works well" with all possible names from the client. This leads to three possible solutions:

Use a wildcard certificate with *.example.com. This will work well.
Use a certificate with many names in the Subject Alt Name extension. You can put hundreds of names in there. This also works, but you have to obtain a new certificate every time you want to add a new name (a certificate is signed by the CA, you cannot change anything in it without invalidating the signature).
Make the server "guess" the intended server name, so that it may send the "right" certificate (the server would then have many certificates, one for each site name). This uses the Server Name Indication extension: a slot in the early SSL handshake messages so that the client may tell to the server, before the server actually sends its certificate, which site name the client is expecting. SNI works well except that some old browsers or OS do not send it, so using this extension means that you will not support such clients. The main unsupported client is Internet Explorer on Windows XP (IE on newer Windows systems is fine). If you think you can afford to reject clients who still use Windows XP and IE, then SNI is a workable solution for you.

The wildcard certificate still seems the simplest and most robust method.


What is the scope of the NSA's backdoor in Microsoft's CryptoAPI? As I understand, the NSA has a kleptographic backdoor in Microsoft's CryptoAPI algorithms, which enable them to use a secret private key to decrypt secure communications which rely on asymmetric key generation. According to Wikipedia, this could be used for example to decrypt ssl communications between two computers on a network.

However, what is the true scope of this? Does this mean that every Microsoft product that implements any form of assymetric encryption could be vulnerable to this specific backdoor?

From Wikipedia:

https://en.wikipedia.org/wiki/Microsoft_CryptoAPI

CNG also adds support for Dual_EC_DRBG,[5] a pseudorandom number generator defined in NIST SP 800-90A that could expose the user to eavesdropping by the National Security Agency since it contains a kleptographic backdoor, unless the developer remembers to generate new base points with a different cryptographically secure pseudorandom number generator or a true random number generator and then publish the generated seed in order to remove the NSA backdoor. It is also very slow.[6] It is only used when called for explicitly.

https://en.wikipedia.org/wiki/Kleptography

The Dual_EC_DRBG cryptographic pseudo-random number generator from the NIST SP 800-90A is thought to contain a kleptographic backdoor. Dual_EC_DRBG utilizes elliptic curve cryptography, and NSA is thought to hold a private key which, together with bias flaws in Dual_EC_DRBG, allows NSA to decrypt SSL traffic between computers using Dual_EC_DRBG for example.[15]

With input from Aria and Xander, it appears that the RNG in question is no longer used/widely used in Microsoft production code following concerns from Microsoft developers back in 2007, and although it can still be used for applications written against CNG, the backdoor is widely known enough that it is not used either in production Microsoft code or in well-known third-party applications. Thanks for the input!


What's the secure way to write clear text password into a file? I'm trying to insert sensible data into a file.
I'm trying to write a MySQL configuration file dynamically.
The file contains this:

[client]
password: 87sfZEKEF,5

The script that I used is owned by root, and therefore "nobody" can see its content.
I'm trying to find the most secure command, or way, to pass the content of the file to the actual file.
The actual file has an unguessable name, and is secured with chmod 600 just after it's written.

The possible problems that I see is:

If I use echo:

echo -e "[client]\npassword: 87sfZEKEF,5" > /tmp/unguessable/path/to/dynamic/mycnf

Then the ps command would probably be able to catch the password, is that right ?

What about using heredoc syntax?

cat << EOF > /tmp/unguessable/path/to/dynamic/mycnf
[client]
password: 87sfZEKEF,5
EOF

Is this more secure?
Are there more secure ways?

Is there a "totally" secured way (or, what's the most secure and reasonable way)
to write such a file?

Actually I found the answer right after writing the question:

https://stackoverflow.com/questions/11279335/bash-write-to-file-without-echo


CSRF defense use case You have an embedded device that supports HTTP based web UI over private ip address.
Does it make sense to implement CSRF defense over HTTP(not HTTPS)?

If an HTTP request is capable of changing state, then it may need CSRF protection. Whether or not the request is encrypted at the transport layer has little to no relation to this.
Without CSRF protection, an attacker who convinces you to visit their website or even a single resource may be able to send requests to your embedded device and take control over it, if the victim's browser is properly authorized or there is insufficient or broken authentication. This happens regardless of whether HTTP or HTTPS are used.
Yes, ideally everything would be over HTTPS. However, the "best" option for most vendors right now is to ship embedded devices with self-signed certs which, other than being good for trust-on-first-use and thwarting passive sniffing, are not much better than plain HTTP in many scenarios. Often, the user will still get a certificate warning and click through it. Until this problem is solved, the HTTPS outlook on embedded devices is still dismal.
(Addressing your now-deleted edits) Indeed, XSS bypasses CSRF mitigations. However, the threat model seems a bit different here, since its way less likely for an adversary to be able to exploit an XSS in your embedded device than a CSRF issue, since they would have to get to the device in the first case.


Can a truncated crypto hash of a truncated crypto hash help harden a resource against attacks? In a project of mine, I have two fields which I need to use for storing a cryptographic signature (hash) of a file, but I can only use 112 bits in total, spread as 16+12 hex chars in those two fields.
Since I cannot store a full SHA256, I intend to use a truncated SHA256 value. Which of the following scenarios would be cryptographically "safest" given the constraint of 28 hex chars?
a) truncate a full SHA256 to 28 hex chars and store the result as a concatenated value in those two fields (16+12).
b) truncate a full SHA256 to 16 chars and store the result in the longer field, PLUS
generate another SHA256 of the original full SHA256 hash, truncate it to 12 chars and store it in the shorter field.
c) truncate a full SHA256 to 16 chars and store the result in the longer field
PLUS generate another crypto hash for the resource (BLAKE2, RIPEMD256, whatever solid), truncate it to 12 chars and store it in the shorter field.
Thanks very much for responses.

Ultimately, this scheme isn't especially secure, since, as kelalaka points out, this doesn't provide enough security with hex characters.
If you can store arbitrary binary in these fields, I would use either a SHA3-224 or a BLAKE2b-224 hash for this purpose, since it's going to be able to store the entire thing there.  SHA-224 (the SHA-2 variant) is also okay if you're certain your application doesn't need significant resistance against length-extension attacks.
If you can't store arbitrary binary, then I'd store it in Ascii85 (without the start and end markers) or base64url encoding if possible to get as many bytes as possible out of the encoded characters.  In this case, I'd use BLAKE2b because it can be truncated specifically to any number of bytes, although SHA-512/t is also a possibility.  The latter may be hard to find as a generic function in major crypto libraries, though.  You can use a truncated function here, but it's preferable to use a hash of exactly the right length.
I'd stick with one strong algorithm over the main data here instead of splitting it between multiple algorithms.  I don't think you gain anything with multiple algorithms, and SHA-2, SHA-3, and BLAKE2b are all thought to be robust and strong.  Ultimately, your goal is to provide as many bits as possible to hard against the canonical attacks, and there's no reason to think hashes of hashes provide any better integrity there.
I would definitely not use MD5 or SHA-1 in any new application for any purpose.  They are known to have significant weaknesses when it comes to collisions and things won't be any better when you truncate them.  In general, unless you get advice from a reputable cryptographer that you should use MD5 or SHA-1 in a new application, you should not.  Even if you don't need cryptographic security, another option is better.


Is there a GNU/Linux or BSD distribution dedicated to air-gapped computer? I am currently in the process of setting up an air-gapped computer which will be dedicated to managing cryptographic key (including: generation of GPG key/subkey, management of a small CA, generation of SSH key).

I am wondering if there are OS already existing that are dedicated to this purpose. I see multiple things that can be nice to have for this kind of computer:

no support for any network driver
a well design entropy generator (since there will not much entropy source)
common cryptographic tool coming pre-installed

And certainly more things to take care that I can come up with or know about.

I took a look at those OS:

Tails: come with a lot of tools ,plus it support a read-only OS with persistent encrypted data; but more dedicated to safe surf.
DEESU/Liberté linux: pretty interesting, seems to support customization, but seems to be quite old now. (At least the last binary release)
OpenBSD: last time I played with it, it was pretty easy to deactivate driver in the kernel. But need to be modified/customized since the default install is pretty bare.

Is there any project or other OS I am not aware of that will fit the role of air-gapped computer?

Thank you for any pointer on this.

As far as I am aware there are none, it's quite a specific niche. Nevertheless it should be easy to configure any of the BSDs/Linux Distro's to serve your needs.

I speak mostly from FreeBSD experience but it should be pretty similar for other BSDs and Linux. It's easy to compile a kernel and just deselect all networking stuff. On an average cpu this takes 3-5 minutes for Freebsd. Probably even faster if you exclude a lot of things. In addition to this you could disable the network ports in the bios.

But you should be asking yourself what your threat model is and whether you want 'online' or 'offline' signing/key generation. If your threat model includes local attackers, do you even want a system that is running continuously? Vulnerable to cold boot attacks, badusb attacks and bios exploits?

If I were to setup a separate air gapped system, I would simply use a tails or freebsd live cd. Use a write once cd-r/dvd-r. After you've written it you can confirm on multiple independent machines via checksums that you have a live cd that has not been tampered with. Now use this live cd to boot on your 'air gapped' hardware and once booted you decrypt an hard drive with your secret keys and you can do your operations.

Advantage of using a live cd is that you can keep it updated by simply creating a new one that has patches included. If you were to setup a separate system without networking it would be tricky to keep updated/secure. By only booting the live cd when necessary and thus leaving the hard drive offline and encrypted you also avoid being vulnerable to cold boot attacks or other local host attacks against a running system.

So some food for thought, first properly define what your threat model is; who or what are you looking to defend against? And then address that.

Another solution could be something like a usbarmory, it's a fully functional computer with no input devices other than usb. Very tamper proof and small enough that you're able to keep the device with you at all times.

Now let's talk about entropy. There is a variety of things you could do here, obviously the more entropy the better. I think the random number generator of neither Freebsd, OpenBSD or Linux can be considered vastly superior to the others. They're all quite solid.

Some extra reading material: RNG of Linux, RNG of OpenBSD and RNG of FreeBSD

All of them do a good job of mixing different sources of randomness. If you want extra randomness because there aren't a lot of entropy sources you could consider getting an extra separate hardware RNG, for example OneRNG.

All distros/bsds will come with OpenSSL preinstalled, OpenBSD will come with LibreSSL. LibreSSL can also easily be installed on Freebsd. So all common cryptographic operations should be doable out of the box.


JSON and form-urlencoded encoded payloads in Burp Intruder The application I'm running a security assessment on encodes POST requests as follows:

POST /foo/save HTTP/1.1
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
X-Requested-With: XMLHttpRequest
Content-Length: 6652
<snip>

bar={"options"%3a{"key"%3a"26b678c6-1d75-41c0-8a20-d9882828c76c","description"%3a"Foo"...<snip>&key=26b678c6-1d75-41c0-8a20-d9882828c76c

i.e. A parameter containing JSON is inserted in the bar key, therefore it is JSON encoded and then percent encoded.

Is there a way to automatically encode payloads using Burp for use in Intruder? The only way that comes to mind is to run payloads through JavaScript hex encoding first, then load the encoded list into Burp and then URL-encode from there. Is there anything built in that would do this? The closest I found was "Javascript constructed string", however this is not suitable for use in JSON.

So to summarise I need the payload to be JSON hex entity encoded then URL encoded (Burp easily does the latter, so the JSON encoding is the bit I need).

There's no build in way to process your payload. Burb has the decoder tool but it's not linkable with other tools. You have three possibilities to achieve your processing:

As you said: Generate your payload data with an appliaction and load the list into a custom iterator.
Create an external application or script to generate your payload and use the runtime file payload. Sometimes this is a bit more useful if you have a big list of payloads or you need some other logic between the requests.
Create or modify an extension to generate the payload. Have a look at this example.


How important is the usage of open_basedir on a server with multiple different PHP websites? On an apache webserver with multiple VirtualHosts running different PHP websites on different domains, how important is it to set open_basedir for each VirtualHost?

Will it actually help to isolate the different VHosts from each other or is it possible to circumvent the restriction?

How big of a security flaw is it to not set open_basedir under the described circumstances?

It adds additional protection in case of a directory traversal vulnerability. For example, consider a PHP file that looks like this:

readfile($_GET['thumbnail_path']);

Without open_basedir, this page could be used to read any file on the filesystem. Setting open_basedir prevents this, so that only files in some specific directory can be read.

However, open_basedir does not protect against someone that can run (PHP) code on the server. For example, simply running system('cat /etc/passwd') will bypass the basedir setting. Also, not all functions that handle files check the path against the open_basedir setting.


Why don’t SMTP servers just require all senders to be authenticated before accepting mail? Why don’t SMTP servers just require all senders to be
authenticated before accepting mail?

Laziness mostly. Ease of configuration, it's easier for administrators to setup a central SMTP server which doesn't require authentication to send email, than one that does.

You will often see that this is also offered by ISPs to accomodate their clients more easily.


Does the advent of GDPR result in improved protections for customers based exclusively in non-EU countries? Sorry if the title is a bit confusing. I'll try to rephrase: GDPR obviously improves transparency and protective services in global service providers/vendors that involve users in the EU.  I can see how transparency about data management would benefit all end users (both those that reside in the EU and those that don't).  But does GDPR require companies to protect non-EU user data using the exact same measures as if the user resided in the EU?

I'd like to think that as a US-based user of a global company, I'm receiving the same exact rights as EU users under the protection of GDPR (because it would be difficult/risky/silly for a company to try to lessen security for some regions) but I'm not so sure.  Could a company technically place some regional data at more risk while still adhering to GDPR guidelines?

As far as the GDPR is concerned, the protections are only afforded to EU residents. As to what organisations are willing to do, it really depends on the organisation, and what concerns one might have with regards to security, implementation, and costs.


Why is CSP require-sri-for marked as obsolete? The description from Mozilla warns that require-sri-for is obsolete and may be removed at any time.

The feature seems useful, especially for large websites where it's likely that a developer may forget to include an integrity attribute.

Is there a specific reason this has been deprecated? Is there an alternative feature to use instead?

Firefox 68 for developers explains:

  The Content-Security-Policy directive require-sri-for is no longer supported due to concerns about its standardization status. It was previously available only behind a preference, which was off by default (bug 1386214).

Hopefully it will be back when the directive is standardized.


Does HTTPS encryption on a site prevent the NSA from knowing you visited its domain / the URL? The reason I ask whether HTTPS protects the metadata of your Internet activity from a wiretapping entity on the backbone like the NSA or not, is the following scenario:

Say I am browsing the encrypted https://xsite.com/page.html and it calls to an unencrypted javascript library at http://ysite.com/library.js or external image at http://ysite.com/image.jpg.

Does the GET request for this cross-site request pass on the URL for the encrypted page I am visiting to the unencrypted ysite.com's server, and thus, if I block the cross-site request using a browser add-on like RequestPolicy, I will prevent the NSA from knowing that my IP address visited https://xsite.com/page.html (or even the domain xsite.com entirely)?

Or, is such a privacy concern a moot point, by HTTPS not in fact hiding (to a backbone wiretapper) that your IP address visited https://xsite.com (or even /page.html), anyway?

Does the GET request for this cross-site request pass on the URL for the encrypted page I am visiting to the unencrypted ysite.com's server

No. ysite.com will not know the URL for the page you are visiting. xsite.com will not show up on any requests you make to ysite.com.

  if I block such a cross-site request using a browser add-on like RequestPolicy, I will prevent the NSA from knowing that my IP address visited https://xsite.com/page.html (or even the domain xsite.com entirely)?

Everyone will know that you have visited xsite.com since HTTPS does not encrypt the hostname. This is because you need the hostname to set up the connection. However, it will not be possible to tell if you visited page.html or page2.html since the path will be encrypted.

However, if NSA knows that http://ysite.com/image.jpg is embedded only on page.html and you have recently made a DNS query and connected to xsite.com, they can guess that you have probably visited https://xsite.com/page.html.

Edit: The approximate length of the URL path is visible to all eavesdroppers. Thus, if xsite.com has only a few pages, it might also be possible for an attacker to guess which page you are visiting.

Additional resource on HTTP traffic analysis: Are URLs viewed during HTTPS transactions to one or more websites from a single IP distinguishable?


Is there any information on the impact of CVE-2016-1907 (openSSH)? I just saw the notification about CVE-2016-1907 this morning:

  The ssh_packet_read_poll2 function in packet.c in OpenSSH before 7.1p2
  allows remote attackers to cause a denial of service (out-of-bounds
  read and application crash) via crafted network traffic.

I can't find any other information about it beyond the general note in the release notes:

  SECURITY: Fix an out of-bound read access in the packet handling
  code. Reported by Ben Hawkes.

Chromium won't let me view the changes in the source repository (expired certificate plus HSTS) so I haven't tried looking at the patch itself yet.

Has anyone posted any analysis of this defect? At the very least I'd like to know if it affects the client, server, or both (e.g. if someone without an account could DoS an arbitrary server).

This is good question. I investigated this issue two weeks ago as it was out. This bug appeared for the first time in openssh-6.8 in refactoring commit. Basically the issue is that there was replaced function which called exit() with function only returning error value.

if (state->packlen < 1 + 4 ||
    state->packlen > PACKET_MAX_SIZE) {
#ifdef PACKET_DEBUG
    sshbuf_dump(state->input, stderr);
#endif
    logit("Bad packet length %u.", state->packlen);
    if ((r = sshpkt_disconnect(ssh, "Packet corrupt")) != 0)
        return r;
    return SSH_ERR_CONN_CORRUPT; /* <-- this line was added */
}
sshbuf_reset(state->incoming_packet);

As you can see in the context of current version (snapshot above), this branch handles wrong packet lengths (smaller than 5 B and larger than PACKET_MAX_SIZE). This condition threw error message, disconnected packet and should have return. But the sshpkt_disconnect() might have failed and at this point, the code execution would continue to the function further, handling the buffers received from the other peer as valid, without additional checks. The code is used in both server and client.

As you see, the CVSS Severity is quite lower than than the other CVE released with the same version. To successfully exploit this bug, wou would have to craft packet fitting above condition (wrong length), make sure the sshpkt_disconnect() fails (close the socket?) and blindly expect that the evil things happen.
Attack surface is much more limited and less investigated than CVE-2016-0778, where was even proof of concept with crafted server.

Also note that openSSH implements privilege separation so on server, which would give you basically just the possible code execution in the limited net child in the sandbox. On the other hand, you could use code execution on client side using crafted malicious server, but for the price of client disconnection. The user would probably be suspicious, but not the scripts (autossh, rsync jobs and similar).


Is there anything insecure about Google ReCaptcha? In this question on software recommendations, the OP asks for an alternative to Google reCAPTCHA because "for a security reasons also we don't want to depend on any out side services".

As far as I know, you ask Google for a CAPTCHA, you display it, you send the user’s input to Google who tell you if the input was correct or not.

Where’s the possible insecurity?

It's not like you send Google the user's log in, password, d.b.b, bank account number or any other sensitive information.

I suppose that a truly determined attacker could use some man-in-the-middle attack, but why? CAPTCHAs are generally used to prove you are not a bot and not as login credentials.

Am I missing something? Is the OP correct to be concerned or is he just going to cause himself a heap of extra work, possibly by trying to implement his own system which he believes to be safer than Google's because ... security through obscurity?

Well, there could be a couple of concerns:

Denial of service: In case the Google reCaptcha system somehow goes down, your users will probably not be able to authenticate anymore. This could also happen if they implement some kind of update, which breaks the whole system.
External JavaScript libraries: when using Google reCaptcha, you need to include some JS libraries. In case Google wants to execute some XSS attack, you have just made it a lot easier for them.
Tracking: anyone clicking through the reCaptcha 'consents' to be tracked by Google. This may impact your user's privacy, as well as provide a means for Google to track traffic on your website.

However, as mentioned in this answer, they probably care more about their reputation than about compromising your website. Although I doubt that when it comes to the 'tracking' concern.


injected code decode Recently I saw a domain of mine was hacked and the hacker have injected his code in some encryption format as below.

<?php $l___l_='base'.(32*2).'_de'.'code';$l___l_=$l___l_(str_replace("\n", '', 'D+I/q0Gc5hiUdrnOss2HvSvTg1sG8Q6rE6jWEaBtDzQFKd1Er6yZI1MBfxpqll488V7Tbm3phDbBFAwG
k5MLq6NbLAXb69v3jtw65S0KD5Nx2R8ROgea8Z0z1b/1amqjjy706S1+QQ2+nJYjdf8QYi0ic4kArurt
yE+zVXve7+PByfRZYTFOL7f+0YwcE/+JilFvFyJjOuid8BGS2mlNGOQfnhKnE5hx6rqcKCtrfk29fJNM
s+r1ppMJoVjBbstGuXjMHXYCPlD90sncCTKs/zartN4bBWXeSWp585mZc+OeYVL5mJcPxJn673e62z+y
rROT7OcGEMyd7LCDyMB41OwG6Q5VDAv0wZNelA+Yz0JiYd4nahYoWC/35syZlXQr136ftUc+8gR9xfQW
gG1d2mOxcozGxZbuM9mB80UyYxmXnRDBocwKeR8uTPTiAEXWocDxXLwuCrfhkLZuAvHG2b857X8uqx68
nS8+XSMFquYb6spb8irA

I was wondering if anyone knows how to decode it. I want to see his code. Is there any online site available? Doing some research, some sites shows that it follows following encryption

str_replace --> base64_decode --> md5

Its a base 64 encoded payload. Web firewalls are familiar with base64 encoded payloads and try to defend against them hence the attacker is using a technique to evade firewalls that search and filter the call to base64_decode.

Eventually the $l___l_ parameter will hold the decoded content

So instead he constructs it as follows:

_ $l___l_='base'.(32*2).'_de'.'code' => base64_decode
$l___l_=$l___l_(//content) => base64_decode(content) => decoded content

the string replace just deletes the new lines (\n) from the content before decoding

from studying similar looking attack on this blog it seems that the content you receive after base 64 decoding is an encrypted payload. The password to decrypt the payload is obtained by a POST request to another server.


How to safely reuse passwords in variation? Remembering a lot of passwords is difficult. A lot of people use the same or a small set of passwords for everything.

Of course, this is very unsafe. If such a password a password is stolen, the adversary could get into several or maybe all of your accounts.

Let's say I have the base password  Fo0b@rPW which I'd like to reuse in every account I use.

Fo0b@rPWgoogle ; Fo0b@rPWfacebook ; and so on

This is at least a little safer than reusing the same password but still pretty vulnerable to dictionary attacks.

How can I alter a single password in a way that it is safe but I still can remember which is the variant for each site?

One idea I have is to add specific digits at specific offsets like:

Fo0b@rPWgo2og4le6 ; Fo0b@rPWfa2ce4bo6ok8 ; and so on.

EDIT:
The problem is, that someone who could get one password in plain text, is able to figure the other passwords out. This means that the site-specific part has to become part of the entropy as well.

Now if I use some sort of elaborate algorithm like

  Take the first digit of host name.
  Take the crossfoot of that digit's dec ASCII value  .
  From the offset(crossfoot), insert a string with the length(host name)
  Invert that substring, if offset is round number

Something like:

  fo0b@rPWfac12345678ebook
  fo0b@rPWgoog654321le

In security we always assume the algorithm is known, as such adding some structure to a password will not help you to increase its entropy (strength). This as an informative side thought as this is not the subject of the question.

Assuming your "basic password" has enough entropy (is strong enough) your proposed method is actually rather safe on the assumption that all the sites you use this method on hash their passwords.

The safety of your method relies on not being able to use the password obtained from one breached site to gain access to other sites. When your password is hashed this is the case.

However should one site not hash your password, or have a vulnerability in their hash. The whole system is vulnerable.

What your system actually does is add "salt" to the system. Many sites already do this for you, best practice requires it. So what you are basically doing is adding your own salt which could help with sites that do hash their password but do not add salt. So opposed to using the same password everywhere this increases security but not a lot.

As such I would not recommend such method and would say that a password manager, even if they do have their issues, is a safer solution to the password problem.


Why would a replay attack be considered a threat to integrity and not confidentiality? I came across a test where the instructions were to circle all the correct answers. I'm looking for an explanation to the answer for this question:

  Question: a replay attack is a threat against
  Answers: 1) confidentiality 2) integrity 3) availability
  Correct: 2) integrity
  Explanation: attacker is faking the authentication process which is a
  level of indirection

First of all, is there a clear cut answer or is it more of an art interpreting the rules of CIA? Second, isn't the data being stolen and nothing is getting written to? Does it count as a write, just falsely authenticating to a system?

A replay attack is an attack where you record a legitimate transaction and then replay it at a later date.

It is not an attack on confidentiality because the attacker isn't learning any new information: he has the same data than what he recorded in the first place. it might lead to an unauthorized access but that is a different issue.

It is not an attack on availability because the target system will still be functioning normally (again, unless the replay attack opens up the way for a different kind of exploit).

It is, however, a breach of the system integrity because it allowed an unauthorized transaction.


Looking for general guidance on securing web API application for client applications and users I have a web service built with WebAPI that accepts JSON requests and responds accordingly.  The core architecture is built but there isn't any authentication/authorization.

After a lot of googling and poking around sample projects, I'm not sure where to start.  I've found a ton of material from 2008 and 2009 but not a whole lot of recent guides/workflows for WebAPI / single page apps.  I think the workflow should be as follows:

Check to see if the user is logged in: How can this be done with javascript?  Do I send a cookie to my webAPI?  If so, do I send that cookie as a parameter in the body of the request?
Let the user log in / register: How is this data encrypted/decrypted?  Surely I can't be sending passwords over the wire... is this where SSL comes in?
Provide them with access to what they have rights to access: I think I got this - I can just authorize in the controllers on a per-request basis.

Any info would be awesome.

The easiest way is to use an SSL connection, have them provide authentication credentials and then return a session token to be used with future requests for that session.  You can then expire the session token after whatever time amount you want (at which point it would be necessary for them to send another authentication message.)

That's of course assuming that there is no built in session management in WebAPI.  It's a bit before my time so I'm not all that familiar with it.  I mostly ended up using WCF based services where there is a lot done for you in terms of session management.


Is writing shellcode still a valid skill to have/learn? Following up from this question: Should I bother teaching buffer overflows any more?

I am a it sec researcher and also security course instructor. Recently questions have been raised about the validity of buffer overflow, buffer overflow techniques and the like, given that the subject itself is involving over the year (new countermeasure, new techniques, etc.). The question I linked rationalized the learning of buffer overflow concept as a whole, but I would like to ask for a more specific area.

So in short, is writing shellcode still worth learning? Also some other techniques like egghunting, NOP sled, etc.

Yes it's still worth learning.  People who are in the early stages of learning exploit development are not going to come out of the gate knowing everything.  It's good to use the buffer overflow, that you reference and shell code writing to get ppl's interest piqued and to use as a stepping stone to becoming a professional exploit developer.  You never know, you may be teaching the next exploit developer genius and learning about shell code development might trigger a new innovation.  So yes keep teaching it.  Besides it's still used.


Can a computer/MacBook be compromised/infected/hacker simply be requesting/attempt to join a network? I was finishing a clean installation of macOS Catalina on my MacBook, and I was asked to select a wifi network. I misclicked on a wifi network with a name that's very similar to mine and was asked to enter the password, obviously I cancelled it and selected my own network instead.

Can the act of requesting to join that network put my MacBook at risk? I am especially concerned since I was still in the middle of finalizing my macOS Catalina's setup.

I wonder if

Does clicking on the wifi network itself and being asked to type in your password gives any information about my system that put it at risk?
Can the request itself cause my MacBook to get any virus that may be plaguing the devices on that network? Or if the person who owns the network is malicious, can they compromise my computer that way?

I am considering reinstalling my MacOS again just for safe measure...

You do not have to worry, because you didn't send anything to the router that was part of the WiFi network you accidentally clicked on.

When any computer, regardless if it is a Mac, Windows, Linux, System V, ect., scans for available WiFi networks, it in fact is not scanning or communicating.  In fact it is just waiting for what is called "Beacon Signal", which WiFi routers send out at regular intervals.

The beacon signals are frames that usually contain information about the WiFi network.  These frames have many different types of information, and thus is said to be divided into many multiple fields.  To not go into to much detail here, out of the 10 most known fields I will explain in a very high level about only two of the fields.  These two fields are named "Capability Information" and "SSID" fields.

The "SSID" field is most known for containing the information relating to the name of the WiFi network.  This is how one is able to see the names of the networks, on the list of available WiFi networks.

The "Capability Information" field is sub-divided into further sub-fields, and it is this field that relates to your question.  The "Capability Field" contains information regarding the encryption, the type of WiFi network (IEEE 802.11 a/ax/n/b/g/.. standard), but more importantly relating to your question, whether the network requires a password or not to connect to it.

As long as you do not type in a password and hit enter, nothing is sent to the router that is sending out the beacon signals.  Basically no information from your Mac Laptop was ever sent to that WiFi network that you accidentally selected.

I referred to the IEEE Std 80.211 Part 11: Wireless LAN Medium Access Control (MAC) and Physical Layer (PHY) Specifications.


Restricting authorization on a web app based on certain criteria For a web app, we are authenticating and authorizing users. There is no Sign-up option, but rather these users are provisioned into the system explicitly and are given certain permissions based on their level.
Say a role has access to customer data. This access is required to conduct business processes during business hours, or say when that user has an appointment with a specific customer.
Is there any way that we can restrict (or reduce) the permission of a user based on certain criteria, e.g. they are using the web app on mobile, or it is outside business hours, or it is being accessed outside a set location?
I have come across this question where they suggest to use IP based restriction, or specific hardware devices with certificate installed. IP restriction could be enabled, but it does not solve the need to access on the go. Having specific hardware doesn't help if they provide full access on the go. I don't have much of a background in security, so any direction is appreciated.
Update
From what everyone is suggesting, I will try to understand about Identity Aware Proxy which would handle dynamic generation of permission, or roll out something on the db side, or look at setting up logging. Thanks for sharing. I don't know which is the right answer.

It is not uncommon that access is restricted by IP address, geographic location, type of device (especially managed or not), patch status, time etc. Some of these information need to have agents on the client device, others not.
There are several solutions out there which help implementing this. Look out for the capabilities of IAP (Identity Aware Proxy) offered by various companies in the context of Zero-Trust and BeyondCorp, Conditional Access in AD etc. Some relevant players in the area are ZScaler, Akamai, Cloudflare, Okta, Cisco Duo, Microsoft, ...


Conceptual question regarding signing with Yubikey/Solokey/Nitrokey using GnuPG The named hardware dongles (or at least several models of them) allow me to store PGP secret keys key.
Suppose I am using such a secret key to sign data (doesn't matter what). As I understand the operation happens on the hardware itself and the PGP secret key doesn't leave the device.
Now suppose I am signing several GiB of data, does that mean all that data gets squeezed through the hardware and therefore the hardware dongle becomes a bottleneck, or is the signature practically the same as signing a hash of the data - where the hash gets computed on my host machine?
To summarize:

When signing large amounts of data, will that data go through the hardware dongle in some way or will its hash be computed and the signature simply signifies the validity of the hash?
Does the involvement of gpg-agent change anything? I.e. suppose I am signing content on host2 connected from host1 which has the hardware dongle with the PGP secret key plugged in.
Suppose I am encrypting data against some public key and subsequently signing it. Does this change anything or create a bottleneck?

GnuPG signatures will sign a digest of a file, not the file itself. When you attempt to sign a large file, GnuPG will create that file's digest (generally by using a hash) and then sign only that.
We can also use the --detach-sig option to show that a (detached) signature is the same size, regardless of the file's initial size:
$ gpg --sign --detach-sig testfile-2M.sig testfile-2M
gpg: using "MYKEY" as default secret key for signing

$ gpg --sign --detach-sig testfile-512M.sig testfile-512M
gpg: using "MYKEY" as default secret key for signing

$ ls -lh .
total 1052792
-rw-r--r--   1 kazwolfe  wheel   2.0M Jul 13 17:33 testfile-2M
-rw-r--r--   1 kazwolfe  wheel   566B Jul 13 17:41 testfile-2M.sig
-rw-r--r--   1 kazwolfe  wheel   512M Jul 13 17:33 testfile-512M
-rw-r--r--   1 kazwolfe  wheel   566B Jul 13 17:42 testfile-512M.sig

When verifying a file, GnuPG will do something similar. It will independently calculate the digest and then verify the signature against that digest.
Encryption works in a similar way. RSA or other asymmetric algorithms are rather slow especially relative to other (symmetric) algorithms like AES. As a result, GnuPG will instead opt to generate a session key that will actually encrypt the file quickly. This session key is then encrypted using the public key.
You can experiment with this too: if you encrypt one (large) file with multiple recipients, the time to encrypt the file won't really change that much as the session key is just being recycled between each recipient.
$ time gpg -r MYKEY --encrypt testfile-512M
       11.58 real        10.43 user         1.08 sys

$ time gpg -r ... -r ... -r ... -r ... --encrypt testfile-512M
       11.83 real        10.55 user         1.17 sys


How could MITM worked clearly although there is an end to end encryption in WLAN? I used ARP spoofing attack in my wireless local network recently. My router is using WPA2-PSK encryption. So while there is an end to end encyrption in my WLAN after my computer enters in the middle of victim and router with arp spoofing, how could I read packets of victim clearly from my own computer? According to my knowledge, if there is an end to end encryption, the packets cannot be read. Because, they are encrypted. What am I missing in theory?

This is very similar to another question on SE.

The simple answer is that ARP packets aren't encrypted. If they were, ARP wouldn't work in the first place.

Quoting myself from that similar question linked above:

  Simply put, ARP poisoning works because ARP works. The only thing that
  changes is that the value of the responses sent by the attacking
  machine are faked. ARP replies are implicitly trusted, and because
  they expire, they need to be refreshed periodically. Attackers
  leverage this implicit trust to send fake responses. If the details of
  the 4WHS were needed for ARP, no one (real or attacker) would be able
  to communicate ARP replies.


Is it safer to use the preloading feature of HTTP Strict Transport Security (HSTS)? Is it safer to use the preloading feature of HTTP Strict Transport Security (HSTS) and if so, why?

With preloading:

Strict-Transport-Security: max-age=10886400; includeSubDomains; preload

Without preloading

Strict-Transport-Security: max-age=10886400; includeSubDomains

It is actually even safer.

Conventional HSTS only takes effect after the first request to the site, and until the user clears his browser's cache (each browser may handle this differently but I assume clearing all browsing data should also delete the HSTS list), and I believe HSTS does not persist between non-private and private browsing due to privacy concerns.

"Preloaded" HSTS works by telling everyone that you wish your HSTS header to be shipped with browser updates, so that browsers know your site should only be accesses using HTTPS even if your user never visited your site before. It has some implications of course, mainly not being able to opt-out (let's say you go back to HTTP, not only will your existing users not be able to connect because they saw your HSTS header, but new users won't either because the HSTS header is bundled with their browser).

I believe you also have to submit the site manually using Google's form as I don't think they crawl the internet looking for preload headers, at least not yet.


How to detect backdoor/root shells? Let's assume I'm a user with root access to a machine and I'm a legit user. My machine/server runs Linux. I'm not very familiar with defensive security (I mainly practice offensive). Sometimes, popping shells can be as easy as running some metasploit module (meterpreter sessions).

What can I do to check if there are remote shells (root or not) running on my machine?

As I cannot find a direct answer to this on this site, I'll provide a quick answer.
There are two primary methods for locating shells:

shell signatures
anomalous network connections

Signature-based
Meterpreter, for example, has a very distinct signature and AV tools can find these. PHP shells and others can likewise contain unique elements that might be detected by automated tools. Custom shells are difficult to find this way.
Network-based
But a shell, in your context, is something that has a network connection. You want to look for

known processes that have no business connecting to the network ("why is calc.exe connecting to a Linode server?")
unknown processes that have a network connection ("what is sefhwebfh and why is it connecting to a Linode server?")
known processes that have a legitimate need to connect to the network, but the connections are unusual ("why is httpd making outbound connections to a Linode server?"

(Note, "Linode" is a generic example.)
To look for these, you need to:

know your OS's tools to list processes and any network connections they make. It's then important to baseline what is "normal" (either through documentation or from personal experience) to compare against.
run packet captures (or similar, like IDS, packet inspection on the firewall, etc.) to listen to the wire to look for anomalies from the network baseline.

What do you do once you find a shell?
Once you discover the shell, you can no longer be confident about anything on the server. You have no idea if permissions have been escalated currently or in the past. While a full forensic investigation might be interesting and satisfying, you can never be sure that you have all the information to declare the machine safe or cleaned.
Your response should be to capture an image of the machine for an investigation into the impacts of the event, then nuke the machine from orbit.


Is VLAN better than guest wifi feature I own the internet connection and router and going to share it with apartment mates. I want to accomplish the following things

Isolate our networks, such that they cannot see my internet activity or my devices (want to avoid router cascading or VPN)
not be held liable for their internet activity
maybe even have two different Ip addresses for two  networks (the modem of ISP allows connecting physically to only one router)
maybe block shady site access for the guests (though I read most routers do not support such advanced configurations)

I researched online and I found out that routers that support VLAN are expensive while almost every modern router is supporting a guest wifi feature.
Is there any advantage of using VLAN over guest wifi in this situation

Is there any advantage of using VLAN over guest wifi in this situation

It depends on exactly how the guest WiFi is implemented, but usually it is done by creating another internal network which is strictly separated from the "normal" internal network. Sometimes are also additional restrictions possible for the guest network, like separation between clients inside this guest network (i.e. cannot see and connect to each other) and restricted internet access (like only HTTP and HTTPS).
A VLAN has no advantage here regarding separation, it might even provide less restrictions than offered with the guest network (i.e. no separation of clients inside the VLAN, no restricted internet access).

not be held liable for their internet activity

This can not be achieved, neither with a guest network nor with a VLAN. Both share the same external IP address.  It is not clear from outside if some access to the internet originated in the guest network or normal network.
There is a business model though to repurpose home internet routers as public WiFi hotspots. In this case the provider of this business model will take care of the liability problems. This is usually done by routing the hotspot traffic using a VPN to a VPN exit of the hotspot provider. This makes the hotspot provider the public visible source IP of the traffic and thus any legal problems are directed to the hotspot provider. Sometimes this kind of feature is already available on the routers provided by the local ISP and sometimes it even already enabled. See for example Your Home Router May Also Be a Public Hotspot — Don’t Panic!. Note that access to this hotspot is then usually open to all public, but often restricted to anybody having an agreement with the hotspot provider which might come with additional costs.


Determining if software installed onto vm is malware or not I've tried searching for methods of scanning files within virtualbox, but most (if not all) of what I find is discussion about studying programs that are already known to be malware. I'm trying to determine if something is malware or not, and I don't exactly know what to do to determine this manually rather than just relying on an antivirus scan of some kind. Are there ways to scan the files from a program on the host computer or within the vm itself? Or is relying on an external program just not the right way to go about this?

Such methods may prove extremely difficult.
The virtualization process involves slicing/dicing data elements inside of the guest, making them very difficult for a an anti-malware tool to recognize. Consider two areas that anti-malware tools heavily scrutinize to find malicious code: memory and file systems.
Let's consider a non-virtual machine first.
It's important to note that even non-virtual machines have virtual memory. Most modern operating systems have a virtual memory system that breaks up data inside the machine; these parts are called memory structures. Using several tables, the virtual memory is then mapped to physical hardware storage addresses. The memory structures make each program on the machine believe that there is an enormous amount of memory, even though physical RAM is actually limited. Most modern operating systems support virtual memory by swapping data between RAM and the hard disk or other high-volume storage devices.
In a virtual machine environment, the guest has its own virtual memory system, as well as its own tables that map various applications' view of memory to physical memory. But the physical memory of the guest machine is actually inside the virtual memory of the host machine, which is mapped into the physical memory underlying the host.
With all of the indirection here, it's no wonder that it's hard for an anti-malware tool to see inside the host and figure out what's going on inside the virtual workstation. To scan the virtual system's memory for malware, the host anti-malware tool would have to read and discern all of the virtual memory tables of the guest in real time. You might be thinking, "But it would just have to look for a few thousand strings in contiguous spaces in memory, right?" Not exactly. From the host's perspective, the strings to search for may not be contiguous at all since the guest's virtual memory system has been sliced and diced.
A similar issue happens in the file system. In most virtual machine implementations, the guest's file system is merely a big file in the host machine. But all kinds of formatting information is stored within that file, and any malware files here are broken down into different pieces that are then distributed throughout.
To scan the host machine, the anti-malware scanner can rely on the operating system itself to group hard drive sectors into files. But, the anti-malware scanner doesn't have that luxury inside the guest, where the guest's own file system breaks things down into virtual sectors and does so inside that big file on the host's hard drive.
Now, creating an anti-malware tool that can run on a host and determine what's happening in the guest is theoretically possible and could be a very powerful tool in one's arsenal. Its architecture though would likely be different from many of today's anti-malware tools. Such a tool could implement its own code to discern a guest's virtual memory and file system. Alternatively, the tool could rely on software in the guest to do this unraveling; this would require hooks into the guest, however, and an extension of the anti-malware tool from the host into the guest itself.
Another option would involve a different kind of anti-malware tool that, instead of looking for a series of signatures, would look for other anomalies inside the guest. These anomalies can be more easily discerned from the host and wouldn't require a complete mapping of memory and the file system.
Such tools may exist in the future.
Original article link here


DMARC none policy overwrites local policy DMARC is used to tell receivers of e-mail what to do if SPF or DKIM fails in mails send from your domain. As far as I know this pretty much sums up DMARC, if this is not correct please correct me.

My question:
The situation is this, mydomain.org has DMARC policy none (p=none).
The mailserver of somedomain.org has it's own policy to reject all e-mails that fail het SPF check
So if the mailserver of somedomain.org receives an e-mail that fails the SPF check it would just reject it.
But is it so that when an e-mail from mydomain.org is received at somedomain.org and fails the SPF check will the mailserver reject the e-mail as per local policy or take the DMARC policy and actually just deliver the e-mail?

In essence the question is, isn't a DMARC p=none policy not even less safe than no DMARC at all?

Kind regards,

TL;DR: A DMARC policy of none does not mean that the mail should be accepted. It only means that it should not be rejected/quarantined based on a failed DMARC check. It can still be rejected based on SPF Fail.

  DMARC is used to tell receivers of e-mail what to do if SPF or DKIM fails in mails send from your domain.

DMARC does not define what happens if SPF or DKIM fail. It does not care about failed checks at all. It only cares about the successful and identifier aligned checks (i.e. domain from check must match From in mail header). DMARC passes if at least one of the identifier aligned DKIM signatures or SPF checks passes and fails otherwise. DMARC can define that the mail should be rejected or quarantined based if the DMARC check fails.

A DMARC policy of "none" does not mean that the mail should be kept - it only says that no decision will be done based on the DMARC status. From RFC 7489 section 6.3:

  none:  The Domain Owner requests no specific action be taken
           regarding delivery of messages.

And the example in section B.2.1 says more clearly that p=none should not be treated as a "pass" but as "don't change existing behavior":

  Receivers should not alter how they treat these messages because
        of this DMARC policy record ("p=none")

Thus p=none does not mean to accept the mail but that one should not reject/quarantine the mail and instead can rely on other policies. And SPF defines its own policy. A Fail means that the mail was not sent from a source IP which is allowed for sending. From RFC 4408 section 2.5.4:

  2.5.4.  Fail

  A "Fail" result is an explicit statement that the client is not
  authorized to use the domain in the given identity.  The checking
  software can choose to mark the mail based on this or to reject the
  mail outright.

Apart from that MTA are neither required to implement SPF nor DMARC and they can implement SPF without implementing DMARC and thus reject a mail solely based on an SPF Fail.


Is it safe to plug an SD card or USB flash drive in my sytem if I turn the write protection on using the switch? I know that plugging in some random SD card or USB drive in a system can be a bad idea because you may get malware on your system. Now imagine you found a storage device either a memory card or flashdrive, you want to check it's contents without having to worry about being infected, now you look at the device and sees it has a write protection switch, so you move it to turn it on and the storage media is now read only.

Now does that mean malware can't spread from it, can the malware bypass that protection?

Also I know it prevents the system from accessing the storage media, but I'm not sure if it prevents the storage media from accessing the sytem.

you look at the device and sees it has a write protection switch, so
  you move it to turn it on and the storage media is now read only.

  Now does that mean malware can't spread from it, can the malware
  bypass that protection?

No.  Malware acts by being read and executed from media, not by being written to it.  Setting the media to read-only merely guarantees you can't add or delete anything from it.  If your operating system wants to, or is tricked into, reading and running code from that device, you're vulnerable.


Is interface spoofing possible? One commonly used iptables rule for Linux servers is this:
# iptables -A INPUT -i lo -j ACCEPT

Can we assume that this rule will only accept traffic which is sent from the local machine?
Is it possible for a remote attacker to craft a packet that says "I arrived through the loopback interface", even if the packet arrived via a physical ethernet port?

An interface is a property of the current system and not a property of the transferred data. Therefore there are no information in the packet which allow to specify the interface which should be used by the receiver or which should be shown as used by the receiver (i.e. different interface shown as actually used).
This does not mean though that an attacker could not indirectly cause malicious traffic originating at the loopback interface. For example an external web page loaded inside the browser on a machine is able to create network connections to 127.0.0.1 or ::1, which then originate at the loopback interface.


Application level protection against Meltdown, Spectre, Foreshadow, Fallout. Zombieload Is it possible to develop an application in such a way that its data in memory cant be stolen by recent attacks such as Meltdown, Spectre, Foreshadow, Fallout. Zombieload? All mitigations focus on patching hardware, BIOS or OS. But could sensitive applications such as password managers also implement additional protection mechanisms?

For example, could KeePass keep the passwords out of L1 cache (always loading them directly from memory)?
This might protect against attacks targeting L1 cache.

There are other vulnerabilities which leak other caches and registers so it might not be sufficient against all attacks. Any other ideas on how to minimize the caching of this sensitive data?

Also, I know keepass encrypts passwords in memory but are they also encrypted in L1 caches? And is the decryption key not also in these caches?

Yes, theoretically applications can work around these issues. However, it's most probably not a threat the average user faces.

Further, these workarounds will be detrimental to performance. It most likely requires lots of work to ensure that no potentially dangerous instruction is used, and even then one can't be 100 % sure if absolutely everything was done right.

As a result, software vendors will see the amount of work required, compared to the relatively small gain in security, and just decide it's not worth it. The aptly named website cpu.fail lists several newly found bugs and FAQs about them.

To cite the ZombieLoad FAQ (emphasis mine):

  Q: Are these software bugs?

  A: No. These are bugs in the processor. Software can work around these bugs, which costs performance. Future processors will have integrated fixes.