aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2009-01-06 21:26:37 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2009-01-06 21:26:37 +0000
commite63da62e4819a6c5c79aae258bd9f76fdd14ca16 (patch)
tree31410a1976eba7ed7d1103b30287a13ea422ab91
parent96915cfe0e02808f0a97c8723f310f357615915b (diff)
Security fix AST-2009-001
git-svn-id: http://svn.digium.com/svn/asterisk/tags/1.4.22.1@167280 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--.version2
-rw-r--r--ChangeLog6
-rw-r--r--channels/chan_iax2.c20
3 files changed, 23 insertions, 5 deletions
diff --git a/.version b/.version
index d6e261679..688a210c4 100644
--- a/.version
+++ b/.version
@@ -1 +1 @@
-1.4.22
+1.4.22.1
diff --git a/ChangeLog b/ChangeLog
index ddbce9be8..d6f1569d4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-01-06 Tilghman Lesher <tlesher@digium.com>
+
+ * Asterisk 1.4.22.1 released.
+
+ * channels/chan_iax2.c: Security fix AST-2009-01
+
2008-10-01 Russell Bryant <russell@digium.com>
* Asterisk 1.4.22 released.
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index 5d83f6280..67177b13e 100644
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -155,6 +155,7 @@ static int trunkfreq = 20;
static int authdebug = 1;
static int autokill = 0;
static int iaxcompat = 0;
+static int last_authmethod = 0;
static int iaxdefaultdpcache=10 * 60; /* Cache dialplan entries for 10 minutes by default */
@@ -6309,23 +6310,34 @@ static int registry_authrequest(int callno)
char challenge[10];
const char *peer_name;
int res = -1;
+ int sentauthmethod;
peer_name = ast_strdupa(iaxs[callno]->peer);
/* SLD: third call to find_peer in registration */
ast_mutex_unlock(&iaxsl[callno]);
- p = find_peer(peer_name, 1);
+ if (p = find_peer(peer_name, 1)) {
+ last_authmethod = p->authmethods;
+ }
+
ast_mutex_lock(&iaxsl[callno]);
if (!iaxs[callno])
goto return_unref;
- if (!p) {
+ if (!p && !delayreject) {
ast_log(LOG_WARNING, "No such peer '%s'\n", peer_name);
goto return_unref;
}
memset(&ied, 0, sizeof(ied));
- iax_ie_append_short(&ied, IAX_IE_AUTHMETHODS, p->authmethods);
- if (p->authmethods & (IAX_AUTH_RSA | IAX_AUTH_MD5)) {
+ /* The selection of which delayed reject is sent may leak information,
+ * if it sets a static response. For example, if a host is known to only
+ * use MD5 authentication, then an RSA response would indicate that the
+ * peer does not exist, and vice-versa.
+ * Therefore, we use whatever the last peer used (which may vary over the
+ * course of a server, which should leak minimal information). */
+ sentauthmethod = p ? p->authmethods : last_authmethod ? last_authmethod : (IAX_AUTH_MD5 | IAX_AUTH_PLAINTEXT);
+ iax_ie_append_short(&ied, IAX_IE_AUTHMETHODS, sentauthmethod);
+ if (sentauthmethod & (IAX_AUTH_RSA | IAX_AUTH_MD5)) {
/* Build the challenge */
snprintf(challenge, sizeof(challenge), "%d", (int)ast_random());
ast_string_field_set(iaxs[callno], challenge, challenge);