
100만 이상을 벌어야 플래그를 준다.

메인함수를 보면 asktitle() 함수를 호출하는것을 알 수 있다.
==================================asktitle 함수 소스===================================
void asktitle() // Function for asking player if they want to continue
{
char choice1;
int choice2;
printf("\n
Are You Ready?");
printf("\n
----------------");
printf("\n
(Y/N)\n
");
scanf("\n%c",&choice1);
while((choice1!='Y') &&
(choice1!='y') && (choice1!='N') && (choice1!='n')) // If
invalid choice entered
{
printf("\n");
printf("Incorrect
Choice. Please Enter Y for Yes or N for No.\n");
scanf("%c",&choice1);
}
if((choice1 == 'Y') || (choice1
== 'y')) // If yes, continue. Prints menu.
{
system("cls");
printf("\nEnter
1 to Begin the Greatest Game Ever Played.");
printf("\nEnter
2 to See a Complete Listing of Rules.");
printf("\nEnter
3 to Exit Game. (Not Recommended)");
printf("\nChoice:
");
scanf("%d",
&choice2); // Prompts user for choice
if((choice2<1)
|| (choice2>3)) // If invalid choice entered
{
printf("\nIncorrect
Choice. Please enter 1, 2 or 3\n");
scanf("%d",
&choice2);
}
switch(choice2)
// Switch case for different choices
{
case 1: // Case to begin game
system("cls");
play();
break;
case 2: // Case to see rules
system("cls");
rules();
break;
case 3: // Case to exit game
printf("\nYour
day could have been perfect.");
printf("\nHave
an almost perfect day!\n\n");
system("pause");
exit(0);
break;
default:
printf("\nInvalid
Input");
}
// End switch case
} // End if loop
else if((choice1 == 'N') || (choice1 == 'n')) //
If no, exit program
{
printf("\nYour
day could have been perfect.");
printf("\nHave
an almost perfect day!\n\n");
system("pause");
exit(0);
}
return;
} // End function
함수를 따라가다보면 play 함수를 호출 하는 것을 알 수 있다.

play함수의 윗부분이다. dealer 함수와 betting 함수를 호출한다.

딜러의 점수를 계산해주는 함수이다.

betting 하는 금액을 처리하는 함수이다.
배팅하는 함수를 보면 player가 가진돈보다 많은 금액 베팅을 검사하는 부분이 있다.
그러나 해당 검증을 한번만 검증하기 때문에 취약점이 발생한다.
위 부분을 이용하기 위해서는 백만원 이상의 금액을 두번 입력해주면 성공적으로 금액을 베팅할 수 있다.
이후 해당게임을 한번만 이기면 성공적으로 플래그를 얻을 수 있다.


플래그 출력
정상적으로 작동하지만 내부에서 논리적인 오류를 일으킬 수 있다. 소스분석을 좀더 열심히 해야할 거 같다.