What is the purpose of subdomain enumeration?

What's the purpose of that in terms of security / hacking?

The hostname(s) of resources can provide valuable information to narrow the scope of an attacker's task by providing information about available machines and resources. The underlying space of network (IP) addresses is sparsely populated (and IP:port combinations even more so), so narrowing down the addresses at which the organization hosts machines significantly reduces the preparatory work necessary to locate machines, map the topology, and launch an attack.

For example, the presence of a name ssh.company.com in the DNS provides hints of machines which probably host an SSH daemon. In the first instance, it is reasonable to suppose that daemon runs on its default port, significantly reducing attack overhead and advancing to the stage of probing for vulnerabilities. By contrast, scanning the large IP ranges of an organization (if known a priori) is slower, more time consuming, and more likely to trigger early alerts in firewalls and IDS devices of port scan attempts.

  Is there any way to do that other than by brute-force with a dictionary of the most popular subdomain names?

Yes, there are alternative methods, which might be available depending upon the degree of (mis-)configuration of the relevant infrastructure. Here is a list of common methods:

A dictionary attack operates passively by sending standard DNS queries for common hostnames. By definition, it cannot guarantee to provide a full enumeration of a zone, but it will always find any resources with common hostnames. This attack vector cannot be mitigated without impeding the proper functioning of the DNS.
A brute-force attack also operates passively, but generates all possible combinations of hostnames. Such an attack can be exhaustive, as RFC 1035 limits the maximum permissible length of a DNS label and the overall length of an FQDN (§2.3.4). However, this would be extremely time-consuming, especially given the sparse population of the DNS namespace.
A zone transfer attack attempts to request a zone transfer from an authoritative DNS nameserver for a given domain. A zone transfers represents a dump of the entire zone contents, which is typically used by slave servers to update their locally cached copy of a zone. A successful zone transfer provides an enumeration of an entire zone.

Most sysadmins provide some security-by-obscurity by restricting the source IP addresses which may submit zone transfer requests. Hence, this attack can only succeed if: a server has an open zone transfer policy (anybody may submit a zone transfer), the attacking party can observe a zone transfer in progress, or the attacking party gains the ability to issue packets from one of the trusted IP addresses, perhaps by traffic interception in the network.
An NSEC walking attack can enumerate DNSSEC-signed zones. DNSSEC must assert the non-existence of records in a zone to prevent attackers spoofing NXDOMAIN responses in an attempt at denial-of-service. The provision of a denial-of-existence proof is commonly achieved by sorting the zone records and linking them in a chain of NSEC records (each signed). It follows that the intervening namespace between each NSEC record contains no valid resource records.

However, this technique necessarily allows the NSEC space to be trivially walked to enumerate a DNS zone.

Various alternative mechanisms for minimizing this risk are proposed:

Online signing, in which the NXDOMAIN responses are generated ad-hoc and iteratively restrict a smaller and smaller subset of the namespace (e.g. restricting a.domain.com, then aa.domain.com, then aaa.domain.com). However, this approach requires a signing key to be distributed to slave servers, which spreads keying material further than perhaps desired.
NSEC3 records introduce hashes into the denial-of-existence proofs. The hashes are signed statically, obviating the need for slave servers to be provided with a copy of the signing key. As the hostnames are hashed, walking the chain of NSEC3 records is no longer trivial and attracts significantly greater overhead, although some claims exist that this is still not sufficient.

Wikipedia has a good view on the whole issue.

  How to protect my domain?

Protecting against the above attacks should be your first line of defense, through properly configured nameservers and carefully considering any deployment of DNSSEC. However, you cannot fully eliminate the threat of a dictionary or brute-force attack without breaking proper DNS functionality.

You should remain cognizant of the fact the DNS is public information; although it is perhaps good practice not to give up your zonefile to anybody who requests it, this is just security-by-obscurity. Defense-in-depth security techniques should still be adopted through appropriate security precautions in your network topology, training your system users against social attacks, properly tightening any public-facing daemons you might operate, and whatever else your written security policy dictates.

Zone transfer testing

It is easy to test (or experiment) with DNS zone transfers using the dig(1) utility under your favorite *nix environment. Finding a zone which allows you to transfer it is another matter, but digi.ninja provides the zonetransfer.me example for this purpose. The following command should demonstrate a successful zone transfer against the zonetransfer.me zone, which will provide you with a full enumeration of this demonstration zone:

dig @nsztm1.digi.ninja zonetransfer.me AXFR

You can test your own zones by replacing the relevant fields in the command. A failed attempt should elicit the response

; Transfer failed


(this question might be better suited for the User Experience site)

Change the error message to "We need you to log in again because you were inactive for more than XX minutes." Problem solved.

Let the user know how long they have exactly, because if they have to submit a complex form they need to be aware that they will need to collect whatever information they need and prepare whatever text they must input within a set time. Even better, monitor on which forms sessions tend to reset and use that information to figure out if you must support longer-lasting sessions.

Sometimes users might make a token expire before they even logged in as you pointed out. In that case, a formulation that is generic enough to cover both use cases will remove the need for you to try and test how the session looked like before it expired. You still need to address the confusion that such a message can cause for users who were not logged in before (their mental model might not accommodate the idea that individual forms expire rather than actual sessions).

You can do so by adding a "learn more" or "more details" link on your error message. Clicking that link can then display an additional paragraph that explains (succintly, and in very simple prose!) that Web login forms expire after XX minutes for security reasons, and the user was inactive for too long. You'll still need to ensure that additional text is visible to users without JS.

At this point you might as well implement your idea of serving a fresh CSRF token via AJAX when the user has been inactive for long enough...

Edit: some services directly display a timer indicating for how long the current page will be valid. You could go as far as implement such a timer on a standalone login page. This will at least prepare users to the idea that the page has expired / will expire, and can be especially useful if the page must be entirely refreshed when the timer expires. This being said, thee proper approach remains to never invalidate the existing login page.


You don't need government grade malware to do this and such attacks have actually been carried out for years. Typical SOHO routers are often vulnerable to CSRF and similar attacks and this can be used by the attacker to compromise the router, i.e. changing critical settings like the DNS servers. This compromise can be executed when you visit a web site. It does not even need to be a "bad" site since such an attack can be executed from inside embedded advertisements too (malvertisement).

For an example of such an attack see How millions of DSL modems were hacked in Brazil,... which talks about how attackers compromised millions of routers in Brazil using CSRF attacks. They then changed the DNS settings in the router so that the traffic got diverted to the attacker. With this man  in the middle attack the attacker then could inject advertisements or malware into the traffic to every computer using this router.

These attacks are unfortunately very common today since a large proportion of SOHO routers are insecure. See Website Security – Compromised Website Used To Hack Home Routers for hacking via compromised web sites or Spam Uses Default Passwords to Hack Routers for similar hacks done via spam mails.

As for the enterprise level routers: Once you are in (maybe via a backdoor) you effectively own a large network with often sensitive information inside. By manipulating the routing you can divert the traffic to the attacker and do the same attacks and more as described above. The main difference is that you have far more computers behind the router and these have usually more more interesting information than you will find in home networks. This means the return of investment for the attacker is usually higher when enterprise routers or even routers as ISP's are compromised.


NtUnmapViewOfSection (and the corresponding NtMapViewOfSection) are function calls used by Windows kernel-mode drivers to manage shared memory.  These functions can be used to share memory between kernel space and user space: for example, a driver could use them to communicate with a user-space configuration tool.


How To decrypt a private key stored in PEM format file

The function PEM_read_(bio_)PrivateKey reads an encrypted or unencrypted private key. I suppose PEM_write_PrivateKey writes it again.


How did my browsing choices reach an Alibaba seller?

There are many ways that advertisers can track you across different sites.

As mentioned here, Skype displays Google ads.  In Google's Terms of Service, they state:

  Our automated systems analyze your content (including emails) to
  provide you personally relevant product features, such as customized
  search results, tailored advertising, and spam and malware detection.
  This analysis occurs as the content is sent, received, and when it is
  stored.

This is a likely culprit as Google could have used your Gmail account to use an invoice from Allegro.pl to target you ads.  Since 96% of Google's revenue comes from advertising, Google constantly shares your information with 3rd parties such as Alibaba.

Another option is through the use of tracking cookies - also known as persistent cookies. If you are interested in how they can be used to track you across the web, EFF has published an article on how they are used in the case of Facebook, which has similar tracking practices to Google.
A third option is through browser fingerprinting, which can track browsers through configuration settings.  You can check if your browser can be uniquely fingerprinted via Panopticlick. The about page of the Panopticlick research project states:

  When you load a web page, you will automatically broadcast certain
  information about your browser to the website you are visiting — as
  well as to any trackers embedded within the site (such as those that
  serve advertisements).

  The site may then create a type of profile of you, tied to this
  pattern of characteristics associated with your browser, rather than
  tied to a specific tracking cookie.

If you are interested in reducing the likelihood of this kind of tracking in the future, you may want to install the browser addon Privacy Badger or Ublock Origin which will block connections to tracker domains.  For more advanced control, try UMatrix.


What to do after a co-worker has been phished?

Block the phishing link in the company firewall. If the co-workers only read their mails in the office, this would suffice. But this seems highly unlikely. Further steps if the co-workers use company laptops, block the link on the laptop firewall too. Lastly, if they access it from any other personal device, make sure they know a phishing mail is going around which they should not click on. Attach a screenshot to the mail you sent around, on how the mail looks like. Besides that there is not much you can do other than scanning the computers where the link has been opened. Malware could have been installed through a drive-by download. Where malicious applications get installed through browser vulnerabilities. Hope this helps! Good luck


Tracking an IMEI or device from an IP address

No, the website cannot, but the phone company can. They will know which account was using the IP and what IMEI is used with that account.


Trusted Platform Module, daughterboard vs onboard TPM?

A daughter card normally implies it is using a LPC (Low Pin Count) bus. This bus is slow and can relatively easily be monitored/manipulated. This is the basis of the famous TPM reset attack on version 1.1.

1.2 introduced the concept of Locality which mitigate this issue but is said to not entirely prevent it (not proven) - the window of attack is way smaller but the communication is not authenticated.

Not all TPMs are made equal and you get to choose your level of security. While a daughter card would likely not mitigate against the physical reset attack, a lot of new TPMs are integrated within the chipset - since 2009 if I recall. Intel provide those TPMs as part of their vPro technology. They run has application within the Management Engine in the Platform Controller Hub on new architecture or northbridge otherwise. In turn, it means the attack surface is most probably null.


Is it possible for an attacker to log my keystrokes on a linux server which has no X window system?

attacker has gained access and is able to run a shell as my regular non-root admin user

If this is the same account as you use to do privileged operations with sudo then the attacker could make changes to your environment which make you run a different binary. In the simplest case this would be changing PATH so that just typing sudo would actually not run /usr/bin/sudo but some rigged /home/admin/.attacker/sudo. This attacker provided sudo implementation could then sniff your password and then just start the real sudo.

But one can make it more stealth, like changing your profile so that it spawns an attacker provided shell with included key logging. Or just run script to log every input and output.

  If so, are there any precautions I can take to minimise this keylogging risk?

Don't allow local users on the system. General hardening of the system. Limit the users with special privileges (like ability to sudo) to only some well-protected accounts.


Configuration settings for sessions in php

session.hash_bits_per_character

This indeed only affects how the raw session ID is encoded. You can generally set it to any value you want. However, a value of 6 will lead to “strangely looking” session cookies, because the comma has to be URL-encoded.

session.hash_function

If the PHP environment uses weak session IDs without additional entropy (see session.entropy_file and session.entropy_length), then it can become feasible to recover the seed of the PHP pseudo-random number generator through the IDs and use that to predict future values (chapter 4.2). A slow hash algorithm like Whirlpool or SHA-512 makes this harder, because finding the original input of the hash takes longer. But of course the real solution to this problem is to not use weak session IDs in the first place.

session.use_strict_mode

This is supposed to make session fixation attacks harder by not allowing an attacker to make up their own session IDs. See the corresponding RFC for a more detailed description of the ideas behind it.

However, an attacker doesn't have to come up with their own IDs to perform a session fixation attack. They can simply obtain a valid ID from the application and use that. So this feature is rather questionable.


I found an unknown ipv4 address on my router

Are you perhaps using carrier-grade NAT (CGN)? That address you specified is part of RFC 6598, a standard that specifies the address range 100.64.0.0/10 (which includes the address you provided). This means that it is not a local private address, but the address provided to you by your ISP. In order to overcome the IPv4 shortage, your ISP assigns you this special address, and then uses NAT to convert it to your real (shared) public IP address. In other words, the address you are seeing is the one between your router and your ISP, not between some device and your router. All this says is that someone is requesting a blocked domain through your router. Most likely culprits? Curious children.


What's the best length for randomly generated passwords? (Security vs. compatibility)

If your passwords are n characters randomly drawn, with equal probability, from a set of 95 characters (which is about all the ASCII printable characters minus space), then each character gives you about 6.6 bits of entropy, so the strength of a random password with n characters is 6.6 × n.  So:

A 10 character password gives you about 66-bit strength;
A 12 character password gives you about 79-bit strength;
A 14 character password gives you about 92-bit strength;
A 20 character password gives you about 132-bit strength.

In my judgment, you could sensibly choose any of these lengths depending on the application.  For example, if you use a 66-bit password for a low-value online service, your password will still be loads stronger than nearly everybody who uses that service.  But if we're talking about a password that's used to derive an encryption key on software that you run on your own hardware, you should certainly consider something stronger.

To add some additional thoughts, it pays to consider two kinds of attack:

An attack targeted at a website (or other password-protected service) that you've enrolled in;
An attack against you specifically.

In scenario #1, the password cracker is going to divide their computational power to cracking as many users' passwords as they can, in the hopes of finding the low-hanging fruit—users who have very weak passwords.  I believe a 64- to 80-bit password is plenty to defend your passwords against such attacks.

In scenario #2, the attacker is going to dedicate all their computational power to cracking your password specifically.  In that case, a powerful adversary might (or might not!) be able to crack a 66-bit password, and you could therefore justify going as far up as 19-20 characters (to match the 128-bit security strength of most ciphers).

And always keep in mind that if your password is strong enough, that just means the #2 attacker is going to probe a different weakness.  Don't bother making your password inconveniently strong if you've got big holes elsewhere.


Yes, it is possible to analyze a kernel mode dump in WinDBG:  https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/analyzing-a-kernel-mode-dump-file-with-windbg

But analyzing it takes a little more finesse than a per-process level dump.  See how to interrogate all running processing with !process:  https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/-process, etc.


How to get the prime number of a secret key in GnuPG?

You can use pgpdump to inspect public and private keys. The "Dump integers" option (pgpdump -i) will display the values used for the key. The values used for the private key (p,d,q,u) however will only be shown if the private key is not protected by a passphrase.

Since pgpdump only works with ascii-armored keys, you'll have to export your keys first.


Is it OK to generate a token for a credit card without the user's permission? Is that PCI compliant?

Short answer: Yes, it is PCI compliant.

Long answer:

The PCI DSS requires that card data be "rendered unreadable anywhere it is stored"; encryption and tokenization are the two most common methods.  But all that tokenization does is to provide a way to reference card data without some places storing card data.  It is most often used to permit a merchant to store and manipulate tokens handed to them by their processor; the processor is still storing the card data (encrypted) but have generated that token to allow the merchant to "use" the card without "having" the card.  It wouldn't make much sense for a single entity to generate tokens for their own use; tokens only work when they reference stored card data, and if you're storing card data, generating your own tokens for them won't alter your scope a whit.

The PCI DSS does not deal with the question of the client asking for the card to be stored or not.  When a client uses a credit card, they are implicitly accepting that their card data will be stored by one or more intermediary parties during and after the credit card authorization and settlement process.  While such requirements are not part of PCI DSS, credit card transaction records must be stored long enough to support card dispute and chargeback purposes.  That includes card number - you need the card number to handle a chargeback request.  The client's ability to say "Hey, I didn't buy that" and get their money back is one of the value-added services use of a credit card provides, and the card data need to be stored for that to happen.

You haven't specified which PCI-covered entity you're concerned about.  Merchants can avoid having to store cards using tools like tokenization.  Processors generally need to store cards.  Other "Service Providers" may or may not need to store cards; depends on what service they're providing.

If you're concerned from the POV of a client - you really can't do much.  You deal only with the merchant, who passes the card through a minimum of 1 and possibly more than 1 other entities during the act of processing.  All of them are allowed to store the data as long as they protect it as dictated by the PCI DSS.  The only way to opt out is to use cash.


Received weird request URL in my TOMCAT access logs

\x16\x03\x01...

This is the start of a TLS 1.0 ClientHello, i.e. the begin of a TLS handshake. The \x16 is the TLS record type 22 (hex 16 is decimal 22) which means handshake. The next two bytes are the major and minor SSL/TLS version of the record, where 03 01 stands for TLS 1.0. Probably somebody tried to access your HTTP site with HTTPS. It's not an attack.


Man-in-the-middle attack with public wifi

Your Charles Proxy software was working fine. The reason you won't see other users on a Starbucks WiFi network is because Starbucks enlisted Google to design and implement their WiFi networks (which is why the SSIDs are named "Google Starbucks"), and Google set them up in a really smart way. Each user that connects to a Google Starbucks hotspot is "sandboxed" on their own individual subnet. If you use a network analysis tool like Nmap, you won't see anyone else. This is a fantastic way to isolate users from each other, which eliminates direct attacks from other people connected to that hotspot.
However, the threat of a Man-in-the-Middle attack still exists on ANY public WiFi network (i.e., WiFi that does not require a password to connect), because actually, these attacks do NOT come from other users who are already connected to that network. The vulnerability is at the moment you initially connect to a public WiFi hotspot. An attacker can set up their own WiFi hotspot and let unsuspecting people connect to it instead of the legitimate hotspot.
This is how it works: an attacker can use a laptop with two WiFi adapters. They would connect one of them to the legitimate public hotspot which is connected to the Internet. Then they would set up their second adapter as another WiFi hotspot that uses the same SSID as the legitimate hotspot. They would also create a fake login screen that looks just like the legitimate one (which is not difficult to do). If you happen to be sitting closer to this "rogue" hotspot than you are to the legitimate hotspot, you may unwittingly connect to it instead of the legitimate hotspot. Then the attacker proxies all of your traffic to/from the Internet and you wouldn't notice the difference. Your secure connection (using HTTPS/SSL/TLS) terminates at their laptop, and then another secure connection is established to go out to the Internet and back, so you will still see that the websites you're using are happily connected using HTTPS. But meanwhile, ALL of your data is passing through the attacker's laptop as unencrypted, clear text that can be intercepted, viewed and recorded. This includes any and all information a user sends through a web page, including passwords.
The only way to be absolutely sure your Internet connection is secure from end to end, is to use locally installed software that "tunnels" your traffic directly to a (proxy) server that the software already recognizes as a trusted provider. Then, even if you do connect to a rogue hotspot, your traffic passing through the attacker's computer is still encrypted, so the attacker cannot view anything at all. Some examples of tunneling software are corporate VPNs (they use client software), anonymous proxy services (only those that use a client app), and SSH (secure shell) tunnels that, once again, connect to and proxy your traffic through already known and trusted servers.
Public WiFi can be safe. Now you know how. Happy surfing.


Your requirements aren't cloud specific.  This same solution will work with a traditional hosting.  The hallmark of cloud computing is dynamic resource consumption by booting up VM's only when you need them.

1)As far as I know MongoDB doesn't support SSL.  In order to have a secure connection to MongoDB you'll have to use a VPN to create a safe tunnel.

2)It is almost always better to encrypt the data prior to inserting it into your database.  From a secuirty perspective if your database is taking care of encryption then it requires a key and the database is compromised then the encrypted data is also compromised.   This should be taken care of by your application,  also note that a stream cipher will produce smaller messages and save space.  Stream ciphers are safe if used properly,  (unique IV for each message).

3) There are many backup services that use encryption.   If you are rolling your own then i recommend using the open source project Bacula.


You could always use a live disk on a computer and mount the hard disks in such a way that the files cannot execute, then scan them from the live disk.

I'm fairly certain AVG has a live disk that can work like this, as does any linux distribution with a live disk that lets you install Clam-AV.

Keep in mind though no anti-virus program is perfect and there is a chance that even after scanning everything you will still have malware.


What is the attack vector for CVE-2018-3639 Speculative Store Bypass?

Can the attack will be performed via a browser? Or the attacker need a physical access to the CentOS server?

The attacker needs local access to the system. This does not necessarily mean physical access but it can also be some kind of remote access which allows the attacker to execute code on the system. This could for example be a security issue in your web application which allows remote code execution (RCE).

If you have such a vulnerability which allows RCE it is very likely that the attacker will not try to use a very hard to execute attack like Speculative Store Bypass or any other Spectre variant but that he will make use of some easier to exploit security issues which are often available on a complex system. In other words: don't worry too much about this issue since it is (currently) very hard to exploit but worry more about the other issues you might have.


hmac based request signature for verification

this service just passes the signature without integration key

It doesn't, although I can forgive you for making that mistake. The function name is a bit misleading.

sign_request isn't a particularly accurate description of what it does. It MACs the request (I assume they say "sign" simply because the average developer will have no idea what a MAC is), but it also includes the request itself in the returned data.

Given:

ikey = '3pA0XSAwHBOkyGH43WlZ'
skey = '21FNMyZQ15c4GqTHzUnJUGpYTp35LXieMfxAulY3'
akey = 'rVbrzSNJNBKyspIZgabSt3m8C6zIs20zrJF27t65'
username = 'johndoe'

sign_request will return:

TX|am9obmRvZXwzcEEwWFNBd0hCT2t5R0g0M1dsWnwxNTQ4MzQwNDY0|f8ab99bf117ec109c16b7193b5be7e16238a46f8:APP|am9obmRvZXwzcEEwWFNBd0hCT2t5R0g0M1dsWnwxNTQ4MzQzNzY2|307f27ee3ea75c09c2f2b4e8b3089b49c167b88f

Picking that apart:

TX is the hard-coded "DUO_PREFIX"
am9obmRvZXwzcEEwWFNBd0hCT2t5R0g0M1dsWnwxNTQ4MzQwNDY0 is the base64 encoding of johndoe|3pA0XSAwHBOkyGH43WlZ|1548340464, which is username|ikey|expiration-timestamp (expiration being 5 minutes from the current time)
f8ab99bf117ec109c16b7193b5be7e16238a46f8 is the hex-encoded MAC of TX|username|ikey|5m-expiration-timestamp using skey
APP is the hard-coded "APP_PREFIX"
am9obmRvZXwzcEEwWFNBd0hCT2t5R0g0M1dsWnwxNTQ4MzQzNzY2 is the base64 encoding of johndoe|3pA0XSAwHBOkyGH43WlZ|1548343766, which is username|ikey|expiration-timestamp (expiration being 1 hour from the current time)
307f27ee3ea75c09c2f2b4e8b3089b49c167b88f is the hex-encoded MAC of APP|username|ikey|1h-expiration-timestamp using akey

So ikey is actually included twice in the request.


Use metasploit with meterpreter scripts to invoke post_ modules.

http://en.wikipedia.org/wiki/Metasploit_Project

http://www.offensive-security.com/metasploit-unleashed/Writing_Meterpreter_Scripts


Does signing my e-mail with DKIM imply non-repudiation for all my users?

DKIM does not provide non-repudiation or confidentiality such as PGP/GPG or S/MIME. It is primarily a means of authentication of the originator of the message (most likely at the domain/company level and not individual), and (to my knowledge) the most practical use is chiefly for spam/phishing prevention.

The scope of the DKIM signature would not necessarily cover the whole message body, but primarily the headers and parts of the body.

"Only plain text messages written in us-ascii, provided that MIME header fields are not signed,[13] enjoy the robustness that end-to-end integrity requires." source

In most typical setups, DKIM is on a per-domain basis, and all users share the same public key for signing messages. The identity of the signer is not necessarily linked to that of the message originator. This means anybody with access to send emails on the domain can generate DKIM signed messages. So for example, if a malware resides on a user's computer and is able to send email from their mailbox, and if the mail is then DKIM-signed at the mail server (which is quite common), the email will have a valid DKIM signature.

When it comes to non-repudiation however, the expectation is in most cases that the actual (human) person is the only one in possession of the private key used to sign the message, and in such cases it can be linked back to this person. Non-repudiation is very tricky because of the so many factors surrounding the 'ownership' of the private key and the ability of the someone to argue that this possession was somehow compromised (that is a little digression however)

Forwarding is another possibility which DKIM doesn't fully protect against (see the same wikipedia entry)

You can read more about limitations and potential misuse of DKIM on the security section, as well as on the FAQ : What does DKIM not do

So to more specifically try to address your questions (even though some clarification might be required, because I'm not entirely sure what you ask very specifically):

Checking that it originated from your domain - with some degree of certainty, yes. DKIM is primarily meant to provide that. There's still a possibility that someone hacked your DNS and injected their own DKIM keys and forged a message of course...
How to communicate this to your user? I'm not sure what is this... Hope that my answer gives you some more clarity about DKIM to be able to answer that by yourself now.
In relation to the article - hard to know what your primary concern might be. If emails are stolen by hacking into a server, then it's more a question of who you trust - the hackers who did this or the people who got hacked? Who has a higher motivation to lie or deceive you about this?? The emails might be legitimate, unaltered version, or they might be altered. In the latter case, it's fair to assume that hackers who got the emails in the first place might be able to forge the signature too. The signing key will likely be stored on the mail server itself, giving the hackers the ability to sign any message they want...


I read Insufficient Entropy For Random Values and now I think non of the given examples provide enough entropy. gethostname() is not secret and uniqid() and even mt_rand() is a Pseudo-Random Number Generator.

I will use

$nonce = base64_encode(bin2hex(openssl_random_pseudo_bytes(16)));


Are there any smartcard/hardware-tokens for certificate-based authentication which are easily destroyed?

Although its a cool idea, I think these would be practically impossible to use.  A better idea would be a tamper-pin.  If coerced, give the tamper pin which renders the smartcard/token/etc useless when entered into a system.

To (try to) answer your question, I haven't seen any commercial solutions, but I bet you can find custom hardware.

EDIT: There is the Verisign OTP card that PayPal uses which is pretty flimsy.  While it's not designed to be broken, I can easily crush/snap the thing in half.  You can check it here: http://www.verisign.com/authentication/two-factor-authentication/compare-two-factor-authentication/index.html


How to detect if employees are using Tor?

You can use a list of Tor (uplink) nodes, add this to the outgoing firewall, setup a task to update this once a day and you'll be good. But Tor can also be used over a HTTP(S) proxy, so you will have to detect proxies as well.

I am not sure if this is going to help you secure anything. As long as there is a connection to the internet, it would be possible to bypass these kind of security measures. You could end up spending endless time and energy to prohibit all kinds of proxies, VPN's, SSL tunnels and such. The advice is to just make sure they cannot do any harm by protecting whats important to your business, and leave users be. For example separate the network in compartments, use subnets, VLANs, DMZs and require authentication and authorization on private networks. Keep the important stuff in one zone, while allowing networking without restrictions on another. And so on...


Security vulnerabilities of POST over SSL

Assuming you mean TLS instead of SSL itself (which is far older and broken), it is absolutely fine to transmit the password in a POST request. This is standard and how virtually every major and secure web authentication service works. You just have to make sure that the TLS is configured properly. TLS mitigates all the attacks you are worried about. It uses HMAC (or a similar authentication) for integrity, and mitigates replay attacks, reflection attacks, and similar issues that affect authentication systems. Note that new vulnerabilities may be found that require either upgrading the version of TLS or manual mitigations. SSL Labs can test for known vulnerabilities in a TLS implementation.


Which factors should you take into account when deciding whether users should be informed of a penetration test?

In the UK, law is a strong factor. The Human Rights Act 1998 states:

  Everyone has the right to respect for his private and family life, his
  home and his correspondence.

So if any users that are caught up in the penetration test have an "expectation of privacy", then you are required by law to inform them prior to any testing. Note that just because they are in the UK does not mean they have an such an expectation - this would be down to the company's policies (e.g. Acceptable Use policy and Internet and Email Access policy) and contract of employment.

This page is a useful resource regarding pen testing and UK law.


Why are db_nmap results filtered, but Nmap is not


Can data coming into my UDP server be sniffed?

It would be easy to sniff data using tools like WireShark from someone who can access the data path between your client and the server. This isn't something anyone on the Internet could do per se but if your device uses wireless and there are people nearby they could grab this data if they wanted it.

As for finding your UDP service on-line that is easy to find via simple scanning tools like nmap and zmap but depending on the port number you used it may already be publicly listed on sites that scan the entire Internet like scans.io. In all likelihood some third parties are already aware of your UDP listener and this will, hopefully, also be listed as other source addresses in your logs.

Security through obscurity no-longer exists on the Internet since people can use tools like zmap or massscan to scan the entire IPv4 address space in just a few minutes.

https://nmap.org/

https://scans.io/

https://github.com/robertdavidgraham/masscan

https://scans.io/

As per the encryption question I think it would be wise to encrypt your data and also wise to consider how each device authenticates to the server. Security of the Internet of Things (IoT) is a very hot item because so many of these devices have abysmal security and security researchers, and bad actors, can leverage these problems to get access to other networks very quickly. If nothing else I recommend using encryption because what you use the device for may change in the future and it's always easier to design security in at the beginning of a project rather than paying the high-cost of reengineering.


How can we guarantee our custom auth implementation to a client?

If you have the money get a pen test of the system from a reputable firm.  Lots of firms are available (e.g. Synopsys/Cigital, Rapid7, SEC Consult, etc.).  Expect it to cost you $40K to $50K USD.

Then you can either show the test report to your customer or you can tell them that you had it pen tested it no issues were found.  Be careful about showing reports to customer, if you do it once they'll expect it from then on.  My company will not show pen test reports to a customer, but will characterize them (e.g. "X highs were found, Y mediums, and Z lows and all have been remediated").


Export Restriction of wrapper for existing crypto library

Legal matters are inherently complex because they depend on the jurisdiction, and with 193 countries or so (193 UN members, plus a few odd cases like Vatican, not counting federal countries which induce extra splits) there are a lot of cases to cover. When proposing some opensource software for download, you are actually giving it away to the whole world so you are both providing it to other people and exporting it, so regardless of where in the world you live, and where the servers are, chances are that many regulations apply.

See this site for a lot of pointers and explanations.

My own prejudice suggests to me that since you don't specify which country you live in, then you are probably American, and you implicitly refer to US laws and regulations. Since 2011, there is a relaxed clause for opensource software, which might apply to your case. Or not. If it really worries you, ask a lawyer (which I am not).


What's the purpose of the preflight check on CORS requests?

In other words, you could skip a preflight check and just rely on the response from the server to dictate whether the request is correct, and this saves the browser from making two requests for the single call.

That would assume that the server is properly validating the request in the first place. The problem is that many servers don't which is the reason CSRF works.

Traditionally it was impossible to do cross-site requests doing JavaScript at all. CORS allows to relax this restriction. But CORS was designed in a way that it will not reduce inadvertently the security. Server side code which simply relied on the fact that XHR could never be done cross-site should not be accidentally become insecure. That's why with all but simple cross-site requests done with JavaScript the browser first checks that the server will explicitly allow a cross-site request by sending a preflight request before doing the real request it.


NMap scan from within armitage - missing root privileges

The nmap command is not launched by armitage but by msfrpcd.

So you must make sure that msfrpcd is running with root proviledges.

So what i guess happend for you: you started armitage without root and without msfrpcd running, in this case armitage asks you if it should start msfrpcd. If you clicked "yes" msfrpcd was started without root, if you quit msfrpcd does not quit too but keeps running in the background. Now you restarted armitage with sudo but it connected to the non sudo msfrpcd so nmap still complains about not haveing root.

Easiest way to fix: Quit armitage, quit msfrpcd (e.g. by using htop), start armitage with sudo which will ask you again if it should launch msfrpcd which will now be launched as root.

Alternatively you can launch msfrpcd seperatly with "sudo msfrpcd -U user -P password"

tl;dr not armitage but msfrpcd needs root: quit armitage, kill msfrpcd (e.g. by using htop), restart armitage with sudo which will start msfrpcd as sudo


Stronger Password-based File Encryption on OS X

You can use hdiutil to create a compressed, encrypted disk image from a source folder like this:

hdiutil create -volname NameOfVolume \
    -srcfolder path/to/source/folder \
    -encryption AES-256 -ov -format UDZO name.dmg

For more options, see man hdiutil or poke around in the GUI for hdiutil, DiskUtility.


Environmentally friendly ways to destroy hard drives

A first method is to open up the old hard disk, and extract the platters. Hard drives are usually closed with screws, so it can be unscrewed; beware, though, that it is customary for hard disk vendors to hide the screws under stickers (a disk is sealed and letting the air in can kill it, so vendors want to prevent inquisitive customers from unknowingly breaking their disks).

The data is on the platters; the rest of the disk can be sent to recycling... except if that is a hybrid drive, where data can be both on the platters and in the Flash chip. Removal of the said chip can be done, but this assume that you access the logic board and reliably recognize the Flash chip.

With this method, the recycling issue is not solved, but reduced to the platters only.

Another method is degaussing. A hard drive degausser will destroy the magnetically stored data by applying a powerful magnetic field on the disk (either a big fixed one, or a smaller alternating one). This makes the disk unusable (because the disk tracks are also destroyed) but preserves its physical integrity, making recycling as easy as it can be on a "normal" disk.

There again, Flash chips may resist degaussing, so SSD and hybrid drives will be a problem.


What does the http_uri content modifier do is SNORT

The normalized and non-normalized uri keywords works differently in snort. Normalization means parsing of the http_uri and then store into the buffer for matching. However in non-normalized uri will directly saved into the buffer without parsing.
For example, suppose the http request came like,
/somefile.php?username=%27;echo%20
Then for normalized uri every hex characters will represented in their corresponding ASCII value, so after normalization the request will look like
/somefile.php?username=';echo
then this string will get stored in the buffer for further matching. In case of non-normalized uri the request will stored in the buffer as it is for further matching.


Is there is a way to lock my USB port over the device physically?

The solution most often found in airports is to restrict access to the PC itself - placing it within a lockable case or kiosk.

Alternatively, epoxy resin is pretty good for sealing ports, whether or not they have a plug inserted (remember you will need to seal all ports an attacker could access)


From what I know of the WebSockets protocol whilst it allows two way message passing, at a TCP level the connection is initiated by the client and as such the most firewall configurations (e.g. those which allow standard web browsing) will allow WebSockets communication without further configuration.  Indeed looking at the Wikipedia Article, this is touted as one of the benefits of the protocol.

The flip side of this is that blocking it wouldn't be possible if the firewall only works at an IP address/ TCP port level, it would need to understand more of the semantics of the protocol to understand when it was being used.  Also if blocking Websockets connections over SSL is needed then the proxying device would need to be able to intercept and decrypt the SSL connection.


Secure channels vs secure endpoints

A secure communication channel allows you to communicate with someone else without third parties being able to intercept or modify the messages, no more no less.

They don't protect the communication from the intended recipient - they can record the conversation and redistribute it, and this is a major source of leaked private videos.

They also don't protect you if the endpoint is compromised - the sending or receiving device may record everything being shown on the screen.


Is it safe to learn new keyfob by its normal open code (rolling-code)?

Doorhan uses KeeLoq cipher. There's a somewhat informative Non-doorhan decoder description. From it we can learn that at least 3 learning strategies exist:

Simple Learning: fixed crypt-key
Normal Learning: crypt-key=f(manufacturer-key,serial). Serial sent in clear text in every opening signal. Our case.
Secure Learn: crypt-key=f(manufacturer-key,secret-keyfob-seed). Seed only sent by holding special combination of buttons.

The pdf also says:

  Manufacturer’s code
   – A unique and secret 64-
  bit number used to generate unique encoder crypt
  keys.

That's a bit misleading. It should be the same among the receivers of the same model so any receiver could learn any compatible keyfob. The crypt-key is unique though.

There are 2 types of inauthentic Doorhan keyfobs:

With crypt key flashed by manufacturer. They work just like branded and cannot clone existing transmitters.
With manufacturer key. They do not requre learning and can clone existing transmitters (poorly, because most of the time they send a code which was already used). In fact, I saw versatile HR Matic transmitters that do this. Not sure whether they're compatible with Doorhan.

The latter can be used to steal our code and open a door once or twice, but it's not suited for usage with comfort.


Can you really change the password to a mac on reboot without knowing the old one?

Linuxios can already answered this but I'll see if I can explain in more detail. It's not always obvious why Physical Access = Game Over:

It is not a "flaw" because if an attacker has physical access to your computer, the login password cannot protect it.

If your data is not encrypted, an attacker with physical access to your computer will just remove the hard drive and put it in a different computer to read the contents. The attacker won't be running the operating system on your hard drive, he will just be reading the contents. Therefore, the prompt for your login password will never appear, as it is a function of the operating system.

As Linuxios pointed out, you can set passwords that appear when turning on the computer (aka BIOS/EFI passwords). However, someone with physical access can get around that requirement by erasing the BIOS settings (there is a jumper on most motherboards to do this), or by removing the BIOS chip entirely and replacing it with a new one.

Someone might point out that your keychain and home directory (if you opted to encrypt it) would still be secure - and that is completely true. That is exactly why you should encrypt sensitive data with a strong password, so that even if your computer is stolen, the attacker can't get it.


How to obfuscate a assemblies binary compiled with .NET framework?

There are many obfuscators around, free ones too, just google for ".NET obfuscators". Visual Studio, the IDE from Microsoft, has one integrated, too. If you want to start out, I would try this one first.

Typically these obfuscators take the IL (Intermediate language), rename variables, create obscure control structures, and use more functions to make things complicated to read.

However, the code will still be easily "decompileable" with the respective tools, it will just be less readable by humans. General consensus is, AFAIK, not to obfuscate, as this is something like "Security by obscurity".


Open source intelligence has been around for sometime even though it's received attention only in the recent past. Here's what I do to keep a check on myself.

Step 1: Hack yourself

Have you ever googled yourself? Try to gather information on yourself using OSINT techniques. Start somewhere, perhaps your most common username you use to access this website and move on from there. There are various tools available to search for usernames on the internet. You'll be able to find where you've signed up with that alias. Many times, it will be in places you don't even remember signing up at. Read through the posts and see how much information about you is given out.
In the meanwhile, start making a profile of yourself based on the information you've found. You'll be surpirsed what you end up with for each post you might've made or replied to will have something unique to tell about you. You might sometimes even find older usernames you used to use somehow having a connection. Branch out from there, search around for that now, all while noting your findings down. By now, you have a fair idea on the person's likes, dislikes, interests, views, etc. Now, in my opinion, things get dangerous when you can connect a person's online identity to their real identity. In some cases, you do it intentionally, in other cases, it happens unintentionally. You find a post that leads you to a username, that leads you to a blog post, that leads you to the user's LinkedIn profile. And now you have rich information on that person.

There are many great tools for reconning people. Google search filters being the first best example to really help you narrow down results. Your info is out there, it's just a matter of finding it. Here are some other tools that can help.
http://pipl.com
http://192.com
http://searchpeopledirectory.com

Step 2: Recalibrate

Once you've gathered a good amount of information on yourself, you need to start evaluating what do you want everyone to know, what should be seen with limited access (friends on facebook, connections on LinkedIn, etc), and what is up there but really shouldn't have been. Once you have this, you can backtrack, find these sources and tidy them up. You can also get a close friend to do the same recon on you to get a different perespective, maybe she finds something different about you.

Step 3: Control

I make it seem like the internet is bad, it really isn't. Some people like sharing and interacting with the community, posting things, tweeting their opinions, sharing experiences. And this is fine, as long as you know what you're doing and are okay with it. The internet is absolute, once it's up there, if you forget about it, it's going to be up there forever. So know that if you post something, don't be surprised if someone you've never met knows a lot about you. Even if it is a private forum, share assuming everyone is watching.

This entire thing is not a one time effort. I like doing it every now and then for I do a lot of things without realizing the impacts of it. As time goes by and your awareness increases, you'll automatically have a filter in your head that raise red flags if you're sharing something you shouldn't be. Some call it paranoia, I call it necessary (in limits).

Bottom line, get used to the fact that what you share on the interent is probably going to be seen by a lot more people than you'd expect and might tell a lot more about yourself than you'd have thought. Once you have this implicit filter in your head, you can control how much someone can gain on you with an OSINT based attack. Apologies if this answer is largely unstructued. There's no right or wrong answer here. Read other answers, get some ideas and make your own model. Goodluck!


The data(username,passwords) stored in app bundle is safe in a jailbroken ios device

Your app checks if the device is jailbroken and refuses to run if it is. That's it.

On a jailbroken device, a hacker (or the user) can modify installed applications, so nothing is safe.


Incident isolation and containment approach

In my opinion the response should be aligned with your business. It depends on what you value more if confidentiality, integrity, availability or traceability.

If availability or traceability are the most important: do not shutdown the systems. Design a procedure to gather forensic evidences as soon as possible and execute it when needed.

If confidentiality or integrity are the most important: shutdown the systems, extract forensic images from the disks and perform forensic analysis with what you have there.


Would it be secure to generate random number using AES?

What you are describing is a custom, AES-based PRNG. Encrypting successive values of a counter with AES and a secret key is a sound method for building a PRNG (indeed, it is equivalent to encrypting a long sequence of zeros with AES/CTR), provided that you take care of the following:

You have to use the block cipher "as is": encode the counter as a single 16-byte block, process it with AES (no "block cipher mode"), get the next 16 pseudorandom bytes. Increment the counter, and loop.
This won't be stronger than the encryption key is secret. Keep the key safe !
Of course this assumes that you already have a secret key, which implies that some other cryptographically secure PRNG was used at some point. A PRNG does not create randomness, it expands some initial randomness (the "seed", here the AES key) into a long stream of pseudorandom bytes.
This PRNG relies on your never reusing a counter value. So you have to make sure that the counter is always increased and cannot be forced to "rewind". This is not as easy as it seems, in particular in embedded devices, where read-write permanent storage is at a premium, and the user (who may be the attacker) can force hardware resets at any time (by removing the battery).
AES being a block cipher, it is a permutation of the space of block values. As such, it won't ever output twice the same 16-byte block, which deviates from what a true random source would produce. This may begin to show (statistically) after about 268 bytes, which is high enough not to be an issue. However, think twice before trying the same trick with a block cipher with smaller blocks (3DES, Blowfish...).

An improvement may be to regenerate a new AES key each time the server starts up, using /dev/urandom. That way, there is no key to store anywhere. Indeed, there is no need to reuse always the same key.

(Arguably, it is even simpler to use the strong PRNG which is already there, e.g. /dev/urandom. Switching to a custom PRNG like the one you envision is quite unwarranted; unless you need pseudorandom bytes at more than 10 megabytes per second, which may happen in some cases, but is weird. If you are in need of lots of pseudorandom bytes, you may want to consider using other more specialized algorithms like these stream ciphers.)


Use of HTTP functions in GCP Cloud Functions Is Not Secure. Why they are still available?

This is likely because the HTTP functions were the original functionality, and predate the secure Pub/Sub replacement methods.

There are also indirect signs of a deprecation roadmap for some subfeatures:

  Note: The default behavior for HTTP functions will change after January 15, 2020. Currently, new HTTP functions allow unauthenticated invocation by default. New HTTP functions created after January 15, 2020 will require authentication by default. You can specify whether a function allows unauthenticated invocation at or after deployment.


Is this a secure hash "Function" for integrity?

I am kinda confused about what you are trying to achieve with this rather complicated and error-prone protocol.

If I understand your idea correctly, you are basically just moving the problem of integrity onto the communications with the "hash server". If someone was able to MITM both Alice's and Bob's in- and outbound traffic, they could mess with Alice's message, then make the server send an arbitrary "hash" to Alice when she requests one and return that same value to Bob when he asks for a "hash" the next time.

There are also some other assumptions that seem contradictory for me; For example, it is mathematically impossible for the server to "never send the same random number for two different messages" if you also require that every hash is a "fixed length message shorter than the cipher text". Also, I see no reason why Bob shouldn't be allowed to "derive Alice's OTP key" - what would he do with it anyway? Thus, the "double OTP" encryption seems unnecessary to me.

You have probably heard it before, but there is this rule in cryptography that says "don't roll your own", which basically means you should not try to invent your own protocol if there are established solutions that haven't been broken so far. The reason is that these well-established protocols have usually undergone a lot of research from large numbers of very intelligent people, as opposed to your "new" algorithm that you have put on the stackexchange forums for discussion ;)


Correct way of dealing with spam via impersonation

It sounds like it's some spambot that is sending out the emails. I can't explain why the links are dead or what the purpose of them is. It may be that the links were valid at one point and are now dead or it may have been set up in error.

As the IPs keep changing, blocking them is likely not useful. It may even be the case that blocking those IPs will block real mail coming from the same IPs.

How your boss's contact list got exposed is something that will take a lot of research to figure out. One of your boss's computers may have had/has a virus on it. It may just be that the spambot is acquiring a list of email addresses and grouping the spam to people in a single domain to make the email look more reasonable.

As far as what can you do, not much. Make sure that all your computers are up to date and have updated antivirus on them. Perhaps there are products/services/freeware that can help you filter these emails out based on content or something. Otherwise, just live with it and be happy that you're living through a time with such wonderful growth of the internet :D


Can you describe a real-life scenario of exploiting sticky bits?

man chmod #Debian Linux

  RESTRICTED DELETION FLAG OR STICKY BIT

  The  restricted  deletion  flag  or  sticky  bit is a single bit, whose
         interpretation depends on the file type.  For directories, it  prevents
         unprivileged  users  from  removing or renaming a file in the directory
         unless they  own  the  file  or  the  directory;  this  is  called  the
         restricted  deletion  flag  for the directory, and is commonly found on
         world-writable directories like /tmp.  For regular files on some  older
         systems,  the  bit saves the program's text image on the swap device so
         it will load more quickly when run; this is called the sticky bit.

Note that the "on some older systems" part applies to various BSD systems. Linux has never had any special handling for the sticky bit on files. See http://en.wikipedia.org/wiki/Sticky_bit for more detail about that.

From a security standpoint, it's really just about understanding why that permission exists on the /tmp directory, and possibly others. It prevents users from deleting the files of others in a directory that can be written to by multiple users. It's really only an issue if you don't set it and somebody gets delete happy on others' files.


How can I prevent my WIFI from being hacked?

Once your router is connected and you are on the wifi, you can connect to the router via the browser. Your ISP will tell you how. Then you can log in using the provided (by ISP or the router's manufacturer) name & password.

You'll find a settings page. You can change your router's login information there and then just look for the WiFi settings. Choose WPA2 (& if available: WPA2-CCMP) for the best security.


If authenticated user tries to access a restricted resource

It is possible to enumerate resources through distinctions such as these - if you return a 403 for pages that do exist, but the current user can't access, and 404 for pages that don't exist, an attacker can easily distinguish between valid and invalid resources.

Whether this matters depends on your application - if you reveal information in this circumstance that has value, it may be a bad thing: if /user/73463 gives me a 404 but /user/64500 gives me a 403, I can make an educated guess that 64500 is a valid user whose profile I can't see. On the other hand, if /year/2003 to /year/2016 give me a 403 but /year/2002 and /year/2020 give me a 404, all I can tell is that you've not created year folders off into the distant future, and possibly that you don't have anything from before 2003.

Ideally, you don't want to provide URLs to which the user has no access (from your question, I'm not sure if the URL being followed is on your site, or from elsewhere). You can only control this within your system though - if user B sends user A a link, user A can discover that the resource exists without caring about your response to them. That applies if a link is provided on a third party website too - no-one is likely to link to a non-existent resource (although they might have linked to a resource that no longer exists, in which case a 404 or 410 would be appropriate). For your own systems, you should aim to minimise the chances that a legitimate user can follow a link to a resource which they don't have permission to access.

Generally, if something can easily be enumerated (e.g. numeric identifier) it makes more sense to return a consistent response to all requests, whether the actual status is lacking authorisation or the resource not existing. If something can't be enumerated (e.g. long hash identifier), it might make sense to distinguish between the states, but you should be aware of the potential for someone to stumble across resources they shouldn't be able to detect, and take steps to prevent this (e.g. monitor for high request rates and throttle apparent attempts to enumerate for resources).


I forgot to shred a file before deleting it (on Windows). How do I shred that part of file system now where the file was located?

First of all (just to be on the safe side) verify the file isn't in the Recycle Bin. If it is, choose Restore and of course shred the recovered file (or maybe you can shred it while inside the Recycle Bin).

If the file has been "truly deleted", recover it using an undelete tool such as Piriform's Recuva, then shred it for good.

Note (suggested by Chris H): deletion under most filesystems is lazy, i.e. the space occupied by the file is simply marked as reusable. Until it is actually reused, the old data is still there and may be recovered. Undelete tools can work in two ways: they can mark that space as occupied again, or they can read the space and make a copy elsewhere. You want the first kind of undeletion, since you want to make the original space accessible to the shredder and destroy it -- not make a copy that will leave the original space still maybe recoverable again and again.

A deleted file might be recoverable using Windows Shadow Copy, which is available since XP and enabled by default in Windows 7+. In an earlier edit I wrote 'chances are that it is disabled'. I should have written "on an unrelated note, ensure that it is disabled". VSS will not help you to shred a deleted file, since (as Chris H noticed) it will actually make another copy. You do not recover the original file space, which remains unshredded. For this reason, your company's IT admins should have disabled VSS on your computer. Otherwise, any "shredded" file may actually have several unshredded and recoverable copies lying around the disk.

DIY overwrite

However: a newly copied file (with VSS disabled) would be at the beginning of the free space area. If you copy a couple thousand files having the same size of the filesystem cluster size (or 1K if you're in doubt), you should be pretty sure that the file has been made unrecoverable even if it has not been "officially shredded".

"Official" overwrite tools

If you really want to be sure use a tool such as SDelete and tell it to wipe the disk's free space (be careful - not the allocated space!). Or you can use Piriform's CCleaner and do the same thing from the Tools menu. Another tool I just discovered by chance, and is recommended by Gutmann himself, is Eraser.

Unless the disk is carefully examined with an electron scanning microscope, nobody's ever going to be able to tell whether the file was shredded with the mandated tool or not before becoming totally irretrievable. If you use SDelete or such in so-called "secure" mode (aka Gutmann erase), even an electron scanning microscope will be none the wiser. Mandatory point: Gutmann erase is serious overkill even in Gutmann's own opinion.

(The above may of course not apply if the company shred executable keeps and possibly transmits a record of the MD5 of every file it shreds).


Newer anti-malware software can include some sort of 'process behavioral analysis' that performs similarly to EMET. Most enterprise AV solutions are centrally managed. Results may vary...

This is a vendor-neutral site, so I won't go into specific vendor offerings. Check out your favorite AV vendor and see what options they provide.


Is 4096 bit good enough to encrypt data?

No, 4096 bit encryption is not good enough to encrypt your data. Becase of a few reasons.

AES does not support 4096 bit encryption.
Even if AES supported 4096 bit encryption, it would be far to slow (most likely). When 128 bit AES is plenty secure why would you want to slow your system down for such little added value?
If you actually meant RSA instead of AES, the answer is maybe. 2048 bit RSA is more than sufficient and faster, so 4096 bit may be overkill. But, that said, why would you want to use public-key crypto to encrypt your database? Normally that would be a bad idea. Please post more details so we can determine the best recommendation.


How to use a sh SUID script to get privilege escalation?

Multiple things can be done to this file to help you get further. By change can you do the following add to the file the following

echo '#!/bin/sh'|tee admin && echo 'chattr -i /home/(your user)/(file of your chosing)'|tee -a admin

echo 'chown root:root /home/(Your User)/(file you create)' | tee -a admin && echo 'chmod 4755 /home/(your user)/(Your file)'|tee -a admin

Then on your user home directory create a simple c file to setgid and setguid. Compile to the name listed in the script above and then reboot. This will run the file and change the owner to root with guid set.

Then it's simple ./file and then fun.


Why should browser security be prioritized?

Can you explain why browser security should be placed on the top priority ...

Because the browser is processing lots of untrusted  content from the internet.

Of course, if you use any other programs which does this (like Mail client, maybe Office program, PDF reader) you should keep these updated too since vulnerabilities in these programs are a regular attack vector too.

  .. Most of the websites I visit have SSL certificate,

A SSL certificate says nothing about the trust you can have in a site. HTTPS only protects against sniffing modification of the traffic during transport. A HTTPS site can serve malware as much as a plain HTTP site can do.

Apart from that "Most of the websites" is not the same as "All of the websites".

  I can smell fishy websites?

Even if you might be confident in your ability to sniff websites where the URL looks fishy (which might actually be overconfidence) I'm pretty sure that you will not know up-front if the site you visit regularly got hacked and is serving malware (i.e. Watering hole attack or other kinds of hacking high-reputation sites to increase number of victims) or if it is serving malicious ads which are outside the control of the website itself (i.e. Malvertising).

EDIT:
After I've wrote my answer the OP added the following to the question:

  Most of them are either big enough that I can trust that they can't be hacked, ...

Too big to be hacked? While large web sites usually employ better security than smaller ones it does not mean they are unhackable. And sites with lots of customers are especially a lucrative target for the attackers since this also means lots of potential victims. Some examples:
 ... malicious ads on Forbes ... or ... New York Times and BBC hit by 'ransomware' malvertising or Study: One-third of top websites vulnerable or hacked.

  ... or small enough that I don't think it's profitable for the hackers, ...

Too small to be hacked? That's not true either: attackers use automated tools to hack insecure CMS installations like WordPress or Django en mass, i.e. it is very cheap to take over a vulnerable site this way.


XSS works when I save generated HTML to file, but not directly in browser

The relevant code for the HTML generation is the following:

for (var i=0; i<posts.length; i++) {
  var html = '

  '
    + '

';

  html += 'You';
  html += '' + new Date(posts[i].date) + '';
  html += "
" + posts[i].message + "</blockquote";
  html += "

"
  containerEl.innerHTML += html;

As we can see, the HTML is being set in the DOM via innerHTML, which means that the script tag will not be executed, because per-specification, innerHTML does not execute scripts. More on why can be found on the Stack Overflow question script tag create with innerHTML of a div doesn't work.

  I've copied the whole html to a separate file on my computer, run the first case and the script fired!

Presumably you copied the resulting HTML which means it was not created by innerHTML, but permanently in the HTML source, so it ran.


What are the new risks of using hyperconvergent systems?

I disagree with @JulianKnight's comment there is a different set of risks introduced by the new converged infrastructure.  Last time we had converged infrastructure the network aspect of computing was in its early stages, and the main security issues were around privilege escalation.  We changed that in the '90s with the layered design: often with the frontend layer, application layer and database layer.

Now, the frontend layer is often the only one exposed to the external network.  Other layers are behind a NAT+firewall and, therefore, more-or-less protected.  Discounting firewall hole puncturing vulnerabilities, and ignoring passive fingerprinting for network mapping, we can say that the internal layers are bubbled inside a more-or-less safe haven.

This produces a lot of bad practice such as open, unauthenticated, database listeners.  For example, by assuming that the database servers are safe from the external world, system administrators drop the authentication between the application and database layers.  That gives a boost in performance but exposes the database to an attacker that can cross the firewall.

OK, but I haven't talked about converged infrastructure yet.  Our new trend (converged architecture/hyperconvergence) pushes all layers back into a single machine.  But we are not in the '80s or early '90s anymore, we are pushing all the infrastructure layers onto a machine that is heavily interconnected to the network and often visible from the internet.  I can see two huge implications:

1. The documentation for layered infrastructure is misleading

When configuring converged infrastructure and using documentation that was written with layered infrastructure in mind you may fall prey of false security.  There is a lot of documentation (blog posts, tutorials, even official manuals) that assumes that internal layers of infrastructure are protected by a firewall and make decisions based on that.

Leaving an unauthenticated database port open in the database layer behind a firewall is bad, but may be compensated by the performance increase.  Leaving the port open on a machine that is visible from the internet is outright terrible.

But is bad documentation a big risk?  For converged infrastructure it certainly is.  Most converged infrastructure is constructed in IaaS/PaaS/SaaS, which in turn are used by "quick-and-dirty" startups which often have inexperienced developers or developers that would blindly follow a guide to do things faster.

Solution?  Do not trust documentation, use your own common sense.  In other words, it requires developer conscientisation.

2. Privilege escalation is back to the front row

But not in the same form as before.  Before (during the golden time of priv escalation on first multiuser OSes) the privilege escalation needed to go through the quirks of the OS (e.g. overflowing a setuid program).  The difference is that now we are running machines that are heavily connected, including connections on the loopback interface.

Since we are running a converged infrastructure, where is the firewall running?  On the same machine.

This firewall will (very likely) be very permissive to any traffic on the loopback interface.  If you have a user with low privileges inside the machine he is still free to explore the loopback interface.  If you leave network based communications between what was previously the layers of the application to run on the loopback interface, any unprivileged user can play with it.  And look back at point 1 (misleading documentation) above to see why the communication between the pieces of infrastructure would be going through the loopback interface.

Solution?  Use shared memory to communicate between the infrastructure layers on the same machine (just like people did before the layered approach), shared memory has permissions set by the OS.


How does PHP's password_hash() BCRYPT cost factor translate into cracking computation times

As documented rather indirectly in the page for the crypt() function, the cost parameter is the base-2 logarithm of iteration count, or to put it another way, each +1 increase to cost represents a doubling of the number of iterations.

If a cost-10 hash takes one minute to crack, a cost-14 would take 2^(14-10) = 16 minutes.  Cracking a cryptographic hash like bcrypt consists of guessing what the password is, hashing it, and seeing if the hashes match, so the difficulty of cracking increases proportionately with the hashing time.  Just like increasing the cost by 1 doubles the hashing time, it doubles the effort involved in cracking the hash.


How to completely destroyed all data from an iPhone before reselling it?

Like many modern smartphones, the iPhone uses flash storage. A flash memory cell has a limited number of rewrite cycles. Two things make data shredding on flash storage difficult:

Wear balancing: the storage controller will automatically remap physical storage blocks to ensure that all storage cells are used equally. This also means that overwriting a file in place will actually rewrite the file in a different physical location before the storage controller remaps it to same virtual location.
Overcapacity: a flash memory device always has more physical storage than its advertised capacity. This extra space is used by the storage controller to replace bad blocks that have died so the end user won't see decreased capacity over the expected lifetime of the drive.

These things combined mean that overwriting the drive until it runs out of space is not guaranteed to wipe out all traces of your data from the drive. So it has become standard practice to use full disk encryption on flash storage, so that deleting flash storage can be done by simply removing the encryption key.

Assuming the encryption is solid, this should be a much more reliable way to delete all data in a flash storage device. Some users still overwrite as much data as possible by creating files until the disk is full, in case there's a vulnerability in the encryption or their encryption key was compromised. While this isn't necessary, you should do so if it eases your worry.


RedGrittyBrick is right.

Here's how it would work:

Keylogger is on host machine: even VM sessions will be keylogged.
Keylogger is on virtual machine: only VM will be keylogged unless it escapes the VM.
Keylogger is hardware-based: same as #1: everything can be captured, but this includes things even outside of the main operating system, as long as it's all going to the hardware. This means anything on your machine, including BIOS passwords, boot passwords, disk encryption, etc.


Should I close other programs as I pay bills?

The main risk you are wary about is "Cross Site Request Forgery". It used to be a big risk until most frameworks started including defenses against it using an anti-CSRF token / technique with/in their session cookies. There are a few other risks for which it won't matter whether tabs are open or not (HTTP-Only Cookies with Secure flag).

That's the theory. Your actual risk depends on whether your bank implements these security protections in their Internet Banking software.

Checking whether they use some of these is not too difficult (e.g., OWASP ZAP reports on the use of secure cookies). Yes, if you want to be sure, you could close other browser tabs. You should know that it would still leave out a few risks.


would the entire chain of them be eligible for A CVE or would each of
  the individual one be eligible?

Each CVE is intended to represent a single vulnerability.  Potential CVEs are more likely to be split up for finer granularity than merged.

The current guidance for this process is the Process to Correct Counting Issues, and the section on merging only describes using it to address "resolving multiple CVE IDs assigned to a single vulnerability".  A merge is not intended to describe a chain of vulnerabilities.


Is the data between a keyboard and a web browser secure from local computer applications?

No, your data is not safe from key loggers on a local computer. There isn't much more to say here, to be fair. A key logger will grab and save any key stroke entered. The tls (https) encryption happens "after" the driver from keyboard "sends" those key strokes to the browser, "through" the key logger.

Even if encryption is being used and there isn't one many types of spyware on the computer, the connection between the computer and site might have a Man in The Middle (MiTM) device in between which tricks your computer into thinking it's using encryption when it's not.

Good question. Yes, on a public kiosk you run the risk of credential harvesting. I can not think of anything that would bypass keylogging software (VPN will fix MiTM issues). Beware.


How to detect credit cards harvested from memory?

Once an attacker gains control of a computer, you cannot trust anything on that computer; inspecting the computer cannot tell you with certainty what happened or is happening.

Your best bet is to watch for the attacker's efforts to get data off of your network and onto a computer under his control.  Monitor outgoing connections at the firewall to see if there are any going to unusual locations; inspect outgoing data to see if it contains anything that looks like sensitive data.

You can also attempt to spot the attack by having the server send its log messages to a secure logging server and inspecting for things that look like an attack.  However, 1) there will be a lot of false positives, 2) a successful attack may not create a log entry, and 3) once the attack succeeds, further log entries cannot be trusted.  Don't expect this to be useful except possibly for post-incident analysis.


Checklist for configuring WinRM Security settings on servers

Here is an incomplete list of security-related items I discovered:

Be aware of new defaults

WinRM used to run on ports 80/443 in Vista and Longhorn.  That has changed to port "5985" and "5986" recognized by IANA as the new management ports (more info bottom of this page)

Helpful commands

The command winrm g winrm/config lists most of the WinRM configuration settings
Inbound listeners are shown here: winrm e winrm/config/listener

Configuration

Many MSFT support documents recommend running the command Winrm quickconfig, which creates a http listener.  A possible vulnerability is that your token is sent unencrypted on port 5985.  The alternative is to run: winrm quickconfig -transport:https.
Ensure that "EnableCompatibilityHttpListener" and its HTTPS counterpart is set to false on all servers, especially public facing web servers.
For machines in the DMZ, or multi-homed machines you may want to prevent a listener on certain interfaces and not others. See winrm help config for more info

Todo/research

The wording of this MSFT page indicates that client or server might downlevel negotiate to unencrypted traffic within the HTTP transport.  This creates room for a MITM to access credentials.  I'm looking into ways to ensure the client always uses SOAP encryption regardless of the transport being used.


I answered a similar question here.  For a normal hardware solution, a hardware security module (HSM) does this.  For software, .NET offers the Secure String mechanism to encrypt and protect sensitive data in RAM. Other platforms may offer something similar.  For an AWS solution, Amazon offers CloudHSM to do pretty much what you are asking for, I think.

From AWS:

  HSM is short for Hardware Security Module. It is a piece of hardware —
  a dedicated appliance that provides secure key storage and a set of
  cryptographic operations within a tamper-resistant enclosure. You can
  store your keys within an HSM and use them to encrypt and decrypt data
  while keeping them safe and sound and under your full control. You are
  the only one with access to the keys stored in an HSM.

  The AWS CloudHSM service brings the benefits of HSMs to the cloud. You
  retain full control of the keys and the cryptographic operations
  performed by the HSM(s) you create, including exclusive, single-tenant
  access to each one. Your cryptographic keys are protected by a
  tamper-resistant HSM that is designed to meet a number of
  international and US Government standards including NIST FIPS 140-2
  and Common Criteria EAL4+.


How can someone sniff dial-up connection using phone line?

If it is a PSTN line a simple tape recorder attached to the lines could do the trick.
For ISDN I suspect you need a DAC but its also easy, as long as you have physical access to the line.

Any connection using a Telephone line (digital or analogue) is easy to understand for anyone that knows the encoding schema. To realy protect it you should use the same techniques as being used between computers. There we ue an encription layer in between the physical line and the interpretation layer (a.k.a. between the telephone receiver and the physical telephone line)
The current default implementation for this is the TLS Protocol, this encrypts everything but the name of the intended 'destination' (so phone number and name)

Bottom Line, if you want to protect your physical line use a TLS connection.


How to set up the Tor browser on Linux Mint in a VM with a VPN on the Host

It depends upon how your VM is connected to the Internet. Generally there are two options: NAT or BRIDGED.

NAT will use whatever your Host is using, including a host VPN if present.

Bridged will set up a second native connection as if the host were not present.

In either case you want to "Just Connect".

Although there are a few reasons for tunneling Tor through a VPN, they all relate to locally hiding the fact that you are running Tor. It does not substantially add to security or anonymity over running Tor directly.


How can I tell if a PPTP tunnel is secure?

PPTP, by design had known vulnerabilities. Especially when comes to Windows based systems. Most of the known vulnerabilities were addressed but some of those still exist which will lead to attacks like DoS or information compromization. When considering Windows based systems, even MSChap v2. Microsoft's Point to Point Encryption quite weak strength (a maximum of 128 bits). You basically need to use EAP methods for strong protection.

Even though it provides authentication, encryption, and packet filtering, Other issues exist:

No protection for IP, GRE, and PPP header information (basically, protection issues for NCP PPP packets). Data  is secure but initial connection negotiations can be vulnerable if captured (during authentication).
Vulnerabilities like low defense against session hijacking, bit-flipping attacks etc.
If RC4 encryption has some weaknesses.

L2TP with IPSec (or any other with ssl/tls ipsec/ike) is recommended.

Penetration tools can be used to test but it is not an easy task for an end user. Basically tools developed for Linux with the intention of penetration testing (no single tool, combinations) can be used but the process does not suit for regular user.

User has the ability to check the security methods used in the connection. As an example, by opening the dial in properties and going to the Security Tab (Windows). Data Encryption should be "Maximum strength encryption(disconnect if server declines)". Authentication should be EAP-TLS, PEAP or Smart Cards. MSChapv2 is absolutely not recommended (least secure). Certificate based security it recommended. In order to check whether the DNS requests are secure, he/she can use online tools such as GRC. FYI: PPTP is not secure at all. Its outdated and can be cracked using nthash


Hydra does not read from STDIN. It's like ramming your hand in a hole that isn't a hole.


Is echoing GET parameters into a script tag reflected or DOM based XSS?

This is reflected XSS, not DOM-based XSS.

The difference is subtle, but here are the key sentences.

OWASP - DOM Based XSS

  the page itself (the HTTP response that is) does not change, but the client side code contained in the page executes differently due to the malicious modifications that have occurred in the DOM environment.

A classic example:

Current URL:

Payload URL:

http://example.com/page.html#

See how the payload is not found in the page source itself, but created from the browsers URL.

OWASP - Testing for Reflected Cross site scripting (OTG-INPVAL-001)

  Reflected Cross-site Scripting (XSS) occur when an attacker injects browser executable code within a single HTTP response. [...] The attack string is included as part of the crafted URI or HTTP parameters, improperly processed by the application, and returned to the victim.

A classic example:

Current URL: <?php echo $_SERVER['REQUEST_URI']; ?>

Payload URL:

http://example.com/page.php?

See how the payload is in the page source itself, but from the URL passed to the PHP script.


No, there isn't any log on the satellite - it's just broadcasting a time signal and an identifier. Anyone can pick it up - think of it as being like a radio broadcast.

Phone location, as in how police track a specific phone, doesn't work using GPS directly. A limited amount of location data can be obtained by looking at which cell tower the phone is connected to. The range that this provides varies in relation to the cell size - in dense areas, like cities, it gives a more precise location than in sparse coverage areas, like lightly populated rural regions. If the phone has an internet connection, you can also plot location with some accuracy from the WiFi access points which can be seen (especially in countries with regular Google maps updates). If the internet connection is off, that probably won't work, but it might be possible to identify locations which have been visited at a later point, when internet connectivity is restored. It would depend on the specific applications on the phone.


One time password over SMS - exposing the Authentication Server to the internet

In a situation like this, all you need is a firewall. You should certainly not have a DMZ, and have no need for a proxy, but simply a firewall.

As with all your machines, the webserver should only be accessible on ports which are intended to be public-facing. The authentication server can be allowed only to egress packets on the SMS protocol, whatever that may be.

So your firewall set up would look something like:

NEW INGRESS:
* -> webserver:http   ALLOW
* -> webserver:https  ALLOW
* -> *                DROP

NEW EGRESS:
auth -> smshost:sms   ALLOW
*    -> *             DROP

ESTABLISHED:
* -> *                ALLOW


how to trace or get evidence you've been hacked

Your first priority: repression. Make sure that your security is tight and no more information is leaked.

Second priority: repair. Don't try to fight the criminal yourself. Go to the police and report a crime. Most police forces have a digital forensic team that can do the things needed. Let's just hope that they have the time/resources/priority to look into your case.


How does nmap do a zombie and decoy scan?

The basic idea of a Zombie or Idle scan is to send source-spoofed packets to the target, then observe some state change in the TCP/IP stack of the machine with the spoofed source address. The original method, discovered in 1998, used the IP ID field to observe the state.

Nmap's -sI Idle Scan is a good implementation that is able to query the Zombie/Idle host to determine its algorithm for incrementing the IP ID field; in some cases, it increments by 2 or by 256. It is up to the user to choose an appropriate Zombie host. By performing a scan with the -O (OS fingerprinting) and -v (verbose) flags, the user can find machines which have an incremental IP ID sequence, then target them with Nping or another packet crafting tool to identify those that are not experiencing a lot of traffic. The "Idle" part of the scan means that the Zombie must be mostly idle (not communicating with other hosts) in order for the scan to work. Finally, the scan is conducted using a command like you posted: nmap -Pn -sI zombieIP targetIP

The technique goes something like this:

Nmap probes the Zombie to determine its IP ID sequence class and the current value it is using.
Nmap then sends TCP SYN packets to various ports on the target, but spoofs the source address to be that of the Zombie.
During the scan, Nmap continually probes the Zombie to find out how many packets it has sent. Expecting one packet per probe, if it finds that two packets have been sent, it can assume that the other one was a RST packet in response to the target's SYN/ACK, indicating an open port.

In version 6.45, Nmap added the ability to do Idle scans over IPv6. The technique is similar, but uses the IPv6 Fragmentation ID field instead. The technique was discovered by Mathias Morbitzer, and will be available in the next release of Nmap.

Decoy scans are a much-less-interesting technique. All packets originate from your scanning machine, but some have spoofed source addresses. Any replies to these spoofed sources will not arrive at your scanner, so they cannot be used to determine port states. This technique only serves to confuse port scan detection, and does not offer any information beyond a regular scan.


Access Control and Authentication using Facebook access tokens in a webapp

You probably want to look at OAuth implementations.  This would not only allow you to use Facebook, but many other account providers for the login.  It is also an established mechanism for using third party accounts for authentication.


What is technically different from iPhone/iOS to Android phones when it comes to data privacy?

Apple has an extensive description of the security features in iOS devices in a white paper titled iOS Security Guide. (There's also a similar, shorter macOS Security Overview if you're curious about their computers.)

Some of the key points made in this document are that:

iOS verifies the authenticity of the operating system during the boot and update process, ensuring that the operating system has not been tampered with.
User data stored on iOS devices is encrypted using keys which are both specific to the device and to the user's passcode.
Application review and signing processes, as well as application sandboxing, make it difficult for malicious applications to be installed on a device, and prevent applications from accessing data in unauthorized ways.

I'm not aware of an analogous document describing Android's security features. Some of the security features of iOS depend on hardware capabilities of the Apple SoC (in particular, for data encryption) which may not be available on some Android devices.


Is it a security threat to have food or drink next to computers

I think you've been watching too many movies.

Food and drink are not security threats. That being said, it's not really appropriate to be leaving cups of coffee or bottles of water on top of critical systems, for obvious reasons.


Why does openSUSE sporadically prompt during boot to trust its built-in certificate?

This is related to UEFI boot security. According to the OpenSUSE wiki, this should happen at first boot:

For the very first time of loading openSUSE 'shim', it asks the user
if the openSUSE certificate built in 'shim' is trusted to verify grub2
and linux kernels.

So this should happen only once. There was a recent security bug regarding UEFI boot security that may have triggered a refresh of the shim; this might have caused the message.


No. The traffic is tunnelled through ToR, so it is just as untraceable as any other use of ToR. In practice you are not traceable at all, unless you make some silly mistake like including your real name in a request.


Configuring socat to pentest an IPv6-only remote web server from an IPv4 host

You literally have to put the brackets in there, i.e.,

socat TCP-LISTEN:8080,reuseaddr,fork TCP6:[fdf3:f0c0:2567:7fe4:a00:27ff:fe74:ddaa]:80

As seen in the excellent work by ERNW in this PDF here --https://www.ernw.de/download/newsletter/ERNW_Newsletter_45_PenTesting_Tools_that_Support_IPv6_v.1.1_en.pdf

They also make mention to the Chiron tool, which allows further proxying. A few books make mention to Relay6, 6tunnel, nt6tunnel, and asybo as other tools that allow for IPv4-to-IPv6 proxying.


SSH Keybased authentication using Nitrokey

I have a feeling that upon exporting my key it somehow got added to my local key storage making the NitroKey redundant but I am not knowledgable enough about the exact workings to be sure.

If that was done properly, it should not be possible. If the private key is stored in the "smartcard", it should not be exportable and for every private key operation, you need that card.

I don't have NitroKey and I am not knowledgeable about the nitrokey applications internals so few commands that should bring some more light:

Post devbug log of your connection using the key stored on the cards: ssh -vvv server
How does the ssh-add -L look like?
Can you see the keys in the "smartcard" when running pkcs11-tool --login -O --module /path/to/usr/lib64/pkcs11/opensc-pkcs11.so


Using a WebView makes a lot of sense.

You have to be connected to the Internet anyhow.
Performance is not an issue.
There's lots of already written and well tested web-based payment processors.
Many people (and you specifically) already have a web-based payment processor in place for non-mobile uses.
More secure since as much as possible is on your servers rather than in the client.
Apple less likely to demand you use the built-in payment systems (with their cut).

PCI is not really optional, so if someone has a working business based on payment from iPhone via WebView then it's going to be possible to meet PCI.


Is it secure if I only encrypt a small part of a file

That fully depends on the contents of the file. If this is encrypted text where the key for decryption is placed at the beginning of the file it might be enough to encrypt only this information since it is essential to interpret the rest of the data. But in most other cases it would probably be a bad idea to encrypt only a part.

For example imagine that this is a document containing passwords in plain text. In this case it is obvious that encrypting only part of it would be a bad idea because it would only protect a small number of passwords and leave the rest exposed. But also with most video or audio files it is possible to recover the majority of the content even if some parts are corrupt (or encrypted).


Is allowing public access to a DNS server, a security threat?

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

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

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

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