关联漏洞
标题:
Apache Tapestry 代码问题漏洞
(CVE-2021-27850)
描述:Apache Tapestry是美国阿帕奇(Apache)基金会的一款使用Java语言编写的Web应用程序框架。 Apache Tapestry 5.7.0, upgrade to 5.7.1 or later 存在安全漏洞,攻击者可利用该漏洞可以通过请求URL“http: localhost:8080 assets something services AppModule.class”下载文件“AppModule.class”,该URL包含一个HMAC密钥。
描述
A Proof of concept for CVE-2021-27850 affecting Apache Tapestry and leading to unauthencticated remote code execution.
介绍
# CVE-2021-27850 Exploit #
## Overview ##
CVE-2021-27850 is a critical unauthenticated remote code execution vulnerability that was found in all recent versions of Apache Tapestry, by downloading the AppModule.class file we can leak the HMAC Secret key used to sign all the serialized objects in apache Tapestry.
We encountered this CVE in a real life assessment and as far as I know there are no public exploits available on how Tapestry signs the serialized objects so we decided to publish the following POC that we have used after digging in apache Tapestry source code for a long time x) .
## Usage ##
1- Clone this repo
2- Run the following command
```sh
javac -classpath commons-codec-1.15/commons-codec-1.15.jar:. Exploit.java
```
3- Finally run the following:
```sh
java -cp commons-codec-1.15/commons-codec-1.15.jar:. Exploit [Tapestry Key] [Ysoserial Payload] [Command To Execute]
```
Where [Tapestry Key] is the Hmac key leaked from the AppModule.class , [Ysoserial Payload] is the payload you want to use from ysoserial and [Command To Execute] the command you want to execute.

**Note:** Unlike the usual Java deserialization exploits where the commands you run are limited ( no pipes or special chars .. ) you can use here any complex command you want since we are appending the following before executing the command ``` sh -c $@|sh . echo ``` .
**References:**
http://cve.mitre.org/cgi-bin/cvename.cgi?name=2021-27850
https://github.com/apache/tapestry-5
文件快照
[4.0K] /data/pocs/50ca14e4ccff8b72dea98d4026c733a609fb59a6
├── [4.0K] commons-codec-1.15
│ ├── [4.0K] apidocs
│ │ ├── [ 12K] allclasses-frame.html
│ │ ├── [ 11K] allclasses-noframe.html
│ │ ├── [ 27K] constant-values.html
│ │ ├── [ 35K] deprecated-list.html
│ │ ├── [8.8K] help-doc.html
│ │ ├── [360K] index-all.html
│ │ ├── [2.9K] index.html
│ │ ├── [4.0K] org
│ │ │ └── [4.0K] apache
│ │ │ └── [4.0K] commons
│ │ │ └── [4.0K] codec
│ │ │ ├── [4.0K] binary
│ │ │ │ ├── [ 19K] Base16.html
│ │ │ │ ├── [ 20K] Base16InputStream.html
│ │ │ │ ├── [ 20K] Base16OutputStream.html
│ │ │ │ ├── [ 29K] Base32.html
│ │ │ │ ├── [ 22K] Base32InputStream.html
│ │ │ │ ├── [ 22K] Base32OutputStream.html
│ │ │ │ ├── [ 50K] Base64.html
│ │ │ │ ├── [ 23K] Base64InputStream.html
│ │ │ │ ├── [ 23K] Base64OutputStream.html
│ │ │ │ ├── [ 50K] BaseNCodec.html
│ │ │ │ ├── [ 28K] BaseNCodecInputStream.html
│ │ │ │ ├── [ 26K] BaseNCodecOutputStream.html
│ │ │ │ ├── [ 27K] BinaryCodec.html
│ │ │ │ ├── [ 10K] CharSequenceUtils.html
│ │ │ │ ├── [4.0K] class-use
│ │ │ │ │ ├── [4.5K] Base16.html
│ │ │ │ │ ├── [4.6K] Base16InputStream.html
│ │ │ │ │ ├── [4.7K] Base16OutputStream.html
│ │ │ │ │ ├── [4.5K] Base32.html
│ │ │ │ │ ├── [4.6K] Base32InputStream.html
│ │ │ │ │ ├── [4.7K] Base32OutputStream.html
│ │ │ │ │ ├── [4.5K] Base64.html
│ │ │ │ │ ├── [4.6K] Base64InputStream.html
│ │ │ │ │ ├── [4.7K] Base64OutputStream.html
│ │ │ │ │ ├── [9.5K] BaseNCodec.html
│ │ │ │ │ ├── [7.7K] BaseNCodecInputStream.html
│ │ │ │ │ ├── [7.7K] BaseNCodecOutputStream.html
│ │ │ │ │ ├── [4.6K] BinaryCodec.html
│ │ │ │ │ ├── [4.6K] CharSequenceUtils.html
│ │ │ │ │ ├── [4.5K] Hex.html
│ │ │ │ │ └── [4.6K] StringUtils.html
│ │ │ │ ├── [ 64K] Hex.html
│ │ │ │ ├── [2.7K] package-frame.html
│ │ │ │ ├── [ 10K] package-summary.html
│ │ │ │ ├── [ 11K] package-tree.html
│ │ │ │ ├── [6.3K] package-use.html
│ │ │ │ └── [ 52K] StringUtils.html
│ │ │ ├── [ 10K] BinaryDecoder.html
│ │ │ ├── [ 10K] BinaryEncoder.html
│ │ │ ├── [ 20K] CharEncoding.html
│ │ │ ├── [ 28K] Charsets.html
│ │ │ ├── [4.0K] class-use
│ │ │ │ ├── [ 11K] BinaryDecoder.html
│ │ │ │ ├── [ 11K] BinaryEncoder.html
│ │ │ │ ├── [4.5K] CharEncoding.html
│ │ │ │ ├── [4.4K] Charsets.html
│ │ │ │ ├── [ 20K] CodecPolicy.html
│ │ │ │ ├── [ 26K] DecoderException.html
│ │ │ │ ├── [ 14K] Decoder.html
│ │ │ │ ├── [ 35K] EncoderException.html
│ │ │ │ ├── [ 21K] Encoder.html
│ │ │ │ ├── [4.4K] Resources.html
│ │ │ │ ├── [8.0K] StringDecoder.html
│ │ │ │ ├── [4.6K] StringEncoderComparator.html
│ │ │ │ └── [ 17K] StringEncoder.html
│ │ │ ├── [4.0K] cli
│ │ │ │ ├── [4.0K] class-use
│ │ │ │ │ └── [4.5K] Digest.html
│ │ │ │ ├── [ 12K] Digest.html
│ │ │ │ ├── [ 865] package-frame.html
│ │ │ │ ├── [5.5K] package-summary.html
│ │ │ │ ├── [5.0K] package-tree.html
│ │ │ │ └── [4.2K] package-use.html
│ │ │ ├── [ 17K] CodecPolicy.html
│ │ │ ├── [ 19K] DecoderException.html
│ │ │ ├── [ 12K] Decoder.html
│ │ │ ├── [4.0K] digest
│ │ │ │ ├── [4.0K] class-use
│ │ │ │ │ ├── [4.5K] Crypt.html
│ │ │ │ │ ├── [4.6K] DigestUtils.html
│ │ │ │ │ ├── [ 12K] HmacAlgorithms.html
│ │ │ │ │ ├── [4.6K] HmacUtils.html
│ │ │ │ │ ├── [4.6K] Md5Crypt.html
│ │ │ │ │ ├── [4.7K] MessageDigestAlgorithms.html
│ │ │ │ │ ├── [4.6K] MurmurHash2.html
│ │ │ │ │ ├── [4.6K] MurmurHash3.html
│ │ │ │ │ ├── [4.8K] MurmurHash3.IncrementalHash32.html
│ │ │ │ │ ├── [7.5K] MurmurHash3.IncrementalHash32x86.html
│ │ │ │ │ ├── [4.6K] PureJavaCrc32C.html
│ │ │ │ │ ├── [4.6K] PureJavaCrc32.html
│ │ │ │ │ ├── [4.6K] Sha2Crypt.html
│ │ │ │ │ ├── [4.6K] UnixCrypt.html
│ │ │ │ │ └── [4.6K] XXHash32.html
│ │ │ │ ├── [ 24K] Crypt.html
│ │ │ │ ├── [212K] DigestUtils.html
│ │ │ │ ├── [ 25K] HmacAlgorithms.html
│ │ │ │ ├── [145K] HmacUtils.html
│ │ │ │ ├── [ 44K] Md5Crypt.html
│ │ │ │ ├── [ 28K] MessageDigestAlgorithms.html
│ │ │ │ ├── [ 23K] MurmurHash2.html
│ │ │ │ ├── [ 63K] MurmurHash3.html
│ │ │ │ ├── [ 12K] MurmurHash3.IncrementalHash32.html
│ │ │ │ ├── [ 14K] MurmurHash3.IncrementalHash32x86.html
│ │ │ │ ├── [2.7K] package-frame.html
│ │ │ │ ├── [ 12K] package-summary.html
│ │ │ │ ├── [9.6K] package-tree.html
│ │ │ │ ├── [6.6K] package-use.html
│ │ │ │ ├── [ 15K] PureJavaCrc32C.html
│ │ │ │ ├── [ 16K] PureJavaCrc32.html
│ │ │ │ ├── [ 30K] Sha2Crypt.html
│ │ │ │ ├── [ 20K] UnixCrypt.html
│ │ │ │ └── [ 16K] XXHash32.html
│ │ │ ├── [ 19K] EncoderException.html
│ │ │ ├── [ 13K] Encoder.html
│ │ │ ├── [4.0K] language
│ │ │ │ ├── [ 17K] AbstractCaverphone.html
│ │ │ │ ├── [4.0K] bm
│ │ │ │ │ ├── [ 27K] BeiderMorseEncoder.html
│ │ │ │ │ ├── [4.0K] class-use
│ │ │ │ │ │ ├── [4.8K] BeiderMorseEncoder.html
│ │ │ │ │ │ ├── [8.5K] Lang.html
│ │ │ │ │ │ ├── [9.3K] Languages.html
│ │ │ │ │ │ ├── [ 23K] Languages.LanguageSet.html
│ │ │ │ │ │ ├── [4.8K] Languages.SomeLanguages.html
│ │ │ │ │ │ ├── [ 19K] NameType.html
│ │ │ │ │ │ ├── [4.7K] PhoneticEngine.html
│ │ │ │ │ │ ├── [ 12K] Rule.html
│ │ │ │ │ │ ├── [ 10K] Rule.PhonemeExpr.html
│ │ │ │ │ │ ├── [ 17K] Rule.Phoneme.html
│ │ │ │ │ │ ├── [4.7K] Rule.PhonemeList.html
│ │ │ │ │ │ ├── [8.7K] Rule.RPattern.html
│ │ │ │ │ │ └── [ 18K] RuleType.html
│ │ │ │ │ ├── [ 18K] Lang.html
│ │ │ │ │ ├── [ 19K] Languages.html
│ │ │ │ │ ├── [ 17K] Languages.LanguageSet.html
│ │ │ │ │ ├── [ 20K] Languages.SomeLanguages.html
│ │ │ │ │ ├── [ 19K] NameType.html
│ │ │ │ │ ├── [2.6K] package-frame.html
│ │ │ │ │ ├── [9.7K] package-summary.html
│ │ │ │ │ ├── [9.5K] package-tree.html
│ │ │ │ │ ├── [7.8K] package-use.html
│ │ │ │ │ ├── [ 23K] PhoneticEngine.html
│ │ │ │ │ ├── [ 37K] Rule.html
│ │ │ │ │ ├── [8.9K] Rule.PhonemeExpr.html
│ │ │ │ │ ├── [ 26K] Rule.Phoneme.html
│ │ │ │ │ ├── [ 14K] Rule.PhonemeList.html
│ │ │ │ │ ├── [8.4K] Rule.RPattern.html
│ │ │ │ │ └── [ 19K] RuleType.html
│ │ │ │ ├── [ 14K] Caverphone1.html
│ │ │ │ ├── [ 14K] Caverphone2.html
│ │ │ │ ├── [ 21K] Caverphone.html
│ │ │ │ ├── [4.0K] class-use
│ │ │ │ │ ├── [7.2K] AbstractCaverphone.html
│ │ │ │ │ ├── [4.6K] Caverphone1.html
│ │ │ │ │ ├── [4.6K] Caverphone2.html
│ │ │ │ │ ├── [4.6K] Caverphone.html
│ │ │ │ │ ├── [4.6K] ColognePhonetic.html
│ │ │ │ │ ├── [4.7K] DaitchMokotoffSoundex.html
│ │ │ │ │ ├── [4.9K] DoubleMetaphone.DoubleMetaphoneResult.html
│ │ │ │ │ ├── [4.6K] DoubleMetaphone.html
│ │ │ │ │ ├── [4.8K] MatchRatingApproachEncoder.html
│ │ │ │ │ ├── [4.6K] Metaphone.html
│ │ │ │ │ ├── [4.6K] Nysiis.html
│ │ │ │ │ ├── [7.0K] RefinedSoundex.html
│ │ │ │ │ └── [8.0K] Soundex.html
│ │ │ │ ├── [ 22K] ColognePhonetic.html
│ │ │ │ ├── [ 21K] DaitchMokotoffSoundex.html
│ │ │ │ ├── [ 19K] DoubleMetaphone.DoubleMetaphoneResult.html
│ │ │ │ ├── [ 29K] DoubleMetaphone.html
│ │ │ │ ├── [ 18K] MatchRatingApproachEncoder.html
│ │ │ │ ├── [ 22K] Metaphone.html
│ │ │ │ ├── [ 22K] Nysiis.html
│ │ │ │ ├── [2.3K] package-frame.html
│ │ │ │ ├── [9.0K] package-summary.html
│ │ │ │ ├── [9.6K] package-tree.html
│ │ │ │ ├── [6.3K] package-use.html
│ │ │ │ ├── [ 25K] RefinedSoundex.html
│ │ │ │ └── [ 35K] Soundex.html
│ │ │ ├── [4.0K] net
│ │ │ │ ├── [ 48K] BCodec.html
│ │ │ │ ├── [4.0K] class-use
│ │ │ │ │ ├── [4.5K] BCodec.html
│ │ │ │ │ ├── [4.6K] PercentCodec.html
│ │ │ │ │ ├── [4.5K] QCodec.html
│ │ │ │ │ ├── [4.6K] QuotedPrintableCodec.html
│ │ │ │ │ └── [4.5K] URLCodec.html
│ │ │ │ ├── [1.3K] package-frame.html
│ │ │ │ ├── [6.9K] package-summary.html
│ │ │ │ ├── [7.9K] package-tree.html
│ │ │ │ ├── [4.2K] package-use.html
│ │ │ │ ├── [ 21K] PercentCodec.html
│ │ │ │ ├── [ 48K] QCodec.html
│ │ │ │ ├── [ 51K] QuotedPrintableCodec.html
│ │ │ │ └── [ 41K] URLCodec.html
│ │ │ ├── [2.6K] package-frame.html
│ │ │ ├── [ 11K] package-summary.html
│ │ │ ├── [8.9K] package-tree.html
│ │ │ ├── [ 16K] package-use.html
│ │ │ ├── [ 12K] Resources.html
│ │ │ ├── [ 10K] StringDecoder.html
│ │ │ ├── [ 20K] StringEncoderComparator.html
│ │ │ └── [ 12K] StringEncoder.html
│ │ ├── [1.5K] overview-frame.html
│ │ ├── [6.1K] overview-summary.html
│ │ ├── [ 29K] overview-tree.html
│ │ ├── [ 218] package-list
│ │ ├── [ 827] script.js
│ │ ├── [4.8K] serialized-form.html
│ │ ├── [4.0K] src-html
│ │ │ └── [4.0K] org
│ │ │ └── [4.0K] apache
│ │ │ └── [4.0K] commons
│ │ │ └── [4.0K] codec
│ │ │ ├── [4.0K] binary
│ │ │ │ ├── [ 26K] Base16.html
│ │ │ │ ├── [8.2K] Base16InputStream.html
│ │ │ │ ├── [8.2K] Base16OutputStream.html
│ │ │ │ ├── [ 68K] Base32.html
│ │ │ │ ├── [ 14K] Base32InputStream.html
│ │ │ │ ├── [ 14K] Base32OutputStream.html
│ │ │ │ ├── [ 87K] Base64.html
│ │ │ │ ├── [ 14K] Base64InputStream.html
│ │ │ │ ├── [ 14K] Base64OutputStream.html
│ │ │ │ ├── [ 70K] BaseNCodec.html
│ │ │ │ ├── [ 21K] BaseNCodecInputStream.html
│ │ │ │ ├── [ 18K] BaseNCodecOutputStream.html
│ │ │ │ ├── [ 29K] BinaryCodec.html
│ │ │ │ ├── [8.0K] CharSequenceUtils.html
│ │ │ │ ├── [ 58K] Hex.html
│ │ │ │ └── [ 44K] StringUtils.html
│ │ │ ├── [3.9K] BinaryDecoder.html
│ │ │ ├── [3.8K] BinaryEncoder.html
│ │ │ ├── [ 12K] CharEncoding.html
│ │ │ ├── [ 17K] Charsets.html
│ │ │ ├── [4.0K] cli
│ │ │ │ └── [ 15K] Digest.html
│ │ │ ├── [3.6K] CodecPolicy.html
│ │ │ ├── [8.7K] DecoderException.html
│ │ │ ├── [5.0K] Decoder.html
│ │ │ ├── [4.0K] digest
│ │ │ │ ├── [ 17K] Crypt.html
│ │ │ │ ├── [156K] DigestUtils.html
│ │ │ │ ├── [ 13K] HmacAlgorithms.html
│ │ │ │ ├── [108K] HmacUtils.html
│ │ │ │ ├── [ 39K] Md5Crypt.html
│ │ │ │ ├── [ 16K] MessageDigestAlgorithms.html
│ │ │ │ ├── [ 30K] MurmurHash2.html
│ │ │ │ ├── [119K] MurmurHash3.html
│ │ │ │ ├── [119K] MurmurHash3.IncrementalHash32.html
│ │ │ │ ├── [119K] MurmurHash3.IncrementalHash32x86.html
│ │ │ │ ├── [ 68K] PureJavaCrc32C.html
│ │ │ │ ├── [ 68K] PureJavaCrc32.html
│ │ │ │ ├── [ 61K] Sha2Crypt.html
│ │ │ │ ├── [ 49K] UnixCrypt.html
│ │ │ │ └── [ 19K] XXHash32.html
│ │ │ ├── [8.9K] EncoderException.html
│ │ │ ├── [4.5K] Encoder.html
│ │ │ ├── [4.0K] language
│ │ │ │ ├── [7.9K] AbstractCaverphone.html
│ │ │ │ ├── [4.0K] bm
│ │ │ │ │ ├── [ 20K] BeiderMorseEncoder.html
│ │ │ │ │ ├── [ 23K] Lang.html
│ │ │ │ │ ├── [ 26K] Languages.html
│ │ │ │ │ ├── [ 26K] Languages.LanguageSet.html
│ │ │ │ │ ├── [ 26K] Languages.SomeLanguages.html
│ │ │ │ │ ├── [5.0K] NameType.html
│ │ │ │ │ ├── [ 51K] PhoneticEngine.html
│ │ │ │ │ ├── [ 69K] Rule.html
│ │ │ │ │ ├── [ 69K] Rule.PhonemeExpr.html
│ │ │ │ │ ├── [ 69K] Rule.Phoneme.html
│ │ │ │ │ ├── [ 69K] Rule.PhonemeList.html
│ │ │ │ │ ├── [ 69K] Rule.RPattern.html
│ │ │ │ │ └── [4.7K] RuleType.html
│ │ │ │ ├── [ 12K] Caverphone1.html
│ │ │ │ ├── [ 13K] Caverphone2.html
│ │ │ │ ├── [ 10K] Caverphone.html
│ │ │ │ ├── [ 41K] ColognePhonetic.html
│ │ │ │ ├── [ 53K] DaitchMokotoffSoundex.html
│ │ │ │ ├── [ 95K] DoubleMetaphone.DoubleMetaphoneResult.html
│ │ │ │ ├── [ 95K] DoubleMetaphone.html
│ │ │ │ ├── [ 40K] MatchRatingApproachEncoder.html
│ │ │ │ ├── [ 41K] Metaphone.html
│ │ │ │ ├── [ 30K] Nysiis.html
│ │ │ │ ├── [ 21K] RefinedSoundex.html
│ │ │ │ └── [ 33K] Soundex.html
│ │ │ ├── [4.0K] net
│ │ │ │ ├── [ 28K] BCodec.html
│ │ │ │ ├── [ 25K] PercentCodec.html
│ │ │ │ ├── [ 33K] QCodec.html
│ │ │ │ ├── [ 59K] QuotedPrintableCodec.html
│ │ │ │ └── [ 35K] URLCodec.html
│ │ │ ├── [4.2K] Resources.html
│ │ │ ├── [3.8K] StringDecoder.html
│ │ │ ├── [8.8K] StringEncoderComparator.html
│ │ │ └── [3.8K] StringEncoder.html
│ │ └── [ 13K] stylesheet.css
│ ├── [346K] commons-codec-1.15.jar
│ ├── [534K] commons-codec-1.15-javadoc.jar
│ ├── [356K] commons-codec-1.15-sources.jar
│ ├── [344K] commons-codec-1.15-tests.jar
│ ├── [231K] commons-codec-1.15-test-sources.jar
│ ├── [ 11K] LICENSE.txt
│ ├── [ 733] NOTICE.txt
│ └── [ 14K] RELEASE-NOTES.txt
├── [2.3K] Exploit.java
├── [1.5K] README.md
└── [ 57M] ysoserial-master-d367e379d9-1.jar
30 directories, 281 files
备注
1. 建议优先通过来源进行访问。
2. 如果因为来源失效或无法访问,请发送邮箱到 f.jinxu#gmail.com 索取本地快照(把 # 换成 @)。
3. 神龙已为您对POC代码进行快照,为了长期维护,请考虑为本地POC付费,感谢您的支持。