【ctfshow】 web29 10

博客围绕Web安全展开,在阅读源码发现匹配中不能出现flag字段后,介绍了运用readfile函数加scandir方法读取flag的方式,通过查看数组下标进行访问。此外,还提及可使用file_get_contents和highlight_file函数来读取。

题目简介:

在这里插入图片描述
在这里插入图片描述大概地阅读源码后发现,匹配中不能出现flag字段,那么我们可以运用readfile函数加上scandir的方法将它读取出来,运用数组下标~~
先看一下数组下标是多少
在这里插入图片描述我们发现是2,那么访问一下
在这里插入图片描述在这里插入图片描述
查看源码,成功拿到flag
在这里插入图片描述

还可以使用file_get_contents函数进行读取

在这里插入图片描述

也可以使用常见的highlight_file函数
在这里插入图片描述
在这里插入图片描述

### CTFShow Web29 Challenge Overview and Solution In the realm of Capture The Flag (CTF) competitions, platforms like CTFShow offer various challenges to hone cybersecurity skills. For the specific case of **Web29**, this challenge revolves around web security vulnerabilities that participants must exploit to gain access to a flag. The primary focus of Web29 is on SQL injection attacks within a login form interface[^1]. Participants are presented with an authentication page where they can input usernames and passwords. By manipulating these inputs using crafted SQL queries, one can bypass standard validation mechanisms set by the application developers. To solve Web29 successfully: A common technique involves injecting malicious code into both fields simultaneously while observing how responses change based upon different payloads used during testing phases. An effective payload might look something similar but not limited to `admin' --` which effectively comments out any remaining part of original query string after username field thus allowing unauthorized entry as administrator without needing actual credentials. Once authenticated through such means, further exploration inside backend systems may reveal hidden directories containing files necessary for completing task objectives—such as text documents holding flags required for submission back onto platform scoring system. ```python import requests url = "http://example.com/login" payloads = ["admin' --", "' OR '1'='1"] for p in payloads: data = {'username': p, 'password': ''} response = requests.post(url, data=data) if "Welcome admin" in response.text: print(f"[+] Successfully logged in with payload: {p}") break ``` This approach highlights fundamental principles behind exploiting insecure coding practices found across many real-world applications today; however, it should only be practiced within legal boundaries provided specifically designed environments meant for learning purposes alone—not against live sites without explicit permission from owners involved beforehand.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值