diff --git a/core/lib/Drupal/Core/Form/FormBuilder.php b/core/lib/Drupal/Core/Form/FormBuilder.php
index a24330d..db5de9b 100644
--- a/core/lib/Drupal/Core/Form/FormBuilder.php
+++ b/core/lib/Drupal/Core/Form/FormBuilder.php
@@ -613,7 +613,15 @@ public function prepareForm($form_id, &$form, FormStateInterface &$form_state) {
 
     // Only update the action if it is not already set.
     if (!isset($form['#action'])) {
-      $form['#action'] = $this->buildFormAction();
+      $form_action = $this->buildFormAction();
+      $placeholder = hash('sha1', $form_action);
+      $placeholder_render_array = [
+        '#lazy_builder' => ['route_processor_csrf:renderPlaceholderCsrfToken', [$form_action]],
+      ];
+      if (isset($form['#attached']) && isset($form['#attached']['placeholders'])) {
+        $form['#attached']['placeholders'] = array_merge($form['#attached']['placeholders'], [$placeholder => $placeholder_render_array]);
+      }
+      $form['#attached']['placeholders'] = [$placeholder => $placeholder_render_array];
     }
 
     // Fix the form method, if it is 'get' in $form_state, but not in $form.
diff --git a/core/modules/block/src/Tests/BlockFormInBlockTest.php b/core/modules/block/src/Tests/BlockFormInBlockTest.php
new file mode 100644
index 0000000..203776b
--- /dev/null
+++ b/core/modules/block/src/Tests/BlockFormInBlockTest.php
@@ -0,0 +1,94 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\block\Tests\BlockFormInBlockTest.
+ */
+
+namespace Drupal\block\Tests;
+
+use Drupal\Core\Cache\Cache;
+use Drupal\simpletest\WebTestBase;
+
+/**
+ * Tests form in block caching.
+ *
+ * @group block
+ */
+class BlockFormInBlockTest extends WebTestBase {
+
+  /**
+   * Modules to install.
+   *
+   * @var array
+   */
+  public static $modules = ['block', 'block_test', 'test_page_test'];
+
+  /**
+   * A user with permission to create and edit books and to administer blocks.
+   *
+   * @var object
+   */
+  protected $adminUser;
+
+  /**
+   * An authenticated user to test block caching.
+   *
+   * @var object
+   */
+  protected $normalUser;
+
+  /**
+   * The block used by this test.
+   *
+   * @var \Drupal\block\BlockInterface
+   */
+  protected $block;
+
+  protected function setUp() {
+    parent::setUp();
+
+    // Create an admin user, log in and enable test blocks.
+    $this->adminUser = $this->drupalCreateUser(['administer blocks', 'access administration pages']);
+    $this->drupalLogin($this->adminUser);
+
+    // Create additional users to test caching modes.
+    $this->normalUser = $this->drupalCreateUser();
+    $this->drupalLogin($this->normalUser);
+
+    // Enable our test block.
+   $this->block = $this->drupalPlaceBlock('test_form_in_block');
+  }
+
+  /**
+   * Test to see if form in block's redirect isn't cached
+   */
+  function testCachePerPage() {
+    $form_values = ['email' => 'test@example.com'];
+
+    // Go to "test-page" and test if the block is enabled.
+    $this->drupalGet('test-page');
+    $this->assertResponse(200);
+    $this->assertText('Your .com email address.', 'form found');
+
+    $this->drupalPostForm(NULL, $form_values, t('Submit'));
+
+    // Make sure that we're currently still on /test-page
+    $this->assertUrl('test-page');
+    $this->assertText(t('Your email address is @email', ['@email' => 'test@example.com']));
+
+    // Go to a different page and see if the block is enabled there as well.
+    $this->drupalGet('test-render-title');
+    $this->assertResponse(200);
+    $this->assertText('Your .com email address.', 'form found');
+
+    $this->drupalPostForm(NULL, $form_values, t('Submit'));
+
+    // Make sure that submitting the form didn't redirect us to the first
+    // page we submitted the form from.
+    $this->assertUrl('test-render-title');
+    $this->assertText(t('Your email address is @email', ['@email' => 'test@example.com']));
+
+  }
+
+}
diff --git a/core/modules/block/tests/modules/block_test/src/Form/TestForm.php b/core/modules/block/tests/modules/block_test/src/Form/TestForm.php
new file mode 100644
index 0000000..de0f6af
--- /dev/null
+++ b/core/modules/block/tests/modules/block_test/src/Form/TestForm.php
@@ -0,0 +1,56 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\block_test\Form\TestForm.
+ */
+
+namespace Drupal\block_test\Form;
+
+use Drupal\Core\Form\FormBase;
+use Drupal\Core\Form\FormStateInterface;
+
+class TestForm extends FormBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getFormId() {
+    return 'block_test_form_test';
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function buildForm(array $form, FormStateInterface $form_state) {
+
+    $form['email'] = [
+      '#type' => 'email',
+      '#title' => $this->t('Your .com email address.')
+    ];
+
+    $form['show'] = [
+      '#type' => 'submit',
+      '#value' => $this->t('Submit'),
+    ];
+
+    return $form;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function validateForm(array &$form, FormStateInterface $form_state) {
+    if (strpos($form_state->getValue('email'), '.com') === FALSE) {
+      $form_state->setErrorByName('email', $this->t('This is not a .com email address.'));
+    }
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function submitForm(array &$form, FormStateInterface $form_state) {
+    drupal_set_message($this->t('Your email address is @email', ['@email' => $form['email']['#value']]));
+  }
+
+}
diff --git a/core/modules/block/tests/modules/block_test/src/Plugin/Block/TestFormBlock.php b/core/modules/block/tests/modules/block_test/src/Plugin/Block/TestFormBlock.php
new file mode 100644
index 0000000..ea503b6
--- /dev/null
+++ b/core/modules/block/tests/modules/block_test/src/Plugin/Block/TestFormBlock.php
@@ -0,0 +1,31 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\block_test\Plugin\Block\TestFormBlock.
+ */
+
+namespace Drupal\block_test\Plugin\Block;
+
+use Drupal\Core\Block\BlockBase;
+
+/**
+ * Provides a block to test caching.
+ *
+ * @Block(
+ *   id = "test_form_in_block",
+ *   admin_label = @Translation("Test form block caching")
+ * )
+ */
+class TestFormBlock extends BlockBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function build() {
+    $form = \Drupal::formBuilder()->getForm('Drupal\block_test\Form\TestForm');
+
+    return $form;
+  }
+
+}
