Created
August 10, 2013 16:55
-
-
Save wilfrem/6201158 to your computer and use it in GitHub Desktop.
ServiceStackのAuthPlugin(AuthFeature)でうっかりオープンリダイレクタ脆弱性を作らないようにする方法
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AuthPluginは/authがContinueパラメータを受け取り、認証後はContinueパラメータで指定されたURLにリダイレクトする設計になっています | |
そして、Continueはホストも含めたフルURLを指定するため、オープンリダイレクタになってしまう危険性があります | |
対処法としては | |
AuthServiceクラスはstaticプロパティとしてValidateFnを持っており、これにdelegateをセットすると認証前にValidateFnにセットしたdelegateが呼び出されるようになります | |
なので、ValidateFnに入れるdelegateでContinueをチェックするようにし、ホワイトリストに無いhostを指定されたらリダイレクトせずに400/404を投げれば良い |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment