Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
Openfire
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Openfire
Commits
ce87ab79
Commit
ce87ab79
authored
Mar 23, 2016
by
Dave Cridland
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OF-941 CVE-2015-7707 Add CSRF to user-edit-form
parent
20174b68
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
0 deletions
+16
-0
user-edit-form.jsp
src/web/user-edit-form.jsp
+16
-0
No files found.
src/web/user-edit-form.jsp
View file @
ce87ab79
...
...
@@ -19,6 +19,7 @@
<%@ page
import=
"org.jivesoftware.util.ParamUtils,
org.jivesoftware.util.StringUtils,
org.jivesoftware.util.CookieUtils,
org.jivesoftware.openfire.user.*,
java.net.URLEncoder"
errorPage=
"error.jsp"
...
...
@@ -42,6 +43,8 @@
String
email
=
ParamUtils
.
getParameter
(
request
,
"email"
);
boolean
isAdmin
=
ParamUtils
.
getBooleanParameter
(
request
,
"isadmin"
);
Map
<
String
,
String
>
errors
=
new
HashMap
<
String
,
String
>
();
Cookie
csrfCookie
=
CookieUtils
.
getCookie
(
request
,
"csrf"
);
String
csrfParam
=
ParamUtils
.
getParameter
(
request
,
"csrf"
);
// Handle a cancel
if
(
request
.
getParameter
(
"cancel"
)
!=
null
)
{
...
...
@@ -49,6 +52,13 @@
return
;
}
if
(
save
)
{
if
(
csrfCookie
==
null
||
csrfParam
==
null
||
!
csrfCookie
.
getValue
().
equals
(
csrfParam
))
{
save
=
false
;
errors
.
put
(
"csrf"
,
"CSRF Failure"
);
}
}
// Load the user object
User
user
=
webManager
.
getUserManager
().
getUser
(
username
);
...
...
@@ -91,6 +101,9 @@
return
;
}
}
csrfParam
=
StringUtils
.
randomString
(
15
);
CookieUtils
.
setCookie
(
request
,
response
,
"csrf"
,
csrfParam
,
-
1
);
%>
<html>
...
...
@@ -113,6 +126,8 @@
<fmt:message
key=
"user.create.invalid_name"
/>
<%
}
else
if
(
errors
.
get
(
"email"
)
!=
null
)
{
%>
<fmt:message
key=
"user.create.invalid_email"
/>
<%
}
else
if
(
errors
.
get
(
"csrf"
)
!=
null
)
{
%>
CSRF Failure!
<%
}
%>
</td>
</tr>
...
...
@@ -142,6 +157,7 @@
<form
action=
"user-edit-form.jsp"
>
<input
type=
"hidden"
name=
"csrf"
value=
"
<%=
StringUtils
.
escapeForXML
(
csrfParam
)
%>
"
>
<input
type=
"hidden"
name=
"username"
value=
"
<%=
StringUtils
.
escapeForXML
(
username
)
%>
"
>
<input
type=
"hidden"
name=
"save"
value=
"true"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment