CVE-2013-10020 (Other, published 2023-03-10T01:15Z)
Description: value: A vulnerability, which was classified as problematic, was found in MMDeveloper A Forms Plugin up to 1.4.2 on WordPress. This affects an unknown part of the file a-forms.php. The manipulation leads to cross site scripting. It is possible to initiate the attack remotely. Upgrading to version 1.4.3 is able to address this issue. The identifier of the patch is 3e693197bd69b7173cc16d8d2e0a7d501a2a0b06. It is recommended to upgrade the affected component. The identifier VDB-222609 was assigned to this vulnerability.
Severity: nan (CVSS v3 base score: 6.1)
Weakness: CWE-79 \u2014 Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
Repository: https://github.com/wp-plugins/a-forms
Files changed:
a-forms.php
readme.txt
Commit message: Fixed yet another issue with critical cross-site scripting. I've forced SiteLock to check and check, and I think its finally fixed.

git-svn-id: https://plugins.svn.wordpress.org/a-forms/trunk@758898 b8457f37-d9ea-0310-8a92-e5e31aec5664


Vulnerable code:
Version: 1.4.2
    update_option("aform_current_css_file", esc_html($_POST["css_file_selection"]));
    echo(@file_get_contents(get_template_directory()."/aforms_css/".esc_html($_POST["css_file_selection"])));
  $section = tom_get_row_by_id("a_form_sections", "*", "ID", esc_html($_POST["section_id"]));
  tom_insert_record("a_form_fields", array("field_order" => esc_html($_POST["field_order"]), "section_id" => esc_html($_POST["section_id"]), "form_id" => $section->form_id));
  if (esc_html(tom_get_query_string_value("a_form_page")) == "fields") {
    if (esc_html($_GET["action"]) == "delete") {
    tom_update_record_by_id("a_form_sections", array("section_order" => esc_html($_POST["section_order"])), "ID", esc_html($_POST["ID"]));
    tom_update_record_by_id("a_form_fields", array("field_order" => esc_html($_POST["field_order"]), "section_id" => esc_html($_POST["section_id"])), "FID", esc_html($_POST["FID"]));
      $action = esc_html($_POST["action"]);
    echo("<div class='updated below-h2'><p>".esc_html($_GET["message"])."</p></div>");
      $a_form = tom_get_row_by_id("a_form_forms", "*", "ID", esc_html($_GET["id"])); ?>
    if (esc_html($_GET["action"]) == "new") {
    echo("<div class='updated below-h2'><p>".esc_html($_GET["message"])."</p></div>");
      $a_form = tom_get_row_by_id("a_form_sections", "*", "ID", esc_html($_GET["id"])); ?>
    if (esc_html($_GET["action"]) == "new") {
  <?php if (esc_html(tom_get_query_string_value("id")) != "") { 
    if (esc_html(tom_get_query_string_value("action")) != "view") { ?>
        $page_no = esc_html($_GET["a_form_tracks_page"]);
      $where_sql = "form_id=".esc_html($_GET["id"]);
      if (esc_html(tom_get_query_string_value("search_text")) != "") {
        $where_sql .= " AND content LIKE '%".esc_html($_POST["search_text"])."%'";
      if ((esc_html(tom_get_query_string_value("search_date_from")) != null) && (esc_html(tom_get_query_string_value("search_date_to")) != null)) {
        $where_sql .= " AND (created_at BETWEEN '".esc_html(tom_get_query_string_value("search_date_from"))." 00:00:00' AND '".esc_html(tom_get_query_string_value("search_date_to"))." 23:59:59')";
      } else if (esc_html(tom_get_query_string_value("search_date_from")) != null) {
        $where_sql .= " AND created_at > '".esc_html(tom_get_query_string_value("search_date_from"))." 00:00:00'";
      } else if (esc_html(tom_get_query_string_value("search_date_to")) != null) {
        $where_sql .= " AND created_at < '".esc_html(tom_get_query_string_value("search_date_to"))." 23:59:59'";
      $fields = tom_get_results("a_form_fields", "*", "form_id=".esc_html($_GET["id"]), array());
        tom_generate_datatable_pagination("a_form_tracks", $total_tracks, $limit_clause, esc_html($_GET["a_form_tracks_page"]), "?page=a-forms/a-forms-tracking.php&action=show&id=".esc_html($_GET["id"])."&search_text=".esc_html(tom_get_query_string_value("search_text"))."&search_date_from=".esc_html(tom_get_query_string_value("search_date_from"))."&search_date_to=".esc_html(tom_get_query_string_value("search_date_to")), "ASC", "top");
                  echo(preg_replace("/, $/", "", $content));
      echo "<p><textarea rows='40' cols='160'>".$view->content."</textarea></p>";
      $section_index = esc_html($_POST["send_a_form_section"]);
      foreach ($_POST as $key => $value) {
        $_POST[$key] = esc_attr(esc_html($value));
      }

        $attachment_urls = explode("::", esc_html($_POST["a_form_attachment_urls"]));
            if (esc_html($_POST[$form_name.$field_name."_".$i]) != "") {
              $content = str_replace('\"', "\"", esc_html($_POST[$form_name.$field_name."_".$i]));
            if (esc_html($_POST["a_form_attachment_urls"]) != "") {
              $records = explode("::", esc_html($_POST["a_form_attachment_urls"]));
          $content = str_replace('\"', "\"", esc_html($_POST[$form_name.$field_name]));
              esc_html($_POST[aform_field_name($form, "captcha_first_number")]) 
              esc_html($_POST[aform_field_name($form, "captcha_second_number")])
            == esc_html($_POST[aform_field_name($form, "captcha")])
        if (esc_html($_POST["action"]) == "Send") {
            $from_name = esc_html($_POST[$form_name.str_replace(" ", "_", strtolower($row->field_label))]);
            $user_email = esc_html($_POST[$form_name.str_replace(" ", "_", strtolower($row->field_label))]);
              $subject .= " - ".esc_html($_POST[$form_name.str_replace(" ", "_", strtolower($row->field_label))]);
              tom_insert_record("a_form_tracks", array("created_at" => $current_datetime, "form_id" => esc_html($_POST["send_a_form"]), "content" => $email_content, "track_type" => "Successful Email", "referrer_url" => $_SERVER["HTTP_REFERER"], "fields_array" => serialize($field_values)));  
              tom_insert_record("a_form_tracks", array("created_at" => $current_datetime, "form_id" => esc_html($_POST["send_a_form"]), "content" => "Error Message: ".$mail_message.".\n\nContent: ".$email_content, "track_type" => "Failed Email", "referrer_url" => $_SERVER["HTTP_REFERER"], "fields_array" => serialize($field_values)));
    if (esc_html($_POST["action"]) == "Next") {
    if (esc_html($_POST["action"]) == "Back") {
Stable tag: 1.4.2

Fixed code:
Version: 1.4.3
    update_option("aform_current_css_file", ($_POST["css_file_selection"]));
    echo(@file_get_contents(get_template_directory()."/aforms_css/".($_POST["css_file_selection"])));
  $section = tom_get_row_by_id("a_form_sections", "*", "ID", ($_POST["section_id"]));
  tom_insert_record("a_form_fields", array("field_order" => ($_POST["field_order"]), "section_id" => ($_POST["section_id"]), "form_id" => $section->form_id));
  if ((tom_get_query_string_value("a_form_page")) == "fields") {
    if (($_GET["action"]) == "delete") {
    tom_update_record_by_id("a_form_sections", array("section_order" => ($_POST["section_order"])), "ID", ($_POST["ID"]));
    tom_update_record_by_id("a_form_fields", array("field_order" => ($_POST["field_order"]), "section_id" => ($_POST["section_id"])), "FID", ($_POST["FID"]));
      $action = ($_POST["action"]);
    echo("<div class='updated below-h2'><p>".($_GET["message"])."</p></div>");
      $a_form = tom_get_row_by_id("a_form_forms", "*", "ID", ($_GET["id"])); ?>
    if (($_GET["action"]) == "new") {
    echo("<div class='updated below-h2'><p>".($_GET["message"])."</p></div>");
      $a_form = tom_get_row_by_id("a_form_sections", "*", "ID", ($_GET["id"])); ?>
    if (($_GET["action"]) == "new") {
  <?php if ((tom_get_query_string_value("id")) != "") { 
    if ((tom_get_query_string_value("action")) != "view") { ?>
        $page_no = ($_GET["a_form_tracks_page"]);
      $where_sql = "form_id=".($_GET["id"]);
      if ((tom_get_query_string_value("search_text")) != "") {
        $where_sql .= " AND content LIKE '%".($_POST["search_text"])."%'";
      if (((tom_get_query_string_value("search_date_from")) != null) && ((tom_get_query_string_value("search_date_to")) != null)) {
        $where_sql .= " AND (created_at BETWEEN '".(tom_get_query_string_value("search_date_from"))." 00:00:00' AND '".(tom_get_query_string_value("search_date_to"))." 23:59:59')";
      } else if ((tom_get_query_string_value("search_date_from")) != null) {
        $where_sql .= " AND created_at > '".(tom_get_query_string_value("search_date_from"))." 00:00:00'";
      } else if ((tom_get_query_string_value("search_date_to")) != null) {
        $where_sql .= " AND created_at < '".(tom_get_query_string_value("search_date_to"))." 23:59:59'";
      $fields = tom_get_results("a_form_fields", "*", "form_id=".($_GET["id"]), array());
        tom_generate_datatable_pagination("a_form_tracks", $total_tracks, $limit_clause, ($_GET["a_form_tracks_page"]), "?page=a-forms/a-forms-tracking.php&action=show&id=".($_GET["id"])."&search_text=".(tom_get_query_string_value("search_text"))."&search_date_from=".(tom_get_query_string_value("search_date_from"))."&search_date_to=".(tom_get_query_string_value("search_date_to")), "ASC", "top");
                  echo(preg_replace("/, $/", "", esc_html($content)));
      echo "<p><textarea rows='40' cols='160'>".esc_html(stripcslashes($view->content))."</textarea></p>";
      $section_index = ($_POST["send_a_form_section"]);
        $attachment_urls = explode("::", ($_POST["a_form_attachment_urls"]));
            if (($_POST[$form_name.$field_name."_".$i]) != "") {
              $content = str_replace('\"', "\"", ($_POST[$form_name.$field_name."_".$i]));
            if (($_POST["a_form_attachment_urls"]) != "") {
              $records = explode("::", ($_POST["a_form_attachment_urls"]));
          $content = str_replace('\"', "\"", ($_POST[$form_name.$field_name]));
              ($_POST[aform_field_name($form, "captcha_first_number")]) 
              ($_POST[aform_field_name($form, "captcha_second_number")])
            == ($_POST[aform_field_name($form, "captcha")])
        if (($_POST["action"]) == "Send") {
            $from_name = ($_POST[$form_name.str_replace(" ", "_", strtolower($row->field_label))]);
            $user_email = ($_POST[$form_name.str_replace(" ", "_", strtolower($row->field_label))]);
              $subject .= " - ".($_POST[$form_name.str_replace(" ", "_", strtolower($row->field_label))]);
              tom_insert_record("a_form_tracks", array("created_at" => $current_datetime, "form_id" => ($_POST["send_a_form"]), "content" => $email_content, "track_type" => "Successful Email", "referrer_url" => $_SERVER["HTTP_REFERER"], "fields_array" => serialize($field_values)));  
              tom_insert_record("a_form_tracks", array("created_at" => $current_datetime, "form_id" => ($_POST["send_a_form"]), "content" => "Error Message: ".$mail_message.".\n\nContent: ".$email_content, "track_type" => "Failed Email", "referrer_url" => $_SERVER["HTTP_REFERER"], "fields_array" => serialize($field_values)));
    if (($_POST["action"]) == "Next") {
    if (($_POST["action"]) == "Back") {
Stable tag: 1.4.3
= 1.4.3 =

* Fixed yet another issue with critical cross-site scripting. I've forced SiteLock to check and check, and I think its finally fixed.

= 1.4.3 =

* Fixed yet another issue with critical cross-site scripting. I've forced SiteLock to check and check, and I think its finally fixed.