Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Captcha Bypass #60

Merged
merged 9 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ RUN apt-get install -y \
php-cgi \
php-cli \
php-common \
php-gd \
php-curl \
php-dev \
php-json \
Expand Down
Binary file added app/lab/captcha-bypass/bypass1/captcha.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/lab/captcha-bypass/bypass1/comment.db
Binary file not shown.
12 changes: 12 additions & 0 deletions app/lab/captcha-bypass/bypass1/en.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
title="Captcha-ByPass"
text="Captcha Verification"
finish="Captcha verification successful, note added."
notfinish="Captcha verification failed, note not added."
comment="Enter your comment:"
herecomment="Write your comment here"
comment1="Think Simple :)"
comment2="Take advantage of Source Codes!"
captcha="Enter the captcha"
button="Confirm"
comments="Comments"
reset="Reset Table"
12 changes: 12 additions & 0 deletions app/lab/captcha-bypass/bypass1/fr.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
title="Captcha-ByPass"
text="Vérification de captcha"
finish="Vérification Captcha réussie, note ajoutée."
notfinish="Vérification Captcha réussie, note non ajoutée"
comment="Entrez votre commentaire :"
herecomment="Ecrivez votre commentaire ici"
comment1="Pensez simple :)"
comment2="Profitez des codes sources !"
captcha="Entrez le captcha"
button="Confirmer"
comments="Commentaires"
reset="Réinitialiser le tableau"
270 changes: 270 additions & 0 deletions app/lab/captcha-bypass/bypass1/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,270 @@
<?php
session_start();
require("../../../lang/lang.php");
$strings = tr();


$db = new PDO('sqlite:comment.db');

$stmt1 = $db->prepare("SELECT id FROM comments WHERE id IN (1, 2)");
$stmt1->execute();
$selected_ids = $stmt1->fetchAll(PDO::FETCH_COLUMN);


if (count($selected_ids) != 2) {


$stmt2 = $db->prepare("INSERT INTO comments (id, comment) VALUES (:id, :comment)");


$comments = [$strings['comment1'], $strings['comment2']];
$ids = [1, 2];
foreach ($comments as $index => $comment) {
$stmt2->bindParam(':id', $ids[$index]);
$stmt2->bindParam(':comment', $comment);
$stmt2->execute();
}
}

$results = $db->prepare("SELECT comment FROM comments");
$results->execute();




function generateCaptcha($width, $height, $length = 6)
{

$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$charactersLength = strlen($characters);
$captcha = '';
$image = imagecreatetruecolor($width, $height);


$bgColor = imagecolorallocate($image, rand(200, 255), rand(200, 255), rand(200, 255));
imagefill($image, 0, 0, $bgColor);

for ($i = 0; $i < 500; $i++) {
$pointColor = imagecolorallocate($image, rand(0, 255), rand(0, 255), rand(0, 255));
imagesetpixel($image, rand(0, $width), rand(0, $height), $pointColor);
}


for ($i = 0; $i < 10; $i++) {
$lineColor = imagecolorallocate($image, rand(0, 255), rand(0, 255), rand(0, 255));
imageline($image, rand(0, $width), rand(0, $height), rand(0, $width), rand(0, $height), $lineColor);
}


for ($i = 0; $i < $length; $i++) {
$char = $characters[rand(0, $charactersLength - 1)];
$captcha .= $char;
$textColor = imagecolorallocate($image, rand(0, 150), rand(0, 150), rand(0, 150));
imagestring($image, 5, 30 * $i + 10, rand(10, 20), $char, $textColor);
}


$imagePath = 'captcha.png';
imagepng($image, $imagePath);
imagedestroy($image);

return array('captcha' => $captcha, 'imagePath' => $imagePath);
}


$captchaData = generateCaptcha(200, 50);
$captchaValue = $captchaData['captcha'];
$captchaImagePath = $captchaData['imagePath'];

if (!isset($_SESSION['captchas'])) {
$_SESSION['captchas'] = array();
}

if (!isset($_SESSION['input'])) {
$_SESSION['input'] = false;
}



array_push($_SESSION['captchas'], $captchaValue);

if ($_SERVER["REQUEST_METHOD"] == "POST") {
$submitted_captcha = $_POST['captcha'];
$_SESSION['input'] = true;

if (in_array($submitted_captcha, $_SESSION['captchas'])) {
$comment = $_POST['user_comment'];
$stmt = $db->prepare("INSERT INTO comments (comment) VALUES (:comment)");
$stmt->bindParam(':comment', $comment);
$stmt->execute();

header("location:/lab/captcha-bypass/bypass1/index.php?success=1");
exit();
} else {
header("location:/lab/captcha-bypass/bypass1/index.php?error=1");
exit();
}
}

?>

<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><?php echo "Captcha Bypass"; ?></title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap" rel="stylesheet">

<style>
body {
font-family: 'Roboto', sans-serif;
background-color: #f8f9fa;
}

.container {
margin-top: 50px;
}

.form-container {
background-color: #fff;
padding: 30px;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

.form-title {
text-align: center;
margin-bottom: 30px;
}

.form-group label {
font-weight: bold;
}

.captcha-container {
text-align: center;
margin-top: 20px;
}

.captcha-image {
margin-bottom: 10px;
}

.table-container {
margin-top: 50px;
}

.table {
background-color: #fff;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

.table th,
.table td {
border: none;
padding: 12px 15px;
text-align: left;
}

.table th {
background-color: #007bff;
color: #fff;
}

.table tbody tr:nth-child(even) {
background-color: #f2f2f2;
}

.btn-submit {
background-color: #007bff;
border-color: #007bff;
}

.btn-submit:hover {
background-color: #0056b3;
border-color: #0056b3;
}

.alert {
border-radius: 10px;
}

.alert-danger {
background-color: #f8d7da;
border-color: #f5c6cb;
color: #721c24;
}

.alert-success {
background-color: #d4edda;
border-color: #c3e6cb;
color: #155724;
}
</style>

</head>

<body>
<div class="container">
<div class="row justify-content-center">
<div class="col-md-6 form-container">
<h2 class="form-title"><?php echo $strings['text']; ?></h2>
<?php if ($_GET["error"] == 1 && $_SESSION["input"]) : ?>
<div class='alert alert-danger text-center' role='alert'>
<strong><?php echo $strings['notfinish']; ?></strong>
<?php $_SESSION['input'] = false; ?>
</div>
<?php elseif ($_GET["success"] == 1 && $_SESSION["input"]) : ?>
<div class='alert alert-success text-center' role='alert'>
<strong><?php echo $strings['finish']; ?></strong>
<?php $_SESSION['input'] = false; ?>
</div>
<?php endif; ?>
<form method="post" action="index.php" class="post">
<div class="form-group">
<label for="user_comment"><?php echo $strings['comment']; ?></label>
<textarea class="form-control" id="user_comment" name="user_comment" rows="4" placeholder="<?php echo $strings['herecomment']; ?>"></textarea>
</div>
<div class="captcha-container">
<img src="<?= $captchaImagePath ?>" alt="Captcha Resmi" class="captcha-image"><br>
<input placeholder="<?php echo $strings['captcha']; ?>" type="text" class="form-control" id="captcha" name="captcha" required>
</div>
<button type="submit" class="btn btn-primary btn-lg btn-block mt-3 btn-submit"><?php echo $strings['button']; ?></button>
</form>
</div>
</div>
</div>

<div class="container table-container">
<form method="post" action="reset_table.php" style="margin-bottom: 8px">
<button type="submit" class="btn btn-danger"><?php echo $strings['reset']; ?></button>
</form>
<table class='table'>
<thead>
<tr>
<th>#</th>
<th><?php echo $strings['comments']; ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($results as $index => $comment) : ?>
<tr>
<td><?= $index + 1 ?></td>
<td><?= htmlspecialchars($comment['comment']) ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>

</div>

</body>

</html>


<script id="VLBar" title="<?= $strings["title"]; ?>" category-id="13" src="/public/assets/js/vlnav.min.js"></script>
12 changes: 12 additions & 0 deletions app/lab/captcha-bypass/bypass1/reset_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php
// Veritabanı bağlantısı
$db = new PDO('sqlite:comment.db');

// 1 ve 2 ID'ye sahip comment'lar hariç tüm comment'ları sil
$stmt = $db->prepare("DELETE FROM comments ");
$stmt->execute();

// Ana sayfaya yönlendirme
header("Location: /lab/captcha-bypass/bypass1/index.php");
exit();
?>
12 changes: 12 additions & 0 deletions app/lab/captcha-bypass/bypass1/tr.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
title="Captcha-ByPass"
text="Captcha Doğrulama"
finish="Captcha Doğrulama Başarılı,Not Eklendi."
notfinish="Captcha Bypass Başarısız,Not Eklenemedi."
comment="Yorumunuzu giriniz"
herecomment="Yorumunuzu buraya yazınız"
comment1="Basit Düşün:)"
comment2="Kaynak Kodlardan yararlan!"
captcha="Captchayı giriniz"
button="Doğrula"
comments="Yorumlar"
reset="Tabloyu sıfırla"
Binary file modified app/lab/race-condition/race-condition1/database.db
Binary file not shown.
Binary file modified app/lab/xss/basic-stored/database.db
Binary file not shown.
Binary file modified app/lab/xss/news/hackernews.db
Binary file not shown.
36 changes: 35 additions & 1 deletion app/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -1036,7 +1036,6 @@

]
},

{
"id": 13,
"title": {
Expand Down Expand Up @@ -1071,5 +1070,40 @@
"vulnID": 13
}
]
},
{
"id": 14,
"title": {
"en": "Captcha Bypass",
"tr": "Captcha Bypass",
"fr": "Captcha Bypass",
"ar": ""
},
"description": {
"en": "CAPTCHA bypass methods are techniques developed to circumvent security measures on websites. These methods typically aim to exploit computer programming and artificial intelligence techniques to allow non-human automated bots to solve or bypass CAPTCHA challenges. This facilitates activities such as spam submissions, account creation bots, and other automated malicious activities. However, such methods are considered unethical and illegal, and are constantly monitored by website owners for detection and mitigation.",
"tr": "CAPTCHA bypass, web sitelerindeki güvenlik önlemlerini aşmak amacıyla geliştirilen yöntemlerdir. Bu yöntemler, genellikle bilgisayar programlama ve yapay zeka tekniklerinin karmaşık kombinasyonlarını kullanarak, insan olmayan otomatik botların CAPTCHA'yı çözmesini veya geçmesini sağlar. Bu sayede, spam gönderimleri, hesap oluşturma botları ve diğer otomatik kötü niyetli faaliyetlerin gerçekleştirilmesi amaçlanır. Ancak, bu tür yöntemler etik dışı ve yasa dışı kabul edilir ve web sitesi sahipleri tarafından tespit edilerek önlem alınması için sürekli olarak izlenirler.",
"fr": "Les méthodes de contournement de CAPTCHA sont des techniques développées pour contourner les mesures de sécurité sur les sites Web. Ces méthodes visent généralement à exploiter la programmation informatique et les techniques d'intelligence artificielle pour permettre aux robots automatisés non humains de résoudre ou de contourner les défis CAPTCHA. Cela facilite des activités telles que les soumissions de spam, les robots de création de compte et d'autres activités malveillantes automatisées. Cependant, de telles méthodes sont considérées comme contraires à l'éthique et illégales, et sont constamment surveillées par les propriétaires de sites Web pour la détection et l'atténuation.",
"ar": ""
},
"imgURL": "public/assets/img/vulns/captcha.png",
"labs": [
{
"id": 1,
"title": {
"en": "Captcha Bypass",
"tr": "Captcha Bypass",
"fr": "Captcha Bypass",
"ar": ""
},
"description": {
"en": "Get rid of CAPTCHA with the help of ROBOTS! Remember, CAPTCHA is constantly being refreshed.",
"tr": "ROBOTlardan yardım alarak Captchadan kurtulun! Unutmayın, captcha sürekli yenileniyor:)",
"fr": "Débarrassez-vous de CAPTCHA avec l'aide des ROBOTS! N'oubliez pas, CAPTCHA est constamment rafraîchi.",
"ar": ""
},
"url": "/lab/captcha-bypass/bypass1",
"vulnID": 14
}
]
}
]
Binary file added app/public/assets/img/vulns/captcha.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading