Re: HTTP/2 DoS issues announced today - Impact for Apache Tomcat

2019-08-14 Thread tomcat

On 13.08.2019 19:48, Mark Thomas wrote:

Today Netflix has published a report highlighting various potential DoS
attacks against HTTP/2 implementations [1].

No immediate action is required for Tomcat users since none of the
described attacks result in a DoS with Apache Tomcat.

The Tomcat Security Team has reviewed the impact on Tomcat of each of
these attacks. The load generated by the attacks is comparable to the
load generated by a similar amount of valid client traffic. Therefore,
these requests are not viewed as a DoS by the Tomcat Security Team. We
did look a little harder at the CVE-2019-9513 "Resource Loop" attack as
came closest to exceeding the load generated by valid traffic.

While we do not consider the described attacks to represent a DoS for
Apache Tomcat, they do all represent abusive client behaviour. In
response to these reports we will be expanding the overhead protection
already in place to detect these abusive behaviours and to close the
connection when they are detected.

The expanded overhead detection will be configurable, including the
option to disable it. The configuration will be provided with what we
consider to be reasonable defaults although there is the possibility
that these defaults will be adjusted based on user feedback in future
versions.

This additional protection will be in the next releases of 9.0.x and
8.5.x, currently expected to be 9.0.23 and 8.5.44. The release process
for these versions is expected to start later today.

Mark
on behalf of the Tomcat Security Team



Hi.

I believe that any sysadmin responsible for several webservers open to the Internet would 
agree with me, that such attacks are quite common, and extremely annoying to say the very 
least; and that any of these same sysadmins has already had many undisclosable wishes 
regarding the ultimate fate of the perpetrators. And I believe that many of them are quite 
annoyed by the fact that so far, the only defense has seemed to be to install additional 
patches, and to present the other cheek.


This was just some background for the suggestion which follows.
It is in fact not an alternative solution, but only an amendment (or an augmentation), to 
the scheme proposed above. Here it goes..


Instead of just closing the connection when malicious behaviour is detected, would it not 
be more effective, in the long run, to provide a (optional) way to keep this connection 
open for some variable and adjustable time (without doing anything resource-intensive, but 
ignoring what the attacker may be sending on it), in order to use up the resources of the 
attacker, for a change ?
Whoever wanted to indeed close the connection right away, could set up his server to do 
just that. But whoever wanted to participate to the collective self-defense scheme which 
is suggested here, would also be able to do that.


I mention collective self-defense, because I am convinced that if such a scheme was 
somewhat widely adopted, it would quickly become uneconomical for perpetrators in general 
to even try their schemes. After all, any DoS (or other similar) attack on a webserver, 
requires an agent, which itself uses resources and thus has a cost. If such an agent can 
quickly determine that its attack doesn't work (as when its connection is immediately 
closed), it can just as quickly move on to the next target and start annoying someone 
else. But if the target reacts in such a way that the agent cannot determine if this is 
just a normal server-busy/network delay or "the scheme", then it cannot move on, and has 
to continue using up its own resources on the current target (ultimately to no avail, but 
that is just the point); which means that to attack a similar number of targets, an 
attacker ultimately has to put more and more resources in play. That's the economic 
argument (*).


Some random delay, with inferior and superior adjustable limits, might just do 
that.
To be most effective, this should be the default tomcat configuration, with possibility 
for the sysadmin to disable it for edge cases (or just because they are unbelievers).
As people update their tomcats over time, it should be so that at some point, the 
worldwide percentage population of tomcat servers applying this form of defense would 
render it uneconomical for potential attackers to target them, leading to the population 
of perpetrators itself to decline.  Which would be a universal benefit not only to tomcat 
admins, but to webserver admins in general. So it would act a bit like a vaccine..

That might be worth an IgNobel prize, wouldn't it ?

I am leaving the implementation details to my colleagues here who can really program Java 
and Tomcat..


Having proposed a similar scheme to the Apache httpd list a few years ago (unsuccesfully, 
I must admit), I am quite familiar with some of the counter-arguments. I'm curious to see 
if the same ones occur here and now.


(*) The basic observation is : if the average server closes t

Signing WAR files

2012-01-19 Thread Tomcat Mailing List
Hi,

I added the feature to sign a war file, sothat the war file containing classes 
can run in a security manager.
As already explained I can.t put my signed code in a jar in the lib file but 
have to have it under /classes.

Now I.d like to commit this change back to the community. 
My changes are for Tomcat 7.0.23

Suggestion for Patch:
java/org/apache/catalina/loader/WebappClassLoader.java

change
if (jarEntry != null) {
entry.certificates = jarEntry.getCertificates();
}

to

if (jarEntry != null) {
entry.certificates = jarEntry.getCertificates();
}
else {
JarEntry jEntry=null;
JarFile wFile=null;
try {
   wFile = new 
JarFile(org.apache.naming.resources.WARDirContext.getCurrentPath());
} catch (Exception e) {
}

if (wFile != null) {

try {
jEntry = 
wFile.getJarEntry(current_full_path.substring(1));
InputStream is = 
wFile.getInputStream(jEntry);
int n;
byte[] buffer = new byte[8192];
while ((n = is.read(buffer, 0, 
buffer.length)) != -1) {
}

   if (jEntry != null) {

entry.certificates=jEntry.getCertificates();
}
} catch (Exception exc) {
log.info(Could not read certificates 
from war.);
}
}
}



./java/org/apache/naming/resources/WARDirContext.java
change 
protected ZipFile base = null;
to
protected static ZipFile base = null;

and add the following function:
public static String getCurrentPath() {
if (base != null)
return base.getName();
else
return null;
}

Perhaps there is a much better way for getting the filename of the war file . 
any suggestions? The change to a static variable is only required to get the 
name of the war file that the class file is read from. 

Thanks,
Thomas

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org