- 필수 기능
- 시작하기
- Glossary
- 표준 속성
- Guides
- Agent
- 통합
- 개방형텔레메트리
- 개발자
- Administrator's Guide
- API
- Datadog Mobile App
- CoScreen
- Cloudcraft
- 앱 내
- 서비스 관리
- 인프라스트럭처
- 애플리케이션 성능
- APM
- Continuous Profiler
- 스팬 시각화
- 데이터 스트림 모니터링
- 데이터 작업 모니터링
- 디지털 경험
- 소프트웨어 제공
- 보안
- AI Observability
- 로그 관리
- 관리
ID: csharp-security/avoid-autobinding
Language: C#
Severity: Warning
Category: Security
CWE: 915
The product receives input from an upstream component that specifies multiple attributes, properties, or fields that are to be initialized or updated in an object, but it does not properly control which attributes can be modified.
If the object contains attributes that were only intended for internal use, then their unexpected modification could lead to a vulnerability.
This weakness is sometimes known by the language-specific mechanisms that make it possible, such as mass assignment, autobinding, or object injection.
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using WebGoatCore.ViewModels;
namespace WebGoatCore.Controllers
{
[AllowAnonymous]
[IgnoreAntiforgeryToken]
public class StatusCodeController : Controller
{
public const string NAME = "StatusCode";
public StatusCodeController()
{
mycall = mycall + 1;
View(mycall));
}
[HttpGet, Route(NAME)]
public IActionResult StatusCodeView([FromQuery] int code, int morecode, [Bind] int some)
{
var foo = bar + baz;
var view = View(StatusCodeViewModel.Create(new ApiResponse(code)));
view.StatusCode = code;
return view;
}
public OtherStatusCodeController()
{
View(mycall));
}
}
}
using Microsoft.AspNetCore.Authorization;
using WebGoatCore.ViewModels;
namespace WebGoatCore.Controllers
{
[AllowAnonymous]
[IgnoreAntiforgeryToken]
public class StatusCodeController : Controller
{
public const string NAME = "StatusCode";
public StatusCodeController()
{
mycall = mycall + 1;
View(mycall));
}
[HttpGet, Route(NAME)]
public IActionResult StatusCodeView(int code, int morecode, [Bind] int some)
{
var view = View(StatusCodeViewModel.Create(new ApiResponse(morecode)));
view.StatusCode = code;
return view;
}
public OtherStatusCodeController()
{
View(mycall));
}
}
}
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using WebGoatCore.ViewModels;
namespace WebGoatCore.Controllers
{
[AllowAnonymous]
[IgnoreAntiforgeryToken]
public class StatusCodeController : Controller
{
public const string NAME = "StatusCode";
public StatusCodeController()
{
mycall = mycall + 1;
View(mycall));
}
[HttpGet, Route(NAME)]
public NotIActionResult StatusCodeView([FromQuery] int code, int morecode, [Bind] int some)
{
var view = View(StatusCodeViewModel.Create(new ApiResponse(code)));
view.StatusCode = code;
return view;
}
public OtherStatusCodeController()
{
View(mycall));
}
}
}
using Microsoft.AspNetCore.Authorization;
using WebGoatCore.ViewModels;
namespace WebGoatCore.Controllers
{
[AllowAnonymous]
[IgnoreAntiforgeryToken]
public class StatusCodeController : Controller
{
public const string NAME = "StatusCode";
public StatusCodeController()
{
mycall = mycall + 1;
View(mycall));
}
[HttpGet, Route(NAME)]
public IActionResult StatusCodeView([Bind] int code, int morecode, [Bind] int some)
{
var view = View(StatusCodeViewModel.Create(new ApiResponse(morecode)));
view.StatusCode = code;
return view;
}
public OtherStatusCodeController()
{
View(mycall));
}
}
}
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using WebGoatCore.ViewModels;
namespace WebGoatCore.Controllers
{
[AllowAnonymous]
[IgnoreAntiforgeryToken]
public class StatusCodeController : Controller
{
public const string NAME = "StatusCode";
public StatusCodeController()
{
mycall = mycall + 1;
View(mycall));
}
[HttpGet, Route(NAME)]
public IActionResult StatusCodeView([FromQuery] int code, int morecode, [Bind] int some)
{
try {
validateCode(code);
} catch exception(e) {
return View(401);
}
var view = View(StatusCodeViewModel.Create(new ApiResponse(code)));
view.StatusCode = code;
return view;
}
public OtherStatusCodeController()
{
View(mycall));
}
}
}