Skip to content

Instantly share code, notes, and snippets.

@conikeec
Created December 17, 2019 06:39
Show Gist options
  • Save conikeec/828ddb72f4d1689e71bdff6e04d35bed to your computer and use it in GitHub Desktop.
Save conikeec/828ddb72f4d1689e71bdff6e04d35bed to your computer and use it in GitHub Desktop.
GitHub's reset password flaw emulatiton
git clone [email protected]:conikeec/spring-security-registration.git
cd spring-security-registration
//compile and create package artifact
mvn -Dmaven.test.skip=true clean package
// Download trial distribution of Ocular (https://ocular.shiftleft.io). Install and thereafter fire up the prompt to commence investigation
./ocular.sh
createCpgAndSp("/Users/chetanconikee/pgithub/spring-security-registration/target/spring-security-login-and-registration.war")
//retrieve controller mapped to resetPassword route
case class RouteMapping(routeName : String, backingController : String)
val attackSurface = cpg.annotation.name("RequestMapping").map(x =>
RouteMapping(x.start.parameterAssign.value.code.l.head, x.start.method.fullName.l.head)
).l
//output
attackSurface: List[RouteMapping] = List(
RouteMapping(
"[\"/user/updatePassword\"]",
"org.baeldung.web.controller.RegistrationController.changeUserPassword:org.baeldung.web.util.GenericResponse(java.util.Locale,org.baeldung.web.dto.PasswordDto)"
),
RouteMapping(
"[\"/user/changePassword\"]",
"org.baeldung.web.controller.RegistrationController.showChangePasswordPage:java.lang.String(java.util.Locale,org.springframework.ui.Model,long,java.lang.String)"
),
RouteMapping(
"[\"/registrationConfirm\"]",
"org.baeldung.web.controller.RegistrationController.confirmRegistration:java.lang.String(javax.servlet.http.HttpServletRequest,org.springframework.ui.Model,java.lang.String)"
),
RouteMapping(
"[\"/loggedUsersFromSessionRegistry\"]",
"org.baeldung.web.controller.UserController.getLoggedUsersFromSessionRegistry:java.lang.String(java.util.Locale,org.springframework.ui.Model)"
),
RouteMapping(
"[\"/user/resendRegistrationToken\"]",
"org.baeldung.web.controller.RegistrationController.resendRegistrationToken:org.baeldung.web.util.GenericResponse(javax.servlet.http.HttpServletRequest,java.lang.String)"
),
RouteMapping(
"[\"/loggedUsers\"]",
"org.baeldung.web.controller.UserController.getLoggedUsers:java.lang.String(java.util.Locale,org.springframework.ui.Model)"
),
RouteMapping(
"[\"/user/resetPassword\"]",
"org.baeldung.web.controller.RegistrationController.resetPassword:org.baeldung.web.util.GenericResponse(javax.servlet.http.HttpServletRequest,java.lang.String)"
),
RouteMapping(
"[\"/user/registrationCaptcha\"]",
"org.baeldung.web.controller.RegistrationCaptchaController.captchaRegisterUserAccount:org.baeldung.web.util.GenericResponse(org.baeldung.web.dto.UserDto,javax.servlet.http.HttpServletRequest)"
),
RouteMapping(
"[\"/user/savePassword\"]",
"org.baeldung.web.controller.RegistrationController.savePassword:org.baeldung.web.util.GenericResponse(java.util.Locale,org.baeldung.web.dto.PasswordDto)"
),
RouteMapping(
"[\"/user/registration\"]",
"org.baeldung.web.controller.RegistrationController.registerUserAccount:org.baeldung.web.util.GenericResponse(org.baeldung.web.dto.UserDto,javax.servlet.http.HttpServletRequest)"
),
RouteMapping(
"[\"/user/update/2fa\"]",
"org.baeldung.web.controller.RegistrationController.modifyUser2FA:org.baeldung.web.util.GenericResponse(boolean)"
),
RouteMapping(
"[\"/user/resetPasswordBad\"]",
"org.baeldung.web.controller.RegistrationController.resetPasswordBad:org.baeldung.web.util.GenericResponse(javax.servlet.http.HttpServletRequest,java.lang.String)"
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment