View Issue Details

IDProjectCategoryView StatusLast Update
0001639SOGoWeb Generalpublic2013-08-09 15:58
Reporterdab1818 Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionwon't fix 
Summary0001639: in SOGo-Apache proxy configuration private data may be accessed trough http://127.0.0.1:20000/SOGo...
Description

using curl, wget & etc... from localhost with manually specified headers x-webobjects-remote-user private user data may be accessed:

curl -v -H "x-webobjects-remote-user: bigboss" http://localhost:20000/SOGo/dav/bigboss/Calendar/personal.ics

Additional Information

with attached patch SOGo uses SOGoAuthenticationType value as secret and compare it with x-webobjects-auth-secret HTTP-header passed by apache.

SOGo configuration (must be accessed by 'sogo' user only):
defaults write sogod SOGoAuthenticationType "topsecret"

Apache configuration (SOGo-Apache.include must be accessed by 'root' user only):
<Proxy http://127.0.0.1:20000/SOGo>
...
RequestHeader set "x-webobjects-auth-secret" "topsecret"

TagsNo tags attached.

Activities

2012-02-17 11:44

 

proxy_auth_secret.patch (1,287 bytes)   
--- SOGo-1.3.9/SoObjects/SOGo/SOGoProxyAuthenticator.m.orig	2011-10-29 22:31:30.000000000 +0400
+++ SOGo-1.3.9/SoObjects/SOGo/SOGoProxyAuthenticator.m	2011-11-18 15:37:17.000000000 +0400
@@ -32,6 +32,7 @@
 #import <NGExtensions/NSObject+Logs.h>
 
 #import "SOGoPermissions.h"
+#import "SOGoSystemDefaults.h"
 #import "SOGoUser.h"
 
 #import "SOGoProxyAuthenticator.h"
@@ -59,10 +60,21 @@
 - (NSString *) checkCredentialsInContext: (WOContext *) context
 {
   NSString *remoteUser;
+  NSString *authSecret;
+  SOGoSystemDefaults *sd;
 
-  /* If such a header is not provided by the proxy, SOPE will attempt to
-     deduce it from the "Authorization" header. */
-  remoteUser = [[context request] headerForKey: @"x-webobjects-remote-user"];
+  sd = [SOGoSystemDefaults sharedSystemDefaults];
+  authSecret = [[context request] headerForKey: @"x-webobjects-auth-secret"];
+  remoteUser = nil;
+
+  if ([[sd authenticationType] isEqualToString: authSecret])
+    {
+    /* If such a header is not provided by the proxy, SOPE will attempt to
+       deduce it from the "Authorization" header. */
+    remoteUser = [[context request] headerForKey: @"x-webobjects-remote-user"];
+    }
+  else
+    [self errorWithFormat: @"invalid x-webobjects-auth-secret value"];
 
   return remoteUser;
 }
proxy_auth_secret.patch (1,287 bytes)   
ludovic

ludovic

2012-02-17 16:22

reporter   ~0003456

What values for SOGoAuthenticationType, SOGoDAVAuthenticationType and SOGoTrustProxyAuthentication were you using BEFORE making that change?

If you set SOGoTrustProxyAuthentication to YES, you'll have the issue you mention. Otherwise, it'll just work - see my example:

sogo:~/src/SOGo# curl -v -H "x-webobjects-remote-user: lmarcotte" http://localhost:30000/SOGo/dav/lmarcotte/Calendar/personal.ics

  • About to connect() to localhost port 30000 (#0)
  • Trying 127.0.0.1... connected
  • Connected to localhost (127.0.0.1) port 30000 (#0)

    GET /SOGo/dav/lmarcotte/Calendar/personal.ics HTTP/1.1
    User-Agent: curl/7.19.7 (powerpc-unknown-linux-gnu) libcurl/7.21.1 OpenSSL/0.9.8o zlib/1.2.3.4 libidn/1.18 libssh2/1.2.6
    Host: localhost:30000
    Accept: /
    x-webobjects-remote-user: lmarcotte

    < HTTP/1.1 401 Authorization Required
    < www-authenticate: basic realm="SOGo"
    < sogo-request-duration: 0.022878
    < content-length: 0
    < content-type: text/plain
    <

  • Connection #0 to host localhost left intact
  • Closing connection #0
wsourdeau

wsourdeau

2012-02-17 16:23

viewer   ~0003457

That is a loose solution. If your apache or SOGo conf is readable by other users, they will have access to your "auth" secret.

If you want to use SOGo with "SOGoTrustProxyAuthentication", you need to take the additional steps to secure your installation. The value says it clearly: you "Trust" any authentication. This is a feature, not a bug.

dab1818

dab1818

2012-02-20 06:02

reporter   ~0003463

yes. i'm using SOGoTrustProxyAuthentication=YES with x509 certificates on apache
and need to secure localhost communication between apache and SOGo.

SOGo configuration must be accessed by 'sogo' user only (mysql passwords&etc.).

on apache side config protected by:
chown root:root SOGo-Apache.include && chmod 0400 SOGo-Apache.include
apache on start read config as 'root'.
or more transparency method:
put 'RequestHeader set "x-webobjects-auth-secret" "topsecret"' in separete file SOGo-secret.include and 'Include SOGo-secret.include' in OGo-Apache.include, then
chown root:root SOGo-secret.include && chmod 0400 SOGo-secret.include

ludovic

ludovic

2013-08-09 15:58

reporter   ~0005861

I see very little value in this. It complexifies the whole configuration and as mentioned, if SOGo trusts authentication, well it trusts it.

Issue History

Date Modified Username Field Change
2012-02-17 11:44 dab1818 New Issue
2012-02-17 11:44 dab1818 File Added: proxy_auth_secret.patch
2012-02-17 16:22 ludovic Note Added: 0003456
2012-02-17 16:23 wsourdeau Note Added: 0003457
2012-02-20 06:02 dab1818 Note Added: 0003463
2013-08-09 15:58 ludovic Note Added: 0005861
2013-08-09 15:58 ludovic Status new => closed
2013-08-09 15:58 ludovic Resolution open => won't fix