CVE-2015-6545 (Other, published 2015-09-03T17:59Z)
Description: value: Cross-site request forgery (CSRF) vulnerability in ajax.php in Cerb before 7.0.4 allows remote attackers to hijack the authentication of administrators for requests that add an administrator account via a saveWorkerPeek action.
Severity: MEDIUM (CVSS v3 base score: )
Weakness: CWE-352 \u2014 Cross-Site Request Forgery (CSRF)
The web application does not, or can not, sufficiently verify whether a well-formed, valid, consistent request was intentionally provided by the user who submitted the request.
Repository: https://github.com/wgm/cerb
Files changed:
features/cerberusweb.core/api/uri/login.php
features/cerberusweb.core/templates/configuration/section/acl/edit_role.tpl
features/cerberusweb.core/templates/configuration/section/branding/index.tpl
features/cerberusweb.core/templates/configuration/section/cache/peek.tpl
features/cerberusweb.core/templates/configuration/section/license/index.tpl
features/cerberusweb.core/templates/configuration/section/localization/index.tpl
features/cerberusweb.core/templates/configuration/section/mail_failed/peek.tpl
features/cerberusweb.core/templates/configuration/section/mail_failed/view.tpl
features/cerberusweb.core/templates/configuration/section/mail_filtering/index.tpl
features/cerberusweb.core/templates/configuration/section/mail_from/index.tpl
features/cerberusweb.core/templates/configuration/section/mail_from/peek.tpl
features/cerberusweb.core/templates/configuration/section/mail_html/peek.tpl
features/cerberusweb.core/templates/configuration/section/mail_html/view.tpl
features/cerberusweb.core/templates/configuration/section/mail_import/index.tpl
features/cerberusweb.core/templates/configuration/section/mail_incoming/index.tpl
features/cerberusweb.core/templates/configuration/section/mail_relay/index.tpl
features/cerberusweb.core/templates/configuration/section/mail_routing/index.tpl
features/cerberusweb.core/templates/configuration/section/mail_routing/peek.tpl
features/cerberusweb.core/templates/configuration/section/plugin_library/download_popup.tpl
features/cerberusweb.core/templates/configuration/section/plugin_library/view.tpl
features/cerberusweb.core/templates/configuration/section/plugins/popup.tpl
features/cerberusweb.core/templates/configuration/section/plugins/view.tpl
features/cerberusweb.core/templates/configuration/section/portal/tabs/settings/index.tpl
features/cerberusweb.core/templates/configuration/section/portal/tabs/templates/add.tpl
features/cerberusweb.core/templates/configuration/section/portal/tabs/templates/bulk.tpl
features/cerberusweb.core/templates/configuration/section/portal/tabs/templates/export.tpl
features/cerberusweb.core/templates/configuration/section/portal/tabs/templates/import.tpl
features/cerberusweb.core/templates/configuration/section/portal/tabs/templates/peek.tpl
features/cerberusweb.core/templates/configuration/section/portal/tabs/templates/view.tpl
features/cerberusweb.core/templates/configuration/section/portals/add.tpl
features/cerberusweb.core/templates/configuration/section/portals/view.tpl
features/cerberusweb.core/templates/configuration/section/scheduler/job_edit.tpl
features/cerberusweb.core/templates/configuration/section/search/peek.tpl
features/cerberusweb.core/templates/configuration/section/security/index.tpl
features/cerberusweb.core/templates/configuration/section/sessions/bulk.tpl
features/cerberusweb.core/templates/configuration/section/sessions/view.tpl
features/cerberusweb.core/templates/configuration/section/storage_attachments/bulk.tpl
features/cerberusweb.core/templates/configuration/section/storage_attachments/view.tpl
features/cerberusweb.core/templates/configuration/section/storage_content/index.tpl
features/cerberusweb.core/templates/configuration/section/storage_content/peek.tpl
features/cerberusweb.core/templates/configuration/section/storage_profiles/peek.tpl
features/cerberusweb.core/templates/configuration/section/storage_profiles/view.tpl
features/cerberusweb.core/templates/configuration/section/workers/bulk.tpl
features/cerberusweb.core/templates/configuration/section/workers/peek.tpl
features/cerberusweb.core/templates/contacts/addresses/bulk.tpl
features/cerberusweb.core/templates/contacts/addresses/peek.tpl
features/cerberusweb.core/templates/contacts/addresses/view.tpl
features/cerberusweb.core/templates/contacts/orgs/bulk.tpl
features/cerberusweb.core/templates/contacts/orgs/org_merge_continue_peek.tpl
features/cerberusweb.core/templates/contacts/orgs/org_merge_peek.tpl
features/cerberusweb.core/templates/contacts/orgs/peek.tpl
features/cerberusweb.core/templates/contacts/orgs/view.tpl
features/cerberusweb.core/templates/contacts/people/bulk.tpl
features/cerberusweb.core/templates/contacts/people/peek.tpl
features/cerberusweb.core/templates/contacts/people/view.tpl
features/cerberusweb.core/templates/context_links/choosers/__file.tpl
features/cerberusweb.core/templates/context_links/choosers/__generic.tpl
features/cerberusweb.core/templates/display/modules/conversation/message.tpl
features/cerberusweb.core/templates/display/modules/history/index.tpl
features/cerberusweb.core/templates/display/rpc/add_note.tpl
features/cerberusweb.core/templates/display/rpc/merge_panel.tpl
features/cerberusweb.core/templates/display/rpc/relay_message.tpl
features/cerberusweb.core/templates/display/rpc/reply.tpl
features/cerberusweb.core/templates/display/rpc/requester_panel.tpl
features/cerberusweb.core/templates/groups/peek.tpl
features/cerberusweb.core/templates/groups/view.tpl
features/cerberusweb.core/templates/header.tpl
features/cerberusweb.core/templates/internal/activity_log/view.tpl
features/cerberusweb.core/templates/internal/bucket/peek.tpl
features/cerberusweb.core/templates/internal/bucket/view.tpl
features/cerberusweb.core/templates/internal/calendar/peek.tpl
features/cerberusweb.core/templates/internal/calendar/tab_availability.tpl
features/cerberusweb.core/templates/internal/calendar/view.tpl
features/cerberusweb.core/templates/internal/calendar_event/peek.tpl
features/cerberusweb.core/templates/internal/calendar_event/view.tpl
features/cerberusweb.core/templates/internal/calendar_recurring_profile/peek.tpl
features/cerberusweb.core/templates/internal/calendar_recurring_profile/view.tpl
features/cerberusweb.core/templates/internal/comments/peek.tpl
features/cerberusweb.core/templates/internal/comments/view.tpl
features/cerberusweb.core/templates/internal/custom_fieldsets/peek.tpl
features/cerberusweb.core/templates/internal/custom_fieldsets/view.tpl
features/cerberusweb.core/templates/internal/decisions/editors/_move.tpl
features/cerberusweb.core/templates/internal/decisions/editors/_reorder.tpl
features/cerberusweb.core/templates/internal/decisions/editors/action.tpl
features/cerberusweb.core/templates/internal/decisions/editors/outcome.tpl
features/cerberusweb.core/templates/internal/decisions/editors/simulate.tpl
features/cerberusweb.core/templates/internal/decisions/editors/switch.tpl
features/cerberusweb.core/templates/internal/decisions/editors/trigger.tpl
features/cerberusweb.core/templates/internal/file_bundle/peek.tpl
features/cerberusweb.core/templates/internal/file_bundle/view.tpl
features/cerberusweb.core/templates/internal/import/popup_mapping.tpl
features/cerberusweb.core/templates/internal/import/popup_upload.tpl
features/cerberusweb.core/templates/internal/macros/display/scheduler_popup.tpl
features/cerberusweb.core/templates/internal/macros/reply/run_popup.tpl
features/cerberusweb.core/templates/internal/mail_transport/peek.tpl
features/cerberusweb.core/templates/internal/mail_transport/view.tpl
features/cerberusweb.core/templates/internal/mailbox/peek.tpl
features/cerberusweb.core/templates/internal/mailbox/view.tpl
features/cerberusweb.core/templates/internal/messages/peek.tpl
features/cerberusweb.core/templates/internal/recommendations/context_recommend_peek.tpl
features/cerberusweb.core/templates/internal/responsibilities/peek_by_group_editable.tpl
features/cerberusweb.core/templates/internal/skills/peek.tpl
features/cerberusweb.core/templates/internal/skills/view.tpl
features/cerberusweb.core/templates/internal/skillsets/chooser_popup.tpl
features/cerberusweb.core/templates/internal/skillsets/peek.tpl
features/cerberusweb.core/templates/internal/skillsets/tab_editable.tpl
features/cerberusweb.core/templates/internal/skillsets/view.tpl
features/cerberusweb.core/templates/internal/snippets/bulk.tpl
features/cerberusweb.core/templates/internal/snippets/paste_placeholders.tpl
features/cerberusweb.core/templates/internal/snippets/peek.tpl
features/cerberusweb.core/templates/internal/snippets/views/default.tpl
features/cerberusweb.core/templates/internal/tour/banner.tpl
features/cerberusweb.core/templates/internal/va/peek.tpl
features/cerberusweb.core/templates/internal/va/scheduled_behavior/view.tpl
features/cerberusweb.core/templates/internal/va/view.tpl
features/cerberusweb.core/templates/internal/views/copy.tpl
features/cerberusweb.core/templates/internal/views/search_and_view.tpl
features/cerberusweb.core/templates/internal/views/view_export.tpl
features/cerberusweb.core/templates/internal/watchers/context_follow_peek.tpl
features/cerberusweb.core/templates/internal/workspaces/tabs/calendar/tab.tpl
features/cerberusweb.core/templates/internal/workspaces/tabs/worklists/tab.tpl
features/cerberusweb.core/templates/internal/workspaces/widgets/add.tpl
features/cerberusweb.core/templates/internal/workspaces/widgets/calendar/calendar.tpl
features/cerberusweb.core/templates/internal/workspaces/widgets/export.tpl
features/cerberusweb.core/templates/internal/workspaces/widgets/export_data.tpl
features/cerberusweb.core/templates/internal/workspaces/widgets/peek.tpl
features/cerberusweb.core/templates/mail/queue/bulk.tpl
features/cerberusweb.core/templates/mail/queue/peek.tpl
features/cerberusweb.core/templates/mail/queue/view.tpl
features/cerberusweb.core/templates/mail/section/compose/peek.tpl
features/cerberusweb.core/templates/messages/view.tpl
features/cerberusweb.core/templates/pages/add_tabs.tpl
features/cerberusweb.core/templates/pages/edit_workspace_page.tpl
features/cerberusweb.core/templates/pages/edit_workspace_tab.tpl
features/cerberusweb.core/templates/pages/page.tpl
features/cerberusweb.core/templates/pages/view.tpl
features/cerberusweb.core/templates/pages/wizard_popup.tpl
features/cerberusweb.core/templates/preferences/modules/general.tpl
features/cerberusweb.core/templates/preferences/modules/security.tpl
features/cerberusweb.core/templates/preferences/tabs/notifications/bulk.tpl
features/cerberusweb.core/templates/preferences/tabs/notifications/view.tpl
features/cerberusweb.core/templates/preferences/tabs/watcher/index.tpl
features/cerberusweb.core/templates/search/quick_search.tpl
features/cerberusweb.core/templates/tasks/rpc/bulk.tpl
features/cerberusweb.core/templates/tasks/rpc/peek.tpl
features/cerberusweb.core/templates/tasks/view.tpl
features/cerberusweb.core/templates/tickets/ajax/merge_confirm.tpl
features/cerberusweb.core/templates/tickets/peek.tpl
features/cerberusweb.core/templates/tickets/rpc/bulk.tpl
features/cerberusweb.core/templates/tickets/rpc/ticket_view_assist.tpl
features/cerberusweb.core/templates/tickets/rpc/ticket_view_assist_headers.tpl
features/cerberusweb.core/templates/tickets/view.tpl
features/cerberusweb.core/templates/workers/view.tpl
features/cerberusweb.crm/templates/crm/opps/bulk.tpl
features/cerberusweb.crm/templates/crm/opps/peek.tpl
features/cerberusweb.crm/templates/crm/opps/view.tpl
features/cerberusweb.feedback/templates/feedback/ajax/peek.tpl
features/cerberusweb.feedback/templates/feedback/bulk.tpl
features/cerberusweb.feedback/templates/feedback/view.tpl
features/cerberusweb.kb/templates/kb/ajax/category_edit_panel.tpl
features/cerberusweb.kb/templates/kb/bulk.tpl
features/cerberusweb.kb/templates/kb/peek_edit.tpl
features/cerberusweb.kb/templates/kb/peek_readonly.tpl
features/cerberusweb.kb/templates/kb/tabs/articles/index.tpl
features/cerberusweb.kb/templates/kb/view.tpl
features/cerberusweb.reports/templates/reports/custom_fields/usage/index.tpl
features/cerberusweb.reports/templates/reports/group/group_replies/index.tpl
features/cerberusweb.reports/templates/reports/snippets/snippet_popularity/index.tpl
features/cerberusweb.reports/templates/reports/ticket/closed_tickets/index.tpl
features/cerberusweb.reports/templates/reports/ticket/new_tickets/index.tpl
features/cerberusweb.reports/templates/reports/ticket/top_contacts_tickets/index.tpl
features/cerberusweb.reports/templates/reports/va/va_usage/index.tpl
features/cerberusweb.reports/templates/reports/worker/average_response_time/index.tpl
features/cerberusweb.reports/templates/reports/worker/worker_history/index.tpl
features/cerberusweb.restapi/templates/peek.tpl
features/cerberusweb.restapi/templates/view.tpl
features/cerberusweb.simulator/templates/setup/section.tpl
features/cerberusweb.timetracking/templates/config/activities/edit_activity.tpl
features/cerberusweb.timetracking/templates/config/activities/index.tpl
features/cerberusweb.timetracking/templates/reports/time_spent_activity/index.tpl
features/cerberusweb.timetracking/templates/reports/time_spent_org/index.tpl
features/cerberusweb.timetracking/templates/reports/time_spent_worker/index.tpl
features/cerberusweb.translators/templates/config/ajax/add_language_panel.tpl
features/cerberusweb.translators/templates/config/ajax/find_strings_panel.tpl
features/cerberusweb.translators/templates/config/ajax/import_strings_panel.tpl
features/cerberusweb.translators/templates/config/section/view.tpl
install/extras/sdk/devblocks-dao.php
install/extras/sdk/examples/example.object/templates/example_object/bulk.tpl
install/extras/sdk/examples/example.object/templates/example_object/peek.tpl
install/extras/sdk/examples/example.object/templates/example_object/view.tpl
install/extras/sdk/examples/example.report/templates/reports/example.tpl
libs/devblocks/api/Engine.php
libs/devblocks/api/Extension.php
libs/devblocks/api/services/template.php
libs/devblocks/framework.defaults.php
libs/devblocks/resources/js/devblocks.js
Commit message: * [Security/CSRF] Fixed a medium risk CSRF (cross-site request forgery) vulnerability reported by High-Tech Bridge (HTB23269). We don't have any evidence of this having taken place in the wild, but we were able to reproduce the results with the proof-of-concept in the advisory. A logged in worker could be tricked into visiting a URL that could perform certain actions in their browser session. Cerb now uses the Synchronizer pattern: a session-based token included with every HTML FORM and Ajax request that is compared to the active session. This verifies that such requests are coming from an existing Cerb page rather than an external source. When a potential CSRF attack is detected, the event is now logged in the PHP log as a warning.


Vulnerable code:
<form action="{devblocks_url}{/devblocks_url}">
{*
<input type="hidden" name="c" value="config">
<input type="hidden" name="a" value="handleSectionAction">
<input type="hidden" name="section" value="plugin_library">
<input type="hidden" name="action" value="saveDownloadPopup">
<input type="hidden" name="plugin_id" value="{$plugin->id}">
<input type="hidden" name="view_id" value="{$view_id}">
*}
<form action="{devblocks_url}{/devblocks_url}">
		$request = new DevblocksHttpRequest($parts,$queryArgs);
	function __construct($path, $query=array()) {
	$devblocksPopups = $('#devblocksPopups');
	$data = $devblocksPopups.data();
	$element = $($sel).closest('DIV.devblocks-popup');
	$popup = genericAjaxPopupFetch($layer);
	$popup = genericAjaxPopupFetch($layer);

Fixed code:
		// Generate a CSRF token for the session
		$_SESSION['csrf_token'] = CerberusApplication::generatePassword(256);
		
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">

<form action="{devblocks_url}{/devblocks_url}" method="POST">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">

<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">

<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
	<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">

<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">

<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
		<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">

	<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">

	<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">

<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">

<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">

<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">

<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
	<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">

<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">

<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
	<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
		  		<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
	<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
	
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">

<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">

	<meta name="_csrf_token" content="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">

<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">

<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<form action="{devblocks_url}{/devblocks_url}" method="post">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">

<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">

<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">

<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">

<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">

<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">

<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">

<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">

<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
		<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">

<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">

<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">

<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
	<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">

<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">

<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">

				<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">

<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">

<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
	<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
	<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
	
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
		<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
		<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
	<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
	
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">

<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">

<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">

<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
		<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
	<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">

<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">

<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
	<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">

<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">

<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">

<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">

<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
	<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">

<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">

	<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
	<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
	<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
				<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">

<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">

		<input type="hidden" name="_csrf_token" value="{$session.csrf_token}">
		$method = strtoupper(@$_SERVER['REQUEST_METHOD']);
		
		$request = new DevblocksHttpRequest($parts,$queryArgs,$method);
		$request->csrf_token = isset($_SERVER['HTTP_X_CSRF_TOKEN']) ? $_SERVER['HTTP_X_CSRF_TOKEN'] : @$_REQUEST['_csrf_token'];
		
		
		// Security: CSRF
		
		// If we are running a controller action...
		if(isset($_REQUEST['c']) || isset($_REQUEST['a'])) {
			
			// ...and we're not in DEVELOPMENT_MODE
			if(!DEVELOPMENT_MODE_ALLOW_CSRF) {
			
				// ...and the CSRF token is invalid for this session, freak out
				if(!isset($_SESSION['csrf_token']) || $_SESSION['csrf_token'] != $request->csrf_token) {
					header("Status: 403");
					@$referer = $_SERVER['HTTP_REFERER'];
					@$remote_addr = $_SERVER['REMOTE_ADDR'];
					
					error_log(sprintf("[Cerb/Security] Possible CSRF attack from IP %s using referrer %s", $remote_addr, $referer), E_USER_WARNING);
					die("Access denied");
				}
			}
		}

		// Controllers
	public $method = null;
	public $csrf_token = null;
	
	function __construct($path, $query=array(), $method=null) {
		$this->method = $method;
		$is_ajax = substr($content, 0, 9) == 'ajax.php?';
		
		if($is_ajax)
			$contents .= '&_csrf_token=' . $_SESSION['csrf_token'];
		
if(!defined('DEVELOPMENT_MODE_ALLOW_CSRF'))
	define('DEVELOPMENT_MODE_ALLOW_CSRF', false);

	var $devblocksPopups = $('#devblocksPopups');
	var $data = $devblocksPopups.data();
	var $element = $($sel).closest('DIV.devblocks-popup');
	var $popup = genericAjaxPopupFetch($layer);
	var $popup = genericAjaxPopupFetch($layer);
	if(null == options.headers)
		options.headers = {};
		
	options.headers['X-CSRF-Token'] = $('meta[name="_csrf_token"]').attr('content');
	
	if(null == options.headers)
		options.headers = {};
		
	options.headers['X-CSRF-Token'] = $('meta[name="_csrf_token"]').attr('content');