CTF实战练习:web-Loginme

本文为看雪论坛优秀文章
看雪论坛作者ID:H3h3QAQ

package middleware
import (
"github.com/gin-gonic/gin"
)
func LocalRequired() gin.HandlerFunc {
return func(c *gin.Context) {
if c.GetHeader("x-forwarded-for") != "" || c.GetHeader("x-client-ip") != "" {
c.AbortWithStatus(403)
return
}
ip := c.ClientIP()
if ip == "127.0.0.1" {
c.Next()
} else {
c.AbortWithStatus(401)
}
}
}
Gin is a web framework written in Go (Golang). It features a martini-like API with performance that is up to 40 times faster thanks to httprouter. If you need performance and good productivity, you will love Gin.
-------------------------------------------------------------------------------
Gin 是一个用 Go (Golang) 编写的 Web 框架。它具有类似martini-like的 API,由于 httprouter,性能提高了 40 倍。如果您需要性能和良好的生产力,您会喜欢 Gin。
func LocalRequired() gin.HandlerFunc {
return func(c *gin.Context) {
if c.GetHeader("x-forwarded-for") != "" || c.GetHeader("x-client-ip") != "" {
c.AbortWithStatus(403)
return
}
ip := c.ClientIP()
if ip == "127.0.0.1" {
c.Next()
} else {
c.AbortWithStatus(401)
}
}
}
if c.GetHeader("x-forwarded-for") != "" || c.GetHeader("x-client-ip") != "" {
c.AbortWithStatus(403)
return
}


1、首先构造ip伪造;
2、在age变量中存在ssti信息泄露出flag;

看雪ID:H3h3QAQ
https://bbs.pediy.com/user-home-921448.htm

# 往期推荐


球分享

球点赞

球在看

点击“阅读原文”,了解更多!
[广告]赞助链接:
关注数据与安全,洞悉企业级服务市场:https://www.ijiandao.com/
让资讯触达的更精准有趣:https://www.0xu.cn/

随时掌握互联网精彩
- 宝塔面板宣布调整版本更新节奏 将提供LTS版长期维护提供更好的稳定性
- 谷歌发布Chrome 137.0.7151.69版紧急安全更新修复CVE-2025-5419漏洞
- Superfile现代且时尚的终端文件管理器
- Umami一款开源的网站统计工具!
- Setapp自4月25日停止家庭版计划 无法再通过家庭版拼车订阅软件
- "你的连接不是专用连接"如何解决?
- SeekAll:AI聚合搜索浏览器扩展插件
- 高通创投领投阿加犀Pre-A轮融资,加速AIoT应用场景落地
- 在Z|极盾科技(高至35K/月)诚招安全解决方案专家、安全算法工程师
- Nginx服务器证书部署
- POC | 悬镜安全:新一代代码灰盒安全测试
- 一张SSL证书可以给几个域名使用?
赞助链接