Skip to content

Commit 335aac1

Browse files
author
jrivard@gmail.com
committed
fix xss in captcha-skip-param field
1 parent b202f31 commit 335aac1

File tree

7 files changed

+8
-5
lines changed

7 files changed

+8
-5
lines changed

server/src/main/java/password/pwm/bean/LocalSessionStateBean.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ public class LocalSessionStateBean implements Serializable
6666

6767
private boolean passwordModified;
6868
private boolean privateUrlAccessed;
69+
private boolean captchaBypassedViaParameter;
6970

7071
private final AtomicInteger intruderAttempts = new AtomicInteger( 0 );
7172
private final AtomicInteger requestCount = new AtomicInteger( 0 );

server/src/main/java/password/pwm/util/CaptchaUtility.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,13 +331,20 @@ public static void prepareCaptchaDisplay( final PwmRequest pwmRequest ) throws S
331331
private static boolean checkIfCaptchaParamPresent( final PwmRequest pwmRequest )
332332
throws PwmUnrecoverableException
333333
{
334+
if ( pwmRequest.getPwmSession().getSessionStateBean().isCaptchaBypassedViaParameter() )
335+
{
336+
LOGGER.trace( pwmRequest, () -> "valid skipCaptcha value previously received in session, skipping captcha check" );
337+
return true;
338+
}
339+
334340
final String skipCaptcha = pwmRequest.readParameterAsString( PwmConstants.PARAM_SKIP_CAPTCHA );
335341
if ( skipCaptcha != null && skipCaptcha.length() > 0 )
336342
{
337343
final String configValue = pwmRequest.getConfig().readSettingAsString( PwmSetting.CAPTCHA_SKIP_PARAM );
338344
if ( configValue != null && configValue.equals( skipCaptcha ) )
339345
{
340346
LOGGER.trace( pwmRequest, () -> "valid skipCaptcha value in request, skipping captcha check for this session" );
347+
pwmRequest.getPwmSession().getSessionStateBean().setCaptchaBypassedViaParameter( true );
341348
return true;
342349
}
343350
else

webapp/src/main/webapp/WEB-INF/jsp/activateuser.jsp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
<input type="hidden" name="processAction" value="activate"/>
5151
<%@ include file="/WEB-INF/jsp/fragment/cancel-button.jsp" %>
5252
<input type="hidden" name="pwmFormID" value="<pwm:FormID/>"/>
53-
<input type="hidden" name="skipCaptcha" value="${param.skipCaptcha}"/>
5453
</div>
5554
</form>
5655
</div>

webapp/src/main/webapp/WEB-INF/jsp/forgottenpassword-search.jsp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@
5858
</button>
5959
</pwm:if>
6060
<input type="hidden" name="pwmFormID" value="<pwm:FormID/>"/>
61-
<input type="hidden" name="skipCaptcha" value="${param.skipCaptcha}"/>
6261
</div>
6362
</form>
6463
</div>

webapp/src/main/webapp/WEB-INF/jsp/forgottenusername-search.jsp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
</button>
5252
<%@ include file="/WEB-INF/jsp/fragment/cancel-button.jsp" %>
5353
<input type="hidden" name="pwmFormID" value="<pwm:FormID/>"/>
54-
<input type="hidden" name="skipCaptcha" value="${param.skipCaptcha}"/>
5554
</div>
5655
</form>
5756
</div>

webapp/src/main/webapp/WEB-INF/jsp/login.jsp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@
7171
<%@ include file="/WEB-INF/jsp/fragment/cancel-button.jsp" %>
7272
</pwm:if>
7373
<input type="hidden" id="pwmFormID" name="pwmFormID" value="<pwm:FormID/>"/>
74-
<input type="hidden" name="skipCaptcha" value="${param.skipCaptcha}"/>
7574
</div>
7675
</div>
7776
</form>

webapp/src/main/webapp/WEB-INF/jsp/newuser.jsp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@
5454
<pwm:display key="Button_Continue"/>
5555
</button>
5656
<input type="hidden" name="pwmFormID" value="<pwm:FormID/>"/>
57-
<input type="hidden" name="skipCaptcha" value="${param.skipCaptcha}"/>
5857

5958
<% if ((Boolean)JspUtility.getAttribute(pageContext, PwmRequestAttribute.NewUser_FormShowBackButton)) { %>
6059
<button type="button" id="button-goBack" name="button-goBack" class="btn" >

0 commit comments

Comments
 (0)