
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
add method to erb. Protect from XSS attack.
I think change the origin <%=
method is not always good. maybe add a <%~
method is better.
$ gem install erb_safe_ext
<%~ "<script>alert('safety:)');</script>" %>
## <script>alert('safety:)');</script>
<%= "<script>alert('danger!');</script>" %>
## <script>alert('danger!');</script>
require 'erb_safe_ext'
template = ERB.new <<-EOF
<%~ "<script>alert('safety:)');</script>" %>
<%= "<script>alert('danger!');</script>" %>
----finish----
EOF
puts template.result
<%= "<script>alert('safety:)');</script>" %>
## <script>alert('safety:)');</script>
it will default wrap the dangerous code with ERB::Util.html_escape(code)
works fine with ruby2.0.
the <%==
is the backup of ERB's original <%=
function.
<%== "<script>alert('danger!');</script>" %>
## <script>alert('danger!');</script>
require 'erb_safe_ext'
template = ERB.new <<-EOF
<%= "<script>alert('safety:)');</script>" %>
<%#= 'here' -%>
<%== "<script>alert('danger!');</script>" %>
----finish----
EOF
puts template.result
work fine with sinatra(current version is 1.4.4).
but don't do following things:
require 'erubis'
add gems that dependent on erubis, such as better_errors
(you may find out all dependences in file Gemfile.lock
)
the original sinatra exception template display ugly with erb_safe_ext, so I rewrite it.
require 'sinatra/base'
require 'erb_safe_ext/sinatra/exception_template'
FAQs
Unknown package
We found that erb_safe_ext demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.