問題
- Liferay Portal 6.2では、p_p_authトークンがURLで公開されています。 これはセキュリティリスクと見なされる可能性があります
環境
- Liferay Portal 6.2
解決
攻撃者や他のユーザーはp_p_authトークンを使用できず、正当なユーザーのみがそれを適用できます。 したがって、トークンのリークは、この"元の"ユーザー以外には何の価値もありません。
p_p_auth
パラメータは、いわゆるポートレット呼び出しトークンです。トークンの目的はポートレットへの不正アクセスをブロックすることです。
より具体的には、トークンはページに動的に追加できるポートレットのセキュリティチェックを意味します。 (詳細については、以下のportlet.add.default.resource.check.enabled
プロパティの説明を参照してください)
認可されたユーザーがポータル全体をナビゲートしている場合、対応するポートレット URL はポートレット呼び出しトークンが付加されて生成されます。 生成された呼び出しトークンは、ポートレットとユーザーセッションごとに一意です。 つまり、認証されていないユーザーや他の認証済みユーザーがポートレットにアクセスするためにトークンを再利用しようとした場合、トークンの検証に失敗し、アクセスが拒否されます。
以下、関連するプロパティの説明をご参照ください:
#
# Portlets that have configured liferay-portlet.xml with the element
# "add-default-resource" set to true will allow those portlets to be
# dynamically added to any page by any user. This is useful
# (and necessary) for some portlets that need to be dynamically added to a
# page, but it can also pose a security risk because it also allows any user
# to do it.
#
# Set this property to true to add a security check around this behavior.
# If set to true, then portlets can only be dynamically added to a page if
# it contains a proper security token. This security token is automatically
# passed when using a portlet URL from one portlet to another portlet.
#
# Modify the property "portlet.add.default.resource.check.whitelist" to
# whitelist certain portlets from this security check.
#
# The security check utilizes the implementation set in the property
# "auth.token.impl".
#
portlet.add.default.resource.check.enabled=true
#
# Set a list of comma delimited portlet IDs that will bypass the security
# check set in the property "portlet.add.default.resource.check.enabled".
#
portlet.add.default.resource.check.whitelist=com_liferay_login_web_portlet_LoginPortlet,com_liferay_portlet_configuration_web_portlet_PortletConfigurationPortlet,com_liferay_portlet_configuration_css_web_portlet_PortletConfigurationCSSPortlet,145,164,166,com_liferay_product_navigation_simulation_web_portlet_SimulationPortlet,com_liferay_staging_bar_web_portlet_StagingBarPortlet
通常、ページには、ページ上でのポートレットの編成方法を定義するレイアウト(行または列、あるいはその両方)があります。この関連付けは、データベース内のレイアウトテーブル(typeSettings
カラム)に格納されています。
ただし、特定のシナリオでは、ページに追加されていない場合でも、ポートレットをレンダリングする必要があります。 たとえば、ゲストユーザーが制限されたページに移動する場合、認証を強制するためにログインポートレットを表示する必要があります。
コントロールパネルも動的に追加されたポートレットの例です。
基本的に、トークンは、動的またはオンザフライでレンダリングできるポートレットへの不正アクセスを防止します。 現在、Liferayポータルにはトークンを転送するための代替ソリューションがありません。 ただし、各トークンは特定のユーザー用に生成され、特定のユーザーのセッションにのみ保存されるため、攻撃者がトークンを取得しても無害であると見なされます。 他の誰かが同じトークンを使用したい場合、それは現在のユーザーセッションに対して検証されます。つまり、検証は失敗し、ポートレットへのアクセスは拒否されます。
詳細については、以下のクラスの実装例を検索すると良いでしょう。com.liferay.portal.security.auth.SessionAuthToken
ただし、p_p_authトークンの漏洩に関して特定のセキュリティ脆弱性の問題が発見された場合は、それを調査するために正確な再現手順を提供してLiferayサポートにチケットを発行してください。
追加情報
-
考えられる回避策は、これらのトークンを削除するためのURL書き換えルールを作成することです。 注意:これは公式の推奨とは見なされません。Liferayはこの方法について徹底的なテストを行っておらず、ポータルの機能にどのような影響があるかは不明です。 カスタマイズとサードパーティのソフトウェア/ハードウェア構成が含まれるため、これらの設定はユーザーの裁量でのみ試してください
-
もう一つの回避策は、認証トークンのチェックをオフにするか、アクションとポートレットをportal-ext.propertiesを通じて"ignore"リストに追加することです
以下の各プロパティの説明とデフォルト値をご参照ください:
##
## Authentication Token
##
#
# Set this to true to enable authentication token security checks. The
# checks can be disabled for specific actions via the property
# "auth.token.ignore.actions" or for specific portlets via the init
# parameter "check-auth-token" in portlet.xml.
#
auth.token.check.enabled=true
#
# Set the authentication token class. This class must implement
# com.liferay.portal.security.auth.AuthToken. This class is used to prevent
# CSRF attacks. See http://issues.liferay.com/browse/LPS-8399 for more
# information.
#
auth.token.impl=com.liferay.portal.security.auth.SessionAuthToken
#
# Input a list of comma delimited struts actions that will not be checked
# for an authentication token.
#
auth.token.ignore.actions=\
/asset/rss,\
\
/asset_publisher/edit_article_discussion,\
/asset_publisher/edit_entry_discussion,\
/asset_publisher/edit_file_entry_discussion,\
/asset_publisher/edit_page_discussion,\
\
/blogs/edit_entry,\
/blogs/edit_entry_discussion,\
/blogs/rss,\
/blogs/trackback,\
\
/blogs_aggregator/edit_entry,\
/blogs_aggregator/edit_entry_discussion,\
/blogs_aggregator/rss,\
\
/document_library/edit_file_entry,\
/document_library/edit_file_entry_discussion,\
\
/document_library_display/edit_file_entry,\
/document_library_display/edit_file_entry_discussion,\
\
/journal/edit_article_discussion,\
/journal/rss,\
\
/journal_content/edit_article_discussion,\
\
/image_gallery_display/edit_file_entry,\
/image_gallery_display/edit_image,\
\
/login/create_account,\
/login/login,\
\
/message_boards/edit_discussion,\
/message_boards/edit_message,\
/message_boards/rss,\
\
/my_sites/view,\
\
/page_comments/edit_page_discussion,\
\
/shopping/edit_order_discussion,\
\
/software_catalog/edit_product_entry_discussion,\
\
/wiki/edit_page,\
/wiki/edit_page_attachment,\
/wiki/edit_page_discussion,\
/wiki/get_page_attachment,\
/wiki/rss,\
\
/wiki_admin/edit_page_attachment,\
\
/wiki_display/edit_page_attachment,\
/wiki_display/edit_page_discussion
#
# Set a list of comma delimited origins that will not be checked for an
# authentication token.
#
#auth.token.ignore.origins=\
# com.liferay.portal.action.JSONServiceAction:com.liferay.portlet.expando.service.ExpandoValueServiceUtil#getJSONData,\
# com.liferay.portal.jsonwebservice.JSONWebServiceServiceAction:/classname/,\
# com.liferay.portal.jsonwebservice.JSONWebServiceServiceAction:/user/get-user-by-email-address,\
# com.liferay.portlet.asset.action.GetCategoriesAction,\
# com.liferay.portlet.portletconfiguration.action.GetLookAndFeelAction
#
# Set a list of comma delimited portlet ids that will not be checked for an
# authentication token.
#
auth.token.ignore.portlets=82
#
# Set the length of the authentication token. Longer auth tokens will
# require more CPU cycles to generate and may impact overall performance.
#
auth.token.length=8
#
# Set the shared secret that is used for requests where it is not possible
# to generate an authentication token (i.e. WSRP).
#
#auth.token.shared.secret=