CVE-2021-4275 (published 2022-12-21T22:15Z)

A vulnerability, which was classified as problematic, was found in katlings pyambic-pentameter. Affected is an unknown function. The manipulation leads to cross-site request forgery. It is possible to launch the attack remotely. The name of the patch is 974f21aa1b2527ef39c8afe1a5060548217deca8. It is recommended to apply a patch to fix this issue. VDB-216498 is the identifier assigned to this vulnerability.

CVSS v3 base score: 8.8, HIGH (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H)

Weakness information:
cwe_id: CWE-352
cwe_name: Cross-Site Request Forgery (CSRF)
description: 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.
extended_description: When a web server is designed to receive a request from a client without any mechanism for verifying that it was intentionally sent, then it might be possible for an attacker to trick a client into making an unintentional request to the web server which will be treated as an authentic request. This can be done via a URL, image load, XMLHttpRequest, etc. and can result in exposure of data or unintended code execution.
         

Fix information:
repo_url: https://github.com/katlings/pyambic-pentameter
commit_details: repo_url: https://github.com/katlings/pyambic-pentameter
author: Kathryn Lingel
author_date: 2021-09-19 01:25:07-07:00
msg: haha actually use csrf
repository: repo_url: https://github.com/katlings/pyambic-pentameter
repo_name: katlings/pyambic-pentameter
repo_language: Python
owner: katlings
file_changes: filename: app.py
change_type: ModificationType.MODIFY
diff: @@ -1,5 +1,6 @@
 import logging
 from logging.handlers import RotatingFileHandler
+import os
 import random
 import re
 
@@ -13,7 +14,8 @@ pm = PoemMaker()
 pm.setup()
 
 app = Flask(__name__)
-app.config.update(WTF_CSRF_ENABLED=False)
+SECRET_KEY = os.urandom(32)
+app.config['SECRET_KEY'] = SECRET_KEY
 
 handler = RotatingFileHandler('poems.log', maxBytes=10000, backupCount=1)
 handler.setLevel(logging.INFO)

programming_language: Python
filename: custom.html
change_type: ModificationType.MODIFY
diff: @@ -13,6 +13,7 @@
     <div class="row my-5 text-center">
       <div class="col">
         <form action="" method="POST">
+          {{ form.csrf_token }}
           <div class="form-group my-3">
             <label for="source_text" class="mb-3">Copy-paste your text! The longer it is, the better and more varied results will be. It will be sanitized with most punctuation and all capitalization and whitespace stripped.</label>
             {{ form.source_text }}

programming_language: HTML
filename: custom_poem.html
change_type: ModificationType.MODIFY
diff: @@ -18,6 +18,7 @@
     <div class="row my-5 text-center">
       <div class="col">
         <form action="" method="POST">
+          {{ form.csrf_token }}
           {{ form.source_text }}
           <div class="form-group my-3">
             I want a {{ form.poem_format }}

programming_language: HTML
filename: generate.html
change_type: ModificationType.MODIFY
diff: @@ -20,6 +20,7 @@
         <div class="row my-3">
           <div class="col">
             <form action="" method="POST">
+              {{ form.csrf_token }}
               <h5>
               I want a {{ form.style }} in the style of {{ form.source }}
               <input type='submit' value='go'>

programming_language: HTML