Creating ssl-certificate for third-party service I have website e.g. https://mysite.com. I want to connect third-party service to domain https://catalog.mysite.com.
This service asked to give them ssl-certificate (.crt + private_key), created on my server, so they could install it on their server.

As I understood, I'll do the following:

create key, csr; approve that I'm the domain owner and fetch
certificate from issuer;
give the .key and .crt to the third-party service
(not copy, but erase from my server and give files to the service).
point catalog.mysite.com to service's ip.

Looks like simple procedure, but will it somehow compromise my server or mysite.com domain security?

If you create a certificate only for catalog.mysite.com, this won't compromise your security (further).
All it allows this third party to do is run their server on the domain "catalog.mysite.com". They obviously can read everything sent to "catalog.mysite.com".

But if I understand you correctly, that is exactly what you want from them.

If you also add "mysite.com", "www.mysite.com" or any other subdomain to the certificate, this third party can also run a server which identifies as "mysite.com".

Some certificate authorities automatically add "mysite.com" to a certificate for "catalog.mysite.com". Don't get a certificate from them.


Have anyone tried to extract the encryption key from a SSD? After reading this forum thread it does not sound like encrypted SSDs provide much protection at all - specifically encryption only occurs between the controller chipset and the NAND storage.

Why is this? Is this a usual disk encryption design? Are there any studies of encrypted SSD hardware? What are the weaknesses and limitations of such a setup, if any? I am particularly interested in key extraction from the controller - is this possible? Is it even necessary, as taking the hard disk in its entirety to another system should mean it is still readable?

Such encryption can be useful to implement a "wipe everything" feature. It is difficult to securely erase things from a SSD (it is already not totally easy with a classic magnetic hard disk, but internal features of the SSD, in particular wear-leveling, make it almost impossible to totally remove all data). With encryption, the problem is much reduced: it is only a matter of erasing the key (and choosing a new one), a mere 128 bits, compared to a dozen gigabytes.

Outside of this secure wipe thing, disk encryption as you describe makes no sense security-wise, because one may assume that an attacker stealing the disk will get the controller with it, including the key... unless the controller does not have the key. This may be a "password-protected disk" in which the encryption key is derived from a password entered at boot-time. If the encryption key is not permanently stored in the disk itself, then encryption at the controller level makes sense because there is little point in doing that in the CPU, unless the attack model supposes that the attacker can spy on the SATA bus. In the realistic model where the attacker is someone who steals the disk (or the whole laptop -- it has better be shut down, not merely put in sleeping mode !), disk encryption is about keeping confidentiality of the data as itself, so encryption has to occur "somewhere" before actual storage, but it can be in the controller.

Of course, nothing says that the encryption is done properly. It is not exactly trivial to go from AES, an algorithm which encrypts 128-bit blocks, to a system which encrypts a whole disk, without leaking information on the encrypted data, while still allowing random read and write access. At least, the "attacker steals the powered down laptop" makes things relatively simple: we do not have to fear active attacks (the attacker does not give the laptop back) and there is no concern about chosen plaintext/ciphertext attacks as well. A simple CTR mode would be fine (I am not claiming that's what any SSD does, only that it would be how I would do it myself).


Vulnerability scanning applicability for PCI DSS I'm fully up to speed on PCI DSS requirements and have attend the ISA course recently. The course was helpful and I was able to bounce ideas off of the trainer. However I keep coming back to one aspect of PCI for which I need to decide if at this stage if it's applicable or if anyone else has gone down this route: vulnerability scans.

I have got the impression that if I can prove that the card data in our environment is fully encrypted from the PIN pad to our transaction handler and there is no way anyone could hack that or retrieve the decryption keys or even be able to influence the transaction, then a vulnerability scan will not add any security. (However I do see the point of vulnerability scans from a general security stand point.) It's a cost and time thing at the moment.

The setup (merchant Level 2 - SAQ C):
Multiple sites, segmented and not connected together via VPN/LAN/etc. All standalone sites. We use a PCI DSS Level 1 Card transaction handler and use their software and industry standard PCI-compliant PIN pads. The data is encrypted within the device and then transmitted. We have no access to the data or other information other than the last four digits after the transaction has been processed.

We currently have quarterly external penetration tests performed by an ASV.

With the encryption and access, does anyone feel I can de-scope the vulnerability scans?

Absolutely not.

If your goal is just to gain PCI-DSS compliance, you're assessing the situation incorrectly. Compliance should be a by-product of good security, and regular penetration testing and vulnerability scans are an invaluable part of that.

As an example, let's say a 0day is released for Windows XP SP3. There's a good chance you won't catch the news, and you'll be oblivious to the potential problems. Regular vulnerability scanning will alert you to that problem as soon as the scanner is updated with a detection routine. This is critical to keeping the barrier to entry on your network relatively high.

If cost is a major factor, it's time to present your case for a budget increase. You need to weigh up the potential damage and risks, and make a strong case as to why you need to be doing these scans.


Why are some websites seemingly immune to self-signed certificate MitM attacks? I recently did an experiment using MitM to gain account information (username and password) while accessing websites. I used two PCs in the scenario; one as the target, running Internet Explorer, and one as the attacker, running ettercap. One attempt (pretending to be steamcommunity.com) yielded information; the target accepted the attacker's fake CA self-signed certificate presented via the MitM attack. The other attempt (pretending to be facebook.com) didn't even allow me to add an exception for the self-signed certificate on the target machine. So the question is, why did one website allow me to add an exception while the other one didn't?

Facebook uses HSTS (with preload[*]) while steamcommunity.com doesn't.

HTTP Strict Transport Security is a HTTP header that has two effects:

It forces all connections to the site over HTTPS (even if it was accidentally linked/bookmarked/typed as HTTP)
It aborts if any HTTPS error or warning exists. This includes self-signed certificate warnings, which means that it is impossible to accept these certificates.

[*] preload means that the browser is aware of HSTS even before the first visit. Without preload, you could perform a man in the middle attack on the very first request to the site, even if HSTS exists.


How do I sign another person's key and make the signature expire? I'm using gnupg and I've just seen that people can sign keys with an expiration attached.

The expiration of individual signatures can be seen in gpg --list-sigs <KEY> when setting this in your .gnupg/gpg.conf:

list-options show-sig-expire

However, I can't find any information on how to add such an expiration to a signature.

How do I do that?

[Edit after the clarification]:

I believe you are looking for the "esoteric options of the GPG", you can have a look at them in here:

http://www.gnupg.org/documentation/manuals/gnupg-devel/GPG-Esoteric-Options.html

Specifically you are looking for the option:

--ask-cert-expire

Use it when issuing a new key.


public WiFi hotspot-What is leaking at that tiny moment before connecting to a VPN? When you sign up for a VPN account you also download the service's client,be it for Android, Windows etc but this question is specifically for Android or portable devices connecting through public hostspots.

For the VPN client to connect you through its VPN service you first have to connect through a wifi hotspot which itself assigns you an IP of its own network.

During that moment between connecting to the hotspot and connecting to the vpn,what kind of leaks that can identify you are taking place? What kind of information can the hotspot collect? Besides,applications like Gmail automatically connect when they become aware of a network connection,which could be very well be the one prior to the vpn's.What can those leak and how can you control them?

Between connecting to the hotspot and establishing the VPN nothing is protected(encrypted) by the VPN.
Anything already encrypted (HTTPS/SSL/etc.) can not be read by the hotspot owner without installing a certificate on your device, but that requires your active permission. Specifically the Gmail app uses encryption.
The opposite is also true, anything not encrypted can be read as plain text from the hotspot owner.

Some VPN apps like FREEDOME from F-Secure have an automatic killswitch (screenshot below) that blocks all in- and outgoing connections until the VPN is established.


PCI-DSS, what is the best distro? What is the best distro of Linux to get PCI-DSS compliant?

I am using Debian 8 because I think Debian is one of the most stable versions, but it seems not to be enough, I am struggling with a lot of vulnerabilities.

Furthermore, if anyone could post what would be better if apache vs nginx in combination with the chosen distro I will really appreciated that.

Whichever version you decide to use you will have to implement a formal lock-down and security maintenance programme for your systems and there won't be much difference between the major versions (Centos, Debian or Ubuntu for example). They all need careful install, lock-down, and patching/monitoring/managing.

I have a number of clients who successfully use Centos and Ubuntu (!4.10 LTS) which, together with appropriate configuration, patching, and montitoring regimes pass level 1 PCS-DSS audit each year without issue.

Apache and Nginx will both be fine for PCI-DSS applications as long as they are also patched, configured securely and monitored etc. It's not really the software (within reason) but the way you use them that's important to PCI.


My computer hacked? tcpdump show a connection to an ALLOCATED UNSPECIFIED ip address 13:06:05.345111 IP 192.168.1.101.36218 > 157.55.130.174.40033: Flags [.], ack 162, win 237, options [nop,nop,TS val 688796 ecr 596714815], length 0

This IP address is Allocated Unspecified on ripe.net and there are many connections today.

I'm running Ubuntu 14.04 (always updated to the latest).

Just because the IP shows as Allocated unspecified does not mean you are being hacked.

This IP status is because you asked the wrong entity, as ripe.net is not the responsible for allocating that IP. If you look at IANA IPv4 Address Space Registry, you would see that this IP range is managed by ARIN.

If you ask arin.net, you would see that the IP is owned by Microsoft Corporation.


Is possible to know if increased marketshare means more viruses? I'm having an argument with other developers about why more "viruses" exist (including all forms of external attacks, exploits, etc) in Android vs iOS. Like with Windows vs *nix, the main idea is that the bigger market share is the determinant factor in the increase of attack attempts.

I think that the main factor is how easy is carry a successful attack, i.e.: Windows have more viruses because it was a weaker target than others.

So:

More numbers (population) = more attacks or
More weak (security) = more attacks

I acknowledge that it is necessary that a sufficient # of targets with enough value must exist to sustain this behavior, but I think that it is possible to have a more secure system, no matter how popular and that the increase on numbers will not yield a increase in viruses.

However, that is my intuition. Does proof exist either way? Is there research about this?

Although there has been reported malware on both platforms (Anroid and iOS) I believe most of the Android malware can be attributed to the freedom given to the user regarding apk (app) installation and the vetting of apps prior to publishing.

On iOS Apple must approve all apps before they are published on the App Store. This process can take several weeks with much back and forth between the developer and Apple. For non jail broken phones this is the only source of apps. Although a few reported cases of malware has slipped through, this process increases the difficulty of publishing iOS malware. Put this on top of the fact that to register as an iOS developer Apple takes good care to get your business registration details. The level of effort is not insignificant for iOS malware.

However on Android it is easy to install apps from third parties. Apps on Google Play itself are only partially vetted (via Google Bouncer and a new client side malware check on 4.2 Jelly Bean for malicious behavior). It's easy to register on Google Play without official business documentation (for example Articles of Organization)

The vast majority of Android trojans are posted on third party app stores as free versions of some paid app. Even on Google Play a number of malware apks have been published and downloaded by hundreds before Google has taken them down. It's relatively easy to convince users that a pirated version of an app is just that, without injected malware.

I personally have seen push notifications telling the user they must download the "Official Android Update" after which the user is brought to a 3rd party site.

The bottom line is the freedom that Google gives its users to download whatever apps they want from wherever they want in addition to a less rigorous pre-publishing process for the Play Store makes the level of effort for publishing Android malware significantly less than iOS malware. So while numbers do play an important role "How can I get the most installed with the least amount of cost/effort" leads to Android being more popular for malware.


What algorithms are used in Bluetooth Secure Simple Pairing LE for authentication, key generation and encryption? From another question in SO, I got to know a lot about authentication, key generation and encryption algorithms available in Bluetooth BR/EDR:

I also read the official specification, and it says that LE Secure Connections and BR/EDR Secure Connections are functionally equal. However, I didn't manage to find a word about what algorithms are used in Bluetooth Secure Simple Pairing LE for authentication, key generation and encryption. I dig through the docs, but I didn't find the answer.

I found somewhere online that SSP in LE uses AES-CCM for encryption (is it true for sure?), so the analogous table for Bluetooth LE should look like the one below, right?


What happened to MD6? I read on Wikipedia, that at first MD6 had some problems with a buffer overflow, and a lack of proof of resilience against differential attacks; however, the article also says that that was fixed.

Yet, I struggle to find much else about MD6 and on the whole of SE there are only a couple of references, so what happened, and why does everyone talk about MD5 instead of the latest iteration MD6?

The short answer is that MD5 is widely discussed because it's had widespread historical use, and MD6 isn't because it's relatively unused and has faded into obscurity due to a multitude of better of alternatives.

Why isn't it more popular? It was an entrant in the SHA-3 competition, but was eliminated in the first round because it simply didn't stack up against the competition. It was noticeably slower than other competitors, didn't offer much in the way of advantages over them, and its formal proofs weren't complete.

In the meantime, SHA-2 is still considered secure and is in widespread use, the Keccak digest was chosen to become SHA-3 and serves as an emergency backup should Merkle–Damgård constructions in general become broken, and BLAKE2 — a derivative of one of the other finalists in the SHA-3 competition — has gained support as a direct successor to SHA-2 due to improved speed, security, and features. Given that, there's not much of a reason for anyone to further consider MD6.


INTEL-SA-00086 extracting the secret key used to encrypt Intel CPU code: is the digital signature bypassed? In a recent attack to INTEL-SA-00086, the researchers are able to extract the secret key that encrypts updates to various Intel CPUs.
In the arstechnica blog it is mentioned as

The key may also allow parties other than Intel—say a malicious hacker or a hobbyist—to update chips with their own microcode, although that customized version wouldn’t survive a reboot.

In theory, it might also be possible to use Chip Red Pill in an evil maid attack, in which someone with fleeting access to a device hacks it. But in either of these cases, the hack would be tethered, meaning it would last only as long as the device was turned on. Once restarted, the chip would return to its normal state. In some cases, the ability to execute arbitrary microcode inside the CPU may also be useful for attacks on cryptography keys, such as those used in trusted platform modules.

How someone can upload the firmware without the private key? Isn't it require a signature check?

How can we sure that our shipped CPU is not hacked by a third party?

Yes, it is bypassed
According to the CVE-2018-3659 and CVE-2018-3643 whitepaper, the Intel® Converged Security Mangement Engine's System on a Chip has four different DFx (Design For testability, debug, security and validation) states:

Green (DFx locked) - normal state
Orange (DFx unlocked) - allows to debug OEM IPs
Red (DFx unlocked) - allows Intel to debug ALL IPs
DAM (Delayed Authentication Mode) - special state in which debug interfaces are still closed

The INTEL-SA-00086 vulnerability uses a buffer overflow in the file handling of Intel Management Engine's file system to change the DFx state to Red unlocked, which later allows the attacker to disable firmware signature checks for as long as the DFx state remains.
The detailed steps to reproduce it can be seen in the published Proof of Concept.
We can be relatively sure the CSME firmware hasn't been hacked by third parties (at least without Intel's consent) because it is the RC4 microcode encryption key what has been broken, NOT the firmware signing key. When the computer reboots, the DFx state goes back to Green locked and, if there are persistent changes, the firmware signature check fails as the signing public keys' hashes are embedded in ROM during the manufacturing process and cannot be rewritten. Newer related vulnerabilities could be discovered, though.


Create https session between server and client I'm doing a project about security transactions and i'm wondering if to establish a connection based on https both client and server need to have a ssl implementation installed to preform the handshake protocol.
Anyone could help me out here?
Cumps.

Yes, the client and server both need to support SSL/TLS.

All modern web browsers ship with this support baked in, such as NSS in Firefox. Unless you have a one off use case, I don't see you needing to worry much about the clients support for SSL/TLS.


Is it safe to use private key encryption for lots of small blocks of data themselves? I currently handle small JSONs of sensitive information which are guaranteed to be smaller than 100 bytes. You can encrypt up to ~500 bytes with a 4096 RSA key.

Is it safe/secure to store these chunks of encrypted messages together? Let's say they get altogether stolen for cryptanalysis. Let's say you even have plaintext associated to some of them. Could you derive the private key or get knowledge about the rest of the encrypted messages?

Additional note: I need to encrypt without the requirement of the owner presence, but I need to guarantee the owner is present if that info is being read. That's the reason I'm using asymmetric encryption.

Yes, you can use RSA with a good padding scheme for this. I would recommend OAEP, even if it requires more overhead (up to 130 bytes for SHA-512).

No, your private key is safe. The contents of the cryptographic messages is safe as well, even if the plaintext is known (the random padding added before encryption will make sure that you cannot distinguish between cryptographic messages based on the contents of the plaintext).

If encryption with the public key would break this scheme then RSA encryption would be broken; an attacker has the ability to encrypt an arbitrary number of messages.

Please note that:

a hybrid cryptosystem is still more flexible and should be preferred;
encryption and especially decryption of many small messages is going to take a large amount of CPU time;
the private key is only secure if side channel attacks do not apply (i.e. decrypt on a secure system);

Furthermore, RSA encryption only provides confidentiality of the messages (not authenticity of messages):

anybody can encrypt, including attackers;
messages can be re-ordered at will;
messages can be left out at will;
messages can be replaced at will;

You will of course also need some scheme to ensure that the private key is not used without the presence of the auditor/owner.


gpg --quick-generate-key user-id [algo [usage [expire]]] - Any way to include a comment? I am doing some unattended key generation using --quick-gen-key and --quick-add-key.  I am not clear if the user-id mentioned in the man page offers a way to include a comment:
--quick-generate-key user-id [algo [usage [expire]]]

I usually see this used as "My Name My@email.com".

It appears to work like this:
gpg --quick-generate-key "MyName (MyComment) <my@email.com>" rsa1024 cert never

At least, when you do it that way, the --list-keys output appears the same as that produced by a key generated with  --full-generate-key, which individually prompts for Name/eMail/Comment to create the UID field.


Why are there few (none?) easy to use encryption libraries? If I search stack overflow for how to safely encrypt data, one of the first hits is someone's custom encryption scheme. I've seen several similar questions on this site, and in general they are all doomed to be severely flawed at best. Most people naive enough to even try to invent their own encryption have no idea how many ways there are to screw it up.

Everyone noding their heads up to this point?

Now, what surprises me then, possibly because I belong with the naive crowd mentioned above, is that there are no good recommendations for those of us that don't know better. While the correct answer may be, "Don't try this at home", that's not helpful.

Need a production ready web server? There's Apache and Nginx. Or a database? For most use cases that don't need to scale to Google/Facebook/Twitter scales, there are so many production ready choices that will all solve your problem that there no point in even listing them. Something more complicated? High quality machine learning libraries are readily available in most languages you can think of and probably a few more.

Want to encrypt something? To bad.

For example, lets say I search for "ruby encrypt data" in google. I end up finding OpenSSL Cipher documentation.

One might think, "Awesome, I've heard one should never invent their own encryption schemes, and here's a simple copy/paste ready piece of code", so I probably copy it, and merrily move on.

With my fairly limited understanding of the subject though, even I can see what looks like a huge flaw: the word integrity is never mentioned anywhere. There's no HMAC of the data, so the application ends up vulnerable.

If you do a similar search for php, you may be lucky enough to pick up the warning about integrity, but there no solid explanation for why it's important, nor does it mention that using an unprocessed password is unsafe, unlike the ruby docs.

So for all the developers that want to encrypt information, we're pretty much destined to get it wrong.

I'm sure there's a good reason for the complexity, but what is it?

Because encryption is complex. There are many pitfalls to avoid and dire consequences that can happen if you get it wrong. The answers to one of my question explores some of the reasons pretty well. At what level of abstraction should a developer work with with regards to cryptography?

That said, there are some nicely abstracted crypto libraries out there. The Fernet library provides a easy to use interface for symmetric encryption in both Ruby and Go. The Keyczar library has implementations in several languages as well. Lastly, a personal plug for a project I am involved with, the cryptography library for python aims to provide both high level crypto recipes and low level primitives with ample documentation on best practices.


Is there a way to prevent someone from making his own client app for my webservice? Say I have a RESTful web service and a commercial Android app on the front end which is used to interact with it. I may use SSL so that the endpoints are not visible, but someone could still do some reverse engineering to find them.

I could also use SOAP instead, so that the call to the web service is a bit more complicated. But, I still don't know if this gives me any real advantage over RESTful based service.

I was thinking about hardcoding the key into my client app, so that only my client app could use the service. Also, maybe some code obfuscation may help. But, how much does this really help?

UPDATE: As JOW pointed out Fiddler

could be used to decrypt https and see the full request. However, if I use Android app only, this may be solved by hardcoding server certificate in Android client app. And also, there is SOAP WS-Security, but I guess a tool can be made to function in similar way as fidler to circumvent that.

This would be impossible. It is fundamental for your app to contain all the  instructions necessary to use your API. Anyone with enough skill and time will be able to extract these secrets and create their own client.


DNS hijack redirect from one HTTPS hostname to another? I just finished reading a Wired article about a DNS hijack where the attackers redirected all bank traffic to servers they hosted on Google Cloud. What I thought was interesting about the story is that they redirected to valid HTTPS websites with certificates for some legitimacy:

  But the Brazilian bank attackers exploited their victim’s DNS in a
  more focused and profit-driven way. Kaspersky believes the attackers
  compromised the bank’s account at Registro.br. That’s the domain
  registration service of NIC.br, the registrar for sites ending in the
  Brazilian .br top-level domain, which they say also managed the DNS
  for the bank. With that access, the researchers believe, the attackers
  were able to change the registration simultaneously for all of the
  bank’s domains, redirecting them to servers the attackers had set up
  on Google’s Cloud Platform.2

  With that domain hijacking in place, anyone visiting the bank’s
  website URLs were redirected to lookalike sites. And those sites even
  had valid HTTPS certificates issued in the name of the bank, so that
  visitors’ browsers would show a green lock and the bank’s name, just
  as they would with the real sites. Kaspersky found that the
  certificates had been issued six months earlier by Let’s Encrypt, the
  non-profit certificate authority that’s made obtaining an HTTPS
  certificate easier in the hopes of increasing HTTPS adoption.

My question is how did they do that, if you attempt access a website using https then can an attacker who controls the DNS for the hostname redirect your request to another https website without any certificate warning? For example if I type in to my browser https://www.santanderbank.com and an attacker has taken over that DNS, can they redirect that to a valid https://www.santanderb4nk.com without the browser warning me? Assume the attacker has the certificate to www.santanderb4nk.com but does not have the certificate to www.santanderbank.com.

For example if I type in to my browser https://www.santanderbank.com and an attacker has taken over that DNS, can they redirect that to a valid https://www.santanderb4nk.com without the browser warning me? Assume the attacker has the certificate to www.santanderb4nk.com but does not have the certificate to www.santanderbank.com.

For a redirection a HTTP request has to be made which results in a redirect response (i.e. HTTP response code 302 or similar and a Location header). When redirecting away from a HTTPS site to some other site the browser first has to make a successful TLS connection to the original site in order to send the HTTP request and get the HTTP response which contains the redirection. To make a successful TLS connection the certificate for this original site needs to be valid, i.e. signed by a trusted CA and matching the name of the site as visible in the URL (i.e. DNS CNAME attacks will not help).

This means the scenario you describe, where the attacker does not have a valid certificate for the original site, will usually result in a warning inside the browser. But the attack might work silently if the user is using some SSL intercepting software (like certain Antivirus or Adware) which does not properly validate certificates, as described in this paper.

But I think the Wired article describes a different scenario, in which the attacker successfully got valid certificates for the real domains. In this case   no warnings will occur since the browser usually does not care which CA issued a certificate as long as the CA is trusted. HPKP can help against this kind of attack.


Can a Java servlet filter be used to pull out scripts that aren't whitelisted? I might be asking a similar question to this: Whitelisting DOM elements to defeat XSS

But I think my proposed solution is different and I was wondering if I could get the community to comment on whether it can be an effective way to prevent XSS attacks.

I am customizing a content management system that has a large code baseline (possibly hundreds of thousands of lines of executable code). Because of the nature of COTs development it's very difficult for developers to keep track of each and every script the browser executes.

Is it possible to whitelist scripts on the server side using a ServletFilter ?

My understanding of a servlet filter is that it sees all requests and responses (i.e. all requests and responses must go through the filter chain).  I have noticed that responses contain   tags.  Which means when all the bytes of the script are transferred back to the client browser from the server, the intention is for the script to be executed client-side.  There lies my opportunity to perform a whitelist check right inside the servlet filter before it reaches the client.  I would like to make sure any script sent back to the client is on my approved list of scripts.  If not, the filter would modify the response and pull out the script then and there.

Now there are a couple problems I can think of with this approach.  First, how would I assign unique identifiers to a particular script that can be added to a whitelist in the first place?

The second issue is even if I figure out a way to assign unique identifiers for a particular script and add them to the whitelist, the whitelist would probably be huge (because this is a COTs product containing possibly thousands of scripts).  And if I happen to forget to put a good script on the whitelist then there will be broken functionality .

These are the only issues I can think of with this approach.  I was wondering if the community could comment on it or make this a better solution.

There's only one real defense against malicious scripts, and that's context-sensitive output escaping.  First we need a couple definitions:

Definition 1:  Any time user input is going to be handed off to another dynamic language interpreter, the transition from your data to the interpreter in question is called a Security Boundary.
Definition 2:  Every security boundary has a specific Context, and this context defines what the rules are to safely ensure that the data you're handing off will not be executed as code.

The technique you're discussing is really an output-filtering approach, perhaps where you only allow scripts to be imported, ie

<script src="mydomain.com/somescript.js"/><script>

The short answer is:  Yes, you could do that, but it would not be a "perfect" control.

Also, if your application allows user-controlled html/script code as part of its business function, this approach is completely shot.


Mitigating TrueCrypt Attack Vectors in Memory and System Cache While browsing PasteBin today, I noticed a new Paste that outlined approaches to compromising TrueCrypt protected data, as well as full Keys, Encryption Schemes, Plain-text Files, and Volume Names (and metadata).  It was terribly un-nerving.

Appears this Pastebin was copied from this blog post, "TrueCrypt Master Key Extraction And Volume Identification."

My question is, what are the options to mitigate these attack vectors, barring Live-Boot/Read-Only OS's.  Or are there any methods?

The Vectors outlined fall into two major categories:

Keys in Memory - Or keys left in swap-files.
Cached Data on Disk - Including data in swap-files, file history (some OS's cache files in plain-text), and TrueCrypt metadata (that can identify encryption schemes, volume use history, and identify the volume it's self [a USB drive with certain characteristics, or a specific file]).

Due to OS caching, my initial expectation is that there is no way to mitigate these attack vectors without a Read-Only OS, but I thought this was a good place to double-check.

Keys in Memory

Unfortunately, the OS needs to store the key somewhere in order to encrypt/decrypt data as requested. There are "workarounds" such as TRESOR which stores the key in CPU registers instead of main memory. This comes with some advantages but the underlying attack vector cannot be closed.

  Cached Data on Disk

One solution to this is encrypt the whole disk with full disk encryption (FDE).

A more elegant solution is to use a live system which runs entirely in RAM so that such data leaks are unrecoverable after a system shutdown.


What is your default umask set to? What is your default umask set to? Did you run into any problem setting a stricter default umask?

027 on most systems. This gives a default of rw-,r--,--- which is suitable for me. I have seen some environments use 077, but unless the users are very limited in what the can do (so why give them a shell at all?) or experienced it just causes helpdesk/IT issues.


How one can find a string whose MD5 hash has a specific prefix? I've heard that there is a string that contains only the letters a to z whose MD5 hash begins with the hexadecimal prefix 314159265358 and the rest can be arbitrary. How can one find such a string and how long would the search take on a normal laptop?

The only way to find a hash with a specific value (disregarding preimage attacks, which MD5 is still secure against) is to hash values until you find one that matches. 314159265358 is 12 hexadecimal characters, which is 48 bits. You would expect to find a specific 48 bit prefix after 247 guesses with probability 50%, so the question becomes how fast can you do 247 hashes on "a normal laptop"?

My laptop is getting pretty old now (2013 I think) but I ran hashcat on it in benchmark mode to see how well it could do. The GPU (GT 730M) was able to do 535.6 MH/s, so I would expect 247 hashes to take around 73 hours. A GTX 1080 appears to achieve around 25 GH/s, so that would only take around an hour and a half. Of course, that's only for a 50% chance; it could take more or less time than that, but it's a decent estimate.

That the hashed string contains only a-z is mostly irrelevant, as hash functions take arbitrary input and deterministically output a fixed number of bits. Since the input is restricted to fewer characters you may end up with a larger string to hash, which could cause the hash to be slower as it's hashing more data. MD5 appears to operate on a 512 bit block, but due to its padding you can only hash 447 bits before it uses 2 blocks (which would presumably cause it to take approximately twice as long, but I haven't tested). 447 bits rounds down to 440/8 = 55 bytes, so you can hash 55 characters before losing performance. 55 characters with 26 possible values is 2655; log2(2655) ~= 258, which is significantly larger than the 128 bit output size, hence I would expect that almost every possible MD5 output could be generated by hashing a string of [a-z]{1,55}.


Can the contents of a web page be protected from modification We are developing an application sending highly  sensitive data over the Internet. For this we use client side encryption so that even if an attacker would get access to our servers, the data could not be decrypted.
Now our clients want the application to be web based. That is a problem because now an attacker could modify the JavaScript code on the server, making all kinds of attacks possible.

Can we protect the code somehow? Is it possible to sign the JavaScript code using a private key and configure the Browser to test the signature?

Use https. This will encrypt and sign all your content between your server and the users web browser.

This does not protect from modification on your server, of course, but when your server is compromised then everything is lost anyway. Web application security simply doesn't work if the server gets compromised.

If you want to sign your code, then Browser-based Javascript isn't the right technology, because there is no code signing and verification system in web browsers. It would be hard to introduce one, because then all scripts on the whole WWW would suddenly need to be signed or the users would get bombarded with missing signature warnings, which will lead to them getting used to just ignore them.

An alternative option would be to use a good old Java applet, because they support code signing.


U2F protocol - Counter value & device cloning My question is about the U2F protocol and more precisely cloning detection.
According to the doc :

"If there is a possibility that a U2F token can be cloned, we also need some way to detect it. We can do this by having an operation counter. Every time a cryptographic operation is performed, the counter increases by 1. The value of the counter is signed and sent as part of the response to the relying party, which stores the value of the counter in its database. If the counter value in a future authentication response is less than the counter value stored by relying party, then the token has been cloned, and the relying party must decline the authentication request. It should probably also log the event occurrence and/or perform necessary actions to secure the user, by for example blocking token from further authentication attempts."

Why the counter value in a future authentication response would be less than the counter value stored by a relying party ? If an attacker has cloned the device, he has access to the current counter value stored in the original device, isn't it ? He could then send a counter value bigger than the counter stored in the database of the relying party, and the device will not be marked as compromised.

I'm certainly wrong but I am just wondering.

Thanks you in advance !

Let's plot out a scenario:

T = 1     Authenticate Real, Counter = 20
T = 2     Device is cloned into Real / Dup
T = 3     Authenticate Real, Counter = 21
T = 4     Authenticate Dup, Counter = 21

Because the server saw the same counter twice, obviously it was cloned.

  The attacker could send a counter value bigger than the counter stored in the database of the relying party

Okay, let's try this, by e.g. adding 1000 to the counter.

T = 1     Authenticate Real, Counter = 20
T = 2     Device is cloned into Real / Dup
T = 3     Authenticate Real, Counter = 21
T = 4     Authenticate Dup, Counter = 1021

Seems fine...

T = 5     Authenticate Real, Counter = 22

Uh oh - 22 is less than 1021 - now the real key has been denied and the user knows something's up.


Assuming I'm using Starbucks Wifi, is there a point of using a VPN if I want to remain anonymous? Wouldn't using Starbucks Wifi make me somewhat anonymous since my ip address would be the same as other users connected to the same network? Therefore, no need to use a VPN assuming I don't want the website I'm connected to know my identify. Of course, the website can figure who I am assuming my browser fingerprints is unique. However, assuming I change my browser fingerprints every session, then I should be fine. Correct?

Your scenario falls under one of the major use cases of a VPN, which is to protect yourself from untrustworthy public Wi-Fi hotspots. Other use cases being, overcoming geographic restrictions when it comes to streaming and accessing certain websites.
The most fundamental selling point of a VPN is to allow access to the public internet using a private connection.

somewhat anonymous since my IP address would be the same as other users connected to the same network?

'Somewhat' is right but having a different IP address does not mean that your identity & connection is secured. As you've mentioned that there are other users on the same network, that alone nullifies the anonymity that you are trying to achieve.
Anonymity should be the least of your worries, I'm more concerned about this from a security standpoint.


Options for simple phone verification with pin delivery My website needs to verify phone numbers in order to ensure that customers claiming a business actually work there. The service calls and gives the customer a pin which they put into the site. Many websites do this, but I can't find a simple site to do it via an API. Lots of people who sell phone password integration (PhoneFactor, Duo), others are too B2B (telesign with their sales people). Others are offshore (OnVerify, Phonoclaim).

Aren't there simple NA-based self-service web2.0 options out there? I loved the look of "called.in" but its not really there...

Twilio has an API that would allow you to do something like this. We use Twilio to send SMS-based PINs to customers as a method of two-factor authentication, and so far it's worked perfectly. I'd consider this a "NA-based self-service" option :)


I want to implement a new type of security feature over several platforms I want to make a security feature that will go farther in discouraging people from looking through a secure system or server than what I have seen being implemented.

Specifically, is there a way (or has it been done) that you can create a setup that will only allow access if a certain "tempo" is kept? More importantly, if this certain "tempo" (just a rhythm to the keystrokes) isn't kept up is there a way for this program to search the other users system for the MAC address to ban it from the network? (I just feel like banning an IP isn't good enough)

If the latter part is something that would be illegal let me know, not trying to break the law in making this program work.

Keystroke Dynamics has been suggested in various forms since World War 2. More recently, there was a paper published on continuous keystroke dynamic authentication (end of 2011) so I'll link to it when I find it.

Your second part is unethical/illegal and also pointless - it is trivial to change MAC addresses so it would not be a good way to build a black list.


Connect to Mysql database from remote host without remote access I have a website which is managed through CPanel. I know that remote database connections are disabled by default and I have tested that it is indeed disabled.

I know that many people have some of my database passwords, but they cannot connect to it. Should I be worried about it? I know they should not know the passwords, but CPanel doesn't let them connect to the database remotely, so is this really a problem? Can they connect to the database in any way?

If Mysql is only accepting local connections (as configured through CPanel), and the people who know the passwords don't have any shell access to your machine, nor any other way to open a local network connection, then they cannot connect to your database and therefore their knowledge of the password doesn't make a difference.

Nonetheless, you are taking the risk that one of these assumptions is violated.

If at some point you accidentally misconfigure the database authorizations in CPanel, or if you decide you need remote connections from some purpose (e.g. because you want to split your service and put the frontend and the backend on different machines), then at this point your data will become exposed. You'll have to change the passwords at that time, and the more you wait, the more places you'll likely have to update, and the higher the risk that you'll forget that the passwords are known.

If at some point the people with the passwords gain access to your machine, they'll be able to access your data. This can obviously happen if they get shell access, but that's only one way. Even if you grant them some restricted access for a different purpose, it may allow them to open local network connections. The most obvious way is if you let them use that server as a relay, but it could also come through less obvious interactions. It's also possible that one of the applications running on your server is partially broken, for example allowing an SQL injection. You might have a low-importance application that only accesses some unimportant table and has an SQL injection vulnerability; if someone exploits that vulnerability and they know some database passwords then they can access all these other databases and not just the unimportant one.

As those people know your passwords, you don't only need to trust them not to misuse them. You also need to trust them not to expose them. Even if they're perfectly honest, if they store your passwords in a file and their machine is compromised then your passwords will be compromised.


Is unrestricted query access to dedicated DNS server considered an insecurity? Let's say hypothetically a business has a network and some respective infrastructure. Importantly, a VPN for giving remote secure access to work resources, and a (not so)private DNS server for DNS but also things like blocking malware domains as your usual business DNS server does. The DNS server is internet facing and accessible. However, the DNS server is not configured to only serve requests that come from the network/VPN... it will respond and serve any request it gets from the internet. Is this an insecurity? It's not as if someone resolving domains with your server really means anything, however at the same time this also means that an unrelated, unauthenticated third party gets to use the server.

Is this an insecurity?

It is not an insecurity by itself but it is needlessly increasing the attack surface. And this can cause security problems.
It can lead to availability problems due to DoS attacks possible from the internet. It can lead to sensitive information leaks since anybody could query the DNS server and gain information about hostnames and IP used inside a company. And if there are security issues in the DNS server they can be exploited directly from the internet, i.e. there is no need to be inside a trusted network already.


Stealing OAuth2 Tokens from IoT Devices As I am delving into different forms of session authentication and persistence, I started to question how tokens are stored and the risk of a token being compromised. The scenario I have in mind is as follows:

A user has synced their smart phone to a social media account, and an OAuth2 token was granted. This token has an expiration time of three days from now. The user has left their phone either unlocked, or you have been able to compromise it briefly and obtain access to anything stored on the device (think the new Android media message exploit). In this time, you quickly grab the OAuth2 token and get out. You take this OAuth2 token and use it from your own device. Now for the next three days, you have authorization for the victims account.

My question - Is the last part feasible? If you can locate an OAuth2 token, can it be used from another device to grant authorization? What are preventative measures for this (other than encrypting OAuth tokens)?

Yes stealing a stored OAuth token from a device and using it to make requests as the user will definitely work. OAuth access tokens are analogous to a traditional session cookie used in a web application. It might help if you're familiar with pre-http-only flag cross-site scripting vulnerabilities were an attacker would exploit a cross-site scripting vulnerability in a web application to steal the victims session cookies from the DOM then use the cookies to masquerade as the user. Most attacks against OAuth2 use a more direct route of exploiting a vulnerability in the providers OAuth2 flow that tricks the user into sending their OAuth token directly to the attacker. Egor Homakov and a handful of other folks have done a great job exploiting popular OAuth2 provider. Some Examples: The Most Common OAuth2 Vulnerability and How we hacked Facebook with OAuth2 and Chrome bugs.


Secure file encryption with OpenSSL and a little trick? I try to really securely encrypt a file with OpenSSL. I´m new to OpenSSL and just read here, that it´s not very secure due to it´s behavior in generating salt & IV, and storing it within the encrypted file.

I use a Server, where OpenSSL is the only tool available for file encryption (currently I have V1.0.1t).

Let´s say, I use a password with 256 or more bytes of random data, including all kind of special chars and aes-256-cbc for encryption.

I know, the md5 of password + salt is stored in the first 32 bytes of the enrypted file now. Quite weak so far...

What if I use a little trick and read out that first 32 bytes and store them in a different location (DB, etc.). Then overwrite them in the file with random data... Later for decrypting I put the original bytes back into the file, prior to decrypting.

As far as I understand, this would be a huge increase of security, as long as no one gets access to the stored fragments.

Is this correct?
What do you think?

I know, the md5 of password + salt is stored in the first 32 bytes of the enrypted file now.

This is not true. It will only write the 8 byte salt and nothing derived from the password (not MD5, not something else) as you claim. Instead the salt and the password will be used together to derive the encryption key using MD5, but the user needs to provide the password for decryption so that the encryption key can be again derived from the (given) password and the stored salt.

The problem with enc is instead that MD5 is a weak key derivation function because it is too fast and thus  simpler passwords can be brute forced. See also openssl enc uses md5 to hash the password and the salt.

If you really need to use enc use a hard password so that brute forcing will not  be successful.

  Let´s say, I use a password with 256 or more bytes of random data,...

Yes, this is probably hard enough: 2048 bits of random data can be well considered impossible to be brute-forced, commonly even 128 or 256 bits (16 or 32 random binary bytes or about 22..44 random alpha-numeric characters) are considered sufficient.


Which SSH security is stronger? 2 Factor or Public key For SSH authentication, which is more secure?
2 Factor Authentication using a USB token/Google Authenticator(time based)
OR
Public/private key with password

Or could they be both used at the same time? If it is possible, are there any downsides in using a multi-factor authentication like this?

Also, could anyone post an example or a link to show how I could implement both public key and 2 Factor together if it's possible. Thankyou!

This is not a "one is better than the other" issue. Both increase the burden of an attacker to break into your system:

Using (and enforcing) keys increases the "quality of the password" ("mypassword123" vs "long_binary_asymetric_keypair_here"). Humans are very bad at remembering long passphrases with good entropy.
Using 2Factor auth ensures that an attacker would have to get 2 properties under control: one password-mechanism (usual passwords, PK) and another one which is (usually) not at the same physical location as the first one. With 2Factor mode the system you are trying to authenticate against will challenge you a second time after you succeeded at the first challenge. But if both challenges are silly / simple / easy to break the whole 2Factor thingy is pointless.

So, both mechanisms supplement each other.

Good tutorial on the 2Factor part:

http://www.howtogeek.com/121650/how-to-secure-ssh-with-google-authenticators-two-factor-authentication/

Combine that with any other tutorial which explains how to use ssh-keys (and there are LOTS in the internets). The flow of the authentication is then as follows:

Client triggers mechanism to unlock the private ssh-key (password) on his machine
Client contacts Server to ensure public and private key match. From here on the ssh-server is basically not involved in the authentification any more.
Server routes Client to the second challenge
Client responds to the second challenge correctly
Client gets access to the shell on the Server


Precautions to secure (company) laptop & mobile while travelling I will be traveling through Central and South America for about half a year.
I have an agreement that I will occasionally work for my company and thus they allowed me to take the laptop from my office. My boss said I "should be careful with the laptop and the stuff I am working on, but it's not that bad if I happen to lose it".

The project is actually not that important and the data on my laptop are not too sensitive - but still I want to be sure that my (and the company's) data stay on the laptop.
Despite studying 'Computer Science' (undergraduate) am quite new in Internet Security, so I decided to ask some friends, colleagues and also do some research on the Internet.
My findings so far are the following:

a) The data on the laptop should be encrypted so that a snatcher won't be able to extract any information after a successful theft.
That's why I used VeraCrypt to encrypt the system drive, hard disk and the flash drive I will be taking with me.

b) I should use a VPN whenever possible so it is harder for any other person in the same network to sniff my traffic.
The laptop already has a ready-to-use VPN connection to the company's network, which I will use while working. Moreover, my university offers the possibility to use a VPN to their network, which I will be using when I am online but not working.

c) Use HTTPS/SSL connection whenever possible!
That's where it starts to get tricky. When using the browser, this is no problem. But when using my mobile phone, some apps will automatically synchronize and download messages (Telegram, Inbox by Gmail). Are these connections also secure? Or can I secure them by also using a VPN for my mobile?
And does Outlook use a secure connection to send and receive mail?

d) Use an up-to-date Anti-Virus/-Malware program.
Right now I am using 'Sophos Endpoint Protection' because I got it for free at the university.

Is this basically enough? Does Sophos offer a good protection against a wide variety of malware? Or should I use another Anti-Malware program like (for example) Malwarebytes Anti-Malware?

e) My colleague told me to 'close all the ports' with the firewall. I am not sure what he meant by that or if that's a good idea. But I read that the 'Zonealarm' Free-Firewall does a very good job and is more or less easy to use, even for beginners.

But I am not sure, how I should configure the firewall or if it is possible or necessary to 'close all the ports'? Or is it alright to use the standard Windows firewall?

f) And of course: keep an eye on the laptop so it won't be stolen!

What do you think about those measures? Did I miss something? Am I completely wrong at some point? Any feedback and hints are welcome.

All of that info you got from your friends is very true, I have just have a few tips:

You can use proxy and vpn apps on android that will proxy all traffic through (phone traffic).

Lock your boot loader/bios!!

People seem to forget that you can simply boot (live?) another OS, and then modify/delete/view/copy all files (including password storage). It also makes it harder for thieves (somewhat) from making your computer do their bidding.


What are the potential security problems running untrusted code in a Docker container as a non-root user? I've seen plenty of ink spilled by now about how Docker is not sufficiently isolated to allow arbitrary containers to be run in a multi-tenant environment, and that makes sense. "If it's root in Docker, consider it root in the host machine." What about non-root though?

If I want to take some untrusted code and run it in a container, can it be done safely so long as the container is running as a non-root non-sudo user? What are the potential security pitfalls of doing something like that?

I'm fairly sure there are production applications doing this today (CI systems, runnable pastebins), but are they just lucky not to have had a determined attacker or is this a reasonable thing to do in a production system?

Docker and LXC technology itself is still in very early stages when it comes to exploitation testing. drewbenn is right in highlighting the difficulties of running Docker containers as a non root user - there are inherently some very low level things that need to happen in order to start up an LXC container.

Something interesting to consider though is the intended target any malware that you're trying to isolate in the container.

Say the malware was trying to exploit a flaw in a piece of local software to do privilege escalation. It might achieve that inside the container, but then it would also have to have been written specifically to attempt to break out of docker containers to do something malicious.

So the question is - will the people who are writing this untrusted code know that you're going to be running it inside a container? If they do (or if they suspect you will) there's a much higher likelyhood of a vulnerability turning up that exploits a dockerised environment directly.


Enterprise standard for securing servers. This must be the most broad question to ask, but through the years, i've come up with my own list of things I so to secure my servers, I follow the obvious steps I could gather online such as, password length, iptables, /etc/hosts, routes, packets securing, security patches etc..

I would like to know if there is a standard in the industry, doesn't matter if it's public or private sector that I could benchmark my steps against. I know there are few out there, but what could be considered THE standard.

Standards are general and consist of high level principles. Guides focus on practical security. Checklists are the most detailed documents.

There are multiple agencies that produce security standards. One of the most widely used security standards today is ISO/IEC 27002 which started in 1995. This standard consists of three basic parts, BS 7799 part 1, part 2 and 3. Recently this standard has become ISO 27001. But it is a very high level standard that doesn't go into configuration specifics. It talks about building an information security infrastructure (BS 7799 part 1), an information security management system (BS 7799 part 2) and risk analysis and management (BS 7799 part 3).

You are asking about guides and the National Institute of Standards and Technology (NIST) has released several special publications addressing cyber security. Here is the Guide to General Server Security from NIST. This general document discusses the need to secure servers and provides recommendations for selecting, implementing, and maintaining the necessary security controls.

NSA develops and distributes security configuration guides for a wide variety of software, both open source and proprietary.

Applications
Database Servers
Operating Systems
Vulnerability Technical Reports

For more detailed documents about securing certain installations follow NIST's National Checklist Program Repository. NCP security checklists (or benchmarks) provide detailed low level guidance on setting the security configuration of operating systems and applications. For example there are checklists for securing:

Web Servers
Email Servers
Applications Servers
Operating Systems


Are there any OSes that verify program signatures before executing them? If so, what are these OSes? Are they specially crafted? How difficult is it to apply this kind of program verification to the everyday OSes we use?

If not, why haven't people invented such OSes?

Package signature verification is quite common with today's package managers. What I'm asking about is signature verification at loading time.

iOS and Android both validates the signature of every single piece of code before loading them into memory.

Windows UWP apps are also all checked for signature before being loaded as well.

  Package signature verification is quite common with today's package managers. What I'm asking about is signature verification at loading time.

The difference is massive in terms of performances. A package signature is checked when it is installed and not afterward.

To be effective, code signing must be checked for every binary before it is executed or loaded.

Furthermore, special care must be taken by the OS (or runtime environment) in order to make sure a memory page marked as executable is signed (or, at least, that is has been loaded from something that was properly signed). That requirements is extremely hard to enforce on any environment that wasn't designed with code signing in mind because it tends to break a lot of legacy code.


How secure are pins on credit / bank cards? Everyone owns a card from the bank. Every card has 4 digit pin.

If someone steals / finds my card I know that this 10.000 combinations are silly stuff to crack. I presume with some piece of hardware (card reader) and brute force it's too easy.

Does the bank card have any other security other than 4 digit pin and how does it work?

The chip on the card functions as a tiny computer communicating with the card reader. It never reveals the PIN to the reader, but instead use a crypto protocol. This means that the card itself can enforce rate limiting to prevent brute force - i.e. locking after X failed attempts. Not sure this is done everywhere, but I know it is in some countries/by some banks.

However, if you are in physical possession of a credit card, you already have enough information to perform purchases on the internet. All you need to know to max out the card on a bitcoin shopping spree is written on the card. So brute forcing the PIN is not nececarry to perform fraud.


Windows discovery through unsecure WMI ports We are discovering Windows servers through unsecured WMI ports i.e 135, 137, 139 and 445. Security team advised that these ports are unsecured. Is there any alternative solution can enable for changing WMI ports?

WMI ports should only be enabled on the internal network and denied from outside to inside in your network firewall

Things you can do to improve security:

Set DCOM Security to Allow only specific Users
Set Namespace Security to Require Data Encryption for Remote Connections
Get a WMI Explorer/Tester to actually perform various VMI tests
Don't forget to secure WinRM

Read some tips here.


How to prevent my ISP or any third party from knowing my browsing history and such without VPN or DNS servers? Is it possible to encrypt my data before sending it through my ISP so all they see is an encrypted stream of what I am doing? How will that be possible? This should be done without using VPN, Tor, i2p, proxies, sshing into another server or similar.

Most preferably locally on my machine, but if there are other alternatives too, please make me aware of them.

For simplicity sake, lets break your question into 2 questions:

  How to prevent my isp or any third party from knowing my browsing
  history?

Multiple tools have been created to accomplish this:

vpn
proxy
tor
shadowsocks
i2p
ssh
ICMP Tunnel
Iodine
IPoAC

  How do I do this with out any of the tools that would make this
  possible?


Is my network infected? Suspicious messages and devices slowing down Recently a family friend has been complaining that he has been getting hacked on his home network and that he has been receiving suspicious messages from the attacker. He says that the attacker has been taking all his subscriptions and email details. His friend who specializes in IT said there's nothing going on after checking his connection. He formatted all computers and instructed him to only use a wired network. His friends and family thought he was just going crazy because he has slight mental issues.

He asked me to come to his house and see if I can find anything suspicious (I am a current IT student and have only completed one semester). I did virus scans and cmd checks and found nothing. I installed a top security router (after he requested it) to ease his mind and attempted to add a VPN. As I was adding the VPN, suddenly his computer started to slow down to the point that I could not switch to any tabs or click on any website. At first, I thought that this was just his laptop playing up because it's a few years old. I decided to connect my phone to the network to enter the VPN details and behold I received a suspicious text message saying that I won an eBay voucher. I immediately disconnected from the network and formatted my phone. There's no way this is a coincidence and I am convinced his network is infected.

Is it possible for his network to infect anything it connects to? Even after changing the router and modem?

Can my smartphone (android) still be infected after formatting it? Am I at risk when using it?

What kind of attack can this be and what steps should I take to resolve the issue?

One of the helpful things in this situation is a knowledge of the OSI model and the layers of technology. OSI layers can be extremely boring to study in school, but they, and an understanding of technology stacks in general, form the basis of almost all understanding of the interrelationships of technology. And that understanding will help you troubleshoot things like this.

Networks do not infect anything. Networks are connections between nodes (computers, phones, routers, etc.) So, if there was malicious code lurking in the network to infect new things, it would have to exist on one of the nodes. You replaced the router, so that's not it. Your phone was new to the network, so that's not it. What's left is everything that is left. His computer and anything else that is a node on the network (TV? Game consoles? Other IoT?). The laptop was formatted and rebuilt, but the malicious code could have been reintroduced when things were reinstalled.

There is nothing in your description to suggest that your phone was infected at all. It received a message. How you got that message is a good question, but you need to provide more details so that there can be an understanding of what layers are involved. If you got a pure SMS message, then the message is a coincidence. There is no technology overlap between WiFi and SMS.

The steps you need to take is to work through a basic troubleshooting process to eliminate the various elements of the problem. You need to understand the connections between the various technologies and trace the behaviours from one technology to another.


Let user send an email to register to prevent outgoing mail abuse Problem
Consider a standard sign-up form (user enters an email address, we send a confirmation link).
Even limiting that form per IP (or even globally per hour), I'm concerned about abuse:
Our real-world reputation would be harmed if someone enters plenty of (publicly known) email addresses of companies in our geographical vicinity, leading to unsolicited welcome-mails. This could even harm our SMTP reputation (if the recipients flag those mails as spam, or could it not?).
We'd always be one step behind the attacker when blocking addresses/domains (who then could not sign up any more if they wanted to later) and might even have to deal with confused or frustrated people calling us.
Proposed mitigation
Instead of a sign-up form, the user sends an email to hello@our-company.com and then we reply with the confirmation link to that From address.
What this achieves
From a technical viewpoint, reliably spoofing emails of multiple different companies requires more technical skill than filling out a form (I'm aware of the limitations of SPF, but still.)
More importantly though, we'd be in the position to tell the victim that someone actively impersonated them. This shifts the (emotional) blame to the attacker rather than just apologizing for us "not getting our sign-up form secured properly".
The attack would become tangible because we can present the spoofed email to the victim, rather than an abstract server log showing the POST form-request. It would even mean that the victim might have to take action to secure their email (with SPF or whatever).
My question
I think reliably spoofing emails of multiple different companies is harder than just submitting POST requests.
Is that true and is my proposed scheme sensible? I have never seen this in the wild.
Final thoughts
I was inspired to this approach when I learned that the SCTP handshake forces the client to remember the initial state (rather than the server) to avoid SYN-flooding. I assume that it is generally desirable that the client has "more work" than the server.
Someone could object that the end-user has no email-client at hand right now to send an email (inconvenience). But I think that's OK, because the user would have to open the mail and confirm the link anyway at some point. And while talking with someone on the phone it's even easier to say "send an email to hello@" instead of "go to this website, find the form, sign up).
I'd like to avoid captchas (plus, they don't solve the problem).
Thank you for your time.
Answers to questions
If people mostly register using Gmail or Microsoft 365, I reckon SPF would pass most of the time, as opposed to small companies registering using their custom domain-email-setup lacking SPF.
If the SPF-check fails, I could at least limit the amount of registrations where SPF fails or I could have an employee double-check (before or after the registration). This would also give us an opportunity to tell the customer that they should improve their email setup (we're in the safety/security business). This could even be done in an automated comment in our outgoing email.
Result
It was very hard to accept one answer, because every answer had a gold nugget in them. I took the one that A) made clear that a new attack vector opens, B) that people are used to spam and C) even on signup an employee could be notified at once.
Thank you to the others for giving good general advice.

The problem I see with this question is that you are trying to mitigate a threat, but that threat only seems a small detail of a much more complex threat model. What I'm saying is that if the threat is "someone harming your reputation", then the sign-up issue you describe is only one possibility the attacker has, among lots of others, to attack your reputation.
For example, the attacker might spoof your emails, or register a typo-squatted domain like your-copmany.com (note the swapped letters) and directly send unsolicited emails pretending to be you. Or they might even make phone calls, pretending to be you, with the sole intent of harming your reputation.
That's why I think solutions like yours are rarely implemented, even though they might make sense and might even work in limited scenarios. If the possibility of a "reputation attack" is real, then you have bigger problems which might require complex solutions. But if the possibility is just theoretical, then you can probably leave it out of your threat model and not implement any mitigations (like most companies do).
By the way, if you are only concerned about a possible abuse of a sign-up form, you might also think of implementing some kind of "monitoring" algorithm that checks for suspicious activity. For example, suppose there are 10 sign-ups per week on average. If all of a sudden you have 50 sign ups, that might be an alert that you might want to investigate. Or if your customers are only from the US and suddenly you get sign-ups from foreign countries, that might be another alert. Or if the confirmation links are usually clicked within a few minutes, and suddenly you realize that most of them are never clicked, that's definitely an alert. Of course implementing such a monitoring system might cost you more than just implementing your simpler solution (sign up via email). There are pro and cons, it's up to you.


What not to reveal of OS configuration I thought that I should publicize all my programming on a web page so someone will hire me as a programmer.

I got tempted to include not only programs but my .emacs, .bashrc, and .Xresources files. They show a serious attitude toward tools, as well as some skill in Elisp and shell scripting. (I'm on Debian.)

But then I thought, those files really tell a lot about my system, and even about me (what programs I use, how I use them, etc.). So perhaps it is not a good idea?

I realize that you don't know my files, so what I ask for is general guidelines and rules of thumb.

All of these configurations should be default from your distribution and most of them don't have a security impact if read.  If an attacker could modify .bashrc then they could pull off a sudo hijack,  but just being able to read the .bashrc isn't a problem.

Sometimes the .bash_history file will contain passwords.  Sometimes passwords are an argument to a command or a user will accidentally type their password into the shell.   The .keychain and .ssh folders may also contain sensitive information related to authentication.  .mozilla contains firefox's cache and may contain personal information.


What is the difference between a Gateway and a Firewall? What is the difference between a Gateway and a Firewall and how do they relate to one another?

I am a developer trying to get a general understanding of network security.

A gateway is simply a device that joins together two different networks. In the most common scenario, an internal network with the internet. A router is an example of a gateway device. A router is a device that does routing, deciding where packets are sent to based on its IP address.

A firewall is a filter that examines packets against a set of defined rules in order to decide whether to allow the packets through.

In many devices, the functionality of both a gateway and a firewall is present. Of course, there are dedicated versions of each for use in large enterprise networks.


Can a steel woven wallet prevent RFID scanning of credit card information? According to the Popular Mechanics article RFID Credit Cards and Theft: Tech Clinic, the fact that many new credit/debit cards have a RFID chip embedded on it, there is a risk (albeit, small according to the article) that the card would be 'skimmed' - from the article:

  RFID cards do have a unique vulnerability. "Your card can be read surreptitiously. Unless you were paying attention to the guy behind you with a reader, you'd never know you were being skimmed."

Now, even though the risk is low, there is always a chance.  With that in mind, a friend bought me a wallet - a Stainless Steel RFID Blocking Wallet to be precise, that claims to

  prevents 'accidental' reading of your information

I have this wallet still (it is rather nice looking), so my question is really two-fold:

Can a steel woven wallet prevent RFID scanning of credit card information?

and

Is there a practical way I can test this myself?

(Note: I have no affiliation with anything to do with the manufacture or sale of these wallets)

Any Faraday cage will do the trick. So a shielding of just about anything conductive, be it aluminum foil, conductive paint, wire mesh, or any of a number of similar alternatives is going to be opaque to radiation. That means no radio waves in or out, which means the RFID signal is blocked.

Note that the size of the mesh has to be significantly smaller than the wavelength in question; RFID specs are mostly in the MHz range but go as high as 2.4GHz, which is about a 10cm wavelength. So your mesh should be just fine. But aluminum foil is cheaper.


Why can't spoofed caller ID's be identified? There are several posts here about how easy it is to spoof caller ID and that there is no way to detect it.

I did find one post suggesting the calls to 1-800 numbers could not be spoofed.

  being done by forwarding calls to a toll-free number, which then (by virtue of being toll-free) receives the true calling number through ANI (which is distinct from Caller ID and which supposedly cannot be spoofed) and finally forwards back to the original number. Source

Question:
Why can't spoofed caller ID's be identified for everyone?

Related posts:

How can caller ID be faked?
How can I spoof a phone call and make it appear to come from another phone?
Why is caller ID spoofing so simple, and catching offenders so hard?
How to protect from caller-id spoofing?
Is there any way to detect caller ID spoofing?

There are substantial flaws in the way phone routing works that makes this difficult.

Caller ID is specified by the outgoing call and anybody who has control over a phone branch exchange (PBX) can mess with it. (This is a "feature" so e.g. a support center can always have the same callback number as opposed to the number of the associate calling you.) I believe there is some limited ability to traverse the call routing, but that stops as soon as it hits a voice-over-IP provider (VoIP), which effectively provide a screen akin to reputation hijacking (an attacker gets lost in the noise of a shared pool of resources).

I am under the impression most spam calls come from VoIP, but my spam expertise is limited to email.

Happily, at least for the US, STIR/SHAKEN was just adopted, as announced by the Federal Communications Commission in Mandating STIR/SHAKEN to Combat Spoofed Robocalls.

With strict limitations on Caller ID forgery, endpoint anti-spam can then build blacklists of at least VoIP spammers.

From the FCC's news release PDF:

  FCC MANDATES THAT PHONE COMPANIES IMPLEMENT CALLER ID AUTHENTICATION TO COMBAT SPOOFED ROBOCALLS

  Industry-wide Deployment of STIR/SHAKEN Will Yield Substantial Benefits for American Consumers

  WASHINGTON, March 31, 2020—The Federal
  Communications Commission today adopted new rules requiring
  implementation of caller ID authentication using technical standards
  known as “STIR/SHAKEN.”  These rules will further the FCC’s efforts to
  protect consumers against malicious caller ID “spoofing,” which is
  often used during robocall scam campaigns to trick consumers into
  answering their phones.

  …


Microsoft Windows Defender keeps detecting BrowserModifier:Win32/SupTab!blnk On my computer, Windows Defender keeps detecting this:

After I click Clean system or Apply Actions. It just comes back again after a few seconds. I am a software developer myself, and I study ransomware and adware, so I am pretty sure that my browsers are clean. At least, as far as I can see. All my browsers seem healthy, with no search engine hijacks or toolbars. My extensions and plugins contains nothing suspicious. I have also tried to remove ALL my extensions, but no luck.

I have tried the following anti-viruses with no infections found:

BitDefender 2017
AdwCleaner
Malwarebytes
Hitman Pro

All with 0 found infections.

My computer seems to run normally. No CPU hogs or HDD/SSD activity.

When I Google around about this infection: All I get are those stupid product placement sites for (scareware?) anti-virus programs, and a generic guide to remove viruses.

I have never in my 12 years of computer background not been able to remove an infection. I have no idea how the infection got on there in the first place, or if there even is an infection at all (false positive?).

I see the infection show up pretty quick on Googles Search suggestions. So it's clear I am not the first one.

I found similar issues on these MS forums pages:

https://answers.microsoft.com/en-us/protect/forum/protect_defender-protect_scanning/windows-defender-keeps-saying-harmful-software/25532dc1-2ca7-402b-8a91-2be7c44fd65a

https://answers.microsoft.com/en-us/protect/forum/protect_defender-protect_scanning/i-can-remove-browser-modifier-win32subtabblnk/49bbb618-d919-4269-a6c8-784a0953396b

A program named VulcanRT seems to be a common denominator in both - could it be you have something similar?

Some tips I found in the above sources that might be useful:

Check browser add-ons/extensions that might be causing the issue
Try resetting your browser/s
After cleaning up with Windows Defender, clean Temp files and reset the computer

Here's what somebody who managed to clean it up had to say:

  In the end this is what I did :

  I did run the programs listed in the link above, and I did reset Internet Explorer.  Restarted after each step.  Even after resetting IE, once it was opened the warning came back.

  Roguekiller was the one program that found anything, deleted what it found.

  At that time WD came up with a new link in its warning for this which led to a folder/program that I could uninstall (VulcanRT), I can reinstall it later if need be though I think my graphics will be fine without it.  Uninstall successful.
  I also uninstalled Google Chrome completely.

  Ran Revo Uninstaller Pro, looked for anything installed in the last few hours before the issue started.  There were two redistributable files, uninstalled both of them.  Uninstall successful.

  Uninstalled a game that I had installed through Steam (which I  have never have problems with installs from but did this anyway).

  Restarted after each of these steps and kept IE closed during everything.

  Not sure which of the above steps did the trick but I have now had IE open for awhile and the warning has not come back up.

Here's a joyful update from reddit:

  I have fixed the problem.

  I went to the directories shown in Window Defender and manually deleted the shortcut .lnk files. For me they were Google Chrome and Internet Explorer. In File Explorer they were .exe files instead, deleting these remove the applications from the Start Menu. Well I can live without it.

  It does look like a false positive to me. A system restore I performed did not fix it. Note that I restored it to an earlier point in time before the notifications started showing.

Hope this helps!

If it doesn't, some Google-fu might lead you to the right answer - as you said, there are a lot of results so you can just go over them :)


How to stop gmail spam after connecting to public wifi without VPN on Android? About two weeks ago, I had to reply to an urgent email (gmail) on my Android phone with the Gmail app.

Unfortunately, my VPN client refused to work that day (Private Internet Access Android Client), so I had to risk it and connect to a public wifi hotspot at a restaurant to reply this email of mine.

Now, I have been bombarded with spam with that gmail account I used to reply the email.

I have changed the password to this Google account mentioned the evening I returned home that day.

Is there any way to stop the spam? I used to have no spam email coming into this account.

It is unlikely that you are getting spam because you used a hotspot. Gmail should have their certificate pinned and their traffic should be https only, so there is no way to intercept it unless you install 3rd party certificates on the phone, or accept any warnings about invalid certificates.

Spammers also do not need access to your account to send you spam, they only need the email address. They already have it, so changing your password will not help.

The best approach to dealing with spam is:

If you can - unsubscribe
If you have not subscribed - mark as spam in Gmail
If you have not subscribed, then it is unsolicited email, which is illegal in most jurisdictions. You can get in touch with the sender and ask them to stop. If they refuse or won't stop, then you should get in touch with an appropriate law enforcement agency in your area, e.g. in United States it is regulated by Federal Trade Comission (source http://en.wikipedia.org/wiki/CAN-SPAM_Act_of_2003) and report them. These law enforcement agencies usually have lots of international connections too, so even if the spam is originating from other country they might be able to do something about it.


DDoS Attack Protection Recently I've been threatened with an IP Address DDoS attack. I was wondering in what ways and how could I stop this attack. I'd really like to be able to do this without my parents finding out.

If you are on a home connection the best solution is to restart or turn off your router for 5 minutes so you get a new IP address from your ISP ...if you still get ddossed because of skype or another program  IP grabbing use a VPN or contact your ISP about the problem


Do common malware compromise recovery partitions? Just about now a friend of mine got compromised, actually she was compromised by various adware since long ago but she installed something (her browser was hijacked to deliver even more malware) and the machine crashed.

I told her to reinstall from the recovery partition since she's not tech-savvy and doesn't know how do to a proper reinstall from a clean Windows ISO.

Now, I'm wondering, do common malware also compromise the recovery partition ? I know an experienced attacker targeting that particular machine would definitely do this, however I don't think she's victim of a targeted attack (she doesn't have anything valuable on her machine nor her network), so does the usual crap you can get from shady websites/malvertising also takes the hassle to compromise recovery partitions ?

Worse! I can't find it but the other day I read about a UEFI hack that installs a rootkit in your UEFI - the bootloader. If that is possible, you can reinstall your system and still get infected.

But this is not common - yet. And I believe these rootkits are not easily made, probably need to be modified for many different systems.


How to secure the connection between the proxy and application I have designed a framework for my application where I have a proxy to communicate with the outside world. The connection between proxy and the application is encrypted using SSL.

But the connection between the application and proxy is NOT encrypted. I have lots of applications. What is the best way of doing this?

Your question is a bit confused (you state that "the connection between proxy and the application is encrypted using SSL" and then that "the connection between the application and proxy is NOT encrypted": apparently, you are using the term "application" to designate several distinct things).

That being said:

SSL is meant to be end-to-end. When the SSL client talks to the SSL server, they establish a tunnel which is safe from third parties (for confidentiality and integrity of data). This property holds even against whatever proxies the connection has gone through.
HTTPS (i.e. HTTP within SSL) can be forwarded through a proxy (see RFC 2817 sections 5.2 and 5.3).
An HTTP proxy is contacted through HTTP -- theoretically, it should be possible to contact it through HTTPS too, but browsers are not necessarily configurable that way. I have seen it done with a Proxy auto-config file which was returning the proxy not as an hostname+port pair, but as a full URL (beginning with https), which is out of spec, but was working (I don't remember which browser supported that, though).

So you could make a SSL connection through a proxy, the tunnel between the application and the proxy being itself an SSL tunnel; at which point you would have two SSL tunnels, one nested in the other. But what would be the use ? If the data is sensitive enough to warrant SSL, then it should use SSL on the whole path, even beyond the proxy. And if it does use SSL for the whole path, then an SSL layer between application and proxy is superfluous.

(HTTPS with proxy makes sense when the proxy requires password-based authentication, and you fear interception of that password, though.)


dirtycow exploit without gcc I found many vulnerabilities but almost all of them require gcc which is not available on most of my target machines.

I was wondering if it's possible to run dirtycow without gcc installed or what is the alternative to do it?

The DirtyCOW PoC page contains a list of proof of concept exploits, including several that do not require GCC. There is one written in Go and even one which requires only an assembler. You can also analyze how the exploit works and implement it yourself in whatever language is available to you.


How to detect Ransomware I have installed a SIEM on my company that is based on Alienvault USM correlation rules. How can I detect Ransomware activity on my network?

I already enabled Suricata IDS on all of my network traffic.

Using a SIEM solution to monitor ramsonware is fairly simple. Explaining it in a high level: If you enable "file audit" logs on your OS you will receive logs every time a file is changed. Ransomware basically encrypts (changes) several files in a very short period of time. Based on that, you can create a rule in your SIEM to detect this burst in "file changed" events and generate a incident once a threshold is reached.
Something like this: "If there are more than 500 file modification events in less than 5 minutes for the same log source, create an incident".
It is important to mention that enabling "file audit" logs can increase considerably your EPS rate. In my opinion, enabling file audit brings a lot of monitoring capabilities (and help a lot in forensic cases), but keep in mind the EPS increase. For this reason, I do recommend you to implement in this in phases. For example, first enable the file audit logs to 10-15 computers and analyse the EPS increase. In the second phase, more 40-50 computers.. and so on..
Also, you should activate intelligence feeds into your SIEM. Those feeds contain "blacklists" of Command&Control servers, so if any of your computers connect to those C&C servers you will get an alert.
If you want to learn more about this topic, I wrote a post in my blog about this. It's more focused on IBM QRadar, but you can easily adapt to any SIEM solution.


Principles of memory forensics tools I am currently writing a thesis about digital forensics which includes a chapter about memory forensics.
Besides the tools and the methods of acquiring various data with them,
I am kind of desperate to find information about how these tools (eg Volatility) are actually working in theory.
For example, how they identify offsets, processes, connections, differences in memory depending on the OS by looking at the raw dump or any other way.

How do memory analysis tools work? What method do they use? I can't seem to find much information about this.

A lot of analysis tools look for known data structures (i.e., patterns) in memory that indicate a particular type of information.

For instance, malloc'd memory has header (and sometimes trailer) data that point forward and backward in memory to adjacent memory. Free'd memory pointers can jump around in memory if they aren't consolidated/coalesced.

Windows C++ applications have the notion of classes and a "this" pointer, which points to a class. The structure of C++ classes is known, so when one of these pointers is found a lot of information about the class can be derived. If it is a known class/data-type then it can be parsed relatively easily.

File's open in memory can be discovered by their "file signatures" (usually the first 3 or so bytes of the file). If those are found, some quick analysis can be done to determine if it's actually a legitimate file of that type or if it was dumb luck that those bytes occurred.

So, in general, many memory analysis tools look for known patterns in memory and/or hook into key datastructures within the kernel and then parse memory from there. Once you find code areas, you can "disassemble" them and find references (pointers) to other regions of memory. And following those you can find other data structures.

I hope that helps some.


Are there any known exploits that come from easter eggs? One of the reasons Microsoft stopped adding easter eggs to products is they could potentially have security flaws. Are there known worms, exploits, etc that take advantage of an easter egg in some product?

Yes, Easter eggs have caused security problems in the past.

Here are three examples, by descending severity:

The XBOX XBE Easter Egg Exploit

An Easter egg in the Xbox which displays hidden developer credits was used in an exploit to run unsigned custom executables (which Microsoft originally proibited).
This is the Easter egg:

  The Xbox contained developer credits in the dashboard. Inserting an
  audio CD and ripping it with the name "<<Eggsßox>>" would trigger
  it.

The exploit itself is documented here.

The PHP Fingerprinting Easter Egg

This PHP Easter egg is probably one of the best known security-relevant Easter eggs although it's "only" an information disclosure problem. Essentially, by appending a particular string to the URL on any PHP site that had the expose_php option set, you could reveal a hidden image instead of the original page. Since these images vary between PHP versions, that feature became a popular way to help an attacker fingerprinting the PHP version of a target server. You can find a write-up on that problem here.

The jdbgmgr.exe virus hoax

The jdbgmgr.exe virus hoax is not a real vulnerability but it was also based on an Easter egg. It's an e-mail hoax that told Windows users to delete a particular file. That file had, as a joke, a teddy bear icon which let it appear unusual in a Windows system directory. This icon made it easy for the hoax messages to convince users that the file was in fact a "dangerous virus".


how to anonymously contribute to Github I have noticed how important has it become to anonymously contribute to github. I have just created a new account with protonmail and removed my actual account from my Macbook. I still have the public keys. Should I use those public keys to connect my Machine to Github or generate a new pair with a new email?
What are the other things I should keep in mind to stay 100% anonymous like Satoshi Nakamoto(who created bitcoin source)?

Github makes all users' public keys available at an unauthenticated endpoint: https://github.com/username.keys (replace username with your, or anyone else's, github username).
Anyone at any point in time could have scraped and saved the public keys associated with your original user. If you reuse them with your new user, the connection is easy to make.
It's simple and cheap enough to generate a new keypair for your new user. You should generate a new keypair.
Note: I'm intentionally ignoring "how to stay 100% anonymous" (this is much too broad for this forum) and "how important it has become to anonymously contribute to github" (this is a strange premise).


Can a salt be a random ASCII string or be derived from one? I'm using a KDF (PBKDF2HMAC) to generate a Fernet key from a given password, but to do so I also need to generate and store a salt.

    import base64
    import os
    from cryptography.fernet import Fernet
    from cryptography.hazmat.backends imort default_backend
    from cryptography.hazmat.primitives import hashes
    from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
    password = \"$PASSWORD\"
    kdf = PBKDF2HMAC(
        algorithm=hashes.SHA256(),length=32,salt=\"$FERNET_SALT\",
        iterations=100000,backend=default_backend()
    )
    key = kdf.derive(password)
    key_encoded = base64.urlsafe_b64encode(key)
    print(key_encoded)

Due to technical constraints, it would be hugely convenient if I could generate that salt using  AWS Secrets Manager, but it only generates strings with alphanumeric+punctuation.

So the question is if I could use these random strings as salt, even if they're coming from a much smaller sample space than a typical urandom would give. And if not, if I could somehow compress the given random string to achieve the necessary randomness.

it [only] generates strings with alphanumeric+punctuation.

This means that each character in the string can be 1 of 72 symbols (26 uppercase letters + 26 lowercase letters + 10 digits + 10 punctuations).

So, if you randomly generated a string 42 characters in length, where each character is one of these 72 symbols, this randomly generated string would have more entropy than 256 randomly generated bits:

72 ^ 42 = 1.01 e78
2 ^ 256 = 1.15 e77

But, as @Steffen Ulrich points out in the comments, salts do not need to have this much entropy.