svn commit: r228384 - head/contrib/openpam/lib
Dag-Erling Smorgrav
des at FreeBSD.org
Sat Dec 10 01:44:24 UTC 2011
Author: des
Date: Sat Dec 10 01:44:24 2011
New Revision: 228384
URL: http://svn.freebsd.org/changeset/base/228384
Log:
Add minimal validation of the service name to fend off at least one
attack vector against applications that allow the applicant to specify
which policy to apply.
Submitted by: Matthias Drochner <drochner at netbsd.org>
MFC after: 1 week
Modified:
head/contrib/openpam/lib/openpam_configure.c
Modified: head/contrib/openpam/lib/openpam_configure.c
==============================================================================
--- head/contrib/openpam/lib/openpam_configure.c Sat Dec 10 01:01:44 2011 (r228383)
+++ head/contrib/openpam/lib/openpam_configure.c Sat Dec 10 01:44:24 2011 (r228384)
@@ -285,6 +285,13 @@ openpam_load_chain(pam_handle_t *pamh,
size_t len;
int r;
+ /* don't allow to escape from policy_path */
+ if (strchr(service, '/')) {
+ openpam_log(PAM_LOG_ERROR, "invalid service name: %s",
+ service);
+ return (-PAM_SYSTEM_ERR);
+ }
+
for (path = openpam_policy_path; *path != NULL; ++path) {
len = strlen(*path);
if ((*path)[len - 1] == '/') {
More information about the svn-src-head
mailing list