CVE-2022-44216 (published 2023-02-20T20:15Z)

Gnuboard 5.5.4 and 5.5.5 is vulnerable to Insecure Permissions. An attacker can change password of all users without knowing victim's original password.

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

Weakness information:
cwe_id: CWE-306
cwe_name: Missing Authentication for Critical Function
description: The product does not perform any authentication for functionality that requires a provable user identity or consumes a significant amount of resources.
extended_description: 
            
            
         
         

Fix information:
repo_url: https://github.com/gnuboard/gnuboard5
commit_details: repo_url: https://github.com/gnuboard/gnuboard5
author: projectSylas
author_date: 2022-04-18 05:42:03+00:00
msg: [G5-80] 본인인증 비밀번호 찾기 후 비밀번호 변경 관련 수정
repository: repo_url: https://github.com/gnuboard/gnuboard5
repo_name: gnuboard/gnuboard5
description: 그누보드5 (영카트 포함) 공개형 Git
repo_language: PHP
owner: gnuboard
file_changes: filename: password_reset_update.php
change_type: ModificationType.MODIFY
diff: @@ -1,27 +1,31 @@
 <?php
 include_once('./_common.php');
 
-if($w == '')
-    $mb_id = isset($_POST['mb_id']) ? trim($_POST['mb_id']) : '';
-else
-    alert('잘못된 접근입니다', G5_URL);
+$mb_id = isset($_SESSION['ss_cert_mb_id']) ? trim(get_session('ss_cert_mb_id')) : '';
+$mb_dupinfo = isset($_SESSION['ss_cert_dupinfo']) ? trim(get_session('ss_cert_dupinfo')) : '';
 
-if(!$mb_id)
-    alert('회원아이디 값이 없습니다. 올바른 방법으로 이용해 주십시오.');
+if(!$mb_id) alert('회원아이디 값이 없습니다. 올바른 방법으로 이용해 주십시오.', G5_URL);
+
+if(!$mb_dupinfo) alert('잘못된 접근입니다.', G5_URL);
+
+$mb_check = sql_fetch("select * from {$g5['member_table']} where mb_id = '{$mb_id}' AND mb_dupinfo = '{$mb_dupinfo}'");
+
+if(!$mb_check) alert('잘못된 접근입니다.', G5_URL);
 
 $mb_password    = isset($_POST['mb_password']) ? trim($_POST['mb_password_re']) : '';
 $mb_password_re = isset($_POST['mb_password_re']) ? trim($_POST['mb_password_re']) : '';
 
 
-if ($w == '' && !$mb_password)
-alert('비밀번호가 넘어오지 않았습니다.');
-if($w == '' && $mb_password != $mb_password_re)
-alert('비밀번호가 일치하지 않습니다.');
+if (!$mb_password)
+    alert('비밀번호가 넘어오지 않았습니다.');
+if ($mb_password != $mb_password_re)
+    alert('비밀번호가 일치하지 않습니다.');
+
+$sql_password = "mb_password = '".get_encrypt_string($mb_password)."' ";
 
-$sql_password = "";
-if ($mb_password)
-    $sql_password = "mb_password = '".get_encrypt_string($mb_password)."' ";
+sql_query("update {$g5['member_table']} set {$sql_password} where mb_id = '{$mb_id}' AND mb_dupinfo = '{$mb_dupinfo}'");
 
-sql_query("update {$g5['member_table']} set {$sql_password} where mb_id = '{$mb_id}'");
+set_session('ss_cert_mb_id', '');
+set_session('ss_cert_dupinfo', '');
 
 goto_url(G5_BBS_URL.'/login.php');
\ No newline at end of file

programming_language: PHP
filename: password_reset.skin.php
change_type: ModificationType.MODIFY
diff: @@ -12,7 +12,8 @@ add_stylesheet('<link rel="stylesheet" href="' . $member_skin_url . '/style.css"
             <fieldset id="info_fs">
                 <p>새로운 비밀번호를 입력해주세요.</p>
                 <label for="mb_id" class="sound_only">아이디</label>
-                <input type="text" name="mb_id" id="mb_id" value="<?php echo $_POST['mb_id']; ?>" required class="required frm_input full_input" size="30" placeholder="아이디" readonly>
+                <br>
+                <b>회원 아이디 : <?php echo $_POST['mb_id']; ?></b>
                 <label for="mb_pw" class="sound_only">새 비밀번호<strong class="sound_only">필수</strong></label>
                 <input type="password" name="mb_password" id="mb_pw" required class="required frm_input full_input" size="30" placeholder="새 비밀번호">
                 <label for="mb_pw2" class="sound_only">새 비밀번호 확인<strong class="sound_only">필수</strong></label>

programming_language: PHP
filename: ini_find_result.php
change_type: ModificationType.MODIFY
diff: @@ -50,6 +50,22 @@ if ($_POST["resultCode"] === "0000") {
             alert_close("인증하신 정보로 가입된 회원정보가 없습니다.");
             exit;                
         }
+
+        $md5_cert_no = md5($cert_no);
+        $hash_data   = md5($user_name.$cert_type.$birth_day.$phone_no.$md5_cert_no);
+
+        // 성인인증결과
+        $adult_day = date("Ymd", strtotime("-19 years", G5_SERVER_TIME));
+        $adult = ((int)$birth_day <= (int)$adult_day) ? 1 : 0;
+
+        set_session("ss_cert_type",    $cert_type);
+        set_session("ss_cert_no",      $md5_cert_no);
+        set_session("ss_cert_hash",    $hash_data);
+        set_session("ss_cert_adult",   $adult);
+        set_session("ss_cert_birth",   $birth_day);
+        //set_session("ss_cert_sex",     ($sex_code=="01"?"M":"F")); // 이니시스 간편인증은 성별정보 리턴 없음
+        set_session('ss_cert_dupinfo', $mb_dupinfo);
+        set_session('ss_cert_mb_id', $row['mb_id']);
     } else {
         // 인증실패 curl의 인증실패 체크
         alert_close('코드 : '.$res_data['resultCode'].'  '.urldecode($res_data['resultMsg']));

programming_language: PHP
filename: find_kcpcert_result.php
change_type: ModificationType.MODIFY
diff: @@ -159,7 +159,25 @@ if( $cert_enc_use == "Y" )
                 alert_close("인증하신 정보로 가입된 회원정보가 없습니다.");
                 exit;
             }
+        }else{
+            $mb_dupinfo = $md5_ci;
         }
+        
+        $md5_cert_no = md5($cert_no);
+        $hash_data   = md5($user_name.$cert_type.$birth_day.$phone_no.$md5_cert_no);
+        
+        // 성인인증결과
+        $adult_day = date("Ymd", strtotime("-19 years", G5_SERVER_TIME));
+        $adult = ((int)$birth_day <= (int)$adult_day) ? 1 : 0;
+        
+        set_session("ss_cert_type",    $cert_type);
+        set_session("ss_cert_no",      $md5_cert_no);
+        set_session("ss_cert_hash",    $hash_data);
+        set_session("ss_cert_adult",   $adult);
+        set_session("ss_cert_birth",   $birth_day);
+        set_session("ss_cert_sex",     ($sex_code=="01"?"M":"F")); // 이니시스 간편인증은 성별정보 리턴 없음
+        set_session('ss_cert_dupinfo', $mb_dupinfo);
+        set_session('ss_cert_mb_id', $row['mb_id']);
     }
     else if( $res_cd != "0000" )
     {

programming_language: PHP
filename: find_AuthOnlyRes.php
change_type: ModificationType.MODIFY
diff: @@ -136,8 +136,25 @@ if ($xpay->TX()) {
                 alert_close("인증하신 정보로 가입된 회원정보가 없습니다.");
                 exit;
             }
+        }else{
+            $mb_dupinfo = $md5_ci;
         }
-
+        
+        $md5_cert_no = md5($cert_no);
+        $hash_data   = md5($user_name.$cert_type.$birth_day.$phone_no.$md5_cert_no);
+        
+        // 성인인증결과
+        $adult_day = date("Ymd", strtotime("-19 years", G5_SERVER_TIME));
+        $adult = ((int)$birth_day <= (int)$adult_day) ? 1 : 0;
+        
+        set_session("ss_cert_type",    $cert_type);
+        set_session("ss_cert_no",      $md5_cert_no);
+        set_session("ss_cert_hash",    $hash_data);
+        set_session("ss_cert_adult",   $adult);
+        set_session("ss_cert_birth",   $birth_day);
+        set_session("ss_cert_sex",     $mb_sex); // 이니시스 간편인증은 성별정보 리턴 없음
+        set_session('ss_cert_dupinfo', $mb_dupinfo);
+        set_session('ss_cert_mb_id', $row['mb_id']);
     } else {
         //인증요청 결과 실패 DB처리
         //echo "인증요청 결과 실패 DB처리하시기 바랍니다.<br>";

programming_language: PHP
filename: find_hpcert2.php
change_type: ModificationType.MODIFY
diff: @@ -121,8 +121,26 @@ if (empty($row['mb_id'])) { // ci로 등록된 계정이 없다면
         alert_close("인증하신 정보로 가입된 회원정보가 없습니다.");
         exit;
     }
+}else{
+    $mb_dupinfo = $md5_ci;
 }
 
+$md5_cert_no = md5($cert_no);
+$hash_data   = md5($user_name.$cert_type.$birth_day.$phone_no.$md5_cert_no);
+
+// 성인인증결과
+$adult_day = date("Ymd", strtotime("-19 years", G5_SERVER_TIME));
+$adult = ((int)$birth_day <= (int)$adult_day) ? 1 : 0;
+
+set_session("ss_cert_type",    $cert_type);
+set_session("ss_cert_no",      $md5_cert_no);
+set_session("ss_cert_hash",    $hash_data);
+set_session("ss_cert_adult",   $adult);
+set_session("ss_cert_birth",   $birth_day);
+set_session('ss_cert_sex',     ($field[9] == 1 ? 'M' : 'F'));
+set_session('ss_cert_dupinfo', $mb_dupinfo);
+set_session('ss_cert_mb_id', $row['mb_id']);
+
 $g5['title'] = 'KCB 휴대폰 본인확인';
 include_once(G5_PATH.'/head.sub.php');
 ?>

programming_language: PHP
filename: find_ipin2.php
change_type: ModificationType.MODIFY
diff: @@ -95,7 +95,26 @@ if (empty($row['mb_id'])) { // ci로 등록된 계정이 없다면
         alert_close("인증하신 정보로 가입된 회원정보가 없습니다.");
         exit;
     }
+}else{
+    $mb_dupinfo = $md5_ci;
 }
+
+$md5_cert_no = md5($cert_no);
+$hash_data   = md5($user_name.$cert_type.$birth_day.$phone_no.$md5_cert_no);
+
+// 성인인증결과
+$adult_day = date("Ymd", strtotime("-19 years", G5_SERVER_TIME));
+$adult = ((int)$birth_day <= (int)$adult_day) ? 1 : 0;
+
+set_session("ss_cert_type",    $cert_type);
+set_session("ss_cert_no",      $md5_cert_no);
+set_session("ss_cert_hash",    $hash_data);
+set_session("ss_cert_adult",   $adult);
+set_session("ss_cert_birth",   $birth_day);
+set_session('ss_cert_sex',     ($field[9] == 1 ? 'M' : 'F'));
+set_session('ss_cert_dupinfo', $mb_dupinfo);
+set_session('ss_cert_mb_id', $row['mb_id']);
+
 $g5['title'] = 'KCB 아이핀 본인확인';
 include_once(G5_PATH.'/head.sub.php');
 ?>

programming_language: PHP
filename: password_reset.skin.php
change_type: ModificationType.MODIFY
diff: @@ -12,7 +12,8 @@ add_stylesheet('<link rel="stylesheet" href="' . $member_skin_url . '/style.css"
             <fieldset id="info_fs">
                 <p>새로운 비밀번호를 입력해주세요.</p>
                 <label for="mb_id" class="sound_only">아이디</label>
-                <input type="text" name="mb_id" id="mb_id" value="<?php echo $_POST['mb_id']; ?>" required class="required frm_input full_input" size="30" placeholder="아이디" readonly>
+                <br>
+                <b>회원 아이디 : <?php echo $_POST['mb_id']; ?></b>
                 <label for="mb_pw" class="sound_only">새 비밀번호<strong class="sound_only">필수</strong></label>
                 <input type="password" name="mb_password" id="mb_pw" required class="required frm_input full_input" size="30" placeholder="새 비밀번호">
                 <label for="mb_pw2" class="sound_only">새 비밀번호 확인<strong class="sound_only">필수</strong></label>

programming_language: PHP
filename: password_reset.skin.php
change_type: ModificationType.MODIFY
diff: @@ -12,7 +12,8 @@ add_stylesheet('<link rel="stylesheet" href="' . $member_skin_url . '/style.css"
             <fieldset id="info_fs">
                 <p>새로운 비밀번호를 입력해주세요.</p>
                 <label for="mb_id" class="sound_only">아이디</label>
-                <input type="text" name="mb_id" id="mb_id" value="<?php echo $_POST['mb_id']; ?>" required class="required frm_input full_input" size="30" placeholder="아이디" readonly>
+                <br>
+                <b>회원 아이디 : <?php echo $_POST['mb_id']; ?></b>
                 <label for="mb_pw" class="sound_only">새 비밀번호<strong class="sound_only">필수</strong></label>
                 <input type="password" name="mb_password" id="mb_pw" required class="required frm_input full_input" size="30" placeholder="새 비밀번호">
                 <label for="mb_pw2" class="sound_only">새 비밀번호 확인<strong class="sound_only">필수</strong></label>

programming_language: PHP
filename: password_reset.skin.php
change_type: ModificationType.MODIFY
diff: @@ -12,7 +12,8 @@ add_stylesheet('<link rel="stylesheet" href="' . $member_skin_url . '/style.css"
             <fieldset id="info_fs">
                 <p>새로운 비밀번호를 입력해주세요.</p>
                 <label for="mb_id" class="sound_only">아이디</label>
-                <input type="text" name="mb_id" id="mb_id" value="<?php echo $_POST['mb_id']; ?>" required class="required frm_input full_input" size="30" placeholder="아이디" readonly>
+                <br>
+                <b>회원 아이디 : <?php echo $_POST['mb_id']; ?></b>
                 <label for="mb_pw" class="sound_only">새 비밀번호<strong class="sound_only">필수</strong></label>
                 <input type="password" name="mb_password" id="mb_pw" required class="required frm_input full_input" size="30" placeholder="새 비밀번호">
                 <label for="mb_pw2" class="sound_only">새 비밀번호 확인<strong class="sound_only">필수</strong></label>

programming_language: PHP